1 #ifndef _SGLRCONTEXTWRAPPER_HPP
2 #define _SGLRCONTEXTWRAPPER_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program OpenGL ES Utilities
5 * ------------------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief Context wrapper that exposes sglr API as GL-compatible API.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "tcuVector.hpp"
38 ContextWrapper (void);
39 ~ContextWrapper (void);
41 void setContext (Context* context);
42 Context* getCurrentContext (void) const;
44 int getWidth (void) const;
45 int getHeight (void) const;
48 void glActiveTexture (deUint32 texture);
49 void glAttachShader (deUint32 program, deUint32 shader);
50 void glBindAttribLocation (deUint32 program, deUint32 index, const char* name);
51 void glBindBuffer (deUint32 target, deUint32 buffer);
52 void glBindFramebuffer (deUint32 target, deUint32 framebuffer);
53 void glBindRenderbuffer (deUint32 target, deUint32 renderbuffer);
54 void glBindTexture (deUint32 target, deUint32 texture);
55 void glBlendColor (float red, float green, float blue, float alpha);
56 void glBlendEquation (deUint32 mode);
57 void glBlendEquationSeparate (deUint32 modeRGB, deUint32 modeAlpha);
58 void glBlendFunc (deUint32 sfactor, deUint32 dfactor);
59 void glBlendFuncSeparate (deUint32 srcRGB, deUint32 dstRGB, deUint32 srcAlpha, deUint32 dstAlpha);
60 void glBufferData (deUint32 target, deIntptr size, const void* data, deUint32 usage);
61 void glBufferSubData (deUint32 target, deIntptr offset, deIntptr size, const void* data);
62 deUint32 glCheckFramebufferStatus (deUint32 target);
63 void glClear (deUint32 mask);
64 void glClearColor (float red, float green, float blue, float alpha);
65 void glClearDepthf (float depth);
66 void glClearStencil (int s);
67 void glColorMask (deBool red, deBool green, deBool blue, deBool alpha);
68 void glCompileShader (deUint32 shader);
69 void glCompressedTexImage2D (deUint32 target, int level, deUint32 internalformat, int width, int height, int border, int imageSize, const void* data);
70 void glCompressedTexSubImage2D (deUint32 target, int level, int xoffset, int yoffset, int width, int height, deUint32 format, int imageSize, const void* data);
71 void glCopyTexImage1D (deUint32 target, int level, deUint32 internalformat, int x, int y, int width, int border);
72 void glCopyTexImage2D (deUint32 target, int level, deUint32 internalformat, int x, int y, int width, int height, int border);
73 void glCopyTexSubImage1D (deUint32 target, int level, int xoffset, int x, int y, int width);
74 void glCopyTexSubImage2D (deUint32 target, int level, int xoffset, int yoffset, int x, int y, int width, int height);
75 deUint32 glCreateProgram ();
76 deUint32 glCreateShader (deUint32 type);
77 void glCullFace (deUint32 mode);
78 void glDeleteBuffers (int n, const deUint32* buffers);
79 void glDeleteFramebuffers (int n, const deUint32* framebuffers);
80 void glDeleteProgram (deUint32 program);
81 void glDeleteRenderbuffers (int n, const deUint32* renderbuffers);
82 void glDeleteShader (deUint32 shader);
83 void glDeleteTextures (int n, const deUint32* textures);
84 void glDepthFunc (deUint32 func);
85 void glDepthMask (deBool flag);
86 void glDepthRangef (float n, float f);
87 void glDetachShader (deUint32 program, deUint32 shader);
88 void glDisable (deUint32 cap);
89 void glDisableVertexAttribArray (deUint32 index);
90 void glDrawArrays (deUint32 mode, int first, int count);
91 void glDrawElements (deUint32 mode, int count, deUint32 type, const void* indices);
92 void glEnable (deUint32 cap);
93 void glEnableVertexAttribArray (deUint32 index);
96 void glFramebufferRenderbuffer (deUint32 target, deUint32 attachment, deUint32 renderbuffertarget, deUint32 renderbuffer);
97 void glFramebufferTexture2D (deUint32 target, deUint32 attachment, deUint32 textarget, deUint32 texture, int level);
98 void glFrontFace (deUint32 mode);
99 void glGenBuffers (int n, deUint32* buffers);
100 void glGenerateMipmap (deUint32 target);
101 void glGenFramebuffers (int n, deUint32* framebuffers);
102 void glGenRenderbuffers (int n, deUint32* renderbuffers);
103 void glGenTextures (int n, deUint32* textures);
104 void glGetActiveAttrib (deUint32 program, deUint32 index, int bufsize, int* length, int* size, deUint32* type, char* name);
105 void glGetActiveUniform (deUint32 program, deUint32 index, int bufsize, int* length, int* size, deUint32* type, char* name);
106 void glGetAttachedShaders (deUint32 program, int maxcount, int* count, deUint32* shaders);
107 int glGetAttribLocation (deUint32 program, const char* name);
108 void glGetBooleanv (deUint32 pname, deBool* params);
109 void glGetBufferParameteriv (deUint32 target, deUint32 pname, int* params);
110 deUint32 glGetError ();
111 void glGetFloatv (deUint32 pname, float* params);
112 void glGetFramebufferAttachmentParameteriv (deUint32 target, deUint32 attachment, deUint32 pname, int* params);
113 void glGetIntegerv (deUint32 pname, int* params);
114 void glGetProgramiv (deUint32 program, deUint32 pname, int* params);
115 void glGetProgramInfoLog (deUint32 program, int bufsize, int* length, char* infolog);
116 void glGetRenderbufferParameteriv (deUint32 target, deUint32 pname, int* params);
117 void glGetShaderiv (deUint32 shader, deUint32 pname, int* params);
118 void glGetShaderInfoLog (deUint32 shader, int bufsize, int* length, char* infolog);
119 void glGetShaderPrecisionFormat (deUint32 shadertype, deUint32 precisiontype, int* range, int* precision);
120 void glGetShaderSource (deUint32 shader, int bufsize, int* length, char* source);
121 const deUint8* glGetString (deUint32 name);
122 void glGetTexParameterfv (deUint32 target, deUint32 pname, float* params);
123 void glGetTexParameteriv (deUint32 target, deUint32 pname, int* params);
124 void glGetUniformfv (deUint32 program, int location, float* params);
125 void glGetUniformiv (deUint32 program, int location, int* params);
126 int glGetUniformLocation (deUint32 program, const char* name);
127 void glGetVertexAttribfv (deUint32 index, deUint32 pname, float* params);
128 void glGetVertexAttribiv (deUint32 index, deUint32 pname, int* params);
129 void glGetVertexAttribPointerv (deUint32 index, deUint32 pname, void** pointer);
130 void glHint (deUint32 target, deUint32 mode);
131 deBool glIsBuffer (deUint32 buffer);
132 deBool glIsEnabled (deUint32 cap);
133 deBool glIsFramebuffer (deUint32 framebuffer);
134 deBool glIsProgram (deUint32 program);
135 deBool glIsRenderbuffer (deUint32 renderbuffer);
136 deBool glIsShader (deUint32 shader);
137 deBool glIsTexture (deUint32 texture);
138 void glLineWidth (float width);
139 void glLinkProgram (deUint32 program);
140 void glPixelStorei (deUint32 pname, int param);
141 void glPolygonOffset (float factor, float units);
142 void glReadPixels (int x, int y, int width, int height, deUint32 format, deUint32 type, void* pixels);
143 void glReleaseShaderCompiler ();
144 void glRenderbufferStorage (deUint32 target, deUint32 internalformat, int width, int height);
145 void glSampleCoverage (float value, deBool invert);
146 void glScissor (int x, int y, int width, int height);
147 void glShaderBinary (int n, const deUint32* shaders, deUint32 binaryformat, const void* binary, int length);
148 void glShaderSource (deUint32 shader, int count, const char* const* string, const int* length);
149 void glStencilFunc (deUint32 func, int ref, deUint32 mask);
150 void glStencilFuncSeparate (deUint32 face, deUint32 func, int ref, deUint32 mask);
151 void glStencilMask (deUint32 mask);
152 void glStencilMaskSeparate (deUint32 face, deUint32 mask);
153 void glStencilOp (deUint32 fail, deUint32 zfail, deUint32 zpass);
154 void glStencilOpSeparate (deUint32 face, deUint32 fail, deUint32 zfail, deUint32 zpass);
155 void glTexImage1D (deUint32 target, int level, int internalformat, int width, int border, deUint32 format, deUint32 type, const void* pixels);
156 void glTexImage2D (deUint32 target, int level, int internalformat, int width, int height, int border, deUint32 format, deUint32 type, const void* pixels);
157 void glTexParameterf (deUint32 target, deUint32 pname, float param);
158 void glTexParameterfv (deUint32 target, deUint32 pname, const float* params);
159 void glTexParameteri (deUint32 target, deUint32 pname, int param);
160 void glTexParameteriv (deUint32 target, deUint32 pname, const int* params);
161 void glTexSubImage1D (deUint32 target, int level, int xoffset, int width, deUint32 format, deUint32 type, const void* pixels);
162 void glTexSubImage2D (deUint32 target, int level, int xoffset, int yoffset, int width, int height, deUint32 format, deUint32 type, const void* pixels);
163 void glUniform1f (int location, float x);
164 void glUniform1fv (int location, int count, const float* v);
165 void glUniform1i (int location, int x);
166 void glUniform1iv (int location, int count, const int* v);
167 void glUniform2f (int location, float x, float y);
168 void glUniform2fv (int location, int count, const float* v);
169 void glUniform2i (int location, int x, int y);
170 void glUniform2iv (int location, int count, const int* v);
171 void glUniform3f (int location, float x, float y, float z);
172 void glUniform3fv (int location, int count, const float* v);
173 void glUniform3i (int location, int x, int y, int z);
174 void glUniform3iv (int location, int count, const int* v);
175 void glUniform4f (int location, float x, float y, float z, float w);
176 void glUniform4fv (int location, int count, const float* v);
177 void glUniform4i (int location, int x, int y, int z, int w);
178 void glUniform4iv (int location, int count, const int* v);
179 void glUniformMatrix2fv (int location, int count, deBool transpose, const float* value);
180 void glUniformMatrix3fv (int location, int count, deBool transpose, const float* value);
181 void glUniformMatrix4fv (int location, int count, deBool transpose, const float* value);
182 void glUseProgram (deUint32 program);
183 void glValidateProgram (deUint32 program);
184 void glVertexAttrib1f (deUint32 indx, float x);
185 void glVertexAttrib1fv (deUint32 indx, const float* values);
186 void glVertexAttrib2f (deUint32 indx, float x, float y);
187 void glVertexAttrib2fv (deUint32 indx, const float* values);
188 void glVertexAttrib3f (deUint32 indx, float x, float y, float z);
189 void glVertexAttrib3fv (deUint32 indx, const float* values);
190 void glVertexAttrib4f (deUint32 indx, float x, float y, float z, float w);
191 void glVertexAttrib4fv (deUint32 indx, const float* values);
192 void glVertexAttribPointer (deUint32 indx, int size, deUint32 type, deBool normalized, int stride, const void* ptr);
193 void glViewport (int x, int y, int width, int height);
194 void glReadBuffer (deUint32 mode);
195 void glDrawRangeElements (deUint32 mode, deUint32 start, deUint32 end, int count, deUint32 type, const void* indices);
196 void glTexImage3D (deUint32 target, int level, int internalformat, int width, int height, int depth, int border, deUint32 format, deUint32 type, const void* pixels);
197 void glTexSubImage3D (deUint32 target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, deUint32 format, deUint32 type, const void* pixels);
198 void glCopyTexSubImage3D (deUint32 target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height);
199 void glCompressedTexImage3D (deUint32 target, int level, deUint32 internalformat, int width, int height, int depth, int border, int imageSize, const void* data);
200 void glCompressedTexSubImage3D (deUint32 target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, deUint32 format, int imageSize, const void* data);
201 void glGenQueries (int n, deUint32* ids);
202 void glDeleteQueries (int n, const deUint32* ids);
203 deBool glIsQuery (deUint32 id);
204 void glBeginQuery (deUint32 target, deUint32 id);
205 void glEndQuery (deUint32 target);
206 void glGetQueryiv (deUint32 target, deUint32 pname, int* params);
207 void glGetQueryObjectuiv (deUint32 id, deUint32 pname, deUint32* params);
208 deBool glUnmapBuffer (deUint32 target);
209 void glGetBufferPointerv (deUint32 target, deUint32 pname, void** params);
210 void glDrawBuffers (int n, const deUint32* bufs);
211 void glUniformMatrix2x3fv (int location, int count, deBool transpose, const float* value);
212 void glUniformMatrix3x2fv (int location, int count, deBool transpose, const float* value);
213 void glUniformMatrix2x4fv (int location, int count, deBool transpose, const float* value);
214 void glUniformMatrix4x2fv (int location, int count, deBool transpose, const float* value);
215 void glUniformMatrix3x4fv (int location, int count, deBool transpose, const float* value);
216 void glUniformMatrix4x3fv (int location, int count, deBool transpose, const float* value);
217 void glBlitFramebuffer (int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, deUint32 mask, deUint32 filter);
218 void glRenderbufferStorageMultisample (deUint32 target, int samples, deUint32 internalformat, int width, int height);
219 void glFramebufferTextureLayer (deUint32 target, deUint32 attachment, deUint32 texture, int level, int layer);
220 void* glMapBufferRange (deUint32 target, deIntptr offset, deIntptr length, deUint32 access);
221 void glFlushMappedBufferRange (deUint32 target, deIntptr offset, deIntptr length);
222 void glBindVertexArray (deUint32 array);
223 void glDeleteVertexArrays (int n, const deUint32* arrays);
224 void glGenVertexArrays (int n, deUint32* arrays);
225 deBool glIsVertexArray (deUint32 array);
226 void glGetIntegeri_v (deUint32 target, deUint32 index, int* data);
227 void glBeginTransformFeedback (deUint32 primitiveMode);
228 void glEndTransformFeedback ();
229 void glBindBufferRange (deUint32 target, deUint32 index, deUint32 buffer, deIntptr offset, deIntptr size);
230 void glBindBufferBase (deUint32 target, deUint32 index, deUint32 buffer);
231 void glTransformFeedbackVaryings (deUint32 program, int count, const char* const* varyings, deUint32 bufferMode);
232 void glGetTransformFeedbackVarying (deUint32 program, deUint32 index, int bufSize, int* length, int* size, deUint32* type, char* name);
233 void glVertexAttribIPointer (deUint32 index, int size, deUint32 type, int stride, const void* pointer);
234 void glGetVertexAttribIiv (deUint32 index, deUint32 pname, int* params);
235 void glGetVertexAttribIuiv (deUint32 index, deUint32 pname, deUint32* params);
236 void glVertexAttribI4i (deUint32 index, int x, int y, int z, int w);
237 void glVertexAttribI4ui (deUint32 index, deUint32 x, deUint32 y, deUint32 z, deUint32 w);
238 void glVertexAttribI4iv (deUint32 index, const int* v);
239 void glVertexAttribI4uiv (deUint32 index, const deUint32* v);
240 void glGetUniformuiv (deUint32 program, int location, deUint32* params);
241 int glGetFragDataLocation (deUint32 program, const char* name);
242 void glUniform1ui (int location, deUint32 v0);
243 void glUniform2ui (int location, deUint32 v0, deUint32 v1);
244 void glUniform3ui (int location, deUint32 v0, deUint32 v1, deUint32 v2);
245 void glUniform4ui (int location, deUint32 v0, deUint32 v1, deUint32 v2, deUint32 v3);
246 void glUniform1uiv (int location, int count, const deUint32* value);
247 void glUniform2uiv (int location, int count, const deUint32* value);
248 void glUniform3uiv (int location, int count, const deUint32* value);
249 void glUniform4uiv (int location, int count, const deUint32* value);
250 void glClearBufferiv (deUint32 buffer, int drawbuffer, const int* value);
251 void glClearBufferuiv (deUint32 buffer, int drawbuffer, const deUint32* value);
252 void glClearBufferfv (deUint32 buffer, int drawbuffer, const float* value);
253 void glClearBufferfi (deUint32 buffer, int drawbuffer, float depth, int stencil);
254 const deUint8* glGetStringi (deUint32 name, deUint32 index);
255 void glCopyBufferSubData (deUint32 readTarget, deUint32 writeTarget, deIntptr readOffset, deIntptr writeOffset, deIntptr size);
256 void glGetUniformIndices (deUint32 program, int uniformCount, const char* const* uniformNames, deUint32* uniformIndices);
257 void glGetActiveUniformsiv (deUint32 program, int uniformCount, const deUint32* uniformIndices, deUint32 pname, int* params);
258 deUint32 glGetUniformBlockIndex (deUint32 program, const char* uniformBlockName);
259 void glGetActiveUniformBlockiv (deUint32 program, deUint32 uniformBlockIndex, deUint32 pname, int* params);
260 void glGetActiveUniformBlockName (deUint32 program, deUint32 uniformBlockIndex, int bufSize, int* length, char* uniformBlockName);
261 void glUniformBlockBinding (deUint32 program, deUint32 uniformBlockIndex, deUint32 uniformBlockBinding);
262 void glDrawArraysInstanced (deUint32 mode, int first, int count, int primcount);
263 void glDrawElementsInstanced (deUint32 mode, int count, deUint32 type, const void* indices, int primcount);
264 void* glFenceSync (deUint32 condition, deUint32 flags);
265 deBool glIsSync (void* sync);
266 void glDeleteSync (void* sync);
267 deUint32 glClientWaitSync (void* sync, deUint32 flags, deUint64 timeout);
268 void glWaitSync (void* sync, deUint32 flags, deUint64 timeout);
269 void glGetInteger64v (deUint32 pname, deInt64* params);
270 void glGetSynciv (void* sync, deUint32 pname, int bufSize, int* length, int* values);
271 void glGetInteger64i_v (deUint32 target, deUint32 index, deInt64* data);
272 void glGetBufferParameteri64v (deUint32 target, deUint32 pname, deInt64* params);
273 void glGenSamplers (int count, deUint32* samplers);
274 void glDeleteSamplers (int count, const deUint32* samplers);
275 deBool glIsSampler (deUint32 sampler);
276 void glBindSampler (deUint32 unit, deUint32 sampler);
277 void glSamplerParameteri (deUint32 sampler, deUint32 pname, int param);
278 void glSamplerParameteriv (deUint32 sampler, deUint32 pname, const int* param);
279 void glSamplerParameterf (deUint32 sampler, deUint32 pname, float param);
280 void glSamplerParameterfv (deUint32 sampler, deUint32 pname, const float* param);
281 void glGetSamplerParameteriv (deUint32 sampler, deUint32 pname, int* params);
282 void glGetSamplerParameterfv (deUint32 sampler, deUint32 pname, float* params);
283 void glVertexAttribDivisor (deUint32 index, deUint32 divisor);
284 void glBindTransformFeedback (deUint32 target, deUint32 id);
285 void glDeleteTransformFeedbacks (int n, const deUint32* ids);
286 void glGenTransformFeedbacks (int n, deUint32* ids);
287 deBool glIsTransformFeedback (deUint32 id);
288 void glPauseTransformFeedback ();
289 void glResumeTransformFeedback ();
290 void glGetProgramBinary (deUint32 program, int bufSize, int* length, deUint32* binaryFormat, void* binary);
291 void glProgramBinary (deUint32 program, deUint32 binaryFormat, const void* binary, int length);
292 void glProgramParameteri (deUint32 program, deUint32 pname, int value);
293 void glInvalidateFramebuffer (deUint32 target, int numAttachments, const deUint32* attachments);
294 void glInvalidateSubFramebuffer (deUint32 target, int numAttachments, const deUint32* attachments, int x, int y, int width, int height);
295 void glTexStorage2D (deUint32 target, int levels, deUint32 internalformat, int width, int height);
296 void glTexStorage3D (deUint32 target, int levels, deUint32 internalformat, int width, int height, int depth);
297 void glGetInternalformativ (deUint32 target, deUint32 internalformat, deUint32 pname, int bufSize, int* params);
305 #endif // _SGLRCONTEXTWRAPPER_HPP