OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" | 5 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" |
6 | 6 |
7 #ifndef GL_GLEXT_PROTOTYPES | 7 #ifndef GL_GLEXT_PROTOTYPES |
8 #define GL_GLEXT_PROTOTYPES | 8 #define GL_GLEXT_PROTOTYPES |
9 #endif | 9 #endif |
10 #include "gpu/GLES2/gl2extchromium.h" | 10 #include "gpu/GLES2/gl2extchromium.h" |
11 #include "third_party/khronos/GLES2/gl2.h" | 11 #include "third_party/khronos/GLES2/gl2.h" |
12 #include "third_party/khronos/GLES2/gl2ext.h" | 12 #include "third_party/khronos/GLES2/gl2ext.h" |
13 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" | 13 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
14 | 14 |
| 15 namespace { |
| 16 // Conversion functions from NV_path_rendering to CHROMIUM_path_rendering. |
| 17 // Coord type is not part of CHROMIUM_path_rendering, so DCHECK it to be |
| 18 // GL_FLOAT. Cover mode is not part of the extension either, but it's only |
| 19 // a perf flag, not a correctness flag. It can not be DCHECKed, as |
| 20 // GL_BOUNDING_BOX_NV is not a token in Chromium GL (in which this code is |
| 21 // compiled). |
| 22 GrGLvoid callPathCommandsCHROMIUM(GrGLuint path, |
| 23 GrGLsizei num_commands, |
| 24 const GrGLubyte* commands, |
| 25 GrGLsizei num_coords, |
| 26 GrGLenum coords_type, |
| 27 const void* coords) { |
| 28 DCHECK(coords_type == GL_FLOAT); |
| 29 glPathCommandsCHROMIUM(path, |
| 30 num_commands, |
| 31 commands, |
| 32 num_coords, |
| 33 static_cast<const GLfloat*>(coords)); |
| 34 } |
| 35 |
| 36 GrGLvoid callCoverFillPathCHROMIUM(GrGLuint path, GrGLenum /*cover_mode*/) { |
| 37 glCoverFillPathCHROMIUM(path); |
| 38 } |
| 39 |
| 40 GrGLvoid callCoverStrokePathCHROMIUM(GrGLuint path, GrGLenum /*cover_mode*/) { |
| 41 glCoverStrokePathCHROMIUM(path); |
| 42 } |
| 43 |
| 44 GrGLvoid callStencilThenCoverFillPathCHROMIUM(GrGLuint path, |
| 45 GrGLenum fill_mode, |
| 46 GrGLuint mask, |
| 47 GrGLenum /*cover_mode*/) { |
| 48 glStencilThenCoverFillPathCHROMIUM(path, fill_mode, mask); |
| 49 } |
| 50 |
| 51 GrGLvoid callStencilThenCoverStrokePathCHROMIUM(GrGLuint path, |
| 52 GrGLint reference, |
| 53 GrGLuint mask, |
| 54 GrGLenum /*cover_mode*/) { |
| 55 glStencilThenCoverStrokePathCHROMIUM(path, reference, mask); |
| 56 } |
| 57 |
| 58 } // anonymous namespace |
| 59 |
15 namespace skia_bindings { | 60 namespace skia_bindings { |
16 | 61 |
17 GrGLInterface* CreateCommandBufferSkiaGLBinding() { | 62 GrGLInterface* CreateCommandBufferSkiaGLBinding() { |
18 GrGLInterface* interface = new GrGLInterface; | 63 GrGLInterface* interface = new GrGLInterface; |
19 interface->fStandard = kGLES_GrGLStandard; | 64 interface->fStandard = kGLES_GrGLStandard; |
20 interface->fExtensions.init(kGLES_GrGLStandard, | 65 interface->fExtensions.init(kGLES_GrGLStandard, |
21 glGetString, | 66 glGetString, |
22 NULL, | 67 NULL, |
23 glGetIntegerv); | 68 glGetIntegerv); |
24 | 69 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 glGetFramebufferAttachmentParameteriv; | 179 glGetFramebufferAttachmentParameteriv; |
135 functions->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv; | 180 functions->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv; |
136 functions->fRenderbufferStorage = glRenderbufferStorage; | 181 functions->fRenderbufferStorage = glRenderbufferStorage; |
137 functions->fRenderbufferStorageMultisample = | 182 functions->fRenderbufferStorageMultisample = |
138 glRenderbufferStorageMultisampleCHROMIUM; | 183 glRenderbufferStorageMultisampleCHROMIUM; |
139 functions->fRenderbufferStorageMultisampleES2EXT = | 184 functions->fRenderbufferStorageMultisampleES2EXT = |
140 glRenderbufferStorageMultisampleEXT; | 185 glRenderbufferStorageMultisampleEXT; |
141 functions->fBindUniformLocation = glBindUniformLocationCHROMIUM; | 186 functions->fBindUniformLocation = glBindUniformLocationCHROMIUM; |
142 functions->fBlitFramebuffer = glBlitFramebufferCHROMIUM; | 187 functions->fBlitFramebuffer = glBlitFramebufferCHROMIUM; |
143 functions->fGenerateMipmap = glGenerateMipmap; | 188 functions->fGenerateMipmap = glGenerateMipmap; |
144 functions->fMatrixLoadf = glMatrixLoadfCHROMIUM; | 189 if (false) { |
145 functions->fMatrixLoadIdentity = glMatrixLoadIdentityCHROMIUM; | 190 // These are disabled until the full extension is implemented. |
| 191 // Otherwise the interface fails validation and the context can not |
| 192 // be created. |
| 193 functions->fMatrixLoadf = glMatrixLoadfCHROMIUM; |
| 194 functions->fMatrixLoadIdentity = glMatrixLoadIdentityCHROMIUM; |
| 195 functions->fPathCommands = callPathCommandsCHROMIUM; |
| 196 functions->fPathParameteri = glPathParameteriCHROMIUM; |
| 197 functions->fPathParameterf = glPathParameterfCHROMIUM; |
| 198 functions->fGenPaths = glGenPathsCHROMIUM; |
| 199 functions->fDeletePaths = glDeletePathsCHROMIUM; |
| 200 functions->fPathStencilFunc = glPathStencilFuncCHROMIUM; |
| 201 functions->fStencilFillPath = glStencilFillPathCHROMIUM; |
| 202 functions->fStencilStrokePath = glStencilStrokePathCHROMIUM; |
| 203 functions->fCoverFillPath = callCoverFillPathCHROMIUM; |
| 204 functions->fCoverStrokePath = callCoverStrokePathCHROMIUM; |
| 205 functions->fStencilThenCoverFillPath = callStencilThenCoverFillPathCHROMIUM; |
| 206 functions->fStencilThenCoverStrokePath = |
| 207 callStencilThenCoverStrokePathCHROMIUM; |
| 208 } |
146 | 209 |
147 return interface; | 210 return interface; |
148 } | 211 } |
149 | 212 |
150 } // namespace skia | 213 } // namespace skia |
OLD | NEW |