1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "GrGLTestInterface.h"
9
10 namespace {
11 template <typename R, typename... A>
bind_to_member(GrGLTestInterface * interface,R (GrGLTestInterface::* member)(A...))12 GrGLFunction<R GR_GL_FUNCTION_TYPE(A...)> bind_to_member(GrGLTestInterface* interface,
13 R (GrGLTestInterface::*member)(A...)) {
14 return [interface, member](A... a) -> R { return (interface->*member)(a...); };
15 }
16 } // anonymous namespace
17
GrGLTestInterface()18 GrGLTestInterface::GrGLTestInterface() {
19 fFunctions.fActiveTexture = bind_to_member(this, &GrGLTestInterface::activeTexture);
20 fFunctions.fAttachShader = bind_to_member(this, &GrGLTestInterface::attachShader);
21 fFunctions.fBeginQuery = bind_to_member(this, &GrGLTestInterface::beginQuery);
22 fFunctions.fBindAttribLocation = bind_to_member(this, &GrGLTestInterface::bindAttribLocation);
23 fFunctions.fBindBuffer = bind_to_member(this, &GrGLTestInterface::bindBuffer);
24 fFunctions.fBindFramebuffer = bind_to_member(this, &GrGLTestInterface::bindFramebuffer);
25 fFunctions.fBindRenderbuffer = bind_to_member(this, &GrGLTestInterface::bindRenderbuffer);
26 fFunctions.fBindSampler = bind_to_member(this, &GrGLTestInterface::bindSampler);
27 fFunctions.fBindTexture = bind_to_member(this, &GrGLTestInterface::bindTexture);
28 fFunctions.fBindFragDataLocation = bind_to_member(this, &GrGLTestInterface::bindFragDataLocation);
29 fFunctions.fBindFragDataLocationIndexed = bind_to_member(this, &GrGLTestInterface::bindFragDataLocationIndexed);
30 fFunctions.fBindVertexArray = bind_to_member(this, &GrGLTestInterface::bindVertexArray);
31 fFunctions.fBlendBarrier = bind_to_member(this, &GrGLTestInterface::blendBarrier);
32 fFunctions.fBlendColor = bind_to_member(this, &GrGLTestInterface::blendColor);
33 fFunctions.fBlendEquation = bind_to_member(this, &GrGLTestInterface::blendEquation);
34 fFunctions.fBlendFunc = bind_to_member(this, &GrGLTestInterface::blendFunc);
35 fFunctions.fBlitFramebuffer = bind_to_member(this, &GrGLTestInterface::blitFramebuffer);
36 fFunctions.fBufferData = bind_to_member(this, &GrGLTestInterface::bufferData);
37 fFunctions.fBufferSubData = bind_to_member(this, &GrGLTestInterface::bufferSubData);
38 fFunctions.fCheckFramebufferStatus = bind_to_member(this, &GrGLTestInterface::checkFramebufferStatus);
39 fFunctions.fClear = bind_to_member(this, &GrGLTestInterface::clear);
40 fFunctions.fClearColor = bind_to_member(this, &GrGLTestInterface::clearColor);
41 fFunctions.fClearStencil = bind_to_member(this, &GrGLTestInterface::clearStencil);
42 fFunctions.fColorMask = bind_to_member(this, &GrGLTestInterface::colorMask);
43 fFunctions.fCompileShader = bind_to_member(this, &GrGLTestInterface::compileShader);
44 fFunctions.fCompressedTexImage2D = bind_to_member(this, &GrGLTestInterface::compressedTexImage2D);
45 fFunctions.fCompressedTexSubImage2D = bind_to_member(this, &GrGLTestInterface::compressedTexSubImage2D);
46 fFunctions.fCopyTexSubImage2D = bind_to_member(this, &GrGLTestInterface::copyTexSubImage2D);
47 fFunctions.fCreateProgram = bind_to_member(this, &GrGLTestInterface::createProgram);
48 fFunctions.fCreateShader = bind_to_member(this, &GrGLTestInterface::createShader);
49 fFunctions.fCullFace = bind_to_member(this, &GrGLTestInterface::cullFace);
50 fFunctions.fDeleteBuffers = bind_to_member(this, &GrGLTestInterface::deleteBuffers);
51 fFunctions.fDeleteFramebuffers = bind_to_member(this, &GrGLTestInterface::deleteFramebuffers);
52 fFunctions.fDeleteProgram = bind_to_member(this, &GrGLTestInterface::deleteProgram);
53 fFunctions.fDeleteQueries = bind_to_member(this, &GrGLTestInterface::deleteQueries);
54 fFunctions.fDeleteRenderbuffers = bind_to_member(this, &GrGLTestInterface::deleteRenderbuffers);
55 fFunctions.fDeleteSamplers = bind_to_member(this, &GrGLTestInterface::deleteSamplers);
56 fFunctions.fDeleteShader = bind_to_member(this, &GrGLTestInterface::deleteShader);
57 fFunctions.fDeleteTextures = bind_to_member(this, &GrGLTestInterface::deleteTextures);
58 fFunctions.fDeleteVertexArrays = bind_to_member(this, &GrGLTestInterface::deleteVertexArrays);
59 fFunctions.fDepthMask = bind_to_member(this, &GrGLTestInterface::depthMask);
60 fFunctions.fDisable = bind_to_member(this, &GrGLTestInterface::disable);
61 fFunctions.fDisableVertexAttribArray = bind_to_member(this, &GrGLTestInterface::disableVertexAttribArray);
62 fFunctions.fDrawArrays = bind_to_member(this, &GrGLTestInterface::drawArrays);
63 fFunctions.fDrawArraysInstanced = bind_to_member(this, &GrGLTestInterface::drawArraysInstanced);
64 fFunctions.fDrawArraysIndirect = bind_to_member(this, &GrGLTestInterface::drawArraysIndirect);
65 fFunctions.fDrawBuffer = bind_to_member(this, &GrGLTestInterface::drawBuffer);
66 fFunctions.fDrawBuffers = bind_to_member(this, &GrGLTestInterface::drawBuffers);
67 fFunctions.fDrawElements = bind_to_member(this, &GrGLTestInterface::drawElements);
68 fFunctions.fDrawElementsInstanced = bind_to_member(this, &GrGLTestInterface::drawElementsInstanced);
69 fFunctions.fDrawElementsIndirect = bind_to_member(this, &GrGLTestInterface::drawElementsIndirect);
70 fFunctions.fDrawRangeElements = bind_to_member(this, &GrGLTestInterface::drawRangeElements);
71 fFunctions.fEnable = bind_to_member(this, &GrGLTestInterface::enable);
72 fFunctions.fEnableVertexAttribArray = bind_to_member(this, &GrGLTestInterface::enableVertexAttribArray);
73 fFunctions.fEndQuery = bind_to_member(this, &GrGLTestInterface::endQuery);
74 fFunctions.fFinish = bind_to_member(this, &GrGLTestInterface::finish);
75 fFunctions.fFlush = bind_to_member(this, &GrGLTestInterface::flush);
76 fFunctions.fFlushMappedBufferRange = bind_to_member(this, &GrGLTestInterface::flushMappedBufferRange);
77 fFunctions.fFramebufferRenderbuffer = bind_to_member(this, &GrGLTestInterface::framebufferRenderbuffer);
78 fFunctions.fFramebufferTexture2D = bind_to_member(this, &GrGLTestInterface::framebufferTexture2D);
79 fFunctions.fFramebufferTexture2DMultisample = bind_to_member(this, &GrGLTestInterface::framebufferTexture2DMultisample);
80 fFunctions.fFrontFace = bind_to_member(this, &GrGLTestInterface::frontFace);
81 fFunctions.fGenBuffers = bind_to_member(this, &GrGLTestInterface::genBuffers);
82 fFunctions.fGenFramebuffers = bind_to_member(this, &GrGLTestInterface::genFramebuffers);
83 fFunctions.fGenerateMipmap = bind_to_member(this, &GrGLTestInterface::generateMipmap);
84 fFunctions.fGenQueries = bind_to_member(this, &GrGLTestInterface::genQueries);
85 fFunctions.fGenRenderbuffers = bind_to_member(this, &GrGLTestInterface::genRenderbuffers);
86 fFunctions.fGenSamplers = bind_to_member(this, &GrGLTestInterface::genSamplers);
87 fFunctions.fGenTextures = bind_to_member(this, &GrGLTestInterface::genTextures);
88 fFunctions.fGenVertexArrays = bind_to_member(this, &GrGLTestInterface::genVertexArrays);
89 fFunctions.fGetBufferParameteriv = bind_to_member(this, &GrGLTestInterface::getBufferParameteriv);
90 fFunctions.fGetError = bind_to_member(this, &GrGLTestInterface::getError);
91 fFunctions.fGetFramebufferAttachmentParameteriv = bind_to_member(this, &GrGLTestInterface::getFramebufferAttachmentParameteriv);
92 fFunctions.fGetIntegerv = bind_to_member(this, &GrGLTestInterface::getIntegerv);
93 fFunctions.fGetMultisamplefv = bind_to_member(this, &GrGLTestInterface::getMultisamplefv);
94 fFunctions.fGetProgramInfoLog = bind_to_member(this, &GrGLTestInterface::getProgramInfoLog);
95 fFunctions.fGetProgramiv = bind_to_member(this, &GrGLTestInterface::getProgramiv);
96 fFunctions.fGetQueryiv = bind_to_member(this, &GrGLTestInterface::getQueryiv);
97 fFunctions.fGetQueryObjecti64v = bind_to_member(this, &GrGLTestInterface::getQueryObjecti64v);
98 fFunctions.fGetQueryObjectiv = bind_to_member(this, &GrGLTestInterface::getQueryObjectiv);
99 fFunctions.fGetQueryObjectui64v = bind_to_member(this, &GrGLTestInterface::getQueryObjectui64v);
100 fFunctions.fGetQueryObjectuiv = bind_to_member(this, &GrGLTestInterface::getQueryObjectuiv);
101 fFunctions.fGetRenderbufferParameteriv = bind_to_member(this, &GrGLTestInterface::getRenderbufferParameteriv);
102 fFunctions.fGetShaderInfoLog = bind_to_member(this, &GrGLTestInterface::getShaderInfoLog);
103 fFunctions.fGetShaderiv = bind_to_member(this, &GrGLTestInterface::getShaderiv);
104 fFunctions.fGetShaderPrecisionFormat = bind_to_member(this, &GrGLTestInterface::getShaderPrecisionFormat);
105 fFunctions.fGetString = bind_to_member(this, &GrGLTestInterface::getString);
106 fFunctions.fGetStringi = bind_to_member(this, &GrGLTestInterface::getStringi);
107 fFunctions.fGetTexLevelParameteriv = bind_to_member(this, &GrGLTestInterface::getTexLevelParameteriv);
108 fFunctions.fGetUniformLocation = bind_to_member(this, &GrGLTestInterface::getUniformLocation);
109 fFunctions.fInsertEventMarker = bind_to_member(this, &GrGLTestInterface::insertEventMarker);
110 fFunctions.fInvalidateBufferData = bind_to_member(this, &GrGLTestInterface::invalidateBufferData);
111 fFunctions.fInvalidateBufferSubData = bind_to_member(this, &GrGLTestInterface::invalidateBufferSubData);
112 fFunctions.fInvalidateFramebuffer = bind_to_member(this, &GrGLTestInterface::invalidateFramebuffer);
113 fFunctions.fInvalidateSubFramebuffer = bind_to_member(this, &GrGLTestInterface::invalidateSubFramebuffer);
114 fFunctions.fInvalidateTexImage = bind_to_member(this, &GrGLTestInterface::invalidateTexImage);
115 fFunctions.fInvalidateTexSubImage = bind_to_member(this, &GrGLTestInterface::invalidateTexSubImage);
116 fFunctions.fIsTexture = bind_to_member(this, &GrGLTestInterface::isTexture);
117 fFunctions.fLineWidth = bind_to_member(this, &GrGLTestInterface::lineWidth);
118 fFunctions.fLinkProgram = bind_to_member(this, &GrGLTestInterface::linkProgram);
119 fFunctions.fMapBuffer = bind_to_member(this, &GrGLTestInterface::mapBuffer);
120 fFunctions.fMapBufferRange = bind_to_member(this, &GrGLTestInterface::mapBufferRange);
121 fFunctions.fMapBufferSubData = bind_to_member(this, &GrGLTestInterface::mapBufferSubData);
122 fFunctions.fMapTexSubImage2D = bind_to_member(this, &GrGLTestInterface::mapTexSubImage2D);
123 fFunctions.fPixelStorei = bind_to_member(this, &GrGLTestInterface::pixelStorei);
124 fFunctions.fPolygonMode = bind_to_member(this, &GrGLTestInterface::polygonMode);
125 fFunctions.fPopGroupMarker = bind_to_member(this, &GrGLTestInterface::popGroupMarker);
126 fFunctions.fPushGroupMarker = bind_to_member(this, &GrGLTestInterface::pushGroupMarker);
127 fFunctions.fQueryCounter = bind_to_member(this, &GrGLTestInterface::queryCounter);
128 fFunctions.fRasterSamples = bind_to_member(this, &GrGLTestInterface::rasterSamples);
129 fFunctions.fReadBuffer = bind_to_member(this, &GrGLTestInterface::readBuffer);
130 fFunctions.fReadPixels = bind_to_member(this, &GrGLTestInterface::readPixels);
131 fFunctions.fRenderbufferStorage = bind_to_member(this, &GrGLTestInterface::renderbufferStorage);
132 fFunctions.fRenderbufferStorageMultisample = bind_to_member(this, &GrGLTestInterface::renderbufferStorageMultisample);
133 fFunctions.fResolveMultisampleFramebuffer = bind_to_member(this, &GrGLTestInterface::resolveMultisampleFramebuffer);
134 fFunctions.fScissor = bind_to_member(this, &GrGLTestInterface::scissor);
135 fFunctions.fBindUniformLocation = bind_to_member(this, &GrGLTestInterface::bindUniformLocation);
136 fFunctions.fSamplerParameteri = bind_to_member(this, &GrGLTestInterface::samplerParameteri);
137 fFunctions.fSamplerParameteriv = bind_to_member(this, &GrGLTestInterface::samplerParameteriv);
138 fFunctions.fShaderSource = bind_to_member(this, &GrGLTestInterface::shaderSource);
139 fFunctions.fStencilFunc = bind_to_member(this, &GrGLTestInterface::stencilFunc);
140 fFunctions.fStencilFuncSeparate = bind_to_member(this, &GrGLTestInterface::stencilFuncSeparate);
141 fFunctions.fStencilMask = bind_to_member(this, &GrGLTestInterface::stencilMask);
142 fFunctions.fStencilMaskSeparate = bind_to_member(this, &GrGLTestInterface::stencilMaskSeparate);
143 fFunctions.fStencilOp = bind_to_member(this, &GrGLTestInterface::stencilOp);
144 fFunctions.fStencilOpSeparate = bind_to_member(this, &GrGLTestInterface::stencilOpSeparate);
145 fFunctions.fTexBuffer = bind_to_member(this, &GrGLTestInterface::texBuffer);
146 fFunctions.fTexImage2D = bind_to_member(this, &GrGLTestInterface::texImage2D);
147 fFunctions.fTexParameterf = bind_to_member(this, &GrGLTestInterface::texParameterf);
148 fFunctions.fTexParameterfv = bind_to_member(this, &GrGLTestInterface::texParameterfv);
149 fFunctions.fTexParameteri = bind_to_member(this, &GrGLTestInterface::texParameteri);
150 fFunctions.fTexParameteriv = bind_to_member(this, &GrGLTestInterface::texParameteriv);
151 fFunctions.fTexStorage2D = bind_to_member(this, &GrGLTestInterface::texStorage2D);
152 fFunctions.fDiscardFramebuffer = bind_to_member(this, &GrGLTestInterface::discardFramebuffer);
153 fFunctions.fTexSubImage2D = bind_to_member(this, &GrGLTestInterface::texSubImage2D);
154 fFunctions.fTextureBarrier = bind_to_member(this, &GrGLTestInterface::textureBarrier);
155 fFunctions.fUniform1f = bind_to_member(this, &GrGLTestInterface::uniform1f);
156 fFunctions.fUniform1i = bind_to_member(this, &GrGLTestInterface::uniform1i);
157 fFunctions.fUniform1fv = bind_to_member(this, &GrGLTestInterface::uniform1fv);
158 fFunctions.fUniform1iv = bind_to_member(this, &GrGLTestInterface::uniform1iv);
159 fFunctions.fUniform2f = bind_to_member(this, &GrGLTestInterface::uniform2f);
160 fFunctions.fUniform2i = bind_to_member(this, &GrGLTestInterface::uniform2i);
161 fFunctions.fUniform2fv = bind_to_member(this, &GrGLTestInterface::uniform2fv);
162 fFunctions.fUniform2iv = bind_to_member(this, &GrGLTestInterface::uniform2iv);
163 fFunctions.fUniform3f = bind_to_member(this, &GrGLTestInterface::uniform3f);
164 fFunctions.fUniform3i = bind_to_member(this, &GrGLTestInterface::uniform3i);
165 fFunctions.fUniform3fv = bind_to_member(this, &GrGLTestInterface::uniform3fv);
166 fFunctions.fUniform3iv = bind_to_member(this, &GrGLTestInterface::uniform3iv);
167 fFunctions.fUniform4f = bind_to_member(this, &GrGLTestInterface::uniform4f);
168 fFunctions.fUniform4i = bind_to_member(this, &GrGLTestInterface::uniform4i);
169 fFunctions.fUniform4fv = bind_to_member(this, &GrGLTestInterface::uniform4fv);
170 fFunctions.fUniform4iv = bind_to_member(this, &GrGLTestInterface::uniform4iv);
171 fFunctions.fUniformMatrix2fv = bind_to_member(this, &GrGLTestInterface::uniformMatrix2fv);
172 fFunctions.fUniformMatrix3fv = bind_to_member(this, &GrGLTestInterface::uniformMatrix3fv);
173 fFunctions.fUniformMatrix4fv = bind_to_member(this, &GrGLTestInterface::uniformMatrix4fv);
174 fFunctions.fUnmapBuffer = bind_to_member(this, &GrGLTestInterface::unmapBuffer);
175 fFunctions.fUnmapBufferSubData = bind_to_member(this, &GrGLTestInterface::unmapBufferSubData);
176 fFunctions.fUnmapTexSubImage2D = bind_to_member(this, &GrGLTestInterface::unmapTexSubImage2D);
177 fFunctions.fUseProgram = bind_to_member(this, &GrGLTestInterface::useProgram);
178 fFunctions.fVertexAttrib1f = bind_to_member(this, &GrGLTestInterface::vertexAttrib1f);
179 fFunctions.fVertexAttrib2fv = bind_to_member(this, &GrGLTestInterface::vertexAttrib2fv);
180 fFunctions.fVertexAttrib3fv = bind_to_member(this, &GrGLTestInterface::vertexAttrib3fv);
181 fFunctions.fVertexAttrib4fv = bind_to_member(this, &GrGLTestInterface::vertexAttrib4fv);
182 fFunctions.fVertexAttribDivisor = bind_to_member(this, &GrGLTestInterface::vertexAttribDivisor);
183 fFunctions.fVertexAttribIPointer = bind_to_member(this, &GrGLTestInterface::vertexAttribIPointer);
184 fFunctions.fVertexAttribPointer = bind_to_member(this, &GrGLTestInterface::vertexAttribPointer);
185 fFunctions.fViewport = bind_to_member(this, &GrGLTestInterface::viewport);
186 fFunctions.fMatrixLoadf = bind_to_member(this, &GrGLTestInterface::matrixLoadf);
187 fFunctions.fMatrixLoadIdentity = bind_to_member(this, &GrGLTestInterface::matrixLoadIdentity);
188 fFunctions.fPathCommands = bind_to_member(this, &GrGLTestInterface::pathCommands);
189 fFunctions.fPathParameteri = bind_to_member(this, &GrGLTestInterface::pathParameteri);
190 fFunctions.fPathParameterf = bind_to_member(this, &GrGLTestInterface::pathParameterf);
191 fFunctions.fGenPaths = bind_to_member(this, &GrGLTestInterface::genPaths);
192 fFunctions.fDeletePaths = bind_to_member(this, &GrGLTestInterface::deletePaths);
193 fFunctions.fIsPath = bind_to_member(this, &GrGLTestInterface::isPath);
194 fFunctions.fPathStencilFunc = bind_to_member(this, &GrGLTestInterface::pathStencilFunc);
195 fFunctions.fStencilFillPath = bind_to_member(this, &GrGLTestInterface::stencilFillPath);
196 fFunctions.fStencilStrokePath = bind_to_member(this, &GrGLTestInterface::stencilStrokePath);
197 fFunctions.fStencilFillPathInstanced = bind_to_member(this, &GrGLTestInterface::stencilFillPathInstanced);
198 fFunctions.fStencilStrokePathInstanced = bind_to_member(this, &GrGLTestInterface::stencilStrokePathInstanced);
199 fFunctions.fCoverFillPath = bind_to_member(this, &GrGLTestInterface::coverFillPath);
200 fFunctions.fCoverStrokePath = bind_to_member(this, &GrGLTestInterface::coverStrokePath);
201 fFunctions.fCoverFillPathInstanced = bind_to_member(this, &GrGLTestInterface::coverFillPathInstanced);
202 fFunctions.fCoverStrokePathInstanced = bind_to_member(this, &GrGLTestInterface::coverStrokePathInstanced);
203 fFunctions.fStencilThenCoverFillPath = bind_to_member(this, &GrGLTestInterface::stencilThenCoverFillPath);
204 fFunctions.fStencilThenCoverStrokePath = bind_to_member(this, &GrGLTestInterface::stencilThenCoverStrokePath);
205 fFunctions.fStencilThenCoverFillPathInstanced = bind_to_member(this, &GrGLTestInterface::stencilThenCoverFillPathInstanced);
206 fFunctions.fStencilThenCoverStrokePathInstanced = bind_to_member(this, &GrGLTestInterface::stencilThenCoverStrokePathInstanced);
207 fFunctions.fProgramPathFragmentInputGen = bind_to_member(this, &GrGLTestInterface::programPathFragmentInputGen);
208 fFunctions.fBindFragmentInputLocation = bind_to_member(this, &GrGLTestInterface::bindFragmentInputLocation);
209 fFunctions.fGetProgramResourceLocation = bind_to_member(this, &GrGLTestInterface::getProgramResourceLocation);
210 fFunctions.fCoverageModulation = bind_to_member(this, &GrGLTestInterface::coverageModulation);
211 fFunctions.fMultiDrawArraysIndirect = bind_to_member(this, &GrGLTestInterface::multiDrawArraysIndirect);
212 fFunctions.fMultiDrawElementsIndirect = bind_to_member(this, &GrGLTestInterface::multiDrawElementsIndirect);
213 fFunctions.fFenceSync = bind_to_member(this, &GrGLTestInterface::fenceSync);
214 fFunctions.fIsSync = bind_to_member(this, &GrGLTestInterface::isSync);
215 fFunctions.fClientWaitSync = bind_to_member(this, &GrGLTestInterface::clientWaitSync);
216 fFunctions.fWaitSync = bind_to_member(this, &GrGLTestInterface::waitSync);
217 fFunctions.fDeleteSync = bind_to_member(this, &GrGLTestInterface::deleteSync);
218 fFunctions.fDebugMessageControl = bind_to_member(this, &GrGLTestInterface::debugMessageControl);
219 fFunctions.fDebugMessageInsert = bind_to_member(this, &GrGLTestInterface::debugMessageInsert);
220 fFunctions.fDebugMessageCallback = bind_to_member(this, &GrGLTestInterface::debugMessageCallback);
221 fFunctions.fGetDebugMessageLog = bind_to_member(this, &GrGLTestInterface::getDebugMessageLog);
222 fFunctions.fPushDebugGroup = bind_to_member(this, &GrGLTestInterface::pushDebugGroup);
223 fFunctions.fPopDebugGroup = bind_to_member(this, &GrGLTestInterface::popDebugGroup);
224 fFunctions.fObjectLabel = bind_to_member(this, &GrGLTestInterface::objectLabel);
225 fFunctions.fGetInternalformativ = bind_to_member(this, &GrGLTestInterface::getInternalformativ);
226 fFunctions.fProgramBinary = bind_to_member(this, &GrGLTestInterface::programBinary);
227 fFunctions.fGetProgramBinary = bind_to_member(this, &GrGLTestInterface::getProgramBinary);
228 fFunctions.fProgramParameteri = bind_to_member(this, &GrGLTestInterface::programParameteri);
229 }
230