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 | 9 |
10 #include "gl/GrGLInterface.h" | 10 #include "gl/GrGLInterface.h" |
11 #include "../GrGLUtil.h" | 11 #include "../GrGLUtil.h" |
12 | 12 |
13 #include <GL/glx.h> | 13 #include <GL/glx.h> |
14 #include <GL/gl.h> | 14 #include <GL/gl.h> |
15 #include <GL/glext.h> | 15 #include <GL/glext.h> |
16 #include <GL/glu.h> | 16 #include <GL/glu.h> |
17 | 17 |
18 #define GR_GL_GET_PROC(F) interface->fFunctions.f ## F = (GrGL ## F ## Proc) \ | 18 #define GR_GL_GET_PROC(F) interface->fFunctions.f ## F = (GrGL ## F ## Proc) \ |
19 glXGetProcAddress(reinterpret_cast<const GLubyte*>("gl" #F)); | 19 glXGetProcAddress(reinterpret_cast<const GLubyte*>("gl" #F)); |
20 #define GR_GL_GET_PROC_SUFFIX(F, S) interface->fFunctions.f ## F = (GrGL ## F ##
Proc) \ | 20 #define GR_GL_GET_PROC_SUFFIX(F, S) interface->fFunctions.f ## F = (GrGL ## F ##
Proc) \ |
21 glXGetProcAddress(reinterpret_cast<const GLubyte*>("gl" #F #S)); | 21 glXGetProcAddress(reinterpret_cast<const GLubyte*>("gl" #F #S)); |
22 | 22 |
23 const GrGLInterface* GrGLCreateNativeInterface() { | 23 const GrGLInterface* GrGLCreateNativeInterface() { |
24 if (NULL != glXGetCurrentContext()) { | 24 if (NULL == glXGetCurrentContext()) { |
25 | 25 return NULL; |
26 const char* versionString = (const char*) glGetString(GL_VERSION); | 26 } |
27 GrGLVersion glVer = GrGLGetVersionFromString(versionString); | 27 |
28 | 28 const char* versionString = (const char*) glGetString(GL_VERSION); |
29 // This may or may not succeed depending on the gl version. | 29 GrGLVersion glVer = GrGLGetVersionFromString(versionString); |
30 GrGLGetStringiProc glGetStringi = | 30 |
31 (GrGLGetStringiProc) glXGetProcAddress(reinterpret_cast<const GLubyt
e*>("glGetStringi")); | 31 // This may or may not succeed depending on the gl version. |
32 | 32 GrGLGetStringiProc glGetStringi = |
33 GrGLExtensions extensions; | 33 (GrGLGetStringiProc) glXGetProcAddress(reinterpret_cast<const GLubyte*>(
"glGetStringi")); |
34 if (!extensions.init(kGL_GrGLStandard, glGetString, glGetStringi, glGetI
ntegerv)) { | 34 |
35 return NULL; | 35 GrGLExtensions extensions; |
| 36 if (!extensions.init(kGL_GrGLStandard, glGetString, glGetStringi, glGetInteg
erv)) { |
| 37 return NULL; |
| 38 } |
| 39 |
| 40 if (glVer < GR_GL_VER(1,5)) { |
| 41 // We must have array and element_array buffer objects. |
| 42 return NULL; |
| 43 } |
| 44 |
| 45 GrGLInterface* interface = SkNEW(GrGLInterface()); |
| 46 GrGLInterface::Functions* functions = &interface->fFunctions; |
| 47 |
| 48 functions->fActiveTexture = glActiveTexture; |
| 49 GR_GL_GET_PROC(AttachShader); |
| 50 GR_GL_GET_PROC(BindAttribLocation); |
| 51 GR_GL_GET_PROC(BindBuffer); |
| 52 GR_GL_GET_PROC(BindFragDataLocation); |
| 53 GR_GL_GET_PROC(BeginQuery); |
| 54 functions->fBindTexture = glBindTexture; |
| 55 functions->fBlendFunc = glBlendFunc; |
| 56 |
| 57 if (glVer >= GR_GL_VER(1,4) || |
| 58 extensions.has("GL_ARB_imaging") || |
| 59 extensions.has("GL_EXT_blend_color")) { |
| 60 GR_GL_GET_PROC(BlendColor); |
| 61 } |
| 62 |
| 63 GR_GL_GET_PROC(BufferData); |
| 64 GR_GL_GET_PROC(BufferSubData); |
| 65 functions->fClear = glClear; |
| 66 functions->fClearColor = glClearColor; |
| 67 functions->fClearStencil = glClearStencil; |
| 68 functions->fColorMask = glColorMask; |
| 69 GR_GL_GET_PROC(CompileShader); |
| 70 functions->fCompressedTexImage2D = glCompressedTexImage2D; |
| 71 functions->fCopyTexSubImage2D = glCopyTexSubImage2D; |
| 72 GR_GL_GET_PROC(CreateProgram); |
| 73 GR_GL_GET_PROC(CreateShader); |
| 74 functions->fCullFace = glCullFace; |
| 75 GR_GL_GET_PROC(DeleteBuffers); |
| 76 GR_GL_GET_PROC(DeleteProgram); |
| 77 GR_GL_GET_PROC(DeleteQueries); |
| 78 GR_GL_GET_PROC(DeleteShader); |
| 79 functions->fDeleteTextures = glDeleteTextures; |
| 80 functions->fDepthMask = glDepthMask; |
| 81 functions->fDisable = glDisable; |
| 82 GR_GL_GET_PROC(DisableVertexAttribArray); |
| 83 functions->fDrawArrays = glDrawArrays; |
| 84 functions->fDrawBuffer = glDrawBuffer; |
| 85 GR_GL_GET_PROC(DrawBuffers); |
| 86 functions->fDrawElements = glDrawElements; |
| 87 functions->fEnable = glEnable; |
| 88 GR_GL_GET_PROC(EnableVertexAttribArray); |
| 89 GR_GL_GET_PROC(EndQuery); |
| 90 functions->fFinish = glFinish; |
| 91 functions->fFlush = glFlush; |
| 92 functions->fFrontFace = glFrontFace; |
| 93 GR_GL_GET_PROC(GenBuffers); |
| 94 GR_GL_GET_PROC(GenerateMipmap); |
| 95 GR_GL_GET_PROC(GetBufferParameteriv); |
| 96 functions->fGetError = glGetError; |
| 97 functions->fGetIntegerv = glGetIntegerv; |
| 98 GR_GL_GET_PROC(GetQueryObjectiv); |
| 99 GR_GL_GET_PROC(GetQueryObjectuiv); |
| 100 if (glVer >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) { |
| 101 GR_GL_GET_PROC(GetQueryObjecti64v); |
| 102 GR_GL_GET_PROC(GetQueryObjectui64v); |
| 103 GR_GL_GET_PROC(QueryCounter); |
| 104 } else if (extensions.has("GL_EXT_timer_query")) { |
| 105 GR_GL_GET_PROC_SUFFIX(GetQueryObjecti64v, EXT); |
| 106 GR_GL_GET_PROC_SUFFIX(GetQueryObjectui64v, EXT); |
| 107 } |
| 108 GR_GL_GET_PROC(GetQueryiv); |
| 109 GR_GL_GET_PROC(GetProgramInfoLog); |
| 110 GR_GL_GET_PROC(GetProgramiv); |
| 111 GR_GL_GET_PROC(GetShaderInfoLog); |
| 112 GR_GL_GET_PROC(GetShaderiv); |
| 113 functions->fGetString = glGetString; |
| 114 GR_GL_GET_PROC(GetStringi); |
| 115 functions->fGetTexLevelParameteriv = glGetTexLevelParameteriv; |
| 116 GR_GL_GET_PROC(GenQueries); |
| 117 functions->fGenTextures = glGenTextures; |
| 118 GR_GL_GET_PROC(GetUniformLocation); |
| 119 functions->fLineWidth = glLineWidth; |
| 120 GR_GL_GET_PROC(LinkProgram); |
| 121 GR_GL_GET_PROC(MapBuffer); |
| 122 functions->fPixelStorei = glPixelStorei; |
| 123 functions->fReadBuffer = glReadBuffer; |
| 124 functions->fReadPixels = glReadPixels; |
| 125 functions->fScissor = glScissor; |
| 126 GR_GL_GET_PROC(ShaderSource); |
| 127 functions->fStencilFunc = glStencilFunc; |
| 128 GR_GL_GET_PROC(StencilFuncSeparate); |
| 129 functions->fStencilMask = glStencilMask; |
| 130 GR_GL_GET_PROC(StencilMaskSeparate); |
| 131 functions->fStencilOp = glStencilOp; |
| 132 GR_GL_GET_PROC(StencilOpSeparate); |
| 133 functions->fTexImage2D = glTexImage2D; |
| 134 functions->fTexGenfv = glTexGenfv; |
| 135 functions->fTexGeni = glTexGeni; |
| 136 functions->fTexParameteri = glTexParameteri; |
| 137 functions->fTexParameteriv = glTexParameteriv; |
| 138 if (glVer >= GR_GL_VER(4,2) || extensions.has("GL_ARB_texture_storage")) { |
| 139 GR_GL_GET_PROC(TexStorage2D); |
| 140 } else if (extensions.has("GL_EXT_texture_storage")) { |
| 141 GR_GL_GET_PROC_SUFFIX(TexStorage2D, EXT); |
| 142 } |
| 143 functions->fTexSubImage2D = glTexSubImage2D; |
| 144 GR_GL_GET_PROC(Uniform1f); |
| 145 GR_GL_GET_PROC(Uniform1i); |
| 146 GR_GL_GET_PROC(Uniform1fv); |
| 147 GR_GL_GET_PROC(Uniform1iv); |
| 148 GR_GL_GET_PROC(Uniform2f); |
| 149 GR_GL_GET_PROC(Uniform2i); |
| 150 GR_GL_GET_PROC(Uniform2fv); |
| 151 GR_GL_GET_PROC(Uniform2iv); |
| 152 GR_GL_GET_PROC(Uniform3f); |
| 153 GR_GL_GET_PROC(Uniform3i); |
| 154 GR_GL_GET_PROC(Uniform3fv); |
| 155 GR_GL_GET_PROC(Uniform3iv); |
| 156 GR_GL_GET_PROC(Uniform4f); |
| 157 GR_GL_GET_PROC(Uniform4i); |
| 158 GR_GL_GET_PROC(Uniform4fv); |
| 159 GR_GL_GET_PROC(Uniform4iv); |
| 160 GR_GL_GET_PROC(UniformMatrix2fv); |
| 161 GR_GL_GET_PROC(UniformMatrix3fv); |
| 162 GR_GL_GET_PROC(UniformMatrix4fv); |
| 163 GR_GL_GET_PROC(UnmapBuffer); |
| 164 GR_GL_GET_PROC(UseProgram); |
| 165 GR_GL_GET_PROC(VertexAttrib4fv); |
| 166 GR_GL_GET_PROC(VertexAttribPointer); |
| 167 functions->fViewport = glViewport; |
| 168 GR_GL_GET_PROC(BindFragDataLocationIndexed); |
| 169 |
| 170 if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_vertex_array_object"))
{ |
| 171 // no ARB suffix for GL_ARB_vertex_array_object |
| 172 GR_GL_GET_PROC(BindVertexArray); |
| 173 GR_GL_GET_PROC(GenVertexArrays); |
| 174 GR_GL_GET_PROC(DeleteVertexArrays); |
| 175 } |
| 176 |
| 177 // First look for GL3.0 FBO or GL_ARB_framebuffer_object (same since |
| 178 // GL_ARB_framebuffer_object doesn't use ARB suffix.) |
| 179 if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_framebuffer_object"))
{ |
| 180 GR_GL_GET_PROC(GenFramebuffers); |
| 181 GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv); |
| 182 GR_GL_GET_PROC(GetRenderbufferParameteriv); |
| 183 GR_GL_GET_PROC(BindFramebuffer); |
| 184 GR_GL_GET_PROC(FramebufferTexture2D); |
| 185 GR_GL_GET_PROC(CheckFramebufferStatus); |
| 186 GR_GL_GET_PROC(DeleteFramebuffers); |
| 187 GR_GL_GET_PROC(RenderbufferStorage); |
| 188 GR_GL_GET_PROC(GenRenderbuffers); |
| 189 GR_GL_GET_PROC(DeleteRenderbuffers); |
| 190 GR_GL_GET_PROC(FramebufferRenderbuffer); |
| 191 GR_GL_GET_PROC(BindRenderbuffer); |
| 192 GR_GL_GET_PROC(RenderbufferStorageMultisample); |
| 193 GR_GL_GET_PROC(BlitFramebuffer); |
| 194 } else if (extensions.has("GL_EXT_framebuffer_object")) { |
| 195 GR_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT); |
| 196 GR_GL_GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT); |
| 197 GR_GL_GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT); |
| 198 GR_GL_GET_PROC_SUFFIX(BindFramebuffer, EXT); |
| 199 GR_GL_GET_PROC_SUFFIX(FramebufferTexture2D, EXT); |
| 200 GR_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT); |
| 201 GR_GL_GET_PROC_SUFFIX(DeleteFramebuffers, EXT); |
| 202 GR_GL_GET_PROC_SUFFIX(RenderbufferStorage, EXT); |
| 203 GR_GL_GET_PROC_SUFFIX(GenRenderbuffers, EXT); |
| 204 GR_GL_GET_PROC_SUFFIX(DeleteRenderbuffers, EXT); |
| 205 GR_GL_GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT); |
| 206 GR_GL_GET_PROC_SUFFIX(BindRenderbuffer, EXT); |
| 207 if (extensions.has("GL_EXT_framebuffer_multisample")) { |
| 208 GR_GL_GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT); |
36 } | 209 } |
37 | 210 if (extensions.has("GL_EXT_framebuffer_blit")) { |
38 if (glVer < GR_GL_VER(1,5)) { | 211 GR_GL_GET_PROC_SUFFIX(BlitFramebuffer, EXT); |
39 // We must have array and element_array buffer objects. | |
40 return NULL; | |
41 } | 212 } |
42 | |
43 GrGLInterface* interface = SkNEW(GrGLInterface()); | |
44 GrGLInterface::Functions* functions = &interface->fFunctions; | |
45 | |
46 functions->fActiveTexture = glActiveTexture; | |
47 GR_GL_GET_PROC(AttachShader); | |
48 GR_GL_GET_PROC(BindAttribLocation); | |
49 GR_GL_GET_PROC(BindBuffer); | |
50 GR_GL_GET_PROC(BindFragDataLocation); | |
51 GR_GL_GET_PROC(BeginQuery); | |
52 functions->fBindTexture = glBindTexture; | |
53 functions->fBlendFunc = glBlendFunc; | |
54 | |
55 if (glVer >= GR_GL_VER(1,4) || | |
56 extensions.has("GL_ARB_imaging") || | |
57 extensions.has("GL_EXT_blend_color")) { | |
58 GR_GL_GET_PROC(BlendColor); | |
59 } | |
60 | |
61 GR_GL_GET_PROC(BufferData); | |
62 GR_GL_GET_PROC(BufferSubData); | |
63 functions->fClear = glClear; | |
64 functions->fClearColor = glClearColor; | |
65 functions->fClearStencil = glClearStencil; | |
66 functions->fColorMask = glColorMask; | |
67 GR_GL_GET_PROC(CompileShader); | |
68 functions->fCompressedTexImage2D = glCompressedTexImage2D; | |
69 functions->fCopyTexSubImage2D = glCopyTexSubImage2D; | |
70 GR_GL_GET_PROC(CreateProgram); | |
71 GR_GL_GET_PROC(CreateShader); | |
72 functions->fCullFace = glCullFace; | |
73 GR_GL_GET_PROC(DeleteBuffers); | |
74 GR_GL_GET_PROC(DeleteProgram); | |
75 GR_GL_GET_PROC(DeleteQueries); | |
76 GR_GL_GET_PROC(DeleteShader); | |
77 functions->fDeleteTextures = glDeleteTextures; | |
78 functions->fDepthMask = glDepthMask; | |
79 functions->fDisable = glDisable; | |
80 GR_GL_GET_PROC(DisableVertexAttribArray); | |
81 functions->fDrawArrays = glDrawArrays; | |
82 functions->fDrawBuffer = glDrawBuffer; | |
83 GR_GL_GET_PROC(DrawBuffers); | |
84 functions->fDrawElements = glDrawElements; | |
85 functions->fEnable = glEnable; | |
86 GR_GL_GET_PROC(EnableVertexAttribArray); | |
87 GR_GL_GET_PROC(EndQuery); | |
88 functions->fFinish = glFinish; | |
89 functions->fFlush = glFlush; | |
90 functions->fFrontFace = glFrontFace; | |
91 GR_GL_GET_PROC(GenBuffers); | |
92 GR_GL_GET_PROC(GenerateMipmap); | |
93 GR_GL_GET_PROC(GetBufferParameteriv); | |
94 functions->fGetError = glGetError; | |
95 functions->fGetIntegerv = glGetIntegerv; | |
96 GR_GL_GET_PROC(GetQueryObjectiv); | |
97 GR_GL_GET_PROC(GetQueryObjectuiv); | |
98 if (glVer >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) { | |
99 GR_GL_GET_PROC(GetQueryObjecti64v); | |
100 GR_GL_GET_PROC(GetQueryObjectui64v); | |
101 GR_GL_GET_PROC(QueryCounter); | |
102 } else if (extensions.has("GL_EXT_timer_query")) { | |
103 GR_GL_GET_PROC_SUFFIX(GetQueryObjecti64v, EXT); | |
104 GR_GL_GET_PROC_SUFFIX(GetQueryObjectui64v, EXT); | |
105 } | |
106 GR_GL_GET_PROC(GetQueryiv); | |
107 GR_GL_GET_PROC(GetProgramInfoLog); | |
108 GR_GL_GET_PROC(GetProgramiv); | |
109 GR_GL_GET_PROC(GetShaderInfoLog); | |
110 GR_GL_GET_PROC(GetShaderiv); | |
111 functions->fGetString = glGetString; | |
112 GR_GL_GET_PROC(GetStringi); | |
113 functions->fGetTexLevelParameteriv = glGetTexLevelParameteriv; | |
114 GR_GL_GET_PROC(GenQueries); | |
115 functions->fGenTextures = glGenTextures; | |
116 GR_GL_GET_PROC(GetUniformLocation); | |
117 functions->fLineWidth = glLineWidth; | |
118 GR_GL_GET_PROC(LinkProgram); | |
119 GR_GL_GET_PROC(MapBuffer); | |
120 functions->fPixelStorei = glPixelStorei; | |
121 functions->fReadBuffer = glReadBuffer; | |
122 functions->fReadPixels = glReadPixels; | |
123 functions->fScissor = glScissor; | |
124 GR_GL_GET_PROC(ShaderSource); | |
125 functions->fStencilFunc = glStencilFunc; | |
126 GR_GL_GET_PROC(StencilFuncSeparate); | |
127 functions->fStencilMask = glStencilMask; | |
128 GR_GL_GET_PROC(StencilMaskSeparate); | |
129 functions->fStencilOp = glStencilOp; | |
130 GR_GL_GET_PROC(StencilOpSeparate); | |
131 functions->fTexImage2D = glTexImage2D; | |
132 functions->fTexGenfv = glTexGenfv; | |
133 functions->fTexGeni = glTexGeni; | |
134 functions->fTexParameteri = glTexParameteri; | |
135 functions->fTexParameteriv = glTexParameteriv; | |
136 if (glVer >= GR_GL_VER(4,2) || extensions.has("GL_ARB_texture_storage"))
{ | |
137 GR_GL_GET_PROC(TexStorage2D); | |
138 } else if (extensions.has("GL_EXT_texture_storage")) { | |
139 GR_GL_GET_PROC_SUFFIX(TexStorage2D, EXT); | |
140 } | |
141 functions->fTexSubImage2D = glTexSubImage2D; | |
142 GR_GL_GET_PROC(Uniform1f); | |
143 GR_GL_GET_PROC(Uniform1i); | |
144 GR_GL_GET_PROC(Uniform1fv); | |
145 GR_GL_GET_PROC(Uniform1iv); | |
146 GR_GL_GET_PROC(Uniform2f); | |
147 GR_GL_GET_PROC(Uniform2i); | |
148 GR_GL_GET_PROC(Uniform2fv); | |
149 GR_GL_GET_PROC(Uniform2iv); | |
150 GR_GL_GET_PROC(Uniform3f); | |
151 GR_GL_GET_PROC(Uniform3i); | |
152 GR_GL_GET_PROC(Uniform3fv); | |
153 GR_GL_GET_PROC(Uniform3iv); | |
154 GR_GL_GET_PROC(Uniform4f); | |
155 GR_GL_GET_PROC(Uniform4i); | |
156 GR_GL_GET_PROC(Uniform4fv); | |
157 GR_GL_GET_PROC(Uniform4iv); | |
158 GR_GL_GET_PROC(UniformMatrix2fv); | |
159 GR_GL_GET_PROC(UniformMatrix3fv); | |
160 GR_GL_GET_PROC(UniformMatrix4fv); | |
161 GR_GL_GET_PROC(UnmapBuffer); | |
162 GR_GL_GET_PROC(UseProgram); | |
163 GR_GL_GET_PROC(VertexAttrib4fv); | |
164 GR_GL_GET_PROC(VertexAttribPointer); | |
165 functions->fViewport = glViewport; | |
166 GR_GL_GET_PROC(BindFragDataLocationIndexed); | |
167 | |
168 if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_vertex_array_objec
t")) { | |
169 // no ARB suffix for GL_ARB_vertex_array_object | |
170 GR_GL_GET_PROC(BindVertexArray); | |
171 GR_GL_GET_PROC(GenVertexArrays); | |
172 GR_GL_GET_PROC(DeleteVertexArrays); | |
173 } | |
174 | |
175 // First look for GL3.0 FBO or GL_ARB_framebuffer_object (same since | |
176 // GL_ARB_framebuffer_object doesn't use ARB suffix.) | |
177 if (glVer >= GR_GL_VER(3,0) || extensions.has("GL_ARB_framebuffer_object
")) { | |
178 GR_GL_GET_PROC(GenFramebuffers); | |
179 GR_GL_GET_PROC(GetFramebufferAttachmentParameteriv); | |
180 GR_GL_GET_PROC(GetRenderbufferParameteriv); | |
181 GR_GL_GET_PROC(BindFramebuffer); | |
182 GR_GL_GET_PROC(FramebufferTexture2D); | |
183 GR_GL_GET_PROC(CheckFramebufferStatus); | |
184 GR_GL_GET_PROC(DeleteFramebuffers); | |
185 GR_GL_GET_PROC(RenderbufferStorage); | |
186 GR_GL_GET_PROC(GenRenderbuffers); | |
187 GR_GL_GET_PROC(DeleteRenderbuffers); | |
188 GR_GL_GET_PROC(FramebufferRenderbuffer); | |
189 GR_GL_GET_PROC(BindRenderbuffer); | |
190 GR_GL_GET_PROC(RenderbufferStorageMultisample); | |
191 GR_GL_GET_PROC(BlitFramebuffer); | |
192 } else if (extensions.has("GL_EXT_framebuffer_object")) { | |
193 GR_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT); | |
194 GR_GL_GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT); | |
195 GR_GL_GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT); | |
196 GR_GL_GET_PROC_SUFFIX(BindFramebuffer, EXT); | |
197 GR_GL_GET_PROC_SUFFIX(FramebufferTexture2D, EXT); | |
198 GR_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT); | |
199 GR_GL_GET_PROC_SUFFIX(DeleteFramebuffers, EXT); | |
200 GR_GL_GET_PROC_SUFFIX(RenderbufferStorage, EXT); | |
201 GR_GL_GET_PROC_SUFFIX(GenRenderbuffers, EXT); | |
202 GR_GL_GET_PROC_SUFFIX(DeleteRenderbuffers, EXT); | |
203 GR_GL_GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT); | |
204 GR_GL_GET_PROC_SUFFIX(BindRenderbuffer, EXT); | |
205 if (extensions.has("GL_EXT_framebuffer_multisample")) { | |
206 GR_GL_GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT); | |
207 } | |
208 if (extensions.has("GL_EXT_framebuffer_blit")) { | |
209 GR_GL_GET_PROC_SUFFIX(BlitFramebuffer, EXT); | |
210 } | |
211 } else { | |
212 // we must have FBOs | |
213 delete interface; | |
214 return NULL; | |
215 } | |
216 | |
217 GR_GL_GET_PROC(LoadIdentity); | |
218 GR_GL_GET_PROC(LoadMatrixf); | |
219 GR_GL_GET_PROC(MatrixMode); | |
220 | |
221 if (extensions.has("GL_NV_path_rendering")) { | |
222 GR_GL_GET_PROC_SUFFIX(PathCommands, NV); | |
223 GR_GL_GET_PROC_SUFFIX(PathCoords, NV); | |
224 GR_GL_GET_PROC_SUFFIX(PathSubCommands, NV); | |
225 GR_GL_GET_PROC_SUFFIX(PathSubCoords, NV); | |
226 GR_GL_GET_PROC_SUFFIX(PathString, NV); | |
227 GR_GL_GET_PROC_SUFFIX(PathGlyphs, NV); | |
228 GR_GL_GET_PROC_SUFFIX(PathGlyphRange, NV); | |
229 GR_GL_GET_PROC_SUFFIX(WeightPaths, NV); | |
230 GR_GL_GET_PROC_SUFFIX(CopyPath, NV); | |
231 GR_GL_GET_PROC_SUFFIX(InterpolatePaths, NV); | |
232 GR_GL_GET_PROC_SUFFIX(TransformPath, NV); | |
233 GR_GL_GET_PROC_SUFFIX(PathParameteriv, NV); | |
234 GR_GL_GET_PROC_SUFFIX(PathParameteri, NV); | |
235 GR_GL_GET_PROC_SUFFIX(PathParameterfv, NV); | |
236 GR_GL_GET_PROC_SUFFIX(PathParameterf, NV); | |
237 GR_GL_GET_PROC_SUFFIX(PathDashArray, NV); | |
238 GR_GL_GET_PROC_SUFFIX(GenPaths, NV); | |
239 GR_GL_GET_PROC_SUFFIX(DeletePaths, NV); | |
240 GR_GL_GET_PROC_SUFFIX(IsPath, NV); | |
241 GR_GL_GET_PROC_SUFFIX(PathStencilFunc, NV); | |
242 GR_GL_GET_PROC_SUFFIX(PathStencilDepthOffset, NV); | |
243 GR_GL_GET_PROC_SUFFIX(StencilFillPath, NV); | |
244 GR_GL_GET_PROC_SUFFIX(StencilStrokePath, NV); | |
245 GR_GL_GET_PROC_SUFFIX(StencilFillPathInstanced, NV); | |
246 GR_GL_GET_PROC_SUFFIX(StencilStrokePathInstanced, NV); | |
247 GR_GL_GET_PROC_SUFFIX(PathCoverDepthFunc, NV); | |
248 GR_GL_GET_PROC_SUFFIX(PathColorGen, NV); | |
249 GR_GL_GET_PROC_SUFFIX(PathTexGen, NV); | |
250 GR_GL_GET_PROC_SUFFIX(PathFogGen, NV); | |
251 GR_GL_GET_PROC_SUFFIX(CoverFillPath, NV); | |
252 GR_GL_GET_PROC_SUFFIX(CoverStrokePath, NV); | |
253 GR_GL_GET_PROC_SUFFIX(CoverFillPathInstanced, NV); | |
254 GR_GL_GET_PROC_SUFFIX(CoverStrokePathInstanced, NV); | |
255 GR_GL_GET_PROC_SUFFIX(GetPathParameteriv, NV); | |
256 GR_GL_GET_PROC_SUFFIX(GetPathParameterfv, NV); | |
257 GR_GL_GET_PROC_SUFFIX(GetPathCommands, NV); | |
258 GR_GL_GET_PROC_SUFFIX(GetPathCoords, NV); | |
259 GR_GL_GET_PROC_SUFFIX(GetPathDashArray, NV); | |
260 GR_GL_GET_PROC_SUFFIX(GetPathMetrics, NV); | |
261 GR_GL_GET_PROC_SUFFIX(GetPathMetricRange, NV); | |
262 GR_GL_GET_PROC_SUFFIX(GetPathSpacing, NV); | |
263 GR_GL_GET_PROC_SUFFIX(GetPathColorGeniv, NV); | |
264 GR_GL_GET_PROC_SUFFIX(GetPathColorGenfv, NV); | |
265 GR_GL_GET_PROC_SUFFIX(GetPathTexGeniv, NV); | |
266 GR_GL_GET_PROC_SUFFIX(GetPathTexGenfv, NV); | |
267 GR_GL_GET_PROC_SUFFIX(IsPointInFillPath, NV); | |
268 GR_GL_GET_PROC_SUFFIX(IsPointInStrokePath, NV); | |
269 GR_GL_GET_PROC_SUFFIX(GetPathLength, NV); | |
270 GR_GL_GET_PROC_SUFFIX(PointAlongPath, NV); | |
271 } | |
272 | |
273 if (extensions.has("GL_EXT_debug_marker")) { | |
274 GR_GL_GET_PROC_SUFFIX(InsertEventMarker, EXT); | |
275 GR_GL_GET_PROC_SUFFIX(PushGroupMarker, EXT); | |
276 GR_GL_GET_PROC_SUFFIX(PopGroupMarker, EXT); | |
277 } | |
278 | |
279 interface->fStandard = kGL_GrGLStandard; | |
280 interface->fExtensions.swap(&extensions); | |
281 | |
282 return interface; | |
283 } else { | 213 } else { |
284 return NULL; | 214 // we must have FBOs |
285 } | 215 delete interface; |
| 216 return NULL; |
| 217 } |
| 218 |
| 219 GR_GL_GET_PROC(LoadIdentity); |
| 220 GR_GL_GET_PROC(LoadMatrixf); |
| 221 GR_GL_GET_PROC(MatrixMode); |
| 222 |
| 223 if (extensions.has("GL_NV_path_rendering")) { |
| 224 GR_GL_GET_PROC_SUFFIX(PathCommands, NV); |
| 225 GR_GL_GET_PROC_SUFFIX(PathCoords, NV); |
| 226 GR_GL_GET_PROC_SUFFIX(PathSubCommands, NV); |
| 227 GR_GL_GET_PROC_SUFFIX(PathSubCoords, NV); |
| 228 GR_GL_GET_PROC_SUFFIX(PathString, NV); |
| 229 GR_GL_GET_PROC_SUFFIX(PathGlyphs, NV); |
| 230 GR_GL_GET_PROC_SUFFIX(PathGlyphRange, NV); |
| 231 GR_GL_GET_PROC_SUFFIX(WeightPaths, NV); |
| 232 GR_GL_GET_PROC_SUFFIX(CopyPath, NV); |
| 233 GR_GL_GET_PROC_SUFFIX(InterpolatePaths, NV); |
| 234 GR_GL_GET_PROC_SUFFIX(TransformPath, NV); |
| 235 GR_GL_GET_PROC_SUFFIX(PathParameteriv, NV); |
| 236 GR_GL_GET_PROC_SUFFIX(PathParameteri, NV); |
| 237 GR_GL_GET_PROC_SUFFIX(PathParameterfv, NV); |
| 238 GR_GL_GET_PROC_SUFFIX(PathParameterf, NV); |
| 239 GR_GL_GET_PROC_SUFFIX(PathDashArray, NV); |
| 240 GR_GL_GET_PROC_SUFFIX(GenPaths, NV); |
| 241 GR_GL_GET_PROC_SUFFIX(DeletePaths, NV); |
| 242 GR_GL_GET_PROC_SUFFIX(IsPath, NV); |
| 243 GR_GL_GET_PROC_SUFFIX(PathStencilFunc, NV); |
| 244 GR_GL_GET_PROC_SUFFIX(PathStencilDepthOffset, NV); |
| 245 GR_GL_GET_PROC_SUFFIX(StencilFillPath, NV); |
| 246 GR_GL_GET_PROC_SUFFIX(StencilStrokePath, NV); |
| 247 GR_GL_GET_PROC_SUFFIX(StencilFillPathInstanced, NV); |
| 248 GR_GL_GET_PROC_SUFFIX(StencilStrokePathInstanced, NV); |
| 249 GR_GL_GET_PROC_SUFFIX(PathCoverDepthFunc, NV); |
| 250 GR_GL_GET_PROC_SUFFIX(PathColorGen, NV); |
| 251 GR_GL_GET_PROC_SUFFIX(PathTexGen, NV); |
| 252 GR_GL_GET_PROC_SUFFIX(PathFogGen, NV); |
| 253 GR_GL_GET_PROC_SUFFIX(CoverFillPath, NV); |
| 254 GR_GL_GET_PROC_SUFFIX(CoverStrokePath, NV); |
| 255 GR_GL_GET_PROC_SUFFIX(CoverFillPathInstanced, NV); |
| 256 GR_GL_GET_PROC_SUFFIX(CoverStrokePathInstanced, NV); |
| 257 GR_GL_GET_PROC_SUFFIX(GetPathParameteriv, NV); |
| 258 GR_GL_GET_PROC_SUFFIX(GetPathParameterfv, NV); |
| 259 GR_GL_GET_PROC_SUFFIX(GetPathCommands, NV); |
| 260 GR_GL_GET_PROC_SUFFIX(GetPathCoords, NV); |
| 261 GR_GL_GET_PROC_SUFFIX(GetPathDashArray, NV); |
| 262 GR_GL_GET_PROC_SUFFIX(GetPathMetrics, NV); |
| 263 GR_GL_GET_PROC_SUFFIX(GetPathMetricRange, NV); |
| 264 GR_GL_GET_PROC_SUFFIX(GetPathSpacing, NV); |
| 265 GR_GL_GET_PROC_SUFFIX(GetPathColorGeniv, NV); |
| 266 GR_GL_GET_PROC_SUFFIX(GetPathColorGenfv, NV); |
| 267 GR_GL_GET_PROC_SUFFIX(GetPathTexGeniv, NV); |
| 268 GR_GL_GET_PROC_SUFFIX(GetPathTexGenfv, NV); |
| 269 GR_GL_GET_PROC_SUFFIX(IsPointInFillPath, NV); |
| 270 GR_GL_GET_PROC_SUFFIX(IsPointInStrokePath, NV); |
| 271 GR_GL_GET_PROC_SUFFIX(GetPathLength, NV); |
| 272 GR_GL_GET_PROC_SUFFIX(PointAlongPath, NV); |
| 273 } |
| 274 |
| 275 if (extensions.has("GL_EXT_debug_marker")) { |
| 276 GR_GL_GET_PROC_SUFFIX(InsertEventMarker, EXT); |
| 277 GR_GL_GET_PROC_SUFFIX(PushGroupMarker, EXT); |
| 278 GR_GL_GET_PROC_SUFFIX(PopGroupMarker, EXT); |
| 279 } |
| 280 |
| 281 interface->fStandard = kGL_GrGLStandard; |
| 282 interface->fExtensions.swap(&extensions); |
| 283 |
| 284 return interface; |
286 } | 285 } |
OLD | NEW |