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 #include "SkTLS.h" | 13 #include "SkTLS.h" |
14 | 14 |
15 // TODO: Delete this file after chrome starts using SkNullGLContext. | |
16 | |
17 // added to suppress 'no previous prototype' warning and because this code is du plicated in | |
bsalomon
2015/02/11 20:01:27
Not entirely sure this is necessary but seemed saf
| |
18 // SkNullGLContext.cpp | |
19 namespace { | |
20 | |
15 class BufferObj { | 21 class BufferObj { |
16 public: | 22 public: |
17 SK_DECLARE_INST_COUNT(BufferObj); | 23 SK_DECLARE_INST_COUNT(BufferObj); |
18 | 24 |
19 BufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) { | 25 BufferObj(GrGLuint id) : fID(id), fDataPtr(NULL), fSize(0), fMapped(false) { |
20 } | 26 } |
21 ~BufferObj() { SkDELETE_ARRAY(fDataPtr); } | 27 ~BufferObj() { SkDELETE_ARRAY(fDataPtr); } |
22 | 28 |
23 void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) { | 29 void allocate(GrGLsizeiptr size, const GrGLchar* dataPtr) { |
24 if (fDataPtr) { | 30 if (fDataPtr) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 , fCurrProgramID(0) | 140 , fCurrProgramID(0) |
135 , fCurrShaderID(0) {} | 141 , fCurrShaderID(0) {} |
136 | 142 |
137 private: | 143 private: |
138 static void* Create() { return SkNEW(ThreadContext ); } | 144 static void* Create() { return SkNEW(ThreadContext ); } |
139 static void Delete(void* context) { SkDELETE(reinterpret_cast<ThreadContext *>(context)); } | 145 static void Delete(void* context) { SkDELETE(reinterpret_cast<ThreadContext *>(context)); } |
140 }; | 146 }; |
141 | 147 |
142 // Functions not declared in GrGLBogusInterface.h (not common with the Debug GL interface). | 148 // Functions not declared in GrGLBogusInterface.h (not common with the Debug GL interface). |
143 | 149 |
144 namespace { // added to suppress 'no previous prototype' warning | |
145 | |
146 GrGLvoid GR_GL_FUNCTION_TYPE nullGLActiveTexture(GrGLenum texture) {} | 150 GrGLvoid GR_GL_FUNCTION_TYPE nullGLActiveTexture(GrGLenum texture) {} |
147 GrGLvoid GR_GL_FUNCTION_TYPE nullGLAttachShader(GrGLuint program, GrGLuint shade r) {} | 151 GrGLvoid GR_GL_FUNCTION_TYPE nullGLAttachShader(GrGLuint program, GrGLuint shade r) {} |
148 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBeginQuery(GrGLenum target, GrGLuint id) {} | 152 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBeginQuery(GrGLenum target, GrGLuint id) {} |
149 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindAttribLocation(GrGLuint program, GrGLuint index, const char* name) {} | 153 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindAttribLocation(GrGLuint program, GrGLuint index, const char* name) {} |
150 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindTexture(GrGLenum target, GrGLuint texture ) {} | 154 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindTexture(GrGLenum target, GrGLuint texture ) {} |
151 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindVertexArray(GrGLuint id) {} | 155 GrGLvoid GR_GL_FUNCTION_TYPE nullGLBindVertexArray(GrGLuint id) {} |
152 | 156 |
153 GrGLvoid GR_GL_FUNCTION_TYPE nullGLGenBuffers(GrGLsizei n, GrGLuint* ids) { | 157 GrGLvoid GR_GL_FUNCTION_TYPE nullGLGenBuffers(GrGLsizei n, GrGLuint* ids) { |
154 ThreadContext* ctx = ThreadContext::Get(); | 158 ThreadContext* ctx = ThreadContext::Get(); |
155 for (int i = 0; i < n; ++i) { | 159 for (int i = 0; i < n; ++i) { |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 functions->fBlitFramebuffer = noOpGLBlitFramebuffer; | 480 functions->fBlitFramebuffer = noOpGLBlitFramebuffer; |
477 functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuf fer; | 481 functions->fResolveMultisampleFramebuffer = noOpGLResolveMultisampleFramebuf fer; |
478 functions->fMatrixLoadf = noOpGLMatrixLoadf; | 482 functions->fMatrixLoadf = noOpGLMatrixLoadf; |
479 functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity; | 483 functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity; |
480 functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed; | 484 functions->fBindFragDataLocationIndexed = noOpGLBindFragDataLocationIndexed; |
481 | 485 |
482 interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functio ns->fGetStringi, | 486 interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functio ns->fGetStringi, |
483 functions->fGetIntegerv); | 487 functions->fGetIntegerv); |
484 return interface; | 488 return interface; |
485 } | 489 } |
OLD | NEW |