1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Module
3 * ---------------------------------------
4 *
5 * Copyright 2014 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief GLES2 render utils.
22 *//*--------------------------------------------------------------------*/
23
24 #include "teglGLES2RenderUtil.hpp"
25 #include "glwFunctions.hpp"
26 #include "glwEnums.hpp"
27
28 namespace deqp
29 {
30 namespace egl
31 {
32 namespace gles2
33 {
34
clear(const glw::Functions & gl,int x,int y,int width,int height,const tcu::Vec4 & color)35 void clear(const glw::Functions &gl, int x, int y, int width, int height, const tcu::Vec4 &color)
36 {
37 gl.disable(GL_DITHER);
38 gl.enable(GL_SCISSOR_TEST);
39 gl.scissor(x, y, width, height);
40 gl.clearColor(color.x(), color.y(), color.z(), color.w());
41 gl.clear(GL_COLOR_BUFFER_BIT);
42 gl.disable(GL_SCISSOR_TEST);
43 }
44
readPixels(const glw::Functions & gl,tcu::Surface & dst,int x,int y,int width,int height)45 void readPixels(const glw::Functions &gl, tcu::Surface &dst, int x, int y, int width, int height)
46 {
47 dst.setSize(width, height);
48 gl.readPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, dst.getAccess().getDataPtr());
49 }
50
finish(const glw::Functions & gl)51 void finish(const glw::Functions &gl)
52 {
53 gl.finish();
54 }
55
56 } // namespace gles2
57 } // namespace egl
58 } // namespace deqp
59