| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "gl/GrGLInterface.h" | 9 #include "gl/GrGLInterface.h" |
| 10 #include "GrGLDefines.h" | 10 #include "GrGLDefines.h" |
| 11 #include "SkTDArray.h" | 11 #include "SkTDArray.h" |
| 12 #include "GrGLNoOpInterface.h" | 12 #include "GrGLNoOpInterface.h" |
| 13 | 13 |
| 14 // Functions not declared in GrGLBogusInterface.h (not common with the Debug GL
interface). | 14 // Functions not declared in GrGLBogusInterface.h (not common with the Debug GL
interface). |
| 15 | 15 |
| 16 namespace { // added to suppress 'no previous prototype' warning | 16 namespace { // added to suppress 'no previous prototype' warning |
| 17 | 17 |
| 18 GrGLvoid GR_GL_FUNCTION_TYPE nullGLActiveTexture(GrGLenum texture) {} | 18 GrGLvoid GR_GL_FUNCTION_TYPE nullGLActiveTexture(GrGLenum texture) {} |
| 19 GrGLvoid GR_GL_FUNCTION_TYPE nullGLAttachShader(GrGLuint program, GrGLuint shade
r) {} | 19 GrGLvoid GR_GL_FUNCTION_TYPE nullGLAttachShader(GrGLuint program, GrGLuint shade
r) {} |
| 20 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBeginQuery(GrGLenum target, GrGLuint id) {} | 20 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBeginQuery(GrGLenum target, GrGLuint id) {} |
| 21 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindAttribLocation(GrGLuint program, GrGLuint
index, const char* name) {} | 21 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindAttribLocation(GrGLuint program, GrGLuint
index, const char* name) {} |
| 22 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindTexture(GrGLenum target, GrGLuint texture
) {} | 22 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindTexture(GrGLenum target, GrGLuint texture
) {} |
| 23 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindVertexArray(GrGLuint id) {} |
| 23 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBufferData(GrGLenum target, GrGLsizeiptr size
, const GrGLvoid* data, GrGLenum usage) {} | 24 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBufferData(GrGLenum target, GrGLsizeiptr size
, const GrGLvoid* data, GrGLenum usage) {} |
| 24 GrGLvoid GR_GL_FUNCTION_TYPE nullGLPixelStorei(GrGLenum pname, GrGLint param) {} | 25 GrGLvoid GR_GL_FUNCTION_TYPE nullGLPixelStorei(GrGLenum pname, GrGLint param) {} |
| 25 GrGLvoid GR_GL_FUNCTION_TYPE nullGLReadPixels(GrGLint x, GrGLint y, GrGLsizei wi
dth, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels) {} | 26 GrGLvoid GR_GL_FUNCTION_TYPE nullGLReadPixels(GrGLint x, GrGLint y, GrGLsizei wi
dth, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels) {} |
| 26 GrGLvoid GR_GL_FUNCTION_TYPE nullGLUseProgram(GrGLuint program) {} | 27 GrGLvoid GR_GL_FUNCTION_TYPE nullGLUseProgram(GrGLuint program) {} |
| 27 GrGLvoid GR_GL_FUNCTION_TYPE nullGLViewport(GrGLint x, GrGLint y, GrGLsizei widt
h, GrGLsizei height) {} | 28 GrGLvoid GR_GL_FUNCTION_TYPE nullGLViewport(GrGLint x, GrGLint y, GrGLsizei widt
h, GrGLsizei height) {} |
| 28 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindFramebuffer(GrGLenum target, GrGLuint fra
mebuffer) {} | 29 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindFramebuffer(GrGLenum target, GrGLuint fra
mebuffer) {} |
| 29 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindRenderbuffer(GrGLenum target, GrGLuint re
nderbuffer) {} | 30 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindRenderbuffer(GrGLenum target, GrGLuint re
nderbuffer) {} |
| 30 GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteFramebuffers(GrGLsizei n, const GrGLuin
t *framebuffers) {} | 31 GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteFramebuffers(GrGLsizei n, const GrGLuin
t *framebuffers) {} |
| 31 GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteRenderbuffers(GrGLsizei n, const GrGLui
nt *renderbuffers) {} | 32 GrGLvoid GR_GL_FUNCTION_TYPE nullGLDeleteRenderbuffers(GrGLsizei n, const GrGLui
nt *renderbuffers) {} |
| 32 GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferRenderbuffer(GrGLenum target, GrGL
enum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer) {} | 33 GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferRenderbuffer(GrGLenum target, GrGL
enum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer) {} |
| 33 GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferTexture2D(GrGLenum target, GrGLenu
m attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {} | 34 GrGLvoid GR_GL_FUNCTION_TYPE nullGLFramebufferTexture2D(GrGLenum target, GrGLenu
m attachment, GrGLenum textarget, GrGLuint texture, GrGLint level) {} |
| 34 | 35 |
| 35 GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateProgram() { | 36 GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateProgram() { |
| 36 static int gCurrID = 0; | 37 static int gCurrID = 0; |
| 37 return ++gCurrID; | 38 return ++gCurrID; |
| 38 } | 39 } |
| 39 | 40 |
| 40 GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateShader(GrGLenum type) { | 41 GrGLuint GR_GL_FUNCTION_TYPE nullGLCreateShader(GrGLenum type) { |
| 41 static int gCurrID = 0; | 42 static int gCurrID = 0; |
| 42 return ++gCurrID; | 43 return ++gCurrID; |
| 43 } | 44 } |
| 44 | 45 |
| 45 // same delete used for shaders and programs | 46 // same delete used for shaders and programs |
| 46 GrGLvoid GR_GL_FUNCTION_TYPE nullGLDelete(GrGLuint program) { | 47 GrGLvoid GR_GL_FUNCTION_TYPE nullGLDelete(GrGLuint program) { |
| 47 } | 48 } |
| 48 | 49 |
| 49 | |
| 50 // In debug builds we do asserts that ensure we agree with GL about when a buffe
r | 50 // In debug builds we do asserts that ensure we agree with GL about when a buffe
r |
| 51 // is mapped. | 51 // is mapped. |
| 52 static SkTDArray<GrGLuint> gMappedBuffers; | 52 static SkTDArray<GrGLuint> gMappedBuffers; |
| 53 static GrGLuint gCurrArrayBuffer; | 53 static GrGLuint gCurrArrayBuffer; |
| 54 static GrGLuint gCurrElementArrayBuffer; | 54 static GrGLuint gCurrElementArrayBuffer; |
| 55 | 55 |
| 56 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindBuffer(GrGLenum target, GrGLuint buffer)
{ | 56 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindBuffer(GrGLenum target, GrGLuint buffer)
{ |
| 57 switch (target) { | 57 switch (target) { |
| 58 case GR_GL_ARRAY_BUFFER: | 58 case GR_GL_ARRAY_BUFFER: |
| 59 gCurrArrayBuffer = buffer; | 59 gCurrArrayBuffer = buffer; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 GrGLInterface* interface = SkNEW(GrGLInterface); | 161 GrGLInterface* interface = SkNEW(GrGLInterface); |
| 162 glInterface.reset(interface); | 162 glInterface.reset(interface); |
| 163 interface->fBindingsExported = kDesktop_GrGLBinding; | 163 interface->fBindingsExported = kDesktop_GrGLBinding; |
| 164 interface->fActiveTexture = nullGLActiveTexture; | 164 interface->fActiveTexture = nullGLActiveTexture; |
| 165 interface->fAttachShader = nullGLAttachShader; | 165 interface->fAttachShader = nullGLAttachShader; |
| 166 interface->fBeginQuery = nullGLBeginQuery; | 166 interface->fBeginQuery = nullGLBeginQuery; |
| 167 interface->fBindAttribLocation = nullGLBindAttribLocation; | 167 interface->fBindAttribLocation = nullGLBindAttribLocation; |
| 168 interface->fBindBuffer = nullGLBindBuffer; | 168 interface->fBindBuffer = nullGLBindBuffer; |
| 169 interface->fBindFragDataLocation = noOpGLBindFragDataLocation; | 169 interface->fBindFragDataLocation = noOpGLBindFragDataLocation; |
| 170 interface->fBindTexture = nullGLBindTexture; | 170 interface->fBindTexture = nullGLBindTexture; |
| 171 interface->fBindVertexArray = nullGLBindVertexArray; |
| 171 interface->fBlendColor = noOpGLBlendColor; | 172 interface->fBlendColor = noOpGLBlendColor; |
| 172 interface->fBlendFunc = noOpGLBlendFunc; | 173 interface->fBlendFunc = noOpGLBlendFunc; |
| 173 interface->fBufferData = nullGLBufferData; | 174 interface->fBufferData = nullGLBufferData; |
| 174 interface->fBufferSubData = noOpGLBufferSubData; | 175 interface->fBufferSubData = noOpGLBufferSubData; |
| 175 interface->fClear = noOpGLClear; | 176 interface->fClear = noOpGLClear; |
| 176 interface->fClearColor = noOpGLClearColor; | 177 interface->fClearColor = noOpGLClearColor; |
| 177 interface->fClearStencil = noOpGLClearStencil; | 178 interface->fClearStencil = noOpGLClearStencil; |
| 178 interface->fColorMask = noOpGLColorMask; | 179 interface->fColorMask = noOpGLColorMask; |
| 179 interface->fCompileShader = noOpGLCompileShader; | 180 interface->fCompileShader = noOpGLCompileShader; |
| 180 interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D; | 181 interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D; |
| 181 interface->fCreateProgram = nullGLCreateProgram; | 182 interface->fCreateProgram = nullGLCreateProgram; |
| 182 interface->fCreateShader = nullGLCreateShader; | 183 interface->fCreateShader = nullGLCreateShader; |
| 183 interface->fCullFace = noOpGLCullFace; | 184 interface->fCullFace = noOpGLCullFace; |
| 184 interface->fDeleteBuffers = nullGLDeleteBuffers; | 185 interface->fDeleteBuffers = nullGLDeleteBuffers; |
| 185 interface->fDeleteProgram = nullGLDelete; | 186 interface->fDeleteProgram = nullGLDelete; |
| 186 interface->fDeleteQueries = noOpGLDeleteIds; | 187 interface->fDeleteQueries = noOpGLDeleteIds; |
| 187 interface->fDeleteShader = nullGLDelete; | 188 interface->fDeleteShader = nullGLDelete; |
| 188 interface->fDeleteTextures = noOpGLDeleteIds; | 189 interface->fDeleteTextures = noOpGLDeleteIds; |
| 190 interface->fDeleteVertexArrays = noOpGLDeleteIds; |
| 189 interface->fDepthMask = noOpGLDepthMask; | 191 interface->fDepthMask = noOpGLDepthMask; |
| 190 interface->fDisable = noOpGLDisable; | 192 interface->fDisable = noOpGLDisable; |
| 191 interface->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; | 193 interface->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; |
| 192 interface->fDrawArrays = noOpGLDrawArrays; | 194 interface->fDrawArrays = noOpGLDrawArrays; |
| 193 interface->fDrawBuffer = noOpGLDrawBuffer; | 195 interface->fDrawBuffer = noOpGLDrawBuffer; |
| 194 interface->fDrawBuffers = noOpGLDrawBuffers; | 196 interface->fDrawBuffers = noOpGLDrawBuffers; |
| 195 interface->fDrawElements = noOpGLDrawElements; | 197 interface->fDrawElements = noOpGLDrawElements; |
| 196 interface->fEnable = noOpGLEnable; | 198 interface->fEnable = noOpGLEnable; |
| 197 interface->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; | 199 interface->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; |
| 198 interface->fEndQuery = noOpGLEndQuery; | 200 interface->fEndQuery = noOpGLEndQuery; |
| 199 interface->fFinish = noOpGLFinish; | 201 interface->fFinish = noOpGLFinish; |
| 200 interface->fFlush = noOpGLFlush; | 202 interface->fFlush = noOpGLFlush; |
| 201 interface->fFrontFace = noOpGLFrontFace; | 203 interface->fFrontFace = noOpGLFrontFace; |
| 202 interface->fGenBuffers = noOpGLGenIds; | 204 interface->fGenBuffers = noOpGLGenIds; |
| 203 interface->fGenQueries = noOpGLGenIds; | 205 interface->fGenQueries = noOpGLGenIds; |
| 204 interface->fGenTextures = noOpGLGenIds; | 206 interface->fGenTextures = noOpGLGenIds; |
| 207 interface->fGenVertexArrays = noOpGLGenIds; |
| 205 interface->fGetBufferParameteriv = nullGLGetBufferParameteriv; | 208 interface->fGetBufferParameteriv = nullGLGetBufferParameteriv; |
| 206 interface->fGetError = noOpGLGetError; | 209 interface->fGetError = noOpGLGetError; |
| 207 interface->fGetIntegerv = noOpGLGetIntegerv; | 210 interface->fGetIntegerv = noOpGLGetIntegerv; |
| 208 interface->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; | 211 interface->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; |
| 209 interface->fGetQueryObjectiv = noOpGLGetQueryObjectiv; | 212 interface->fGetQueryObjectiv = noOpGLGetQueryObjectiv; |
| 210 interface->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; | 213 interface->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; |
| 211 interface->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; | 214 interface->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; |
| 212 interface->fGetQueryiv = noOpGLGetQueryiv; | 215 interface->fGetQueryiv = noOpGLGetQueryiv; |
| 213 interface->fGetProgramInfoLog = noOpGLGetInfoLog; | 216 interface->fGetProgramInfoLog = noOpGLGetInfoLog; |
| 214 interface->fGetProgramiv = noOpGLGetShaderOrProgramiv; | 217 interface->fGetProgramiv = noOpGLGetShaderOrProgramiv; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 interface->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMu
ltisample; | 278 interface->fRenderbufferStorageMultisample = noOpGLRenderbufferStorageMu
ltisample; |
| 276 interface->fBlitFramebuffer = noOpGLBlitFramebuffer; | 279 interface->fBlitFramebuffer = noOpGLBlitFramebuffer; |
| 277 interface->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFram
ebuffer; | 280 interface->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFram
ebuffer; |
| 278 interface->fMapBuffer = nullGLMapBuffer; | 281 interface->fMapBuffer = nullGLMapBuffer; |
| 279 interface->fUnmapBuffer = nullGLUnmapBuffer; | 282 interface->fUnmapBuffer = nullGLUnmapBuffer; |
| 280 interface->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationInde
xed; | 283 interface->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationInde
xed; |
| 281 } | 284 } |
| 282 glInterface.get()->ref(); | 285 glInterface.get()->ref(); |
| 283 return glInterface.get(); | 286 return glInterface.get(); |
| 284 } | 287 } |
| OLD | NEW |