OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "gl/GrGLExtensions.h" | 9 #include "gl/GrGLExtensions.h" |
10 #include "gl/GrGLInterface.h" | 10 #include "gl/GrGLInterface.h" |
11 #include "../GrGLUtil.h" | 11 #include "../GrGLUtil.h" |
12 | 12 |
13 #define GL_GLEXT_PROTOTYPES | 13 #define GL_GLEXT_PROTOTYPES |
14 #include "osmesa_wrapper.h" | 14 #include "osmesa_wrapper.h" |
15 | 15 |
16 #define GR_GL_GET_PROC(F) interface->f ## F = (GrGL ## F ## Proc) \ | 16 #define GR_GL_GET_PROC(F) interface->fFunctions.f ## F = (GrGL ## F ## Proc) \ |
17 OSMesaGetProcAddress("gl" #F); | 17 OSMesaGetProcAddress("gl" #F); |
18 #define GR_GL_GET_PROC_SUFFIX(F, S) interface->f ## F = (GrGL ## F ## Proc) \ | 18 #define GR_GL_GET_PROC_SUFFIX(F, S) interface->fFunctions.f ## F = (GrGL ## F ##
Proc) \ |
19 OSMesaGetProcAddress("gl" #F #S); | 19 OSMesaGetProcAddress("gl" #F #S); |
20 | 20 |
21 // We use OSMesaGetProcAddress for every gl function to avoid accidentally using | 21 // We use OSMesaGetProcAddress for every gl function to avoid accidentally using |
22 // non-Mesa gl functions. | 22 // non-Mesa gl functions. |
23 | 23 |
24 const GrGLInterface* GrGLCreateMesaInterface() { | 24 const GrGLInterface* GrGLCreateMesaInterface() { |
25 if (NULL != OSMesaGetCurrentContext()) { | 25 if (NULL != OSMesaGetCurrentContext()) { |
26 | 26 |
27 GrGLGetStringProc getString = (GrGLGetStringProc) OSMesaGetProcAddress("
glGetString"); | 27 GrGLGetStringProc getString = (GrGLGetStringProc) OSMesaGetProcAddress("
glGetString"); |
28 GrGLGetStringiProc getStringi = (GrGLGetStringiProc) OSMesaGetProcAddres
s("glGetStringi"); | 28 GrGLGetStringiProc getStringi = (GrGLGetStringiProc) OSMesaGetProcAddres
s("glGetStringi"); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 GR_GL_GET_PROC(StencilMaskSeparate); | 134 GR_GL_GET_PROC(StencilMaskSeparate); |
135 GR_GL_GET_PROC(StencilOp); | 135 GR_GL_GET_PROC(StencilOp); |
136 GR_GL_GET_PROC(StencilOpSeparate); | 136 GR_GL_GET_PROC(StencilOpSeparate); |
137 GR_GL_GET_PROC(TexGenf); | 137 GR_GL_GET_PROC(TexGenf); |
138 GR_GL_GET_PROC(TexGenfv); | 138 GR_GL_GET_PROC(TexGenfv); |
139 GR_GL_GET_PROC(TexGeni); | 139 GR_GL_GET_PROC(TexGeni); |
140 GR_GL_GET_PROC(TexImage2D) | 140 GR_GL_GET_PROC(TexImage2D) |
141 GR_GL_GET_PROC(TexParameteri); | 141 GR_GL_GET_PROC(TexParameteri); |
142 GR_GL_GET_PROC(TexParameteriv); | 142 GR_GL_GET_PROC(TexParameteriv); |
143 GR_GL_GET_PROC(TexStorage2D); | 143 GR_GL_GET_PROC(TexStorage2D); |
144 if (NULL == interface->fTexStorage2D) { | 144 if (NULL == interface->fFunctions.fTexStorage2D) { |
145 GR_GL_GET_PROC_SUFFIX(TexStorage2D, EXT); | 145 GR_GL_GET_PROC_SUFFIX(TexStorage2D, EXT); |
146 } | 146 } |
147 GR_GL_GET_PROC(TexSubImage2D); | 147 GR_GL_GET_PROC(TexSubImage2D); |
148 GR_GL_GET_PROC(Uniform1f); | 148 GR_GL_GET_PROC(Uniform1f); |
149 GR_GL_GET_PROC(Uniform1i); | 149 GR_GL_GET_PROC(Uniform1i); |
150 GR_GL_GET_PROC(Uniform1fv); | 150 GR_GL_GET_PROC(Uniform1fv); |
151 GR_GL_GET_PROC(Uniform1iv); | 151 GR_GL_GET_PROC(Uniform1iv); |
152 GR_GL_GET_PROC(Uniform2f); | 152 GR_GL_GET_PROC(Uniform2f); |
153 GR_GL_GET_PROC(Uniform2i); | 153 GR_GL_GET_PROC(Uniform2i); |
154 GR_GL_GET_PROC(Uniform2fv); | 154 GR_GL_GET_PROC(Uniform2fv); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 GR_GL_GET_PROC(BindFragDataLocationIndexed); | 222 GR_GL_GET_PROC(BindFragDataLocationIndexed); |
223 | 223 |
224 interface->fStandard = kGL_GrGLStandard; | 224 interface->fStandard = kGL_GrGLStandard; |
225 interface->fExtensions.swap(&extensions); | 225 interface->fExtensions.swap(&extensions); |
226 | 226 |
227 return interface; | 227 return interface; |
228 } else { | 228 } else { |
229 return NULL; | 229 return NULL; |
230 } | 230 } |
231 } | 231 } |
OLD | NEW |