Brian Osman | 8e874bb | 2019-04-08 12:24:46 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | // TODO: Remove this file. This has been temporarily copied from Skia (where this class is |
| 18 | // deprecated). The NullGlesDriver should be constructing a GrGLInterface that calls *its* |
| 19 | // GL functions! |
| 20 | |
Brian Osman | 8e874bb | 2019-04-08 12:24:46 -0400 | [diff] [blame] | 21 | #include "GrNonAtomicRef.h" |
| 22 | #include "SkMutex.h" |
| 23 | #include "SkTDArray.h" |
| 24 | #include "SkTo.h" |
Brian Osman | eae47f4 | 2019-04-09 13:02:22 -0400 | [diff] [blame] | 25 | #include "gl/GrGLDefines.h" |
Brian Osman | 8e874bb | 2019-04-08 12:24:46 -0400 | [diff] [blame] | 26 | #include "gl/GrGLInterface.h" |
| 27 | |
| 28 | #include <type_traits> |
| 29 | |
| 30 | // added to suppress 'no previous prototype' warning and because this code is duplicated in |
| 31 | // SkNullGLContext.cpp |
| 32 | namespace { |
| 33 | |
| 34 | class GLObject : public GrNonAtomicRef<GLObject> { |
| 35 | public: |
| 36 | GLObject(GrGLuint id) : fID(id) {} |
| 37 | virtual ~GLObject() {} |
| 38 | |
| 39 | GrGLuint id() const { return fID; } |
| 40 | |
| 41 | private: |
| 42 | GrGLuint fID; |
| 43 | }; |
| 44 | |
| 45 | // This class maintains a sparsely populated array of object pointers. |
| 46 | template<typename T> class TGLObjectManager { |
| 47 | static_assert(std::is_convertible<T*, GLObject*>::value, "T must be a subclass of GLObject"); |
| 48 | |
| 49 | public: |
| 50 | TGLObjectManager() : fFreeListHead(kFreeListEnd) { |
| 51 | *fGLObjects.append() = nullptr; // 0 is not a valid GL object id. |
| 52 | } |
| 53 | |
| 54 | ~TGLObjectManager() { |
| 55 | // nullptr out the entries that are really free list links rather than ptrs before deleting. |
| 56 | intptr_t curr = fFreeListHead; |
| 57 | while (kFreeListEnd != curr) { |
| 58 | intptr_t next = reinterpret_cast<intptr_t>(fGLObjects[SkToS32(curr)]); |
| 59 | fGLObjects[SkToS32(curr)] = nullptr; |
| 60 | curr = next; |
| 61 | } |
| 62 | |
| 63 | fGLObjects.safeUnrefAll(); |
| 64 | } |
| 65 | |
| 66 | T* lookUp(GrGLuint id) { |
| 67 | T* object = fGLObjects[id]; |
| 68 | SkASSERT(object && object->id() == id); |
| 69 | return object; |
| 70 | } |
| 71 | |
| 72 | T* create() { |
| 73 | GrGLuint id; |
| 74 | T* object; |
| 75 | |
| 76 | if (kFreeListEnd == fFreeListHead) { |
| 77 | // no free slots - create a new one |
| 78 | id = fGLObjects.count(); |
| 79 | object = new T(id); |
| 80 | *fGLObjects.append() = object; |
| 81 | } else { |
| 82 | // grab the head of the free list and advance the head to the next free slot. |
| 83 | id = static_cast<GrGLuint>(fFreeListHead); |
| 84 | fFreeListHead = reinterpret_cast<intptr_t>(fGLObjects[id]); |
| 85 | |
| 86 | object = new T(id); |
| 87 | fGLObjects[id] = object; |
| 88 | } |
| 89 | |
| 90 | return object; |
| 91 | } |
| 92 | |
| 93 | void free(T* object) { |
| 94 | SkASSERT(object); |
| 95 | SkASSERT(fGLObjects.count() > 0); |
| 96 | |
| 97 | GrGLuint id = object->id(); |
| 98 | object->unref(); |
| 99 | |
| 100 | fGLObjects[id] = reinterpret_cast<T*>(fFreeListHead); |
| 101 | fFreeListHead = id; |
| 102 | } |
| 103 | |
| 104 | private: |
| 105 | static const intptr_t kFreeListEnd = -1; |
| 106 | // Index of the first entry of fGLObjects in the free list. Free slots in fGLObjects are indices |
| 107 | // to the next free slot. The last free slot has a value of kFreeListEnd. |
| 108 | intptr_t fFreeListHead; |
| 109 | SkTDArray<T*> fGLObjects; |
| 110 | }; |
| 111 | |
| 112 | class Buffer : public GLObject { |
| 113 | public: |
| 114 | Buffer(GrGLuint id) : INHERITED(id), fDataPtr(nullptr), fSize(0), fMapped(false) {} |
| 115 | ~Buffer() { delete[] fDataPtr; } |
| 116 | |
| 117 | void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) { |
| 118 | if (fDataPtr) { |
| 119 | SkASSERT(0 != fSize); |
| 120 | delete[] fDataPtr; |
| 121 | } |
| 122 | |
| 123 | fSize = size; |
| 124 | fDataPtr = new char[size]; |
| 125 | } |
| 126 | |
| 127 | GrGLchar* dataPtr() { return fDataPtr; } |
| 128 | GrGLsizeiptr size() const { return fSize; } |
| 129 | |
| 130 | void setMapped(bool mapped) { fMapped = mapped; } |
| 131 | bool mapped() const { return fMapped; } |
| 132 | |
| 133 | private: |
| 134 | GrGLchar* fDataPtr; |
| 135 | GrGLsizeiptr fSize; // size in bytes |
| 136 | bool fMapped; |
| 137 | |
| 138 | typedef GLObject INHERITED; |
| 139 | }; |
| 140 | |
| 141 | class FramebufferAttachment : public GLObject { |
| 142 | public: |
| 143 | int numSamples() const { return fNumSamples; } |
| 144 | |
| 145 | protected: |
| 146 | FramebufferAttachment(int id) : INHERITED(id), fNumSamples(1) {} |
| 147 | |
| 148 | int fNumSamples; |
| 149 | |
| 150 | typedef GLObject INHERITED; |
| 151 | }; |
| 152 | |
| 153 | class Renderbuffer : public FramebufferAttachment { |
| 154 | public: |
| 155 | Renderbuffer(int id) : INHERITED(id) {} |
| 156 | void setNumSamples(int numSamples) { fNumSamples = numSamples; } |
| 157 | |
| 158 | private: |
| 159 | typedef FramebufferAttachment INHERITED; |
| 160 | }; |
| 161 | |
| 162 | class Texture : public FramebufferAttachment { |
| 163 | public: |
| 164 | Texture() : INHERITED(1) {} |
| 165 | |
| 166 | private: |
| 167 | typedef FramebufferAttachment INHERITED; |
| 168 | }; |
| 169 | |
| 170 | class Framebuffer : public GLObject { |
| 171 | public: |
| 172 | Framebuffer(int id) : INHERITED(id) {} |
| 173 | |
| 174 | void setAttachment(GrGLenum attachmentPoint, const FramebufferAttachment* attachment) { |
| 175 | switch (attachmentPoint) { |
| 176 | default: |
| 177 | SK_ABORT("Invalid framebuffer attachment."); |
| 178 | break; |
| 179 | case GR_GL_STENCIL_ATTACHMENT: |
| 180 | fAttachments[(int)AttachmentPoint::kStencil].reset(SkRef(attachment)); |
| 181 | break; |
| 182 | case GR_GL_DEPTH_ATTACHMENT: |
| 183 | fAttachments[(int)AttachmentPoint::kDepth].reset(SkRef(attachment)); |
| 184 | break; |
| 185 | case GR_GL_COLOR_ATTACHMENT0: |
| 186 | fAttachments[(int)AttachmentPoint::kColor].reset(SkRef(attachment)); |
| 187 | break; |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | void notifyAttachmentDeleteWhileBound(const FramebufferAttachment* deleted) { |
| 192 | for (auto& attachment : fAttachments) { |
| 193 | if (attachment.get() == deleted) { |
| 194 | attachment.reset(nullptr); |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | int numSamples() const { |
| 200 | int numSamples = 0; |
| 201 | for (auto& attachment : fAttachments) { |
| 202 | if (!attachment) { |
| 203 | continue; |
| 204 | } |
| 205 | if (numSamples) { |
| 206 | GrAlwaysAssert(attachment->numSamples() == numSamples); |
| 207 | continue; |
| 208 | } |
| 209 | numSamples = attachment->numSamples(); |
| 210 | } |
| 211 | GrAlwaysAssert(numSamples); |
| 212 | return numSamples; |
| 213 | } |
| 214 | |
| 215 | private: |
| 216 | enum AttachmentPoint { |
| 217 | kStencil, |
| 218 | kDepth, |
| 219 | kColor |
| 220 | }; |
| 221 | constexpr int static kNumAttachmentPoints = 1 + (int)AttachmentPoint::kColor; |
| 222 | |
| 223 | sk_sp<const FramebufferAttachment> fAttachments[kNumAttachmentPoints]; |
| 224 | |
| 225 | typedef GLObject INHERITED; |
| 226 | }; |
| 227 | |
Brian Osman | eae47f4 | 2019-04-09 13:02:22 -0400 | [diff] [blame] | 228 | class TestInterface : public GrGLInterface { |
| 229 | public: |
| 230 | virtual GrGLvoid activeTexture(GrGLenum texture) {} |
| 231 | virtual GrGLvoid attachShader(GrGLuint program, GrGLuint shader) {} |
| 232 | virtual GrGLvoid beginQuery(GrGLenum target, GrGLuint id) {} |
| 233 | virtual GrGLvoid bindAttribLocation(GrGLuint program, GrGLuint index, const char* name) {} |
| 234 | virtual GrGLvoid bindBuffer(GrGLenum target, GrGLuint buffer) {} |
| 235 | virtual GrGLvoid bindFramebuffer(GrGLenum target, GrGLuint framebuffer) {} |
| 236 | virtual GrGLvoid bindRenderbuffer(GrGLenum target, GrGLuint renderbuffer) {} |
| 237 | virtual GrGLvoid bindSampler(GrGLuint unit, GrGLuint sampler) {} |
| 238 | virtual GrGLvoid bindTexture(GrGLenum target, GrGLuint texture) {} |
| 239 | virtual GrGLvoid bindFragDataLocation(GrGLuint program, GrGLuint colorNumber, const GrGLchar* name) {} |
| 240 | virtual GrGLvoid bindFragDataLocationIndexed(GrGLuint program, GrGLuint colorNumber, GrGLuint index, const GrGLchar * name) {} |
| 241 | virtual GrGLvoid bindVertexArray(GrGLuint array) {} |
| 242 | virtual GrGLvoid blendBarrier() {} |
| 243 | virtual GrGLvoid blendColor(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha) {} |
| 244 | virtual GrGLvoid blendEquation(GrGLenum mode) {} |
| 245 | virtual GrGLvoid blendFunc(GrGLenum sfactor, GrGLenum dfactor) {} |
| 246 | virtual GrGLvoid blitFramebuffer(GrGLint srcX0, GrGLint srcY0, GrGLint srcX1, GrGLint srcY1, GrGLint dstX0, GrGLint dstY0, GrGLint dstX1, GrGLint dstY1, GrGLbitfield mask, GrGLenum filter) {} |
| 247 | virtual GrGLvoid bufferData(GrGLenum target, GrGLsizeiptr size, const GrGLvoid* data, GrGLenum usage) {} |
| 248 | virtual GrGLvoid bufferSubData(GrGLenum target, GrGLintptr offset, GrGLsizeiptr size, const GrGLvoid* data) {} |
| 249 | virtual GrGLenum checkFramebufferStatus(GrGLenum target) { return GR_GL_FRAMEBUFFER_COMPLETE; } |
| 250 | virtual GrGLvoid clear(GrGLbitfield mask) {} |
| 251 | virtual GrGLvoid clearColor(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha) {} |
| 252 | virtual GrGLvoid clearStencil(GrGLint s) {} |
| 253 | virtual GrGLvoid colorMask(GrGLboolean red, GrGLboolean green, GrGLboolean blue, GrGLboolean alpha) {} |
| 254 | virtual GrGLvoid compileShader(GrGLuint shader) {} |
| 255 | virtual GrGLvoid compressedTexImage2D(GrGLenum target, GrGLint level, GrGLenum internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid* data) {} |
| 256 | virtual GrGLvoid compressedTexSubImage2D(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLsizei imageSize, const GrGLvoid* data) {} |
| 257 | virtual GrGLvoid copyTexSubImage2D(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {} |
| 258 | virtual GrGLuint createProgram() { return 0; } |
| 259 | virtual GrGLuint createShader(GrGLenum type) { return 0; } |
| 260 | virtual GrGLvoid cullFace(GrGLenum mode) {} |
| 261 | virtual GrGLvoid deleteBuffers(GrGLsizei n, const GrGLuint* buffers) {} |
| 262 | virtual GrGLvoid deleteFramebuffers(GrGLsizei n, const GrGLuint *framebuffers) {} |
| 263 | virtual GrGLvoid deleteProgram(GrGLuint program) {} |
| 264 | virtual GrGLvoid deleteQueries(GrGLsizei n, const GrGLuint *ids) {} |
| 265 | virtual GrGLvoid deleteRenderbuffers(GrGLsizei n, const GrGLuint *renderbuffers) {} |
| 266 | virtual GrGLvoid deleteSamplers(GrGLsizei n, const GrGLuint* samplers) {} |
| 267 | virtual GrGLvoid deleteShader(GrGLuint shader) {} |
| 268 | virtual GrGLvoid deleteTextures(GrGLsizei n, const GrGLuint* textures) {} |
| 269 | virtual GrGLvoid deleteVertexArrays(GrGLsizei n, const GrGLuint *arrays) {} |
| 270 | virtual GrGLvoid depthMask(GrGLboolean flag) {} |
| 271 | virtual GrGLvoid disable(GrGLenum cap) {} |
| 272 | virtual GrGLvoid disableVertexAttribArray(GrGLuint index) {} |
| 273 | virtual GrGLvoid drawArrays(GrGLenum mode, GrGLint first, GrGLsizei count) {} |
| 274 | virtual GrGLvoid drawArraysInstanced(GrGLenum mode, GrGLint first, GrGLsizei count, GrGLsizei primcount) {} |
| 275 | virtual GrGLvoid drawArraysIndirect(GrGLenum mode, const GrGLvoid* indirect) {} |
| 276 | virtual GrGLvoid drawBuffer(GrGLenum mode) {} |
| 277 | virtual GrGLvoid drawBuffers(GrGLsizei n, const GrGLenum* bufs) {} |
| 278 | virtual GrGLvoid drawElements(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid* indices) {} |
| 279 | virtual GrGLvoid drawElementsInstanced(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid *indices, GrGLsizei primcount) {} |
| 280 | virtual GrGLvoid drawElementsIndirect(GrGLenum mode, GrGLenum type, const GrGLvoid* indirect) {} |
| 281 | virtual GrGLvoid drawRangeElements(GrGLenum mode, GrGLuint start, GrGLuint end, GrGLsizei count, GrGLenum type, const GrGLvoid* indices) {} |
| 282 | virtual GrGLvoid enable(GrGLenum cap) {} |
| 283 | virtual GrGLvoid enableVertexAttribArray(GrGLuint index) {} |
| 284 | virtual GrGLvoid endQuery(GrGLenum target) {} |
| 285 | virtual GrGLvoid finish() {} |
| 286 | virtual GrGLvoid flush() {} |
| 287 | virtual GrGLvoid flushMappedBufferRange(GrGLenum target, GrGLintptr offset, GrGLsizeiptr length) {} |
| 288 | virtual GrGLvoid framebufferRenderbuffer(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer) {} |
| 289 | virtual GrGLvoid framebufferTexture2D(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {} |
| 290 | virtual GrGLvoid framebufferTexture2DMultisample(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level, GrGLsizei samples) {} |
| 291 | virtual GrGLvoid frontFace(GrGLenum mode) {} |
| 292 | virtual GrGLvoid genBuffers(GrGLsizei n, GrGLuint* buffers) {} |
| 293 | virtual GrGLvoid genFramebuffers(GrGLsizei n, GrGLuint *framebuffers) {} |
| 294 | virtual GrGLvoid generateMipmap(GrGLenum target) {} |
| 295 | virtual GrGLvoid genQueries(GrGLsizei n, GrGLuint *ids) {} |
| 296 | virtual GrGLvoid genRenderbuffers(GrGLsizei n, GrGLuint *renderbuffers) {} |
| 297 | virtual GrGLvoid genSamplers(GrGLsizei n, GrGLuint *samplers) {} |
| 298 | virtual GrGLvoid genTextures(GrGLsizei n, GrGLuint* textures) {} |
| 299 | virtual GrGLvoid genVertexArrays(GrGLsizei n, GrGLuint *arrays) {} |
| 300 | virtual GrGLvoid getBufferParameteriv(GrGLenum target, GrGLenum pname, GrGLint* params) {} |
| 301 | virtual GrGLenum getError() { return GR_GL_NO_ERROR; } |
| 302 | virtual GrGLvoid getFramebufferAttachmentParameteriv(GrGLenum target, GrGLenum attachment, GrGLenum pname, GrGLint* params) {} |
| 303 | virtual GrGLvoid getIntegerv(GrGLenum pname, GrGLint* params) {} |
| 304 | virtual GrGLvoid getMultisamplefv(GrGLenum pname, GrGLuint index, GrGLfloat* val) {} |
| 305 | virtual GrGLvoid getProgramInfoLog(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, char* infolog) {} |
| 306 | virtual GrGLvoid getProgramiv(GrGLuint program, GrGLenum pname, GrGLint* params) {} |
| 307 | virtual GrGLvoid getQueryiv(GrGLenum GLtarget, GrGLenum pname, GrGLint *params) {} |
| 308 | virtual GrGLvoid getQueryObjecti64v(GrGLuint id, GrGLenum pname, GrGLint64 *params) {} |
| 309 | virtual GrGLvoid getQueryObjectiv(GrGLuint id, GrGLenum pname, GrGLint *params) {} |
| 310 | virtual GrGLvoid getQueryObjectui64v(GrGLuint id, GrGLenum pname, GrGLuint64 *params) {} |
| 311 | virtual GrGLvoid getQueryObjectuiv(GrGLuint id, GrGLenum pname, GrGLuint *params) {} |
| 312 | virtual GrGLvoid getRenderbufferParameteriv(GrGLenum target, GrGLenum pname, GrGLint* params) {} |
| 313 | virtual GrGLvoid getShaderInfoLog(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* length, char* infolog) {} |
| 314 | virtual GrGLvoid getShaderiv(GrGLuint shader, GrGLenum pname, GrGLint* params) {} |
| 315 | virtual GrGLvoid getShaderPrecisionFormat(GrGLenum shadertype, GrGLenum precisiontype, GrGLint *range, GrGLint *precision) {} |
| 316 | virtual const GrGLubyte* getString(GrGLenum name) { return nullptr; } |
| 317 | virtual const GrGLubyte* getStringi(GrGLenum name, GrGLuint index) { return nullptr; } |
| 318 | virtual GrGLvoid getTexLevelParameteriv(GrGLenum target, GrGLint level, GrGLenum pname, GrGLint* params) {} |
| 319 | virtual GrGLint getUniformLocation(GrGLuint program, const char* name) { return 0; } |
| 320 | virtual GrGLvoid insertEventMarker(GrGLsizei length, const char* marker) {} |
| 321 | virtual GrGLvoid invalidateBufferData(GrGLuint buffer) {} |
| 322 | virtual GrGLvoid invalidateBufferSubData(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr length) {} |
| 323 | virtual GrGLvoid invalidateFramebuffer(GrGLenum target, GrGLsizei numAttachments, const GrGLenum *attachments) {} |
| 324 | virtual GrGLvoid invalidateSubFramebuffer(GrGLenum target, GrGLsizei numAttachments, const GrGLenum *attachments, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {} |
| 325 | virtual GrGLvoid invalidateTexImage(GrGLuint texture, GrGLint level) {} |
| 326 | virtual GrGLvoid invalidateTexSubImage(GrGLuint texture, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLsizei width, GrGLsizei height, GrGLsizei depth) {} |
| 327 | virtual GrGLboolean isTexture(GrGLuint texture) { return GR_GL_FALSE; } |
| 328 | virtual GrGLvoid lineWidth(GrGLfloat width) {} |
| 329 | virtual GrGLvoid linkProgram(GrGLuint program) {} |
| 330 | virtual GrGLvoid* mapBuffer(GrGLenum target, GrGLenum access) { return nullptr; } |
| 331 | virtual GrGLvoid* mapBufferRange(GrGLenum target, GrGLintptr offset, GrGLsizeiptr length, GrGLbitfield access) { return nullptr; } |
| 332 | virtual GrGLvoid* mapBufferSubData(GrGLuint target, GrGLintptr offset, GrGLsizeiptr size, GrGLenum access) { return nullptr; } |
| 333 | virtual GrGLvoid* mapTexSubImage2D(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLenum access) { return nullptr; } |
| 334 | virtual GrGLvoid pixelStorei(GrGLenum pname, GrGLint param) {} |
| 335 | virtual GrGLvoid polygonMode(GrGLenum face, GrGLenum mode) {} |
| 336 | virtual GrGLvoid popGroupMarker() {} |
| 337 | virtual GrGLvoid pushGroupMarker(GrGLsizei length, const char* marker) {} |
| 338 | virtual GrGLvoid queryCounter(GrGLuint id, GrGLenum target) {} |
| 339 | virtual GrGLvoid rasterSamples(GrGLuint samples, GrGLboolean fixedsamplelocations) {} |
| 340 | virtual GrGLvoid readBuffer(GrGLenum src) {} |
| 341 | virtual GrGLvoid readPixels(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels) {} |
| 342 | virtual GrGLvoid renderbufferStorage(GrGLenum target, GrGLenum internalformat, GrGLsizei width, GrGLsizei height) {} |
| 343 | virtual GrGLvoid renderbufferStorageMultisample(GrGLenum target, GrGLsizei samples, GrGLenum internalformat, GrGLsizei width, GrGLsizei height) {} |
| 344 | virtual GrGLvoid resolveMultisampleFramebuffer() {} |
| 345 | virtual GrGLvoid samplerParameteri(GrGLuint sampler, GrGLenum pname, GrGLint param) {} |
| 346 | virtual GrGLvoid samplerParameteriv(GrGLuint sampler, GrGLenum pname, const GrGLint* param) {} |
| 347 | virtual GrGLvoid scissor(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {} |
| 348 | virtual GrGLvoid bindUniformLocation(GrGLuint program, GrGLint location, const char* name) {} |
| 349 | virtual GrGLvoid shaderSource(GrGLuint shader, GrGLsizei count, const char* const * str, const GrGLint* length) {} |
| 350 | virtual GrGLvoid stencilFunc(GrGLenum func, GrGLint ref, GrGLuint mask) {} |
| 351 | virtual GrGLvoid stencilFuncSeparate(GrGLenum face, GrGLenum func, GrGLint ref, GrGLuint mask) {} |
| 352 | virtual GrGLvoid stencilMask(GrGLuint mask) {} |
| 353 | virtual GrGLvoid stencilMaskSeparate(GrGLenum face, GrGLuint mask) {} |
| 354 | virtual GrGLvoid stencilOp(GrGLenum fail, GrGLenum zfail, GrGLenum zpass) {} |
| 355 | virtual GrGLvoid stencilOpSeparate(GrGLenum face, GrGLenum fail, GrGLenum zfail, GrGLenum zpass) {} |
| 356 | virtual GrGLvoid texBuffer(GrGLenum target, GrGLenum internalformat, GrGLuint buffer) {} |
| 357 | virtual GrGLvoid texImage2D(GrGLenum target, GrGLint level, GrGLint internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid* pixels) {} |
| 358 | virtual GrGLvoid texParameterf(GrGLenum target, GrGLenum pname, GrGLfloat param) {} |
| 359 | virtual GrGLvoid texParameterfv(GrGLenum target, GrGLenum pname, const GrGLfloat* params) {} |
| 360 | virtual GrGLvoid texParameteri(GrGLenum target, GrGLenum pname, GrGLint param) {} |
| 361 | virtual GrGLvoid texParameteriv(GrGLenum target, GrGLenum pname, const GrGLint* params) {} |
| 362 | virtual GrGLvoid texStorage2D(GrGLenum target, GrGLsizei levels, GrGLenum internalformat, GrGLsizei width, GrGLsizei height) {} |
| 363 | virtual GrGLvoid discardFramebuffer(GrGLenum target, GrGLsizei numAttachments, const GrGLenum* attachments) {} |
| 364 | virtual GrGLvoid texSubImage2D(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, const GrGLvoid* pixels) {} |
| 365 | virtual GrGLvoid textureBarrier() {} |
| 366 | virtual GrGLvoid uniform1f(GrGLint location, GrGLfloat v0) {} |
| 367 | virtual GrGLvoid uniform1i(GrGLint location, GrGLint v0) {} |
| 368 | virtual GrGLvoid uniform1fv(GrGLint location, GrGLsizei count, const GrGLfloat* v) {} |
| 369 | virtual GrGLvoid uniform1iv(GrGLint location, GrGLsizei count, const GrGLint* v) {} |
| 370 | virtual GrGLvoid uniform2f(GrGLint location, GrGLfloat v0, GrGLfloat v1) {} |
| 371 | virtual GrGLvoid uniform2i(GrGLint location, GrGLint v0, GrGLint v1) {} |
| 372 | virtual GrGLvoid uniform2fv(GrGLint location, GrGLsizei count, const GrGLfloat* v) {} |
| 373 | virtual GrGLvoid uniform2iv(GrGLint location, GrGLsizei count, const GrGLint* v) {} |
| 374 | virtual GrGLvoid uniform3f(GrGLint location, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2) {} |
| 375 | virtual GrGLvoid uniform3i(GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2) {} |
| 376 | virtual GrGLvoid uniform3fv(GrGLint location, GrGLsizei count, const GrGLfloat* v) {} |
| 377 | virtual GrGLvoid uniform3iv(GrGLint location, GrGLsizei count, const GrGLint* v) {} |
| 378 | virtual GrGLvoid uniform4f(GrGLint location, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2, GrGLfloat v3) {} |
| 379 | virtual GrGLvoid uniform4i(GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2, GrGLint v3) {} |
| 380 | virtual GrGLvoid uniform4fv(GrGLint location, GrGLsizei count, const GrGLfloat* v) {} |
| 381 | virtual GrGLvoid uniform4iv(GrGLint location, GrGLsizei count, const GrGLint* v) {} |
| 382 | virtual GrGLvoid uniformMatrix2fv(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value) {} |
| 383 | virtual GrGLvoid uniformMatrix3fv(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value) {} |
| 384 | virtual GrGLvoid uniformMatrix4fv(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value) {} |
| 385 | virtual GrGLboolean unmapBuffer(GrGLenum target) { return GR_GL_TRUE; } |
| 386 | virtual GrGLvoid unmapBufferSubData(const GrGLvoid* mem) {} |
| 387 | virtual GrGLvoid unmapTexSubImage2D(const GrGLvoid* mem) {} |
| 388 | virtual GrGLvoid useProgram(GrGLuint program) {} |
| 389 | virtual GrGLvoid vertexAttrib1f(GrGLuint indx, const GrGLfloat value) {} |
| 390 | virtual GrGLvoid vertexAttrib2fv(GrGLuint indx, const GrGLfloat* values) {} |
| 391 | virtual GrGLvoid vertexAttrib3fv(GrGLuint indx, const GrGLfloat* values) {} |
| 392 | virtual GrGLvoid vertexAttrib4fv(GrGLuint indx, const GrGLfloat* values) {} |
| 393 | virtual GrGLvoid vertexAttribDivisor(GrGLuint index, GrGLuint divisor) {} |
| 394 | virtual GrGLvoid vertexAttribIPointer(GrGLuint indx, GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* ptr) {} |
| 395 | virtual GrGLvoid vertexAttribPointer(GrGLuint indx, GrGLint size, GrGLenum type, GrGLboolean normalized, GrGLsizei stride, const GrGLvoid* ptr) {} |
| 396 | virtual GrGLvoid viewport(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {} |
| 397 | virtual GrGLvoid matrixLoadf(GrGLenum matrixMode, const GrGLfloat* m) {} |
| 398 | virtual GrGLvoid matrixLoadIdentity(GrGLenum) {} |
| 399 | virtual GrGLvoid pathCommands(GrGLuint path, GrGLsizei numCommands, const GrGLubyte *commands, GrGLsizei numCoords, GrGLenum coordType, const GrGLvoid *coords) {} |
| 400 | virtual GrGLvoid pathParameteri(GrGLuint path, GrGLenum pname, GrGLint value) {} |
| 401 | virtual GrGLvoid pathParameterf(GrGLuint path, GrGLenum pname, GrGLfloat value) {} |
| 402 | virtual GrGLuint genPaths(GrGLsizei range) { return 0; } |
| 403 | virtual GrGLvoid deletePaths(GrGLuint path, GrGLsizei range) {} |
| 404 | virtual GrGLboolean isPath(GrGLuint path) { return true; } |
| 405 | virtual GrGLvoid pathStencilFunc(GrGLenum func, GrGLint ref, GrGLuint mask) {} |
| 406 | virtual GrGLvoid stencilFillPath(GrGLuint path, GrGLenum fillMode, GrGLuint mask) {} |
| 407 | virtual GrGLvoid stencilStrokePath(GrGLuint path, GrGLint reference, GrGLuint mask) {} |
| 408 | virtual GrGLvoid stencilFillPathInstanced(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, GrGLenum transformType, const GrGLfloat *transformValues) {} |
| 409 | virtual GrGLvoid stencilStrokePathInstanced(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLint reference, GrGLuint mask, GrGLenum transformType, const GrGLfloat *transformValues) {} |
| 410 | virtual GrGLvoid coverFillPath(GrGLuint path, GrGLenum coverMode) {} |
| 411 | virtual GrGLvoid coverStrokePath(GrGLuint name, GrGLenum coverMode) {} |
| 412 | virtual GrGLvoid coverFillPathInstanced(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLenum coverMode, GrGLenum transformType, const GrGLfloat *transformValues) {} |
| 413 | virtual GrGLvoid coverStrokePathInstanced(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLenum coverMode, GrGLenum transformType, const GrGLfloat* transformValues) {} |
| 414 | virtual GrGLvoid stencilThenCoverFillPath(GrGLuint path, GrGLenum fillMode, GrGLuint mask, GrGLenum coverMode) {} |
| 415 | virtual GrGLvoid stencilThenCoverStrokePath(GrGLuint path, GrGLint reference, GrGLuint mask, GrGLenum coverMode) {} |
| 416 | virtual GrGLvoid stencilThenCoverFillPathInstanced(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, GrGLenum coverMode, GrGLenum transformType, const GrGLfloat *transformValues) {} |
| 417 | virtual GrGLvoid stencilThenCoverStrokePathInstanced(GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase, GrGLint reference, GrGLuint mask, GrGLenum coverMode, GrGLenum transformType, const GrGLfloat *transformValues) {} |
| 418 | virtual GrGLvoid programPathFragmentInputGen(GrGLuint program, GrGLint location, GrGLenum genMode, GrGLint components,const GrGLfloat *coeffs) {} |
| 419 | virtual GrGLvoid bindFragmentInputLocation(GrGLuint program, GrGLint location, const GrGLchar* name) {} |
| 420 | virtual GrGLint getProgramResourceLocation(GrGLuint program, GrGLenum programInterface, const GrGLchar *name) { return 0; } |
| 421 | virtual GrGLvoid coverageModulation(GrGLenum components) {} |
| 422 | virtual GrGLvoid multiDrawArraysIndirect(GrGLenum mode, const GrGLvoid *indirect, GrGLsizei drawcount, GrGLsizei stride) {} |
| 423 | virtual GrGLvoid multiDrawElementsIndirect(GrGLenum mode, GrGLenum type, const GrGLvoid *indirect, GrGLsizei drawcount, GrGLsizei stride) {} |
| 424 | virtual GrGLuint64 getTextureHandle(GrGLuint texture) { return 0; } |
| 425 | virtual GrGLuint64 getTextureSamplerHandle(GrGLuint texture, GrGLuint sampler) { return 0; } |
| 426 | virtual GrGLvoid makeTextureHandleResident(GrGLuint64 handle) {} |
| 427 | virtual GrGLvoid makeTextureHandleNonResident(GrGLuint64 handle) {} |
| 428 | virtual GrGLuint64 getImageHandle(GrGLuint texture, GrGLint level, GrGLboolean layered, GrGLint layer, GrGLint format) { return 0; } |
| 429 | virtual GrGLvoid makeImageHandleResident(GrGLuint64 handle, GrGLenum access) {} |
| 430 | virtual GrGLvoid makeImageHandleNonResident(GrGLuint64 handle) {} |
| 431 | virtual GrGLboolean isTextureHandleResident(GrGLuint64 handle) { return GR_GL_FALSE; } |
| 432 | virtual GrGLboolean isImageHandleResident(GrGLuint64 handle) { return GR_GL_FALSE; } |
| 433 | virtual GrGLvoid uniformHandleui64(GrGLint location, GrGLuint64 v0) {} |
| 434 | virtual GrGLvoid uniformHandleui64v(GrGLint location, GrGLsizei count, const GrGLuint64 *value) {} |
| 435 | virtual GrGLvoid programUniformHandleui64(GrGLuint program, GrGLint location, GrGLuint64 v0) {} |
| 436 | virtual GrGLvoid programUniformHandleui64v(GrGLuint program, GrGLint location, GrGLsizei count, const GrGLuint64 *value) {} |
| 437 | virtual GrGLvoid textureParameteri(GrGLuint texture, GrGLenum target, GrGLenum pname, GrGLint param) {} |
| 438 | virtual GrGLvoid textureParameteriv(GrGLuint texture, GrGLenum target, GrGLenum pname, const GrGLint *param) {} |
| 439 | virtual GrGLvoid textureParameterf(GrGLuint texture, GrGLenum target, GrGLenum pname, float param) {} |
| 440 | virtual GrGLvoid textureParameterfv(GrGLuint texture, GrGLenum target, GrGLenum pname, const float *param) {} |
| 441 | virtual GrGLvoid textureImage1D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint GrGLinternalformat, GrGLsizei width, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid *pixels) {} |
| 442 | virtual GrGLvoid textureImage2D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint GrGLinternalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid *pixels) {} |
| 443 | virtual GrGLvoid textureSubImage1D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLsizei width, GrGLenum format, GrGLenum type, const GrGLvoid *pixels) {} |
| 444 | virtual GrGLvoid textureSubImage2D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, const GrGLvoid *pixels) {} |
| 445 | virtual GrGLvoid copyTextureImage1D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum GrGLinternalformat, GrGLint x, GrGLint y, GrGLsizei width, GrGLint border) {} |
| 446 | virtual GrGLvoid copyTextureImage2D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum GrGLinternalformat, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLint border) {} |
| 447 | virtual GrGLvoid copyTextureSubImage1D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint x, GrGLint y, GrGLsizei width) {} |
| 448 | virtual GrGLvoid copyTextureSubImage2D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {} |
| 449 | virtual GrGLvoid getTextureImage(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum format, GrGLenum type, GrGLvoid *pixels) {} |
| 450 | virtual GrGLvoid getTextureParameterfv(GrGLuint texture, GrGLenum target, GrGLenum pname, float *params) {} |
| 451 | virtual GrGLvoid getTextureParameteriv(GrGLuint texture, GrGLenum target, GrGLenum pname, GrGLint *params) {} |
| 452 | virtual GrGLvoid getTextureLevelParameterfv(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum pname, float *params) {} |
| 453 | virtual GrGLvoid getTextureLevelParameteriv(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum pname, GrGLint *params) {} |
| 454 | virtual GrGLvoid textureImage3D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint GrGLinternalformat, GrGLsizei width, GrGLsizei height, GrGLsizei depth, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid *pixels) {} |
| 455 | virtual GrGLvoid textureSubImage3D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLsizei width, GrGLsizei height, GrGLsizei depth, GrGLenum format, GrGLenum type, const GrGLvoid *pixels) {} |
| 456 | virtual GrGLvoid copyTextureSubImage3D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height) {} |
| 457 | virtual GrGLvoid compressedTextureImage3D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum GrGLinternalformat, GrGLsizei width, GrGLsizei height, GrGLsizei depth, GrGLint border, GrGLsizei imageSize, const GrGLvoid *data) {} |
| 458 | virtual GrGLvoid compressedTextureImage2D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum GrGLinternalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid *data) {} |
| 459 | virtual GrGLvoid compressedTextureImage1D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLenum GrGLinternalformat, GrGLsizei width, GrGLint border, GrGLsizei imageSize, const GrGLvoid *data) {} |
| 460 | virtual GrGLvoid compressedTextureSubImage3D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLsizei width, GrGLsizei height, GrGLsizei depth, GrGLenum format, GrGLsizei imageSize, const GrGLvoid *data) {} |
| 461 | virtual GrGLvoid compressedTextureSubImage2D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLsizei imageSize, const GrGLvoid *data) {} |
| 462 | virtual GrGLvoid compressedTextureSubImage1D(GrGLuint texture, GrGLenum target, GrGLint level, GrGLint xoffset, GrGLsizei width, GrGLenum format, GrGLsizei imageSize, const GrGLvoid *data) {} |
| 463 | virtual GrGLvoid getCompressedTextureImage(GrGLuint texture, GrGLenum target, GrGLint level, GrGLvoid *img) {} |
| 464 | virtual GrGLvoid namedBufferData(GrGLuint buffer, GrGLsizeiptr size, const GrGLvoid *data, GrGLenum usage) {} |
| 465 | virtual GrGLvoid namedBufferSubData(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr size, const GrGLvoid *data) {} |
| 466 | virtual GrGLvoid* mapNamedBuffer(GrGLuint buffer, GrGLenum access) { return nullptr; } |
| 467 | virtual GrGLboolean unmapNamedBuffer(GrGLuint buffer) { return GR_GL_FALSE; } |
| 468 | virtual GrGLvoid getNamedBufferParameteriv(GrGLuint buffer, GrGLenum pname, GrGLint *params) {} |
| 469 | virtual GrGLvoid getNamedBufferPointerv(GrGLuint buffer, GrGLenum pname, GrGLvoid* *params) {} |
| 470 | virtual GrGLvoid getNamedBufferSubData(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr size, GrGLvoid *data) {} |
| 471 | virtual GrGLvoid programUniform1f(GrGLuint program, GrGLint location, float v0) {} |
| 472 | virtual GrGLvoid programUniform2f(GrGLuint program, GrGLint location, float v0, float v1) {} |
| 473 | virtual GrGLvoid programUniform3f(GrGLuint program, GrGLint location, float v0, float v1, float v2) {} |
| 474 | virtual GrGLvoid programUniform4f(GrGLuint program, GrGLint location, float v0, float v1, float v2, float v3) {} |
| 475 | virtual GrGLvoid programUniform1i(GrGLuint program, GrGLint location, GrGLint v0) {} |
| 476 | virtual GrGLvoid programUniform2i(GrGLuint program, GrGLint location, GrGLint v0, GrGLint v1) {} |
| 477 | virtual GrGLvoid programUniform3i(GrGLuint program, GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2) {} |
| 478 | virtual GrGLvoid programUniform4i(GrGLuint program, GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2, GrGLint v3) {} |
| 479 | virtual GrGLvoid programUniform1fv(GrGLuint program, GrGLint location, GrGLsizei count, const float *value) {} |
| 480 | virtual GrGLvoid programUniform2fv(GrGLuint program, GrGLint location, GrGLsizei count, const float *value) {} |
| 481 | virtual GrGLvoid programUniform3fv(GrGLuint program, GrGLint location, GrGLsizei count, const float *value) {} |
| 482 | virtual GrGLvoid programUniform4fv(GrGLuint program, GrGLint location, GrGLsizei count, const float *value) {} |
| 483 | virtual GrGLvoid programUniform1iv(GrGLuint program, GrGLint location, GrGLsizei count, const GrGLint *value) {} |
| 484 | virtual GrGLvoid programUniform2iv(GrGLuint program, GrGLint location, GrGLsizei count, const GrGLint *value) {} |
| 485 | virtual GrGLvoid programUniform3iv(GrGLuint program, GrGLint location, GrGLsizei count, const GrGLint *value) {} |
| 486 | virtual GrGLvoid programUniform4iv(GrGLuint program, GrGLint location, GrGLsizei count, const GrGLint *value) {} |
| 487 | virtual GrGLvoid programUniformMatrix2fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {} |
| 488 | virtual GrGLvoid programUniformMatrix3fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {} |
| 489 | virtual GrGLvoid programUniformMatrix4fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {} |
| 490 | virtual GrGLvoid programUniformMatrix2x3fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {} |
| 491 | virtual GrGLvoid programUniformMatrix3x2fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {} |
| 492 | virtual GrGLvoid programUniformMatrix2x4fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {} |
| 493 | virtual GrGLvoid programUniformMatrix4x2fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {} |
| 494 | virtual GrGLvoid programUniformMatrix3x4fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {} |
| 495 | virtual GrGLvoid programUniformMatrix4x3fv(GrGLuint program, GrGLint location, GrGLsizei count, GrGLboolean transpose, const float *value) {} |
| 496 | virtual GrGLvoid namedRenderbufferStorage(GrGLuint renderbuffer, GrGLenum GrGLinternalformat, GrGLsizei width, GrGLsizei height) {} |
| 497 | virtual GrGLvoid getNamedRenderbufferParameteriv(GrGLuint renderbuffer, GrGLenum pname, GrGLint *params) {} |
| 498 | virtual GrGLvoid namedRenderbufferStorageMultisample(GrGLuint renderbuffer, GrGLsizei samples, GrGLenum GrGLinternalformat, GrGLsizei width, GrGLsizei height) {} |
| 499 | virtual GrGLenum checkNamedFramebufferStatus(GrGLuint framebuffer, GrGLenum target) { return GR_GL_FRAMEBUFFER_COMPLETE; } |
| 500 | virtual GrGLvoid namedFramebufferTexture1D(GrGLuint framebuffer, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {} |
| 501 | virtual GrGLvoid namedFramebufferTexture2D(GrGLuint framebuffer, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {} |
| 502 | virtual GrGLvoid namedFramebufferTexture3D(GrGLuint framebuffer, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level, GrGLint zoffset) {} |
| 503 | virtual GrGLvoid namedFramebufferRenderbuffer(GrGLuint framebuffer, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer) {} |
| 504 | virtual GrGLvoid getNamedFramebufferAttachmentParameteriv(GrGLuint framebuffer, GrGLenum attachment, GrGLenum pname, GrGLint *params) {} |
| 505 | virtual GrGLvoid generateTextureMipmap(GrGLuint texture, GrGLenum target) {} |
| 506 | virtual GrGLvoid framebufferDrawBuffer(GrGLuint framebuffer, GrGLenum mode) {} |
| 507 | virtual GrGLvoid framebufferDrawBuffers(GrGLuint framebuffer, GrGLsizei n, const GrGLenum *bufs) {} |
| 508 | virtual GrGLvoid framebufferReadBuffer(GrGLuint framebuffer, GrGLenum mode) {} |
| 509 | virtual GrGLvoid getFramebufferParameteriv(GrGLuint framebuffer, GrGLenum pname, GrGLint *param) {} |
| 510 | virtual GrGLvoid namedCopyBufferSubData(GrGLuint readBuffer, GrGLuint writeBuffer, GrGLintptr readOffset, GrGLintptr writeOffset, GrGLsizeiptr size) {} |
| 511 | virtual GrGLvoid vertexArrayVertexOffset(GrGLuint vaobj, GrGLuint buffer, GrGLint size, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {} |
| 512 | virtual GrGLvoid vertexArrayColorOffset(GrGLuint vaobj, GrGLuint buffer, GrGLint size, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {} |
| 513 | virtual GrGLvoid vertexArrayEdgeFlagOffset(GrGLuint vaobj, GrGLuint buffer, GrGLsizei stride, GrGLintptr offset) {} |
| 514 | virtual GrGLvoid vertexArrayIndexOffset(GrGLuint vaobj, GrGLuint buffer, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {} |
| 515 | virtual GrGLvoid vertexArrayNormalOffset(GrGLuint vaobj, GrGLuint buffer, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {} |
| 516 | virtual GrGLvoid vertexArrayTexCoordOffset(GrGLuint vaobj, GrGLuint buffer, GrGLint size, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {} |
| 517 | virtual GrGLvoid vertexArrayMultiTexCoordOffset(GrGLuint vaobj, GrGLuint buffer, GrGLenum texunit, GrGLint size, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {} |
| 518 | virtual GrGLvoid vertexArrayFogCoordOffset(GrGLuint vaobj, GrGLuint buffer, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {} |
| 519 | virtual GrGLvoid vertexArraySecondaryColorOffset(GrGLuint vaobj, GrGLuint buffer, GrGLint size, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {} |
| 520 | virtual GrGLvoid vertexArrayVertexAttribOffset(GrGLuint vaobj, GrGLuint buffer, GrGLuint index, GrGLint size, GrGLenum type, GrGLboolean normalized, GrGLsizei stride, GrGLintptr offset) {} |
| 521 | virtual GrGLvoid vertexArrayVertexAttribIOffset(GrGLuint vaobj, GrGLuint buffer, GrGLuint index, GrGLint size, GrGLenum type, GrGLsizei stride, GrGLintptr offset) {} |
| 522 | virtual GrGLvoid enableVertexArray(GrGLuint vaobj, GrGLenum array) {} |
| 523 | virtual GrGLvoid disableVertexArray(GrGLuint vaobj, GrGLenum array) {} |
| 524 | virtual GrGLvoid enableVertexArrayAttrib(GrGLuint vaobj, GrGLuint index) {} |
| 525 | virtual GrGLvoid disableVertexArrayAttrib(GrGLuint vaobj, GrGLuint index) {} |
| 526 | virtual GrGLvoid getVertexArrayIntegerv(GrGLuint vaobj, GrGLenum pname, GrGLint *param) {} |
| 527 | virtual GrGLvoid getVertexArrayPointerv(GrGLuint vaobj, GrGLenum pname, GrGLvoid **param) {} |
| 528 | virtual GrGLvoid getVertexArrayIntegeri_v(GrGLuint vaobj, GrGLuint index, GrGLenum pname, GrGLint *param) {} |
| 529 | virtual GrGLvoid getVertexArrayPointeri_v(GrGLuint vaobj, GrGLuint index, GrGLenum pname, GrGLvoid **param) {} |
| 530 | virtual GrGLvoid* mapNamedBufferRange(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr length, GrGLbitfield access) { return nullptr; } |
| 531 | virtual GrGLvoid flushMappedNamedBufferRange(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr length) {} |
| 532 | virtual GrGLvoid textureBuffer(GrGLuint texture, GrGLenum target, GrGLenum internalformat, GrGLuint buffer) {} |
| 533 | virtual GrGLsync fenceSync(GrGLenum condition, GrGLbitfield flags) { return nullptr; } |
| 534 | virtual GrGLboolean isSync(GrGLsync) { return false; } |
| 535 | virtual GrGLenum clientWaitSync(GrGLsync sync, GrGLbitfield flags, GrGLuint64 timeout) { return GR_GL_WAIT_FAILED; } |
| 536 | virtual GrGLvoid waitSync(GrGLsync sync, GrGLbitfield flags, GrGLuint64 timeout) {} |
| 537 | virtual GrGLvoid deleteSync(GrGLsync sync) {} |
| 538 | virtual GrGLvoid debugMessageControl(GrGLenum source, GrGLenum type, GrGLenum severity, GrGLsizei count, const GrGLuint* ids, GrGLboolean enabled) {} |
| 539 | virtual GrGLvoid debugMessageInsert(GrGLenum source, GrGLenum type, GrGLuint id, GrGLenum severity, GrGLsizei length, const GrGLchar* buf) {} |
| 540 | virtual GrGLvoid debugMessageCallback(GRGLDEBUGPROC callback, const GrGLvoid* userParam) {} |
| 541 | virtual GrGLuint getDebugMessageLog(GrGLuint count, GrGLsizei bufSize, GrGLenum* sources, GrGLenum* types, GrGLuint* ids, GrGLenum* severities, GrGLsizei* lengths, GrGLchar* messageLog) { return 0; } |
| 542 | virtual GrGLvoid pushDebugGroup(GrGLenum source, GrGLuint id, GrGLsizei length, const GrGLchar * message) {} |
| 543 | virtual GrGLvoid popDebugGroup() {} |
| 544 | virtual GrGLvoid objectLabel(GrGLenum identifier, GrGLuint name, GrGLsizei length, const GrGLchar *label) {} |
| 545 | virtual GrGLvoid getInternalformativ(GrGLenum target, GrGLenum internalformat, GrGLenum pname, GrGLsizei bufSize, GrGLint *params) {} |
| 546 | virtual GrGLvoid programBinary(GrGLuint program, GrGLenum binaryFormat, void *binary, GrGLsizei length) {} |
| 547 | virtual GrGLvoid getProgramBinary(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, GrGLenum *binaryFormat, void *binary) {} |
| 548 | virtual GrGLvoid programParameteri(GrGLuint program, GrGLenum pname, GrGLint value) {} |
| 549 | |
| 550 | protected: |
| 551 | // This must be called by leaf class |
| 552 | void init(GrGLStandard standard) { |
| 553 | fStandard = standard; |
| 554 | fExtensions.init(standard, fFunctions.fGetString, fFunctions.fGetStringi, |
| 555 | fFunctions.fGetIntegerv, nullptr, GR_EGL_NO_DISPLAY); |
| 556 | } |
| 557 | TestInterface(); |
| 558 | }; |
| 559 | |
| 560 | template <typename R, typename... A> |
| 561 | GrGLFunction<R GR_GL_FUNCTION_TYPE(A...)> bind_to_member(TestInterface* interface, |
| 562 | R (TestInterface::*member)(A...)) { |
| 563 | return [interface, member](A... a) -> R { return (interface->*member)(a...); }; |
| 564 | } |
| 565 | |
| 566 | TestInterface::TestInterface() { |
| 567 | fFunctions.fActiveTexture = bind_to_member(this, &TestInterface::activeTexture); |
| 568 | fFunctions.fAttachShader = bind_to_member(this, &TestInterface::attachShader); |
| 569 | fFunctions.fBeginQuery = bind_to_member(this, &TestInterface::beginQuery); |
| 570 | fFunctions.fBindAttribLocation = bind_to_member(this, &TestInterface::bindAttribLocation); |
| 571 | fFunctions.fBindBuffer = bind_to_member(this, &TestInterface::bindBuffer); |
| 572 | fFunctions.fBindFramebuffer = bind_to_member(this, &TestInterface::bindFramebuffer); |
| 573 | fFunctions.fBindRenderbuffer = bind_to_member(this, &TestInterface::bindRenderbuffer); |
| 574 | fFunctions.fBindSampler = bind_to_member(this, &TestInterface::bindSampler); |
| 575 | fFunctions.fBindTexture = bind_to_member(this, &TestInterface::bindTexture); |
| 576 | fFunctions.fBindFragDataLocation = bind_to_member(this, &TestInterface::bindFragDataLocation); |
| 577 | fFunctions.fBindFragDataLocationIndexed = bind_to_member(this, &TestInterface::bindFragDataLocationIndexed); |
| 578 | fFunctions.fBindVertexArray = bind_to_member(this, &TestInterface::bindVertexArray); |
| 579 | fFunctions.fBlendBarrier = bind_to_member(this, &TestInterface::blendBarrier); |
| 580 | fFunctions.fBlendColor = bind_to_member(this, &TestInterface::blendColor); |
| 581 | fFunctions.fBlendEquation = bind_to_member(this, &TestInterface::blendEquation); |
| 582 | fFunctions.fBlendFunc = bind_to_member(this, &TestInterface::blendFunc); |
| 583 | fFunctions.fBlitFramebuffer = bind_to_member(this, &TestInterface::blitFramebuffer); |
| 584 | fFunctions.fBufferData = bind_to_member(this, &TestInterface::bufferData); |
| 585 | fFunctions.fBufferSubData = bind_to_member(this, &TestInterface::bufferSubData); |
| 586 | fFunctions.fCheckFramebufferStatus = bind_to_member(this, &TestInterface::checkFramebufferStatus); |
| 587 | fFunctions.fClear = bind_to_member(this, &TestInterface::clear); |
| 588 | fFunctions.fClearColor = bind_to_member(this, &TestInterface::clearColor); |
| 589 | fFunctions.fClearStencil = bind_to_member(this, &TestInterface::clearStencil); |
| 590 | fFunctions.fColorMask = bind_to_member(this, &TestInterface::colorMask); |
| 591 | fFunctions.fCompileShader = bind_to_member(this, &TestInterface::compileShader); |
| 592 | fFunctions.fCompressedTexImage2D = bind_to_member(this, &TestInterface::compressedTexImage2D); |
| 593 | fFunctions.fCompressedTexSubImage2D = bind_to_member(this, &TestInterface::compressedTexSubImage2D); |
| 594 | fFunctions.fCopyTexSubImage2D = bind_to_member(this, &TestInterface::copyTexSubImage2D); |
| 595 | fFunctions.fCreateProgram = bind_to_member(this, &TestInterface::createProgram); |
| 596 | fFunctions.fCreateShader = bind_to_member(this, &TestInterface::createShader); |
| 597 | fFunctions.fCullFace = bind_to_member(this, &TestInterface::cullFace); |
| 598 | fFunctions.fDeleteBuffers = bind_to_member(this, &TestInterface::deleteBuffers); |
| 599 | fFunctions.fDeleteFramebuffers = bind_to_member(this, &TestInterface::deleteFramebuffers); |
| 600 | fFunctions.fDeleteProgram = bind_to_member(this, &TestInterface::deleteProgram); |
| 601 | fFunctions.fDeleteQueries = bind_to_member(this, &TestInterface::deleteQueries); |
| 602 | fFunctions.fDeleteRenderbuffers = bind_to_member(this, &TestInterface::deleteRenderbuffers); |
| 603 | fFunctions.fDeleteSamplers = bind_to_member(this, &TestInterface::deleteSamplers); |
| 604 | fFunctions.fDeleteShader = bind_to_member(this, &TestInterface::deleteShader); |
| 605 | fFunctions.fDeleteTextures = bind_to_member(this, &TestInterface::deleteTextures); |
| 606 | fFunctions.fDeleteVertexArrays = bind_to_member(this, &TestInterface::deleteVertexArrays); |
| 607 | fFunctions.fDepthMask = bind_to_member(this, &TestInterface::depthMask); |
| 608 | fFunctions.fDisable = bind_to_member(this, &TestInterface::disable); |
| 609 | fFunctions.fDisableVertexAttribArray = bind_to_member(this, &TestInterface::disableVertexAttribArray); |
| 610 | fFunctions.fDrawArrays = bind_to_member(this, &TestInterface::drawArrays); |
| 611 | fFunctions.fDrawArraysInstanced = bind_to_member(this, &TestInterface::drawArraysInstanced); |
| 612 | fFunctions.fDrawArraysIndirect = bind_to_member(this, &TestInterface::drawArraysIndirect); |
| 613 | fFunctions.fDrawBuffer = bind_to_member(this, &TestInterface::drawBuffer); |
| 614 | fFunctions.fDrawBuffers = bind_to_member(this, &TestInterface::drawBuffers); |
| 615 | fFunctions.fDrawElements = bind_to_member(this, &TestInterface::drawElements); |
| 616 | fFunctions.fDrawElementsInstanced = bind_to_member(this, &TestInterface::drawElementsInstanced); |
| 617 | fFunctions.fDrawElementsIndirect = bind_to_member(this, &TestInterface::drawElementsIndirect); |
| 618 | fFunctions.fDrawRangeElements = bind_to_member(this, &TestInterface::drawRangeElements); |
| 619 | fFunctions.fEnable = bind_to_member(this, &TestInterface::enable); |
| 620 | fFunctions.fEnableVertexAttribArray = bind_to_member(this, &TestInterface::enableVertexAttribArray); |
| 621 | fFunctions.fEndQuery = bind_to_member(this, &TestInterface::endQuery); |
| 622 | fFunctions.fFinish = bind_to_member(this, &TestInterface::finish); |
| 623 | fFunctions.fFlush = bind_to_member(this, &TestInterface::flush); |
| 624 | fFunctions.fFlushMappedBufferRange = bind_to_member(this, &TestInterface::flushMappedBufferRange); |
| 625 | fFunctions.fFramebufferRenderbuffer = bind_to_member(this, &TestInterface::framebufferRenderbuffer); |
| 626 | fFunctions.fFramebufferTexture2D = bind_to_member(this, &TestInterface::framebufferTexture2D); |
| 627 | fFunctions.fFramebufferTexture2DMultisample = bind_to_member(this, &TestInterface::framebufferTexture2DMultisample); |
| 628 | fFunctions.fFrontFace = bind_to_member(this, &TestInterface::frontFace); |
| 629 | fFunctions.fGenBuffers = bind_to_member(this, &TestInterface::genBuffers); |
| 630 | fFunctions.fGenFramebuffers = bind_to_member(this, &TestInterface::genFramebuffers); |
| 631 | fFunctions.fGenerateMipmap = bind_to_member(this, &TestInterface::generateMipmap); |
| 632 | fFunctions.fGenQueries = bind_to_member(this, &TestInterface::genQueries); |
| 633 | fFunctions.fGenRenderbuffers = bind_to_member(this, &TestInterface::genRenderbuffers); |
| 634 | fFunctions.fGenSamplers = bind_to_member(this, &TestInterface::genSamplers); |
| 635 | fFunctions.fGenTextures = bind_to_member(this, &TestInterface::genTextures); |
| 636 | fFunctions.fGenVertexArrays = bind_to_member(this, &TestInterface::genVertexArrays); |
| 637 | fFunctions.fGetBufferParameteriv = bind_to_member(this, &TestInterface::getBufferParameteriv); |
| 638 | fFunctions.fGetError = bind_to_member(this, &TestInterface::getError); |
| 639 | fFunctions.fGetFramebufferAttachmentParameteriv = bind_to_member(this, &TestInterface::getFramebufferAttachmentParameteriv); |
| 640 | fFunctions.fGetIntegerv = bind_to_member(this, &TestInterface::getIntegerv); |
| 641 | fFunctions.fGetMultisamplefv = bind_to_member(this, &TestInterface::getMultisamplefv); |
| 642 | fFunctions.fGetProgramInfoLog = bind_to_member(this, &TestInterface::getProgramInfoLog); |
| 643 | fFunctions.fGetProgramiv = bind_to_member(this, &TestInterface::getProgramiv); |
| 644 | fFunctions.fGetQueryiv = bind_to_member(this, &TestInterface::getQueryiv); |
| 645 | fFunctions.fGetQueryObjecti64v = bind_to_member(this, &TestInterface::getQueryObjecti64v); |
| 646 | fFunctions.fGetQueryObjectiv = bind_to_member(this, &TestInterface::getQueryObjectiv); |
| 647 | fFunctions.fGetQueryObjectui64v = bind_to_member(this, &TestInterface::getQueryObjectui64v); |
| 648 | fFunctions.fGetQueryObjectuiv = bind_to_member(this, &TestInterface::getQueryObjectuiv); |
| 649 | fFunctions.fGetRenderbufferParameteriv = bind_to_member(this, &TestInterface::getRenderbufferParameteriv); |
| 650 | fFunctions.fGetShaderInfoLog = bind_to_member(this, &TestInterface::getShaderInfoLog); |
| 651 | fFunctions.fGetShaderiv = bind_to_member(this, &TestInterface::getShaderiv); |
| 652 | fFunctions.fGetShaderPrecisionFormat = bind_to_member(this, &TestInterface::getShaderPrecisionFormat); |
| 653 | fFunctions.fGetString = bind_to_member(this, &TestInterface::getString); |
| 654 | fFunctions.fGetStringi = bind_to_member(this, &TestInterface::getStringi); |
| 655 | fFunctions.fGetTexLevelParameteriv = bind_to_member(this, &TestInterface::getTexLevelParameteriv); |
| 656 | fFunctions.fGetUniformLocation = bind_to_member(this, &TestInterface::getUniformLocation); |
| 657 | fFunctions.fInsertEventMarker = bind_to_member(this, &TestInterface::insertEventMarker); |
| 658 | fFunctions.fInvalidateBufferData = bind_to_member(this, &TestInterface::invalidateBufferData); |
| 659 | fFunctions.fInvalidateBufferSubData = bind_to_member(this, &TestInterface::invalidateBufferSubData); |
| 660 | fFunctions.fInvalidateFramebuffer = bind_to_member(this, &TestInterface::invalidateFramebuffer); |
| 661 | fFunctions.fInvalidateSubFramebuffer = bind_to_member(this, &TestInterface::invalidateSubFramebuffer); |
| 662 | fFunctions.fInvalidateTexImage = bind_to_member(this, &TestInterface::invalidateTexImage); |
| 663 | fFunctions.fInvalidateTexSubImage = bind_to_member(this, &TestInterface::invalidateTexSubImage); |
| 664 | fFunctions.fIsTexture = bind_to_member(this, &TestInterface::isTexture); |
| 665 | fFunctions.fLineWidth = bind_to_member(this, &TestInterface::lineWidth); |
| 666 | fFunctions.fLinkProgram = bind_to_member(this, &TestInterface::linkProgram); |
| 667 | fFunctions.fMapBuffer = bind_to_member(this, &TestInterface::mapBuffer); |
| 668 | fFunctions.fMapBufferRange = bind_to_member(this, &TestInterface::mapBufferRange); |
| 669 | fFunctions.fMapBufferSubData = bind_to_member(this, &TestInterface::mapBufferSubData); |
| 670 | fFunctions.fMapTexSubImage2D = bind_to_member(this, &TestInterface::mapTexSubImage2D); |
| 671 | fFunctions.fPixelStorei = bind_to_member(this, &TestInterface::pixelStorei); |
| 672 | fFunctions.fPolygonMode = bind_to_member(this, &TestInterface::polygonMode); |
| 673 | fFunctions.fPopGroupMarker = bind_to_member(this, &TestInterface::popGroupMarker); |
| 674 | fFunctions.fPushGroupMarker = bind_to_member(this, &TestInterface::pushGroupMarker); |
| 675 | fFunctions.fQueryCounter = bind_to_member(this, &TestInterface::queryCounter); |
| 676 | fFunctions.fReadBuffer = bind_to_member(this, &TestInterface::readBuffer); |
| 677 | fFunctions.fReadPixels = bind_to_member(this, &TestInterface::readPixels); |
| 678 | fFunctions.fRenderbufferStorage = bind_to_member(this, &TestInterface::renderbufferStorage); |
| 679 | fFunctions.fRenderbufferStorageMultisample = bind_to_member(this, &TestInterface::renderbufferStorageMultisample); |
| 680 | fFunctions.fResolveMultisampleFramebuffer = bind_to_member(this, &TestInterface::resolveMultisampleFramebuffer); |
| 681 | fFunctions.fScissor = bind_to_member(this, &TestInterface::scissor); |
| 682 | fFunctions.fBindUniformLocation = bind_to_member(this, &TestInterface::bindUniformLocation); |
| 683 | fFunctions.fSamplerParameteri = bind_to_member(this, &TestInterface::samplerParameteri); |
| 684 | fFunctions.fSamplerParameteriv = bind_to_member(this, &TestInterface::samplerParameteriv); |
| 685 | fFunctions.fShaderSource = bind_to_member(this, &TestInterface::shaderSource); |
| 686 | fFunctions.fStencilFunc = bind_to_member(this, &TestInterface::stencilFunc); |
| 687 | fFunctions.fStencilFuncSeparate = bind_to_member(this, &TestInterface::stencilFuncSeparate); |
| 688 | fFunctions.fStencilMask = bind_to_member(this, &TestInterface::stencilMask); |
| 689 | fFunctions.fStencilMaskSeparate = bind_to_member(this, &TestInterface::stencilMaskSeparate); |
| 690 | fFunctions.fStencilOp = bind_to_member(this, &TestInterface::stencilOp); |
| 691 | fFunctions.fStencilOpSeparate = bind_to_member(this, &TestInterface::stencilOpSeparate); |
| 692 | fFunctions.fTexBuffer = bind_to_member(this, &TestInterface::texBuffer); |
| 693 | fFunctions.fTexImage2D = bind_to_member(this, &TestInterface::texImage2D); |
| 694 | fFunctions.fTexParameterf = bind_to_member(this, &TestInterface::texParameterf); |
| 695 | fFunctions.fTexParameterfv = bind_to_member(this, &TestInterface::texParameterfv); |
| 696 | fFunctions.fTexParameteri = bind_to_member(this, &TestInterface::texParameteri); |
| 697 | fFunctions.fTexParameteriv = bind_to_member(this, &TestInterface::texParameteriv); |
| 698 | fFunctions.fTexStorage2D = bind_to_member(this, &TestInterface::texStorage2D); |
| 699 | fFunctions.fDiscardFramebuffer = bind_to_member(this, &TestInterface::discardFramebuffer); |
| 700 | fFunctions.fTexSubImage2D = bind_to_member(this, &TestInterface::texSubImage2D); |
| 701 | fFunctions.fTextureBarrier = bind_to_member(this, &TestInterface::textureBarrier); |
| 702 | fFunctions.fUniform1f = bind_to_member(this, &TestInterface::uniform1f); |
| 703 | fFunctions.fUniform1i = bind_to_member(this, &TestInterface::uniform1i); |
| 704 | fFunctions.fUniform1fv = bind_to_member(this, &TestInterface::uniform1fv); |
| 705 | fFunctions.fUniform1iv = bind_to_member(this, &TestInterface::uniform1iv); |
| 706 | fFunctions.fUniform2f = bind_to_member(this, &TestInterface::uniform2f); |
| 707 | fFunctions.fUniform2i = bind_to_member(this, &TestInterface::uniform2i); |
| 708 | fFunctions.fUniform2fv = bind_to_member(this, &TestInterface::uniform2fv); |
| 709 | fFunctions.fUniform2iv = bind_to_member(this, &TestInterface::uniform2iv); |
| 710 | fFunctions.fUniform3f = bind_to_member(this, &TestInterface::uniform3f); |
| 711 | fFunctions.fUniform3i = bind_to_member(this, &TestInterface::uniform3i); |
| 712 | fFunctions.fUniform3fv = bind_to_member(this, &TestInterface::uniform3fv); |
| 713 | fFunctions.fUniform3iv = bind_to_member(this, &TestInterface::uniform3iv); |
| 714 | fFunctions.fUniform4f = bind_to_member(this, &TestInterface::uniform4f); |
| 715 | fFunctions.fUniform4i = bind_to_member(this, &TestInterface::uniform4i); |
| 716 | fFunctions.fUniform4fv = bind_to_member(this, &TestInterface::uniform4fv); |
| 717 | fFunctions.fUniform4iv = bind_to_member(this, &TestInterface::uniform4iv); |
| 718 | fFunctions.fUniformMatrix2fv = bind_to_member(this, &TestInterface::uniformMatrix2fv); |
| 719 | fFunctions.fUniformMatrix3fv = bind_to_member(this, &TestInterface::uniformMatrix3fv); |
| 720 | fFunctions.fUniformMatrix4fv = bind_to_member(this, &TestInterface::uniformMatrix4fv); |
| 721 | fFunctions.fUnmapBuffer = bind_to_member(this, &TestInterface::unmapBuffer); |
| 722 | fFunctions.fUnmapBufferSubData = bind_to_member(this, &TestInterface::unmapBufferSubData); |
| 723 | fFunctions.fUnmapTexSubImage2D = bind_to_member(this, &TestInterface::unmapTexSubImage2D); |
| 724 | fFunctions.fUseProgram = bind_to_member(this, &TestInterface::useProgram); |
| 725 | fFunctions.fVertexAttrib1f = bind_to_member(this, &TestInterface::vertexAttrib1f); |
| 726 | fFunctions.fVertexAttrib2fv = bind_to_member(this, &TestInterface::vertexAttrib2fv); |
| 727 | fFunctions.fVertexAttrib3fv = bind_to_member(this, &TestInterface::vertexAttrib3fv); |
| 728 | fFunctions.fVertexAttrib4fv = bind_to_member(this, &TestInterface::vertexAttrib4fv); |
| 729 | fFunctions.fVertexAttribDivisor = bind_to_member(this, &TestInterface::vertexAttribDivisor); |
| 730 | fFunctions.fVertexAttribIPointer = bind_to_member(this, &TestInterface::vertexAttribIPointer); |
| 731 | fFunctions.fVertexAttribPointer = bind_to_member(this, &TestInterface::vertexAttribPointer); |
| 732 | fFunctions.fViewport = bind_to_member(this, &TestInterface::viewport); |
| 733 | fFunctions.fMatrixLoadf = bind_to_member(this, &TestInterface::matrixLoadf); |
| 734 | fFunctions.fMatrixLoadIdentity = bind_to_member(this, &TestInterface::matrixLoadIdentity); |
| 735 | fFunctions.fPathCommands = bind_to_member(this, &TestInterface::pathCommands); |
| 736 | fFunctions.fPathParameteri = bind_to_member(this, &TestInterface::pathParameteri); |
| 737 | fFunctions.fPathParameterf = bind_to_member(this, &TestInterface::pathParameterf); |
| 738 | fFunctions.fGenPaths = bind_to_member(this, &TestInterface::genPaths); |
| 739 | fFunctions.fDeletePaths = bind_to_member(this, &TestInterface::deletePaths); |
| 740 | fFunctions.fIsPath = bind_to_member(this, &TestInterface::isPath); |
| 741 | fFunctions.fPathStencilFunc = bind_to_member(this, &TestInterface::pathStencilFunc); |
| 742 | fFunctions.fStencilFillPath = bind_to_member(this, &TestInterface::stencilFillPath); |
| 743 | fFunctions.fStencilStrokePath = bind_to_member(this, &TestInterface::stencilStrokePath); |
| 744 | fFunctions.fStencilFillPathInstanced = bind_to_member(this, &TestInterface::stencilFillPathInstanced); |
| 745 | fFunctions.fStencilStrokePathInstanced = bind_to_member(this, &TestInterface::stencilStrokePathInstanced); |
| 746 | fFunctions.fCoverFillPath = bind_to_member(this, &TestInterface::coverFillPath); |
| 747 | fFunctions.fCoverStrokePath = bind_to_member(this, &TestInterface::coverStrokePath); |
| 748 | fFunctions.fCoverFillPathInstanced = bind_to_member(this, &TestInterface::coverFillPathInstanced); |
| 749 | fFunctions.fCoverStrokePathInstanced = bind_to_member(this, &TestInterface::coverStrokePathInstanced); |
| 750 | fFunctions.fStencilThenCoverFillPath = bind_to_member(this, &TestInterface::stencilThenCoverFillPath); |
| 751 | fFunctions.fStencilThenCoverStrokePath = bind_to_member(this, &TestInterface::stencilThenCoverStrokePath); |
| 752 | fFunctions.fStencilThenCoverFillPathInstanced = bind_to_member(this, &TestInterface::stencilThenCoverFillPathInstanced); |
| 753 | fFunctions.fStencilThenCoverStrokePathInstanced = bind_to_member(this, &TestInterface::stencilThenCoverStrokePathInstanced); |
| 754 | fFunctions.fProgramPathFragmentInputGen = bind_to_member(this, &TestInterface::programPathFragmentInputGen); |
| 755 | fFunctions.fBindFragmentInputLocation = bind_to_member(this, &TestInterface::bindFragmentInputLocation); |
| 756 | fFunctions.fGetProgramResourceLocation = bind_to_member(this, &TestInterface::getProgramResourceLocation); |
| 757 | fFunctions.fCoverageModulation = bind_to_member(this, &TestInterface::coverageModulation); |
| 758 | fFunctions.fMultiDrawArraysIndirect = bind_to_member(this, &TestInterface::multiDrawArraysIndirect); |
| 759 | fFunctions.fMultiDrawElementsIndirect = bind_to_member(this, &TestInterface::multiDrawElementsIndirect); |
| 760 | fFunctions.fFenceSync = bind_to_member(this, &TestInterface::fenceSync); |
| 761 | fFunctions.fIsSync = bind_to_member(this, &TestInterface::isSync); |
| 762 | fFunctions.fClientWaitSync = bind_to_member(this, &TestInterface::clientWaitSync); |
| 763 | fFunctions.fWaitSync = bind_to_member(this, &TestInterface::waitSync); |
| 764 | fFunctions.fDeleteSync = bind_to_member(this, &TestInterface::deleteSync); |
| 765 | fFunctions.fDebugMessageControl = bind_to_member(this, &TestInterface::debugMessageControl); |
| 766 | fFunctions.fDebugMessageInsert = bind_to_member(this, &TestInterface::debugMessageInsert); |
| 767 | fFunctions.fDebugMessageCallback = bind_to_member(this, &TestInterface::debugMessageCallback); |
| 768 | fFunctions.fGetDebugMessageLog = bind_to_member(this, &TestInterface::getDebugMessageLog); |
| 769 | fFunctions.fPushDebugGroup = bind_to_member(this, &TestInterface::pushDebugGroup); |
| 770 | fFunctions.fPopDebugGroup = bind_to_member(this, &TestInterface::popDebugGroup); |
| 771 | fFunctions.fObjectLabel = bind_to_member(this, &TestInterface::objectLabel); |
| 772 | fFunctions.fGetInternalformativ = bind_to_member(this, &TestInterface::getInternalformativ); |
| 773 | fFunctions.fProgramBinary = bind_to_member(this, &TestInterface::programBinary); |
| 774 | fFunctions.fGetProgramBinary = bind_to_member(this, &TestInterface::getProgramBinary); |
| 775 | fFunctions.fProgramParameteri = bind_to_member(this, &TestInterface::programParameteri); |
| 776 | } |
| 777 | |
Brian Osman | 8e874bb | 2019-04-08 12:24:46 -0400 | [diff] [blame] | 778 | /** Null interface implementation */ |
Brian Osman | eae47f4 | 2019-04-09 13:02:22 -0400 | [diff] [blame] | 779 | class NullInterface : public TestInterface { |
Brian Osman | 8e874bb | 2019-04-08 12:24:46 -0400 | [diff] [blame] | 780 | public: |
| 781 | NullInterface(bool enableNVPR) |
| 782 | : fCurrDrawFramebuffer(0) |
| 783 | , fCurrReadFramebuffer(0) |
| 784 | , fCurrRenderbuffer(0) |
| 785 | , fCurrProgramID(0) |
| 786 | , fCurrShaderID(0) |
| 787 | , fCurrGenericID(0) |
| 788 | , fCurrUniformLocation(0) |
| 789 | , fCurrPathID(0) { |
| 790 | memset(fBoundBuffers, 0, sizeof(fBoundBuffers)); |
| 791 | fAdvertisedExtensions.push_back("GL_ARB_framebuffer_object"); |
| 792 | fAdvertisedExtensions.push_back("GL_ARB_blend_func_extended"); |
| 793 | fAdvertisedExtensions.push_back("GL_ARB_timer_query"); |
| 794 | fAdvertisedExtensions.push_back("GL_ARB_draw_buffers"); |
| 795 | fAdvertisedExtensions.push_back("GL_ARB_occlusion_query"); |
| 796 | fAdvertisedExtensions.push_back("GL_EXT_stencil_wrap"); |
| 797 | if (enableNVPR) { |
| 798 | fAdvertisedExtensions.push_back("GL_NV_path_rendering"); |
| 799 | fAdvertisedExtensions.push_back("GL_ARB_program_interface_query"); |
| 800 | } |
| 801 | fAdvertisedExtensions.push_back(nullptr); |
| 802 | |
| 803 | this->init(kGL_GrGLStandard); |
| 804 | } |
| 805 | |
| 806 | GrGLenum checkFramebufferStatus(GrGLenum target) override { |
| 807 | return GR_GL_FRAMEBUFFER_COMPLETE; |
| 808 | } |
| 809 | |
| 810 | GrGLvoid genBuffers(GrGLsizei n, GrGLuint* ids) override { |
| 811 | for (int i = 0; i < n; ++i) { |
| 812 | Buffer* buffer = fBufferManager.create(); |
| 813 | ids[i] = buffer->id(); |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | GrGLvoid bufferData(GrGLenum target, GrGLsizeiptr size, const GrGLvoid* data, |
| 818 | GrGLenum usage) override { |
| 819 | GrGLuint id = fBoundBuffers[GetBufferIndex(target)]; |
| 820 | if (id > 0) { |
| 821 | Buffer* buffer = fBufferManager.lookUp(id); |
| 822 | buffer->allocate(size, (const GrGLchar*) data); |
| 823 | } |
| 824 | } |
| 825 | |
| 826 | GrGLuint createProgram() override { |
| 827 | return ++fCurrProgramID; |
| 828 | } |
| 829 | |
| 830 | GrGLuint createShader(GrGLenum type) override { |
| 831 | return ++fCurrShaderID; |
| 832 | } |
| 833 | |
| 834 | GrGLvoid bindBuffer(GrGLenum target, GrGLuint buffer) override { |
| 835 | fBoundBuffers[GetBufferIndex(target)] = buffer; |
| 836 | } |
| 837 | |
| 838 | // deleting a bound buffer has the side effect of binding 0 |
| 839 | GrGLvoid deleteBuffers(GrGLsizei n, const GrGLuint* ids) override { |
| 840 | // First potentially unbind the buffers. |
| 841 | for (int buffIdx = 0; buffIdx < kNumBufferTargets; ++buffIdx) { |
| 842 | if (!fBoundBuffers[buffIdx]) { |
| 843 | continue; |
| 844 | } |
| 845 | for (int i = 0; i < n; ++i) { |
| 846 | if (ids[i] == fBoundBuffers[buffIdx]) { |
| 847 | fBoundBuffers[buffIdx] = 0; |
| 848 | break; |
| 849 | } |
| 850 | } |
| 851 | } |
| 852 | |
| 853 | // Then actually "delete" the buffers. |
| 854 | for (int i = 0; i < n; ++i) { |
| 855 | if (ids[i] > 0) { |
| 856 | Buffer* buffer = fBufferManager.lookUp(ids[i]); |
| 857 | fBufferManager.free(buffer); |
| 858 | } |
| 859 | } |
| 860 | } |
| 861 | |
| 862 | GrGLvoid genFramebuffers(GrGLsizei n, GrGLuint *framebuffers) override { |
| 863 | for (int i = 0; i < n; ++i) { |
| 864 | Framebuffer* framebuffer = fFramebufferManager.create(); |
| 865 | framebuffers[i] = framebuffer->id(); |
| 866 | } |
| 867 | } |
| 868 | |
| 869 | GrGLvoid bindFramebuffer(GrGLenum target, GrGLuint framebuffer) override { |
| 870 | SkASSERT(GR_GL_FRAMEBUFFER == target || GR_GL_DRAW_FRAMEBUFFER == target || |
| 871 | GR_GL_READ_FRAMEBUFFER == target); |
| 872 | if (GR_GL_READ_FRAMEBUFFER != target) { |
| 873 | fCurrDrawFramebuffer = framebuffer; |
| 874 | } |
| 875 | if (GR_GL_DRAW_FRAMEBUFFER != target) { |
| 876 | fCurrReadFramebuffer = framebuffer; |
| 877 | } |
| 878 | } |
| 879 | |
| 880 | GrGLvoid deleteFramebuffers(GrGLsizei n, const GrGLuint* ids) override { |
| 881 | for (int i = 0; i < n; ++i) { |
| 882 | if (ids[i] == fCurrDrawFramebuffer) { |
| 883 | fCurrDrawFramebuffer = 0; |
| 884 | } |
| 885 | if (ids[i] == fCurrReadFramebuffer) { |
| 886 | fCurrReadFramebuffer = 0; |
| 887 | } |
| 888 | |
| 889 | if (ids[i] > 0) { |
| 890 | Framebuffer* framebuffer = fFramebufferManager.lookUp(ids[i]); |
| 891 | fFramebufferManager.free(framebuffer); |
| 892 | } |
| 893 | } |
| 894 | } |
| 895 | |
| 896 | GrGLvoid genQueries(GrGLsizei n, GrGLuint *ids) override { this->genGenericIds(n, ids); } |
| 897 | |
| 898 | GrGLvoid genRenderbuffers(GrGLsizei n, GrGLuint *renderbuffers) override { |
| 899 | for (int i = 0; i < n; ++i) { |
| 900 | Renderbuffer* renderbuffer = fRenderbufferManager.create(); |
| 901 | renderbuffers[i] = renderbuffer->id(); |
| 902 | } |
| 903 | } |
| 904 | |
| 905 | GrGLvoid bindRenderbuffer(GrGLenum target, GrGLuint renderbuffer) override { |
| 906 | SkASSERT(GR_GL_RENDERBUFFER == target); |
| 907 | fCurrRenderbuffer = renderbuffer; |
| 908 | } |
| 909 | |
| 910 | GrGLvoid deleteRenderbuffers(GrGLsizei n, const GrGLuint* ids) override { |
| 911 | for (int i = 0; i < n; ++i) { |
| 912 | if (ids[i] <= 0) { |
| 913 | continue; |
| 914 | } |
| 915 | if (ids[i] == fCurrRenderbuffer) { |
| 916 | fCurrRenderbuffer = 0; |
| 917 | } |
| 918 | Renderbuffer* renderbuffer = fRenderbufferManager.lookUp(ids[i]); |
| 919 | |
| 920 | if (fCurrDrawFramebuffer) { |
| 921 | Framebuffer* drawFramebuffer = fFramebufferManager.lookUp(fCurrDrawFramebuffer); |
| 922 | drawFramebuffer->notifyAttachmentDeleteWhileBound(renderbuffer); |
| 923 | } |
| 924 | if (fCurrReadFramebuffer) { |
| 925 | Framebuffer* readFramebuffer = fFramebufferManager.lookUp(fCurrReadFramebuffer); |
| 926 | readFramebuffer->notifyAttachmentDeleteWhileBound(renderbuffer); |
| 927 | } |
| 928 | |
| 929 | fRenderbufferManager.free(renderbuffer); |
| 930 | } |
| 931 | } |
| 932 | |
| 933 | GrGLvoid renderbufferStorage(GrGLenum target, GrGLenum internalformat, GrGLsizei width, |
| 934 | GrGLsizei height) override { |
| 935 | GrAlwaysAssert(GR_GL_RENDERBUFFER == target); |
| 936 | GrAlwaysAssert(fCurrRenderbuffer); |
| 937 | Renderbuffer* renderbuffer = fRenderbufferManager.lookUp(fCurrRenderbuffer); |
| 938 | renderbuffer->setNumSamples(1); |
| 939 | } |
| 940 | |
| 941 | GrGLvoid renderbufferStorageMultisample(GrGLenum target, GrGLsizei samples, |
| 942 | GrGLenum internalformat, GrGLsizei width, |
| 943 | GrGLsizei height) override { |
| 944 | GrAlwaysAssert(GR_GL_RENDERBUFFER == target); |
| 945 | GrAlwaysAssert(samples > 0); |
| 946 | GrAlwaysAssert(fCurrRenderbuffer); |
| 947 | Renderbuffer* renderbuffer = fRenderbufferManager.lookUp(fCurrRenderbuffer); |
| 948 | renderbuffer->setNumSamples(samples); |
| 949 | } |
| 950 | |
| 951 | GrGLvoid namedRenderbufferStorage(GrGLuint renderbuffer, GrGLenum GrGLinternalformat, |
| 952 | GrGLsizei width, GrGLsizei height) override { |
| 953 | SK_ABORT("Not implemented"); |
| 954 | } |
| 955 | |
| 956 | GrGLvoid namedRenderbufferStorageMultisample(GrGLuint renderbuffer, GrGLsizei samples, |
| 957 | GrGLenum GrGLinternalformat, GrGLsizei width, |
| 958 | GrGLsizei height) override { |
| 959 | SK_ABORT("Not implemented"); |
| 960 | } |
| 961 | |
| 962 | GrGLvoid framebufferRenderbuffer(GrGLenum target, GrGLenum attachment, |
| 963 | GrGLenum renderbuffertarget, |
| 964 | GrGLuint renderBufferID) override { |
| 965 | GrGLuint id = this->getBoundFramebufferID(target); |
| 966 | GrAlwaysAssert(id); |
| 967 | Framebuffer* framebuffer = fFramebufferManager.lookUp(id); |
| 968 | |
| 969 | GrAlwaysAssert(GR_GL_RENDERBUFFER == renderbuffertarget); |
| 970 | if (!renderBufferID && !fCurrRenderbuffer) { |
| 971 | return; |
| 972 | } |
| 973 | GrAlwaysAssert(fCurrRenderbuffer); |
| 974 | Renderbuffer* renderbuffer = fRenderbufferManager.lookUp(fCurrRenderbuffer); |
| 975 | |
| 976 | framebuffer->setAttachment(attachment, renderbuffer); |
| 977 | } |
| 978 | |
| 979 | GrGLvoid namedFramebufferRenderbuffer(GrGLuint framebuffer, GrGLenum attachment, |
| 980 | GrGLenum renderbuffertarget, |
| 981 | GrGLuint renderbuffer) override { |
| 982 | SK_ABORT("Not implemented"); |
| 983 | } |
| 984 | |
| 985 | GrGLvoid genSamplers(GrGLsizei n, GrGLuint* samplers) override { |
| 986 | this->genGenericIds(n, samplers); |
| 987 | } |
| 988 | |
| 989 | GrGLvoid genTextures(GrGLsizei n, GrGLuint *textures) override { |
| 990 | this->genGenericIds(n, textures); |
| 991 | } |
| 992 | |
| 993 | GrGLvoid framebufferTexture2D(GrGLenum target, GrGLenum attachment, GrGLenum textarget, |
| 994 | GrGLuint textureID, GrGLint level) override { |
| 995 | GrGLuint id = this->getBoundFramebufferID(target); |
| 996 | GrAlwaysAssert(id); |
| 997 | Framebuffer* framebuffer = fFramebufferManager.lookUp(id); |
| 998 | framebuffer->setAttachment(attachment, this->getSingleTextureObject()); |
| 999 | } |
| 1000 | |
| 1001 | GrGLvoid framebufferTexture2DMultisample(GrGLenum target, GrGLenum attachment, |
| 1002 | GrGLenum textarget, GrGLuint texture, GrGLint level, |
| 1003 | GrGLsizei samples) override { |
| 1004 | SK_ABORT("Not implemented"); |
| 1005 | } |
| 1006 | |
| 1007 | GrGLvoid namedFramebufferTexture1D(GrGLuint framebuffer, GrGLenum attachment, |
| 1008 | GrGLenum textarget, GrGLuint texture, |
| 1009 | GrGLint level) override { |
| 1010 | SK_ABORT("Not implemented"); |
| 1011 | } |
| 1012 | |
| 1013 | GrGLvoid namedFramebufferTexture2D(GrGLuint framebuffer, GrGLenum attachment, |
| 1014 | GrGLenum textarget, GrGLuint texture, |
| 1015 | GrGLint level) override { |
| 1016 | SK_ABORT("Not implemented"); |
| 1017 | } |
| 1018 | |
| 1019 | GrGLvoid namedFramebufferTexture3D(GrGLuint framebuffer, GrGLenum attachment, |
| 1020 | GrGLenum textarget, GrGLuint texture, GrGLint level, |
| 1021 | GrGLint zoffset) override { |
| 1022 | SK_ABORT("Not implemented"); |
| 1023 | } |
| 1024 | |
| 1025 | GrGLvoid genVertexArrays(GrGLsizei n, GrGLuint *arrays) override { |
| 1026 | this->genGenericIds(n, arrays); |
| 1027 | } |
| 1028 | |
| 1029 | GrGLenum getError() override { return GR_GL_NO_ERROR; } |
| 1030 | |
| 1031 | GrGLvoid getIntegerv(GrGLenum pname, GrGLint* params) override { |
| 1032 | // TODO: remove from Ganesh the #defines for gets we don't use. |
| 1033 | // We would like to minimize gets overall due to performance issues |
| 1034 | switch (pname) { |
| 1035 | case GR_GL_CONTEXT_PROFILE_MASK: |
| 1036 | *params = GR_GL_CONTEXT_COMPATIBILITY_PROFILE_BIT; |
| 1037 | break; |
| 1038 | case GR_GL_STENCIL_BITS: |
| 1039 | *params = 8; |
| 1040 | break; |
| 1041 | case GR_GL_SAMPLES: { |
| 1042 | GrAlwaysAssert(fCurrDrawFramebuffer); |
| 1043 | Framebuffer* framebuffer = fFramebufferManager.lookUp(fCurrDrawFramebuffer); |
| 1044 | *params = framebuffer->numSamples(); |
| 1045 | break; |
| 1046 | } |
| 1047 | case GR_GL_FRAMEBUFFER_BINDING: |
| 1048 | *params = 0; |
| 1049 | break; |
| 1050 | case GR_GL_VIEWPORT: |
| 1051 | params[0] = 0; |
| 1052 | params[1] = 0; |
| 1053 | params[2] = 800; |
| 1054 | params[3] = 600; |
| 1055 | break; |
| 1056 | case GR_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: |
| 1057 | case GR_GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS: |
| 1058 | case GR_GL_MAX_TEXTURE_IMAGE_UNITS: |
| 1059 | case GR_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: |
| 1060 | *params = 8; |
| 1061 | break; |
| 1062 | case GR_GL_MAX_TEXTURE_COORDS: |
| 1063 | *params = 8; |
| 1064 | break; |
| 1065 | case GR_GL_MAX_VERTEX_UNIFORM_VECTORS: |
| 1066 | *params = kDefaultMaxVertexUniformVectors; |
| 1067 | break; |
| 1068 | case GR_GL_MAX_FRAGMENT_UNIFORM_VECTORS: |
| 1069 | *params = kDefaultMaxFragmentUniformVectors; |
| 1070 | break; |
| 1071 | case GR_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: |
| 1072 | *params = 16 * 4; |
| 1073 | break; |
| 1074 | case GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS: |
| 1075 | *params = 0; |
| 1076 | break; |
| 1077 | case GR_GL_COMPRESSED_TEXTURE_FORMATS: |
| 1078 | break; |
| 1079 | case GR_GL_MAX_TEXTURE_SIZE: |
| 1080 | *params = 8192; |
| 1081 | break; |
| 1082 | case GR_GL_MAX_RENDERBUFFER_SIZE: |
| 1083 | *params = 8192; |
| 1084 | break; |
| 1085 | case GR_GL_MAX_SAMPLES: |
| 1086 | *params = 32; |
| 1087 | break; |
| 1088 | case GR_GL_MAX_VERTEX_ATTRIBS: |
| 1089 | *params = kDefaultMaxVertexAttribs; |
| 1090 | break; |
| 1091 | case GR_GL_MAX_VARYING_VECTORS: |
| 1092 | *params = kDefaultMaxVaryingVectors; |
| 1093 | break; |
| 1094 | case GR_GL_NUM_EXTENSIONS: { |
| 1095 | GrGLint i = 0; |
| 1096 | while (fAdvertisedExtensions[i++]); |
| 1097 | *params = i; |
| 1098 | break; |
| 1099 | } |
| 1100 | default: |
| 1101 | SK_ABORT("Unexpected pname to GetIntegerv"); |
| 1102 | } |
| 1103 | } |
| 1104 | |
| 1105 | GrGLvoid getProgramiv(GrGLuint program, GrGLenum pname, GrGLint* params) override { |
| 1106 | this->getShaderOrProgramiv(program, pname, params); |
| 1107 | } |
| 1108 | |
| 1109 | GrGLvoid getProgramInfoLog(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, |
| 1110 | char* infolog) override { |
| 1111 | this->getInfoLog(program, bufsize, length, infolog); |
| 1112 | } |
| 1113 | |
| 1114 | GrGLvoid getMultisamplefv(GrGLenum pname, GrGLuint index, GrGLfloat* val) override { |
| 1115 | val[0] = val[1] = 0.5f; |
| 1116 | } |
| 1117 | |
| 1118 | GrGLvoid getQueryiv(GrGLenum GLtarget, GrGLenum pname, GrGLint *params) override { |
| 1119 | switch (pname) { |
| 1120 | case GR_GL_CURRENT_QUERY: |
| 1121 | *params = 0; |
| 1122 | break; |
| 1123 | case GR_GL_QUERY_COUNTER_BITS: |
| 1124 | *params = 32; |
| 1125 | break; |
| 1126 | default: |
| 1127 | SK_ABORT("Unexpected pname passed GetQueryiv."); |
| 1128 | } |
| 1129 | } |
| 1130 | |
| 1131 | GrGLvoid getQueryObjecti64v(GrGLuint id, GrGLenum pname, GrGLint64 *params) override { |
| 1132 | this->queryResult(id, pname, params); |
| 1133 | } |
| 1134 | |
| 1135 | GrGLvoid getQueryObjectiv(GrGLuint id, GrGLenum pname, GrGLint *params) override { |
| 1136 | this->queryResult(id, pname, params); |
| 1137 | } |
| 1138 | |
| 1139 | GrGLvoid getQueryObjectui64v(GrGLuint id, GrGLenum pname, GrGLuint64 *params) override { |
| 1140 | this->queryResult(id, pname, params); |
| 1141 | } |
| 1142 | |
| 1143 | GrGLvoid getQueryObjectuiv(GrGLuint id, GrGLenum pname, GrGLuint *params) override { |
| 1144 | this->queryResult(id, pname, params); |
| 1145 | } |
| 1146 | |
| 1147 | GrGLvoid getShaderiv(GrGLuint shader, GrGLenum pname, GrGLint* params) override { |
| 1148 | this->getShaderOrProgramiv(shader, pname, params); |
| 1149 | } |
| 1150 | |
| 1151 | GrGLvoid getShaderInfoLog(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* length, |
| 1152 | char* infolog) override { |
| 1153 | this->getInfoLog(shader, bufsize, length, infolog); |
| 1154 | } |
| 1155 | |
| 1156 | const GrGLubyte* getString(GrGLenum name) override { |
| 1157 | switch (name) { |
| 1158 | case GR_GL_EXTENSIONS: |
| 1159 | return CombinedExtensionString(); |
| 1160 | case GR_GL_VERSION: |
| 1161 | return (const GrGLubyte*)"4.0 Null GL"; |
| 1162 | case GR_GL_SHADING_LANGUAGE_VERSION: |
| 1163 | return (const GrGLubyte*)"4.20.8 Null GLSL"; |
| 1164 | case GR_GL_VENDOR: |
| 1165 | return (const GrGLubyte*)"Null Vendor"; |
| 1166 | case GR_GL_RENDERER: |
| 1167 | return (const GrGLubyte*)"The Null (Non-)Renderer"; |
| 1168 | default: |
| 1169 | SK_ABORT("Unexpected name passed to GetString"); |
| 1170 | return nullptr; |
| 1171 | } |
| 1172 | } |
| 1173 | |
| 1174 | const GrGLubyte* getStringi(GrGLenum name, GrGLuint i) override { |
| 1175 | switch (name) { |
| 1176 | case GR_GL_EXTENSIONS: { |
| 1177 | GrGLint count; |
| 1178 | this->getIntegerv(GR_GL_NUM_EXTENSIONS, &count); |
| 1179 | if ((GrGLint)i <= count) { |
| 1180 | return (const GrGLubyte*) fAdvertisedExtensions[i]; |
| 1181 | } else { |
| 1182 | return nullptr; |
| 1183 | } |
| 1184 | } |
| 1185 | default: |
| 1186 | SK_ABORT("Unexpected name passed to GetStringi"); |
| 1187 | return nullptr; |
| 1188 | } |
| 1189 | } |
| 1190 | |
| 1191 | GrGLint getUniformLocation(GrGLuint program, const char* name) override { |
| 1192 | return ++fCurrUniformLocation; |
| 1193 | } |
| 1194 | |
| 1195 | GrGLvoid* mapBufferRange(GrGLenum target, GrGLintptr offset, GrGLsizeiptr length, |
| 1196 | GrGLbitfield access) override { |
| 1197 | GrGLuint id = fBoundBuffers[GetBufferIndex(target)]; |
| 1198 | if (id > 0) { |
| 1199 | // We just ignore the offset and length here. |
| 1200 | Buffer* buffer = fBufferManager.lookUp(id); |
| 1201 | SkASSERT(!buffer->mapped()); |
| 1202 | buffer->setMapped(true); |
| 1203 | return buffer->dataPtr(); |
| 1204 | } |
| 1205 | return nullptr; |
| 1206 | } |
| 1207 | |
| 1208 | GrGLvoid* mapBuffer(GrGLenum target, GrGLenum access) override { |
| 1209 | GrGLuint id = fBoundBuffers[GetBufferIndex(target)]; |
| 1210 | if (id > 0) { |
| 1211 | Buffer* buffer = fBufferManager.lookUp(id); |
| 1212 | SkASSERT(!buffer->mapped()); |
| 1213 | buffer->setMapped(true); |
| 1214 | return buffer->dataPtr(); |
| 1215 | } |
| 1216 | |
| 1217 | SkASSERT(false); |
| 1218 | return nullptr; // no buffer bound to target |
| 1219 | } |
| 1220 | |
| 1221 | GrGLboolean unmapBuffer(GrGLenum target) override { |
| 1222 | GrGLuint id = fBoundBuffers[GetBufferIndex(target)]; |
| 1223 | if (id > 0) { |
| 1224 | Buffer* buffer = fBufferManager.lookUp(id); |
| 1225 | SkASSERT(buffer->mapped()); |
| 1226 | buffer->setMapped(false); |
| 1227 | return GR_GL_TRUE; |
| 1228 | } |
| 1229 | |
| 1230 | GrAlwaysAssert(false); |
| 1231 | return GR_GL_FALSE; // GR_GL_INVALID_OPERATION; |
| 1232 | } |
| 1233 | |
| 1234 | GrGLvoid getBufferParameteriv(GrGLenum target, GrGLenum pname, GrGLint* params) override { |
| 1235 | switch (pname) { |
| 1236 | case GR_GL_BUFFER_MAPPED: { |
| 1237 | *params = GR_GL_FALSE; |
| 1238 | GrGLuint id = fBoundBuffers[GetBufferIndex(target)]; |
| 1239 | if (id > 0) { |
| 1240 | Buffer* buffer = fBufferManager.lookUp(id); |
| 1241 | if (buffer->mapped()) { |
| 1242 | *params = GR_GL_TRUE; |
| 1243 | } |
| 1244 | } |
| 1245 | break; } |
| 1246 | default: |
| 1247 | SK_ABORT("Unexpected pname to GetBufferParamateriv"); |
| 1248 | break; |
| 1249 | } |
| 1250 | } |
| 1251 | |
| 1252 | // NV_path_rendering |
| 1253 | GrGLuint genPaths(GrGLsizei range) override { |
| 1254 | return ++fCurrPathID; |
| 1255 | } |
| 1256 | |
| 1257 | |
| 1258 | private: |
| 1259 | inline int static GetBufferIndex(GrGLenum glTarget) { |
| 1260 | switch (glTarget) { |
| 1261 | default: SK_ABORT("Unexpected GL target to GetBufferIndex"); |
| 1262 | case GR_GL_ARRAY_BUFFER: return 0; |
| 1263 | case GR_GL_ELEMENT_ARRAY_BUFFER: return 1; |
| 1264 | case GR_GL_TEXTURE_BUFFER: return 2; |
| 1265 | case GR_GL_DRAW_INDIRECT_BUFFER: return 3; |
| 1266 | case GR_GL_PIXEL_PACK_BUFFER: return 4; |
| 1267 | case GR_GL_PIXEL_UNPACK_BUFFER: return 5; |
| 1268 | } |
| 1269 | } |
| 1270 | constexpr int static kNumBufferTargets = 6; |
| 1271 | |
| 1272 | TGLObjectManager<Buffer> fBufferManager; |
| 1273 | GrGLuint fBoundBuffers[kNumBufferTargets]; |
| 1274 | TGLObjectManager<Framebuffer> fFramebufferManager; |
| 1275 | GrGLuint fCurrDrawFramebuffer; |
| 1276 | GrGLuint fCurrReadFramebuffer; |
| 1277 | TGLObjectManager<Renderbuffer> fRenderbufferManager; |
| 1278 | GrGLuint fCurrRenderbuffer; |
| 1279 | GrGLuint fCurrProgramID; |
| 1280 | GrGLuint fCurrShaderID; |
| 1281 | GrGLuint fCurrGenericID; |
| 1282 | GrGLuint fCurrUniformLocation; |
| 1283 | GrGLuint fCurrPathID; |
| 1284 | sk_sp<const Texture> fSingleTextureObject; |
| 1285 | SkTArray<const char*> fAdvertisedExtensions; |
| 1286 | |
| 1287 | // the OpenGLES 2.0 spec says this must be >= 128 |
| 1288 | static const GrGLint kDefaultMaxVertexUniformVectors = 128; |
| 1289 | |
| 1290 | // the OpenGLES 2.0 spec says this must be >=16 |
| 1291 | static const GrGLint kDefaultMaxFragmentUniformVectors = 16; |
| 1292 | |
| 1293 | // the OpenGLES 2.0 spec says this must be >= 8 |
| 1294 | static const GrGLint kDefaultMaxVertexAttribs = 8; |
| 1295 | |
| 1296 | // the OpenGLES 2.0 spec says this must be >= 8 |
| 1297 | static const GrGLint kDefaultMaxVaryingVectors = 8; |
| 1298 | |
| 1299 | GrGLuint getBoundFramebufferID(GrGLenum target) { |
| 1300 | switch (target) { |
| 1301 | case GR_GL_FRAMEBUFFER: |
| 1302 | case GR_GL_DRAW_FRAMEBUFFER: |
| 1303 | return fCurrDrawFramebuffer; |
| 1304 | case GR_GL_READ_FRAMEBUFFER: |
| 1305 | return fCurrReadFramebuffer; |
| 1306 | default: |
| 1307 | SK_ABORT("Invalid framebuffer target."); |
| 1308 | return 0; |
| 1309 | } |
| 1310 | } |
| 1311 | |
| 1312 | const Texture* getSingleTextureObject() { |
| 1313 | // We currently only use FramebufferAttachment objects for a sample count, and all textures |
| 1314 | // in Skia have one sample, so there is no need as of yet to track individual textures. This |
| 1315 | // also works around a bug in chromium's cc_unittests where they send us texture IDs that |
| 1316 | // were generated by cc::TestGLES2Interface. |
| 1317 | if (!fSingleTextureObject) { |
| 1318 | fSingleTextureObject.reset(new Texture); |
| 1319 | } |
| 1320 | return fSingleTextureObject.get(); |
| 1321 | } |
| 1322 | |
| 1323 | const GrGLubyte* CombinedExtensionString() { |
| 1324 | static SkString gExtString; |
| 1325 | static SkMutex gMutex; |
| 1326 | gMutex.acquire(); |
| 1327 | if (0 == gExtString.size()) { |
| 1328 | int i = 0; |
| 1329 | while (fAdvertisedExtensions[i]) { |
| 1330 | if (i > 0) { |
| 1331 | gExtString.append(" "); |
| 1332 | } |
| 1333 | gExtString.append(fAdvertisedExtensions[i]); |
| 1334 | ++i; |
| 1335 | } |
| 1336 | } |
| 1337 | gMutex.release(); |
| 1338 | return (const GrGLubyte*) gExtString.c_str(); |
| 1339 | } |
| 1340 | |
| 1341 | GrGLvoid genGenericIds(GrGLsizei n, GrGLuint* ids) { |
| 1342 | for (int i = 0; i < n; ++i) { |
| 1343 | ids[i] = ++fCurrGenericID; |
| 1344 | } |
| 1345 | } |
| 1346 | |
| 1347 | GrGLvoid getInfoLog(GrGLuint object, GrGLsizei bufsize, GrGLsizei* length, |
| 1348 | char* infolog) { |
| 1349 | if (length) { |
| 1350 | *length = 0; |
| 1351 | } |
| 1352 | if (bufsize > 0) { |
| 1353 | *infolog = 0; |
| 1354 | } |
| 1355 | } |
| 1356 | |
| 1357 | GrGLvoid getShaderOrProgramiv(GrGLuint object, GrGLenum pname, GrGLint* params) { |
| 1358 | switch (pname) { |
| 1359 | case GR_GL_LINK_STATUS: // fallthru |
| 1360 | case GR_GL_COMPILE_STATUS: |
| 1361 | *params = GR_GL_TRUE; |
| 1362 | break; |
| 1363 | case GR_GL_INFO_LOG_LENGTH: // fallthru |
| 1364 | case GL_PROGRAM_BINARY_LENGTH: |
| 1365 | *params = 0; |
| 1366 | break; |
| 1367 | // we don't expect any other pnames |
| 1368 | default: |
| 1369 | SK_ABORT("Unexpected pname to GetProgramiv"); |
| 1370 | break; |
| 1371 | } |
| 1372 | } |
| 1373 | |
| 1374 | template <typename T> |
| 1375 | void queryResult(GrGLenum GLtarget, GrGLenum pname, T *params) { |
| 1376 | switch (pname) { |
| 1377 | case GR_GL_QUERY_RESULT_AVAILABLE: |
| 1378 | *params = GR_GL_TRUE; |
| 1379 | break; |
| 1380 | case GR_GL_QUERY_RESULT: |
| 1381 | *params = 0; |
| 1382 | break; |
| 1383 | default: |
| 1384 | SK_ABORT("Unexpected pname passed to GetQueryObject."); |
| 1385 | break; |
| 1386 | } |
| 1387 | } |
| 1388 | |
Brian Osman | eae47f4 | 2019-04-09 13:02:22 -0400 | [diff] [blame] | 1389 | typedef TestInterface INHERITED; |
Brian Osman | 8e874bb | 2019-04-08 12:24:46 -0400 | [diff] [blame] | 1390 | }; |
| 1391 | |
| 1392 | } // anonymous namespace |
| 1393 | |
| 1394 | namespace android { |
| 1395 | namespace uirenderer { |
| 1396 | namespace debug { |
| 1397 | |
| 1398 | const GrGLInterface* CreateNullSkiaInterface() { return new NullInterface(false); } |
| 1399 | |
| 1400 | } // namespace debug |
| 1401 | } // namespace uirenderer |
| 1402 | } // namespace android |