• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 GLES1 render utils.
22  *//*--------------------------------------------------------------------*/
23 
24 #include "teglGLES1RenderUtil.hpp"
25 
26 #if defined(DEQP_SUPPORT_GLES1)
27 #include <GLES/gl.h>
28 #endif
29 
30 using std::vector;
31 
32 namespace deqp
33 {
34 namespace egl
35 {
36 namespace gles1
37 {
38 
39 #if defined(DEQP_SUPPORT_GLES1)
40 
clear(int x,int y,int width,int height,const tcu::Vec4 & color)41 void clear(int x, int y, int width, int height, const tcu::Vec4 &color)
42 {
43     glDisable(GL_DITHER);
44     glEnable(GL_SCISSOR_TEST);
45     glScissor(x, y, width, height);
46     glClearColor(color.x(), color.y(), color.z(), color.w());
47     glClear(GL_COLOR_BUFFER_BIT);
48     glDisable(GL_SCISSOR_TEST);
49 }
50 
readPixels(tcu::Surface & dst,int x,int y,int width,int height)51 void readPixels(tcu::Surface &dst, int x, int y, int width, int height)
52 {
53     dst.setSize(width, height);
54     glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, dst.getAccess().getDataPtr());
55 }
56 
finish(void)57 void finish(void)
58 {
59     glFinish();
60 }
61 
62 #else // DEQP_SUPPORT_GLES1
63 
64 void clear(int x, int y, int width, int height, const tcu::Vec4 &color)
65 {
66     DE_UNREF(x && y && width && height);
67     DE_UNREF(color);
68     TCU_THROW(NotSupportedError, "OpenGL ES 1.x is not supported");
69 }
70 
71 void readPixels(tcu::Surface &dst, int x, int y, int width, int height)
72 {
73     DE_UNREF(x && y && width && height);
74     DE_UNREF(dst);
75     TCU_THROW(NotSupportedError, "OpenGL ES 1.x is not supported");
76 }
77 
78 void finish(void)
79 {
80     TCU_THROW(NotSupportedError, "OpenGL ES 1.x is not supported");
81 }
82 
83 #endif // DEQP_SUPPORT_GLES1
84 
85 } // namespace gles1
86 } // namespace egl
87 } // namespace deqp
88