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 "gl/GrGLExtensions.h" | 11 #include "gl/GrGLExtensions.h" |
12 #include "../GrGLUtil.h" | 12 #include "../GrGLUtil.h" |
13 | 13 |
14 #include <OpenGL/gl.h> | |
15 #include <OpenGL/glext.h> | |
16 | |
17 #include <dlfcn.h> | 14 #include <dlfcn.h> |
18 | 15 |
| 16 // We get the proc addresss of all GL functions dynamically because we sometimes
link against |
| 17 // alternative GL implementations (e.g. MESA) in addition to the native GL imple
mentation. |
| 18 class GLLoader { |
| 19 public: |
| 20 GLLoader() { |
| 21 fLibrary = dlopen( |
| 22 "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libr
aries/libGL.dylib", |
| 23 RTLD_LAZY); |
| 24 } |
| 25 ~GLLoader() { |
| 26 if (NULL != fLibrary) { |
| 27 dlclose(fLibrary); |
| 28 } |
| 29 } |
| 30 void* handle() { |
| 31 return NULL == fLibrary ? RTLD_DEFAULT : fLibrary; |
| 32 } |
| 33 private: |
| 34 void* fLibrary; |
| 35 }; |
| 36 |
19 static void* GetProcAddress(const char* name) { | 37 static void* GetProcAddress(const char* name) { |
20 return dlsym(RTLD_DEFAULT, name); | 38 static GLLoader gLoader; |
| 39 return dlsym(gLoader.handle(), name); |
21 } | 40 } |
22 | 41 |
23 #define GET_PROC(name) (interface->f ## name = ((GrGL ## name ## Proc) GetProcAd
dress("gl" #name))) | 42 #define GET_PROC(name) (interface->f ## name = ((GrGL ## name ## Proc) GetProcAd
dress("gl" #name))) |
24 #define GET_PROC_SUFFIX(name, suffix) (interface->f ## name = ((GrGL ## name ##
Proc) GetProcAddress("gl" #name #suffix))) | 43 #define GET_PROC_SUFFIX(name, suffix) (interface->f ## name = ((GrGL ## name ##
Proc) GetProcAddress("gl" #name #suffix))) |
25 | 44 |
26 const GrGLInterface* GrGLCreateNativeInterface() { | 45 const GrGLInterface* GrGLCreateNativeInterface() { |
27 // The gl functions are not context-specific so we create one global | 46 // The gl functions are not context-specific so we create one global interfa
ce |
28 // interface | |
29 static SkAutoTUnref<GrGLInterface> glInterface; | 47 static SkAutoTUnref<GrGLInterface> glInterface; |
30 if (!glInterface.get()) { | 48 if (!glInterface.get()) { |
31 GrGLInterface* interface = new GrGLInterface; | 49 GrGLInterface* interface = new GrGLInterface; |
| 50 |
| 51 GrGLGetStringProc glGetString = (GrGLGetStringProc) GetProcAddress("glGe
tString"); |
| 52 GrGLGetStringiProc glGetStringi = (GrGLGetStringiProc) GetProcAddress("g
lGetStringi"); |
| 53 GrGLGetIntegervProc glGetIntegerv = (GrGLGetIntegervProc) GetProcAddress
("glGetIntegerv"); |
| 54 |
32 glInterface.reset(interface); | 55 glInterface.reset(interface); |
33 const char* verStr = (const char*) glGetString(GL_VERSION); | 56 const char* verStr = (const char*) glGetString(GR_GL_VERSION); |
34 GrGLVersion ver = GrGLGetVersionFromString(verStr); | 57 GrGLVersion ver = GrGLGetVersionFromString(verStr); |
35 GrGLExtensions extensions; | 58 GrGLExtensions extensions; |
36 GrGLGetStringiProc glGetStringi = (GrGLGetStringiProc) GetProcAddress("g
lGetStringi"); | |
37 if (!extensions.init(kDesktop_GrGLBinding, glGetString, glGetStringi, gl
GetIntegerv)) { | 59 if (!extensions.init(kDesktop_GrGLBinding, glGetString, glGetStringi, gl
GetIntegerv)) { |
38 glInterface.reset(NULL); | 60 glInterface.reset(NULL); |
39 return NULL; | 61 return NULL; |
40 } | 62 } |
41 interface->fBindingsExported = kDesktop_GrGLBinding; | 63 interface->fBindingsExported = kDesktop_GrGLBinding; |
42 interface->fActiveTexture = glActiveTexture; | 64 |
43 interface->fAttachShader = glAttachShader; | 65 GET_PROC(ActiveTexture); |
44 interface->fBeginQuery = glBeginQuery; | 66 GET_PROC(AttachShader); |
45 interface->fBindAttribLocation = glBindAttribLocation; | 67 GET_PROC(BeginQuery); |
46 interface->fBindBuffer = glBindBuffer; | 68 GET_PROC(BindAttribLocation); |
| 69 GET_PROC(BindBuffer); |
47 if (ver >= GR_GL_VER(3,0)) { | 70 if (ver >= GR_GL_VER(3,0)) { |
48 #if GL_VERSION_3_0 | |
49 interface->fBindFragDataLocation = glBindFragDataLocation; | |
50 #else | |
51 GET_PROC(BindFragDataLocation); | 71 GET_PROC(BindFragDataLocation); |
52 #endif | |
53 } | 72 } |
54 interface->fBindTexture = glBindTexture; | 73 GET_PROC(BindTexture); |
55 interface->fBlendFunc = glBlendFunc; | 74 GET_PROC(BlendFunc); |
56 | 75 |
57 if (ver >= GR_GL_VER(1,4)) { | 76 if (ver >= GR_GL_VER(1,4) || |
58 interface->fBlendColor = glBlendColor; | 77 extensions.has("GL_ARB_imaging") || |
59 } else if (extensions.has("GL_ARB_imaging") || | 78 extensions.has("GL_EXT_blend_color")) { |
60 extensions.has("GL_EXT_blend_color")) { | |
61 GET_PROC(BlendColor); | 79 GET_PROC(BlendColor); |
62 } | 80 } |
63 | 81 |
64 interface->fBufferData = glBufferData; | 82 GET_PROC(BufferData); |
65 interface->fBufferSubData = glBufferSubData; | 83 GET_PROC(BufferSubData); |
66 interface->fClear = glClear; | 84 GET_PROC(Clear); |
67 interface->fClearColor = glClearColor; | 85 GET_PROC(ClearColor); |
68 interface->fClearStencil = glClearStencil; | 86 GET_PROC(ClearStencil); |
69 interface->fColorMask = glColorMask; | 87 GET_PROC(ColorMask); |
70 interface->fCompileShader = glCompileShader; | 88 GET_PROC(CompileShader); |
71 interface->fCompressedTexImage2D = glCompressedTexImage2D; | 89 GET_PROC(CompressedTexImage2D); |
72 interface->fCreateProgram = glCreateProgram; | 90 GET_PROC(CreateProgram); |
73 interface->fCreateShader = glCreateShader; | 91 GET_PROC(CreateShader); |
74 interface->fCullFace = glCullFace; | 92 GET_PROC(CullFace); |
75 interface->fDeleteBuffers = glDeleteBuffers; | 93 GET_PROC(DeleteBuffers); |
76 interface->fDeleteProgram = glDeleteProgram; | 94 GET_PROC(DeleteProgram); |
77 interface->fDeleteQueries = glDeleteQueries; | 95 GET_PROC(DeleteQueries); |
78 interface->fDeleteShader = glDeleteShader; | 96 GET_PROC(DeleteShader); |
79 interface->fDeleteTextures = glDeleteTextures; | 97 GET_PROC(DeleteTextures); |
80 interface->fDepthMask = glDepthMask; | 98 GET_PROC(DepthMask); |
81 interface->fDisable = glDisable; | 99 GET_PROC(Disable); |
82 interface->fDisableVertexAttribArray = glDisableVertexAttribArray; | 100 GET_PROC(DisableVertexAttribArray); |
83 interface->fDrawArrays = glDrawArrays; | 101 GET_PROC(DrawArrays); |
84 interface->fDrawBuffer = glDrawBuffer; | 102 GET_PROC(DrawBuffer); |
85 interface->fDrawBuffers = glDrawBuffers; | 103 GET_PROC(DrawBuffers); |
86 interface->fDrawElements = glDrawElements; | 104 GET_PROC(DrawElements); |
87 interface->fEnable = glEnable; | 105 GET_PROC(Enable); |
88 interface->fEnableVertexAttribArray = glEnableVertexAttribArray; | 106 GET_PROC(EnableVertexAttribArray); |
89 interface->fEndQuery = glEndQuery; | 107 GET_PROC(EndQuery); |
90 interface->fFinish = glFinish; | 108 GET_PROC(Finish); |
91 interface->fFlush = glFlush; | 109 GET_PROC(Flush); |
92 interface->fFrontFace = glFrontFace; | 110 GET_PROC(FrontFace); |
93 interface->fGenBuffers = glGenBuffers; | 111 GET_PROC(GenBuffers); |
94 interface->fGenQueries = glGenQueries; | 112 GET_PROC(GenQueries); |
95 interface->fGetBufferParameteriv = glGetBufferParameteriv; | 113 GET_PROC(GetBufferParameteriv); |
96 interface->fGetError = glGetError; | 114 GET_PROC(GetError); |
97 interface->fGetIntegerv = glGetIntegerv; | 115 GET_PROC(GetIntegerv); |
98 interface->fGetProgramInfoLog = glGetProgramInfoLog; | 116 GET_PROC(GetProgramInfoLog); |
99 interface->fGetProgramiv = glGetProgramiv; | 117 GET_PROC(GetProgramiv); |
100 interface->fGetQueryiv = glGetQueryiv; | 118 GET_PROC(GetQueryiv); |
101 interface->fGetQueryObjectiv = glGetQueryObjectiv; | 119 GET_PROC(GetQueryObjectiv); |
102 interface->fGetQueryObjectuiv = glGetQueryObjectuiv; | 120 GET_PROC(GetQueryObjectuiv); |
103 interface->fGetShaderInfoLog = glGetShaderInfoLog; | 121 GET_PROC(GetShaderInfoLog); |
104 interface->fGetShaderiv = glGetShaderiv; | 122 GET_PROC(GetShaderiv); |
105 interface->fGetString = glGetString; | 123 GET_PROC(GetString); |
106 interface->fGetStringi = glGetStringi; | 124 GET_PROC(GetStringi); |
107 interface->fGetTexLevelParameteriv = glGetTexLevelParameteriv; | 125 GET_PROC(GetTexLevelParameteriv); |
108 interface->fGenTextures = glGenTextures; | 126 GET_PROC(GenTextures); |
109 interface->fGetUniformLocation = glGetUniformLocation; | 127 GET_PROC(GetUniformLocation); |
110 interface->fLineWidth = glLineWidth; | 128 GET_PROC(LineWidth); |
111 interface->fLinkProgram = glLinkProgram; | 129 GET_PROC(LinkProgram); |
112 interface->fMapBuffer = glMapBuffer; | 130 GET_PROC(MapBuffer); |
113 interface->fPixelStorei = glPixelStorei; | 131 GET_PROC(PixelStorei); |
114 interface->fReadBuffer = glReadBuffer; | 132 GET_PROC(ReadBuffer); |
115 interface->fReadPixels = glReadPixels; | 133 GET_PROC(ReadPixels); |
116 interface->fScissor = glScissor; | 134 GET_PROC(Scissor); |
117 // The new OpenGLES2 header has an extra "const" in it. :( | 135 GET_PROC(ShaderSource); |
118 #if GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE | 136 GET_PROC(StencilFunc); |
119 interface->fShaderSource = (GrGLShaderSourceProc) glShaderSource; | 137 GET_PROC(StencilFuncSeparate); |
120 #else | 138 GET_PROC(StencilMask); |
121 interface->fShaderSource = glShaderSource; | 139 GET_PROC(StencilMaskSeparate); |
122 #endif | 140 GET_PROC(StencilOp); |
123 interface->fStencilFunc = glStencilFunc; | 141 GET_PROC(StencilOpSeparate); |
124 interface->fStencilFuncSeparate = glStencilFuncSeparate; | 142 GET_PROC(TexImage2D); |
125 interface->fStencilMask = glStencilMask; | 143 GET_PROC(TexParameteri); |
126 interface->fStencilMaskSeparate = glStencilMaskSeparate; | 144 GET_PROC(TexParameteriv); |
127 interface->fStencilOp = glStencilOp; | |
128 interface->fStencilOpSeparate = glStencilOpSeparate; | |
129 // mac uses GLenum for internalFormat param (non-standard) | |
130 // amounts to int vs. uint. | |
131 interface->fTexImage2D = (GrGLTexImage2DProc)glTexImage2D; | |
132 interface->fTexParameteri = glTexParameteri; | |
133 interface->fTexParameteriv = glTexParameteriv; | |
134 #if GL_ARB_texture_storage || GL_VERSION_4_2 | |
135 interface->fTexStorage2D = glTexStorage2D | |
136 #elif GL_EXT_texture_storage | |
137 interface->fTexStorage2D = glTexStorage2DEXT; | |
138 #else | |
139 if (ver >= GR_GL_VER(4,2) || extensions.has("GL_ARB_texture_storage")) { | 145 if (ver >= GR_GL_VER(4,2) || extensions.has("GL_ARB_texture_storage")) { |
140 GET_PROC(TexStorage2D); | 146 GET_PROC(TexStorage2D); |
141 } else if (extensions.has("GL_EXT_texture_storage")) { | 147 } else if (extensions.has("GL_EXT_texture_storage")) { |
142 GET_PROC_SUFFIX(TexStorage2D, EXT); | 148 GET_PROC_SUFFIX(TexStorage2D, EXT); |
143 } | 149 } |
144 #endif | 150 GET_PROC(TexSubImage2D); |
145 interface->fTexSubImage2D = glTexSubImage2D; | 151 GET_PROC(Uniform1f); |
146 interface->fUniform1f = glUniform1f; | 152 GET_PROC(Uniform1i); |
147 interface->fUniform1i = glUniform1i; | 153 GET_PROC(Uniform1fv); |
148 interface->fUniform1fv = glUniform1fv; | 154 GET_PROC(Uniform1iv); |
149 interface->fUniform1iv = glUniform1iv; | 155 GET_PROC(Uniform2f); |
150 interface->fUniform2f = glUniform2f; | 156 GET_PROC(Uniform2i); |
151 interface->fUniform2i = glUniform2i; | 157 GET_PROC(Uniform2fv); |
152 interface->fUniform2fv = glUniform2fv; | 158 GET_PROC(Uniform2iv); |
153 interface->fUniform2iv = glUniform2iv; | 159 GET_PROC(Uniform3f); |
154 interface->fUniform3f = glUniform3f; | 160 GET_PROC(Uniform3i); |
155 interface->fUniform3i = glUniform3i; | 161 GET_PROC(Uniform3fv); |
156 interface->fUniform3fv = glUniform3fv; | 162 GET_PROC(Uniform3iv); |
157 interface->fUniform3iv = glUniform3iv; | 163 GET_PROC(Uniform4f); |
158 interface->fUniform4f = glUniform4f; | 164 GET_PROC(Uniform4i); |
159 interface->fUniform4i = glUniform4i; | 165 GET_PROC(Uniform4fv); |
160 interface->fUniform4fv = glUniform4fv; | 166 GET_PROC(Uniform4iv); |
161 interface->fUniform4iv = glUniform4iv; | 167 GET_PROC(Uniform4fv); |
162 interface->fUniform4fv = glUniform4fv; | 168 GET_PROC(UniformMatrix2fv); |
163 interface->fUniformMatrix2fv = glUniformMatrix2fv; | 169 GET_PROC(UniformMatrix3fv); |
164 interface->fUniformMatrix3fv = glUniformMatrix3fv; | 170 GET_PROC(UniformMatrix4fv); |
165 interface->fUniformMatrix4fv = glUniformMatrix4fv; | 171 GET_PROC(UnmapBuffer); |
166 interface->fUnmapBuffer = glUnmapBuffer; | 172 GET_PROC(UseProgram); |
167 interface->fUseProgram = glUseProgram; | 173 GET_PROC(VertexAttrib4fv); |
168 interface->fVertexAttrib4fv = glVertexAttrib4fv; | 174 GET_PROC(VertexAttribPointer); |
169 interface->fVertexAttribPointer = glVertexAttribPointer; | 175 GET_PROC(Viewport); |
170 interface->fViewport = glViewport; | |
171 | 176 |
172 if (ver >= GR_GL_VER(3,0) || extensions.has("GL_ARB_vertex_array_object"
)) { | 177 if (ver >= GR_GL_VER(3,0) || extensions.has("GL_ARB_vertex_array_object"
)) { |
173 // no ARB suffix for GL_ARB_vertex_array_object | 178 // no ARB suffix for GL_ARB_vertex_array_object |
174 #if GL_ARB_vertex_array_object || GL_VERSION_3_0 | |
175 interface->fBindVertexArray = glBindVertexArray; | |
176 interface->fDeleteVertexArrays = glDeleteVertexArrays; | |
177 interface->fGenVertexArrays = glGenVertexArrays; | |
178 #else | |
179 GET_PROC(BindVertexArray); | 179 GET_PROC(BindVertexArray); |
180 GET_PROC(DeleteVertexArrays); | 180 GET_PROC(DeleteVertexArrays); |
181 GET_PROC(GenVertexArrays); | 181 GET_PROC(GenVertexArrays); |
182 #endif | |
183 } | 182 } |
184 | 183 |
185 if (ver >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) { | 184 if (ver >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) { |
186 // ARB extension doesn't use the ARB suffix on the function name | 185 // ARB extension doesn't use the ARB suffix on the function name |
187 #if GL_ARB_timer_query || GL_VERSION_3_3 | |
188 interface->fQueryCounter = glQueryCounter; | |
189 interface->fGetQueryObjecti64v = glGetQueryObjecti64v; | |
190 interface->fGetQueryObjectui64v = glGetQueryObjectui64v; | |
191 #else | |
192 GET_PROC(QueryCounter); | 186 GET_PROC(QueryCounter); |
193 GET_PROC(GetQueryObjecti64v); | 187 GET_PROC(GetQueryObjecti64v); |
194 GET_PROC(GetQueryObjectui64v); | 188 GET_PROC(GetQueryObjectui64v); |
195 #endif | |
196 } else if (extensions.has("GL_EXT_timer_query")) { | 189 } else if (extensions.has("GL_EXT_timer_query")) { |
197 #if GL_EXT_timer_query | |
198 interface->fGetQueryObjecti64v = glGetQueryObjecti64vEXT; | |
199 interface->fGetQueryObjectui64v = glGetQueryObjectui64vEXT; | |
200 #else | |
201 GET_PROC_SUFFIX(GetQueryObjecti64v, EXT); | 190 GET_PROC_SUFFIX(GetQueryObjecti64v, EXT); |
202 GET_PROC_SUFFIX(GetQueryObjectui64v, EXT); | 191 GET_PROC_SUFFIX(GetQueryObjectui64v, EXT); |
203 #endif | |
204 } | 192 } |
205 | 193 |
206 if (ver >= GR_GL_VER(3,0) || extensions.has("GL_ARB_framebuffer_object")
) { | 194 if (ver >= GR_GL_VER(3,0) || extensions.has("GL_ARB_framebuffer_object")
) { |
207 // ARB extension doesn't use the ARB suffix on the function names | 195 // ARB extension doesn't use the ARB suffix on the function names |
208 #if GL_VERSION_3_0 || GL_ARB_framebuffer_object | |
209 interface->fGenFramebuffers = glGenFramebuffers; | |
210 interface->fGetFramebufferAttachmentParameteriv = glGetFramebuff
erAttachmentParameteriv; | |
211 interface->fGetRenderbufferParameteriv = glGetRenderbufferParame
teriv; | |
212 interface->fBindFramebuffer = glBindFramebuffer; | |
213 interface->fFramebufferTexture2D = glFramebufferTexture2D; | |
214 interface->fCheckFramebufferStatus = glCheckFramebufferStatus; | |
215 interface->fDeleteFramebuffers = glDeleteFramebuffers; | |
216 interface->fRenderbufferStorage = glRenderbufferStorage; | |
217 interface->fGenRenderbuffers = glGenRenderbuffers; | |
218 interface->fDeleteRenderbuffers = glDeleteRenderbuffers; | |
219 interface->fFramebufferRenderbuffer = glFramebufferRenderbuffer; | |
220 interface->fBindRenderbuffer = glBindRenderbuffer; | |
221 interface->fRenderbufferStorageMultisample = glRenderbufferStora
geMultisample; | |
222 interface->fBlitFramebuffer = glBlitFramebuffer; | |
223 #else | |
224 GET_PROC(GenFramebuffers); | 196 GET_PROC(GenFramebuffers); |
225 GET_PROC(GetFramebufferAttachmentParameteriv); | 197 GET_PROC(GetFramebufferAttachmentParameteriv); |
226 GET_PROC(GetRenderbufferParameteriv); | 198 GET_PROC(GetRenderbufferParameteriv); |
227 GET_PROC(BindFramebuffer); | 199 GET_PROC(BindFramebuffer); |
228 GET_PROC(FramebufferTexture2D); | 200 GET_PROC(FramebufferTexture2D); |
229 GET_PROC(CheckFramebufferStatus); | 201 GET_PROC(CheckFramebufferStatus); |
230 GET_PROC(DeleteFramebuffers); | 202 GET_PROC(DeleteFramebuffers); |
231 GET_PROC(RenderbufferStorage); | 203 GET_PROC(RenderbufferStorage); |
232 GET_PROC(GenRenderbuffers); | 204 GET_PROC(GenRenderbuffers); |
233 GET_PROC(DeleteRenderbuffers); | 205 GET_PROC(DeleteRenderbuffers); |
234 GET_PROC(FramebufferRenderbuffer); | 206 GET_PROC(FramebufferRenderbuffer); |
235 GET_PROC(BindRenderbuffer); | 207 GET_PROC(BindRenderbuffer); |
236 GET_PROC(RenderbufferStorageMultisample); | 208 GET_PROC(RenderbufferStorageMultisample); |
237 GET_PROC(BlitFramebuffer); | 209 GET_PROC(BlitFramebuffer); |
238 #endif | |
239 } else { | 210 } else { |
240 if (extensions.has("GL_EXT_framebuffer_object")) { | 211 if (extensions.has("GL_EXT_framebuffer_object")) { |
241 #if GL_EXT_framebuffer_object | |
242 interface->fGenFramebuffers = glGenFramebuffersEXT; | |
243 interface->fGetFramebufferAttachmentParameteriv = glGetFramebuff
erAttachmentParameterivEXT; | |
244 interface->fGetRenderbufferParameteriv = glGetRenderbufferParame
terivEXT; | |
245 interface->fBindFramebuffer = glBindFramebufferEXT; | |
246 interface->fFramebufferTexture2D = glFramebufferTexture2DEXT; | |
247 interface->fCheckFramebufferStatus = glCheckFramebufferStatusEXT
; | |
248 interface->fDeleteFramebuffers = glDeleteFramebuffersEXT; | |
249 interface->fRenderbufferStorage = glRenderbufferStorageEXT; | |
250 interface->fGenRenderbuffers = glGenRenderbuffersEXT; | |
251 interface->fDeleteRenderbuffers = glDeleteRenderbuffersEXT; | |
252 interface->fFramebufferRenderbuffer = glFramebufferRenderbufferE
XT; | |
253 interface->fBindRenderbuffer = glBindRenderbufferEXT; | |
254 #else | |
255 GET_PROC_SUFFIX(GenFramebuffers, EXT); | 212 GET_PROC_SUFFIX(GenFramebuffers, EXT); |
256 GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT); | 213 GET_PROC_SUFFIX(GetFramebufferAttachmentParameteriv, EXT); |
257 GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT); | 214 GET_PROC_SUFFIX(GetRenderbufferParameteriv, EXT); |
258 GET_PROC_SUFFIX(BindFramebuffer, EXT); | 215 GET_PROC_SUFFIX(BindFramebuffer, EXT); |
259 GET_PROC_SUFFIX(FramebufferTexture2D, EXT); | 216 GET_PROC_SUFFIX(FramebufferTexture2D, EXT); |
260 GET_PROC_SUFFIX(CheckFramebufferStatus, EXT); | 217 GET_PROC_SUFFIX(CheckFramebufferStatus, EXT); |
261 GET_PROC_SUFFIX(DeleteFramebuffers, EXT); | 218 GET_PROC_SUFFIX(DeleteFramebuffers, EXT); |
262 GET_PROC_SUFFIX(RenderbufferStorage, EXT); | 219 GET_PROC_SUFFIX(RenderbufferStorage, EXT); |
263 GET_PROC_SUFFIX(GenRenderbuffers, EXT); | 220 GET_PROC_SUFFIX(GenRenderbuffers, EXT); |
264 GET_PROC_SUFFIX(DeleteRenderbuffers, EXT); | 221 GET_PROC_SUFFIX(DeleteRenderbuffers, EXT); |
265 GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT); | 222 GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT); |
266 GET_PROC_SUFFIX(BindRenderbuffer, EXT); | 223 GET_PROC_SUFFIX(BindRenderbuffer, EXT); |
267 #endif | |
268 } | 224 } |
269 if (extensions.has("GL_EXT_framebuffer_multisample")) { | 225 if (extensions.has("GL_EXT_framebuffer_multisample")) { |
270 #if GL_EXT_framebuffer_multisample | |
271 interface->fRenderbufferStorageMultisample = glRenderbufferStora
geMultisampleEXT; | |
272 #else | |
273 GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT); | 226 GET_PROC_SUFFIX(RenderbufferStorageMultisample, EXT); |
274 #endif | |
275 } | 227 } |
276 if (extensions.has("GL_EXT_framebuffer_blit")) { | 228 if (extensions.has("GL_EXT_framebuffer_blit")) { |
277 #if GL_EXT_framebuffer_blit | |
278 interface->fBlitFramebuffer = glBlitFramebufferEXT; | |
279 #else | |
280 GET_PROC_SUFFIX(BlitFramebuffer, EXT); | 229 GET_PROC_SUFFIX(BlitFramebuffer, EXT); |
281 #endif | |
282 } | 230 } |
283 } | 231 } |
284 if (ver >= GR_GL_VER(3,3) || extensions.has("GL_ARB_blend_func_extended"
)) { | 232 if (ver >= GR_GL_VER(3,3) || extensions.has("GL_ARB_blend_func_extended"
)) { |
285 // ARB extension doesn't use the ARB suffix on the function name | 233 // ARB extension doesn't use the ARB suffix on the function name |
286 #if GL_VERSION_3_3 || GL_ARB_blend_func_extended | |
287 interface->fBindFragDataLocationIndexed = glBindFragDataLocationInde
xed; | |
288 #else | |
289 GET_PROC(BindFragDataLocationIndexed); | 234 GET_PROC(BindFragDataLocationIndexed); |
290 #endif | |
291 } | 235 } |
292 } | 236 } |
293 glInterface.get()->ref(); | 237 glInterface.get()->ref(); |
294 return glInterface.get(); | 238 return glInterface.get(); |
295 } | 239 } |
OLD | NEW |