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 "gl/GrGLExtensions.h" |
| 12 #include "GrGLUtil.h" |
12 | 13 |
13 #include <OpenGL/gl.h> | 14 #include <OpenGL/gl.h> |
14 #include <OpenGL/glext.h> | 15 #include <OpenGL/glext.h> |
15 | 16 |
16 #include <dlfcn.h> | 17 #include <dlfcn.h> |
17 | 18 |
18 static void* GetProcAddress(const char* name) { | 19 static void* GetProcAddress(const char* name) { |
19 return dlsym(RTLD_DEFAULT, name); | 20 return dlsym(RTLD_DEFAULT, name); |
20 } | 21 } |
21 | 22 |
22 #define GET_PROC(name) (interface->f ## name = ((GrGL ## name ## Proc) GetProcAd
dress("gl" #name))) | 23 #define GET_PROC(name) (interface->f ## name = ((GrGL ## name ## Proc) GetProcAd
dress("gl" #name))) |
23 #define GET_PROC_SUFFIX(name, suffix) (interface->f ## name = ((GrGL ## name ##
Proc) GetProcAddress("gl" #name #suffix))) | 24 #define GET_PROC_SUFFIX(name, suffix) (interface->f ## name = ((GrGL ## name ##
Proc) GetProcAddress("gl" #name #suffix))) |
24 | 25 |
25 const GrGLInterface* GrGLCreateNativeInterface() { | 26 const GrGLInterface* GrGLCreateNativeInterface() { |
26 // The gl functions are not context-specific so we create one global | 27 // The gl functions are not context-specific so we create one global |
27 // interface | 28 // interface |
28 static SkAutoTUnref<GrGLInterface> glInterface; | 29 static SkAutoTUnref<GrGLInterface> glInterface; |
29 if (!glInterface.get()) { | 30 if (!glInterface.get()) { |
30 GrGLInterface* interface = new GrGLInterface; | 31 GrGLInterface* interface = new GrGLInterface; |
31 glInterface.reset(interface); | 32 glInterface.reset(interface); |
32 const char* verStr = (const char*) glGetString(GL_VERSION); | 33 const char* verStr = (const char*) glGetString(GL_VERSION); |
33 GrGLVersion ver = GrGLGetVersionFromString(verStr); | 34 GrGLVersion ver = GrGLGetVersionFromString(verStr); |
34 const char* extStr = (const char*) glGetString(GL_EXTENSIONS); | 35 GrGLExtensions extensions; |
35 | 36 GrGLGetStringiProc glGetStringi = (GrGLGetStringiProc) GetProcAddress("g
lGetStringi"); |
| 37 if (!extensions.init(kDesktop_GrGLBinding, glGetString, glGetStringi, gl
GetIntegerv)) { |
| 38 glInterface.reset(NULL); |
| 39 return NULL; |
| 40 } |
36 interface->fBindingsExported = kDesktop_GrGLBinding; | 41 interface->fBindingsExported = kDesktop_GrGLBinding; |
37 interface->fActiveTexture = glActiveTexture; | 42 interface->fActiveTexture = glActiveTexture; |
38 interface->fAttachShader = glAttachShader; | 43 interface->fAttachShader = glAttachShader; |
39 interface->fBeginQuery = glBeginQuery; | 44 interface->fBeginQuery = glBeginQuery; |
40 interface->fBindAttribLocation = glBindAttribLocation; | 45 interface->fBindAttribLocation = glBindAttribLocation; |
41 interface->fBindBuffer = glBindBuffer; | 46 interface->fBindBuffer = glBindBuffer; |
42 if (ver >= GR_GL_VER(3,0)) { | 47 if (ver >= GR_GL_VER(3,0)) { |
43 #if GL_VERSION_3_0 | 48 #if GL_VERSION_3_0 |
44 interface->fBindFragDataLocation = glBindFragDataLocation; | 49 interface->fBindFragDataLocation = glBindFragDataLocation; |
45 #else | 50 #else |
46 interface->fBindFragDataLocation = GET_PROC(BindFragDataLocation
); | 51 interface->fBindFragDataLocation = GET_PROC(BindFragDataLocation
); |
47 #endif | 52 #endif |
48 } | 53 } |
49 interface->fBindTexture = glBindTexture; | 54 interface->fBindTexture = glBindTexture; |
50 interface->fBlendFunc = glBlendFunc; | 55 interface->fBlendFunc = glBlendFunc; |
51 | 56 |
52 if (ver >= GR_GL_VER(1,4)) { | 57 if (ver >= GR_GL_VER(1,4)) { |
53 interface->fBlendColor = glBlendColor; | 58 interface->fBlendColor = glBlendColor; |
54 } else if (GrGLHasExtensionFromString("GL_ARB_imaging", extStr) || | 59 } else if (extensions.has("GL_ARB_imaging") || |
55 GrGLHasExtensionFromString("GL_EXT_blend_color", extStr)) { | 60 extensions.has("GL_EXT_blend_color")) { |
56 GET_PROC(BlendColor); | 61 GET_PROC(BlendColor); |
57 } | 62 } |
58 | 63 |
59 interface->fBufferData = glBufferData; | 64 interface->fBufferData = glBufferData; |
60 interface->fBufferSubData = glBufferSubData; | 65 interface->fBufferSubData = glBufferSubData; |
61 interface->fClear = glClear; | 66 interface->fClear = glClear; |
62 interface->fClearColor = glClearColor; | 67 interface->fClearColor = glClearColor; |
63 interface->fClearStencil = glClearStencil; | 68 interface->fClearStencil = glClearStencil; |
64 interface->fColorMask = glColorMask; | 69 interface->fColorMask = glColorMask; |
65 interface->fCompileShader = glCompileShader; | 70 interface->fCompileShader = glCompileShader; |
66 interface->fCompressedTexImage2D = glCompressedTexImage2D; | 71 interface->fCompressedTexImage2D = glCompressedTexImage2D; |
67 interface->fCreateProgram = glCreateProgram; | 72 interface->fCreateProgram = glCreateProgram; |
68 interface->fCreateShader = glCreateShader; | 73 interface->fCreateShader = glCreateShader; |
69 interface->fCullFace = glCullFace; | 74 interface->fCullFace = glCullFace; |
70 interface->fDeleteBuffers = glDeleteBuffers; | 75 interface->fDeleteBuffers = glDeleteBuffers; |
71 interface->fDeleteProgram = glDeleteProgram; | 76 interface->fDeleteProgram = glDeleteProgram; |
72 interface->fDeleteQueries = glDeleteQueries; | 77 interface->fDeleteQueries = glDeleteQueries; |
73 interface->fDeleteShader = glDeleteShader; | 78 interface->fDeleteShader = glDeleteShader; |
74 interface->fDeleteTextures = glDeleteTextures; | 79 interface->fDeleteTextures = glDeleteTextures; |
75 interface->fDepthMask = glDepthMask; | 80 interface->fDepthMask = glDepthMask; |
76 interface->fDisable = glDisable; | 81 interface->fDisable = glDisable; |
77 interface->fDisableVertexAttribArray = | 82 interface->fDisableVertexAttribArray = glDisableVertexAttribArray; |
78 glDisableVertexAttribArray; | |
79 interface->fDrawArrays = glDrawArrays; | 83 interface->fDrawArrays = glDrawArrays; |
80 interface->fDrawBuffer = glDrawBuffer; | 84 interface->fDrawBuffer = glDrawBuffer; |
81 interface->fDrawBuffers = glDrawBuffers; | 85 interface->fDrawBuffers = glDrawBuffers; |
82 interface->fDrawElements = glDrawElements; | 86 interface->fDrawElements = glDrawElements; |
83 interface->fEnable = glEnable; | 87 interface->fEnable = glEnable; |
84 interface->fEnableVertexAttribArray = glEnableVertexAttribArray; | 88 interface->fEnableVertexAttribArray = glEnableVertexAttribArray; |
85 interface->fEndQuery = glEndQuery; | 89 interface->fEndQuery = glEndQuery; |
86 interface->fFinish = glFinish; | 90 interface->fFinish = glFinish; |
87 interface->fFlush = glFlush; | 91 interface->fFlush = glFlush; |
88 interface->fFrontFace = glFrontFace; | 92 interface->fFrontFace = glFrontFace; |
89 interface->fGenBuffers = glGenBuffers; | 93 interface->fGenBuffers = glGenBuffers; |
90 interface->fGenQueries = glGenQueries; | 94 interface->fGenQueries = glGenQueries; |
91 interface->fGetBufferParameteriv = glGetBufferParameteriv; | 95 interface->fGetBufferParameteriv = glGetBufferParameteriv; |
92 interface->fGetError = glGetError; | 96 interface->fGetError = glGetError; |
93 interface->fGetIntegerv = glGetIntegerv; | 97 interface->fGetIntegerv = glGetIntegerv; |
94 interface->fGetProgramInfoLog = glGetProgramInfoLog; | 98 interface->fGetProgramInfoLog = glGetProgramInfoLog; |
95 interface->fGetProgramiv = glGetProgramiv; | 99 interface->fGetProgramiv = glGetProgramiv; |
96 interface->fGetQueryiv = glGetQueryiv; | 100 interface->fGetQueryiv = glGetQueryiv; |
97 interface->fGetQueryObjectiv = glGetQueryObjectiv; | 101 interface->fGetQueryObjectiv = glGetQueryObjectiv; |
98 interface->fGetQueryObjectuiv = glGetQueryObjectuiv; | 102 interface->fGetQueryObjectuiv = glGetQueryObjectuiv; |
99 interface->fGetShaderInfoLog = glGetShaderInfoLog; | 103 interface->fGetShaderInfoLog = glGetShaderInfoLog; |
100 interface->fGetShaderiv = glGetShaderiv; | 104 interface->fGetShaderiv = glGetShaderiv; |
101 interface->fGetString = glGetString; | 105 interface->fGetString = glGetString; |
| 106 interface->fGetStringi = glGetStringi; |
102 interface->fGetTexLevelParameteriv = glGetTexLevelParameteriv; | 107 interface->fGetTexLevelParameteriv = glGetTexLevelParameteriv; |
103 interface->fGenTextures = glGenTextures; | 108 interface->fGenTextures = glGenTextures; |
104 interface->fGetUniformLocation = glGetUniformLocation; | 109 interface->fGetUniformLocation = glGetUniformLocation; |
105 interface->fLineWidth = glLineWidth; | 110 interface->fLineWidth = glLineWidth; |
106 interface->fLinkProgram = glLinkProgram; | 111 interface->fLinkProgram = glLinkProgram; |
107 interface->fMapBuffer = glMapBuffer; | 112 interface->fMapBuffer = glMapBuffer; |
108 interface->fPixelStorei = glPixelStorei; | 113 interface->fPixelStorei = glPixelStorei; |
109 interface->fReadBuffer = glReadBuffer; | 114 interface->fReadBuffer = glReadBuffer; |
110 interface->fReadPixels = glReadPixels; | 115 interface->fReadPixels = glReadPixels; |
111 interface->fScissor = glScissor; | 116 interface->fScissor = glScissor; |
(...skipping 12 matching lines...) Expand all Loading... |
124 // mac uses GLenum for internalFormat param (non-standard) | 129 // mac uses GLenum for internalFormat param (non-standard) |
125 // amounts to int vs. uint. | 130 // amounts to int vs. uint. |
126 interface->fTexImage2D = (GrGLTexImage2DProc)glTexImage2D; | 131 interface->fTexImage2D = (GrGLTexImage2DProc)glTexImage2D; |
127 interface->fTexParameteri = glTexParameteri; | 132 interface->fTexParameteri = glTexParameteri; |
128 interface->fTexParameteriv = glTexParameteriv; | 133 interface->fTexParameteriv = glTexParameteriv; |
129 #if GL_ARB_texture_storage || GL_VERSION_4_2 | 134 #if GL_ARB_texture_storage || GL_VERSION_4_2 |
130 interface->fTexStorage2D = glTexStorage2D | 135 interface->fTexStorage2D = glTexStorage2D |
131 #elif GL_EXT_texture_storage | 136 #elif GL_EXT_texture_storage |
132 interface->fTexStorage2D = glTexStorage2DEXT; | 137 interface->fTexStorage2D = glTexStorage2DEXT; |
133 #else | 138 #else |
134 if (ver >= GR_GL_VER(4,2) || | 139 if (ver >= GR_GL_VER(4,2) || extensions.has("GL_ARB_texture_storage")) { |
135 GrGLHasExtensionFromString("GL_ARB_texture_storage", extStr)) { | |
136 GET_PROC(TexStorage2D); | 140 GET_PROC(TexStorage2D); |
137 } else if (GrGLHasExtensionFromString("GL_EXT_texture_storage", extStr))
{ | 141 } else if (extensions.has("GL_EXT_texture_storage")) { |
138 GET_PROC_SUFFIX(TexStorage2D, EXT); | 142 GET_PROC_SUFFIX(TexStorage2D, EXT); |
139 } | 143 } |
140 #endif | 144 #endif |
141 interface->fTexSubImage2D = glTexSubImage2D; | 145 interface->fTexSubImage2D = glTexSubImage2D; |
142 interface->fUniform1f = glUniform1f; | 146 interface->fUniform1f = glUniform1f; |
143 interface->fUniform1i = glUniform1i; | 147 interface->fUniform1i = glUniform1i; |
144 interface->fUniform1fv = glUniform1fv; | 148 interface->fUniform1fv = glUniform1fv; |
145 interface->fUniform1iv = glUniform1iv; | 149 interface->fUniform1iv = glUniform1iv; |
146 interface->fUniform2f = glUniform2f; | 150 interface->fUniform2f = glUniform2f; |
147 interface->fUniform2i = glUniform2i; | 151 interface->fUniform2i = glUniform2i; |
(...skipping 10 matching lines...) Expand all Loading... |
158 interface->fUniform4fv = glUniform4fv; | 162 interface->fUniform4fv = glUniform4fv; |
159 interface->fUniformMatrix2fv = glUniformMatrix2fv; | 163 interface->fUniformMatrix2fv = glUniformMatrix2fv; |
160 interface->fUniformMatrix3fv = glUniformMatrix3fv; | 164 interface->fUniformMatrix3fv = glUniformMatrix3fv; |
161 interface->fUniformMatrix4fv = glUniformMatrix4fv; | 165 interface->fUniformMatrix4fv = glUniformMatrix4fv; |
162 interface->fUnmapBuffer = glUnmapBuffer; | 166 interface->fUnmapBuffer = glUnmapBuffer; |
163 interface->fUseProgram = glUseProgram; | 167 interface->fUseProgram = glUseProgram; |
164 interface->fVertexAttrib4fv = glVertexAttrib4fv; | 168 interface->fVertexAttrib4fv = glVertexAttrib4fv; |
165 interface->fVertexAttribPointer = glVertexAttribPointer; | 169 interface->fVertexAttribPointer = glVertexAttribPointer; |
166 interface->fViewport = glViewport; | 170 interface->fViewport = glViewport; |
167 | 171 |
168 if (ver >= GR_GL_VER(3,3) || GrGLHasExtensionFromString("GL_ARB_timer_qu
ery", extStr)) { | 172 if (ver >= GR_GL_VER(3,3) || extensions.has("GL_ARB_timer_query")) { |
169 // ARB extension doesn't use the ARB suffix on the function name | 173 // ARB extension doesn't use the ARB suffix on the function name |
170 #if GL_ARB_timer_query || GL_VERSION_3_3 | 174 #if GL_ARB_timer_query || GL_VERSION_3_3 |
171 interface->fQueryCounter = glQueryCounter; | 175 interface->fQueryCounter = glQueryCounter; |
172 interface->fGetQueryObjecti64v = glGetQueryObjecti64v; | 176 interface->fGetQueryObjecti64v = glGetQueryObjecti64v; |
173 interface->fGetQueryObjectui64v = glGetQueryObjectui64v; | 177 interface->fGetQueryObjectui64v = glGetQueryObjectui64v; |
174 #else | 178 #else |
175 interface->fQueryCounter = GET_PROC(QueryCounter); | 179 interface->fQueryCounter = GET_PROC(QueryCounter); |
176 interface->fGetQueryObjecti64v = GET_PROC(GetQueryObjecti64v); | 180 interface->fGetQueryObjecti64v = GET_PROC(GetQueryObjecti64v); |
177 interface->fGetQueryObjectui64v = GET_PROC(GetQueryObjectui64v); | 181 interface->fGetQueryObjectui64v = GET_PROC(GetQueryObjectui64v); |
178 #endif | 182 #endif |
179 } else if (GrGLHasExtensionFromString("GL_EXT_timer_query", extStr)) { | 183 } else if (extensions.has("GL_EXT_timer_query")) { |
180 #if GL_EXT_timer_query | 184 #if GL_EXT_timer_query |
181 interface->fGetQueryObjecti64v = glGetQueryObjecti64vEXT; | 185 interface->fGetQueryObjecti64v = glGetQueryObjecti64vEXT; |
182 interface->fGetQueryObjectui64v = glGetQueryObjectui64vEXT; | 186 interface->fGetQueryObjectui64v = glGetQueryObjectui64vEXT; |
183 #else | 187 #else |
184 interface->fGetQueryObjecti64v = GET_PROC_SUFFIX(GetQueryObjecti
64v, EXT); | 188 interface->fGetQueryObjecti64v = GET_PROC_SUFFIX(GetQueryObjecti
64v, EXT); |
185 interface->fGetQueryObjectui64v = GET_PROC_SUFFIX(GetQueryObject
ui64v, EXT); | 189 interface->fGetQueryObjectui64v = GET_PROC_SUFFIX(GetQueryObject
ui64v, EXT); |
186 #endif | 190 #endif |
187 } | 191 } |
188 | 192 |
189 if (ver >= GR_GL_VER(3,0) || GrGLHasExtensionFromString("GL_ARB_framebuf
fer_object", extStr)) { | 193 if (ver >= GR_GL_VER(3,0) || extensions.has("GL_ARB_framebuffer_object")
) { |
190 // ARB extension doesn't use the ARB suffix on the function names | 194 // ARB extension doesn't use the ARB suffix on the function names |
191 #if GL_VERSION_3_0 || GL_ARB_framebuffer_object | 195 #if GL_VERSION_3_0 || GL_ARB_framebuffer_object |
192 interface->fGenFramebuffers = glGenFramebuffers; | 196 interface->fGenFramebuffers = glGenFramebuffers; |
193 interface->fGetFramebufferAttachmentParameteriv = glGetFramebuff
erAttachmentParameteriv; | 197 interface->fGetFramebufferAttachmentParameteriv = glGetFramebuff
erAttachmentParameteriv; |
194 interface->fGetRenderbufferParameteriv = glGetRenderbufferParame
teriv; | 198 interface->fGetRenderbufferParameteriv = glGetRenderbufferParame
teriv; |
195 interface->fBindFramebuffer = glBindFramebuffer; | 199 interface->fBindFramebuffer = glBindFramebuffer; |
196 interface->fFramebufferTexture2D = glFramebufferTexture2D; | 200 interface->fFramebufferTexture2D = glFramebufferTexture2D; |
197 interface->fCheckFramebufferStatus = glCheckFramebufferStatus; | 201 interface->fCheckFramebufferStatus = glCheckFramebufferStatus; |
198 interface->fDeleteFramebuffers = glDeleteFramebuffers; | 202 interface->fDeleteFramebuffers = glDeleteFramebuffers; |
199 interface->fRenderbufferStorage = glRenderbufferStorage; | 203 interface->fRenderbufferStorage = glRenderbufferStorage; |
(...skipping 13 matching lines...) Expand all Loading... |
213 interface->fDeleteFramebuffers = GET_PROC(DeleteFramebuffers); | 217 interface->fDeleteFramebuffers = GET_PROC(DeleteFramebuffers); |
214 interface->fRenderbufferStorage = GET_PROC(RenderbufferStorage); | 218 interface->fRenderbufferStorage = GET_PROC(RenderbufferStorage); |
215 interface->fGenRenderbuffers = GET_PROC(GenRenderbuffers); | 219 interface->fGenRenderbuffers = GET_PROC(GenRenderbuffers); |
216 interface->fDeleteRenderbuffers = GET_PROC(DeleteRenderbuffers); | 220 interface->fDeleteRenderbuffers = GET_PROC(DeleteRenderbuffers); |
217 interface->fFramebufferRenderbuffer = GET_PROC(FramebufferRender
buffer); | 221 interface->fFramebufferRenderbuffer = GET_PROC(FramebufferRender
buffer); |
218 interface->fBindRenderbuffer = GET_PROC(BindRenderbuffer); | 222 interface->fBindRenderbuffer = GET_PROC(BindRenderbuffer); |
219 interface->fRenderbufferStorageMultisample = GET_PROC(Renderbuff
erStorageMultisample); | 223 interface->fRenderbufferStorageMultisample = GET_PROC(Renderbuff
erStorageMultisample); |
220 interface->fBlitFramebuffer = GET_PROC(BlitFramebuffer); | 224 interface->fBlitFramebuffer = GET_PROC(BlitFramebuffer); |
221 #endif | 225 #endif |
222 } else { | 226 } else { |
223 if (GrGLHasExtensionFromString("GL_EXT_framebuffer_object", extStr))
{ | 227 if (extensions.has("GL_EXT_framebuffer_object")) { |
224 #if GL_EXT_framebuffer_object | 228 #if GL_EXT_framebuffer_object |
225 interface->fGenFramebuffers = glGenFramebuffersEXT; | 229 interface->fGenFramebuffers = glGenFramebuffersEXT; |
226 interface->fGetFramebufferAttachmentParameteriv = glGetFrame
bufferAttachmentParameterivEXT; | 230 interface->fGetFramebufferAttachmentParameteriv = glGetFrame
bufferAttachmentParameterivEXT; |
227 interface->fGetRenderbufferParameteriv = glGetRenderbufferPa
rameterivEXT; | 231 interface->fGetRenderbufferParameteriv = glGetRenderbufferPa
rameterivEXT; |
228 interface->fBindFramebuffer = glBindFramebufferEXT; | 232 interface->fBindFramebuffer = glBindFramebufferEXT; |
229 interface->fFramebufferTexture2D = glFramebufferTexture2DEXT
; | 233 interface->fFramebufferTexture2D = glFramebufferTexture2DEXT
; |
230 interface->fCheckFramebufferStatus = glCheckFramebufferStatu
sEXT; | 234 interface->fCheckFramebufferStatus = glCheckFramebufferStatu
sEXT; |
231 interface->fDeleteFramebuffers = glDeleteFramebuffersEXT; | 235 interface->fDeleteFramebuffers = glDeleteFramebuffersEXT; |
232 interface->fRenderbufferStorage = glRenderbufferStorageEXT; | 236 interface->fRenderbufferStorage = glRenderbufferStorageEXT; |
233 interface->fGenRenderbuffers = glGenRenderbuffersEXT; | 237 interface->fGenRenderbuffers = glGenRenderbuffersEXT; |
234 interface->fDeleteRenderbuffers = glDeleteRenderbuffersEXT; | 238 interface->fDeleteRenderbuffers = glDeleteRenderbuffersEXT; |
235 interface->fFramebufferRenderbuffer = glFramebufferRenderbuf
ferEXT; | 239 interface->fFramebufferRenderbuffer = glFramebufferRenderbuf
ferEXT; |
236 interface->fBindRenderbuffer = glBindRenderbufferEXT; | 240 interface->fBindRenderbuffer = glBindRenderbufferEXT; |
237 #else | 241 #else |
238 interface->fGenFramebuffers = GET_PROC_SUFFIX(GenFramebuffer
s, EXT); | 242 interface->fGenFramebuffers = GET_PROC_SUFFIX(GenFramebuffer
s, EXT); |
239 interface->fGetFramebufferAttachmentParameteriv = GET_PROC_S
UFFIX(GetFramebufferAttachmentParameteriv, EXT); | 243 interface->fGetFramebufferAttachmentParameteriv = GET_PROC_S
UFFIX(GetFramebufferAttachmentParameteriv, EXT); |
240 interface->fGetRenderbufferParameteriv = GET_PROC_SUFFIX(Get
RenderbufferParameteriv, EXT); | 244 interface->fGetRenderbufferParameteriv = GET_PROC_SUFFIX(Get
RenderbufferParameteriv, EXT); |
241 interface->fBindFramebuffer = GET_PROC_SUFFIX(BindFramebuffe
r, EXT); | 245 interface->fBindFramebuffer = GET_PROC_SUFFIX(BindFramebuffe
r, EXT); |
242 interface->fFramebufferTexture2D = GET_PROC_SUFFIX(Framebuff
erTexture2D, EXT); | 246 interface->fFramebufferTexture2D = GET_PROC_SUFFIX(Framebuff
erTexture2D, EXT); |
243 interface->fCheckFramebufferStatus = GET_PROC_SUFFIX(CheckFr
amebufferStatus, EXT); | 247 interface->fCheckFramebufferStatus = GET_PROC_SUFFIX(CheckFr
amebufferStatus, EXT); |
244 interface->fDeleteFramebuffers = GET_PROC_SUFFIX(DeleteFrame
buffers, EXT); | 248 interface->fDeleteFramebuffers = GET_PROC_SUFFIX(DeleteFrame
buffers, EXT); |
245 interface->fRenderbufferStorage = GET_PROC_SUFFIX(Renderbuff
erStorage, EXT); | 249 interface->fRenderbufferStorage = GET_PROC_SUFFIX(Renderbuff
erStorage, EXT); |
246 interface->fGenRenderbuffers = GET_PROC_SUFFIX(GenRenderbuff
ers, EXT); | 250 interface->fGenRenderbuffers = GET_PROC_SUFFIX(GenRenderbuff
ers, EXT); |
247 interface->fDeleteRenderbuffers = GET_PROC_SUFFIX(DeleteRend
erbuffers, EXT); | 251 interface->fDeleteRenderbuffers = GET_PROC_SUFFIX(DeleteRend
erbuffers, EXT); |
248 interface->fFramebufferRenderbuffer = GET_PROC_SUFFIX(Frameb
ufferRenderbuffer, EXT); | 252 interface->fFramebufferRenderbuffer = GET_PROC_SUFFIX(Frameb
ufferRenderbuffer, EXT); |
249 interface->fBindRenderbuffer = GET_PROC_SUFFIX(BindRenderbuf
fer, EXT); | 253 interface->fBindRenderbuffer = GET_PROC_SUFFIX(BindRenderbuf
fer, EXT); |
250 #endif | 254 #endif |
251 } | 255 } |
252 if (GrGLHasExtensionFromString("GL_EXT_framebuffer_multisample", ext
Str)) { | 256 if (extensions.has("GL_EXT_framebuffer_multisample")) { |
253 #if GL_EXT_framebuffer_multisample | 257 #if GL_EXT_framebuffer_multisample |
254 interface->fRenderbufferStorageMultisample = glRenderbufferS
torageMultisampleEXT; | 258 interface->fRenderbufferStorageMultisample = glRenderbufferS
torageMultisampleEXT; |
255 #else | 259 #else |
256 interface->fRenderbufferStorageMultisample = GET_PROC_SUFFIX
(RenderbufferStorageMultisample, EXT); | 260 interface->fRenderbufferStorageMultisample = GET_PROC_SUFFIX
(RenderbufferStorageMultisample, EXT); |
257 #endif | 261 #endif |
258 } | 262 } |
259 if (GrGLHasExtensionFromString("", extStr)) { | 263 if (extensions.has("GL_EXT_framebuffer_blit")) { |
260 #if GL_EXT_framebuffer_blit | 264 #if GL_EXT_framebuffer_blit |
261 interface->fBlitFramebuffer = glBlitFramebufferEXT; | 265 interface->fBlitFramebuffer = glBlitFramebufferEXT; |
262 #else | 266 #else |
263 interface->fBlitFramebuffer = GET_PROC_SUFFIX(BlitFramebuffe
r, EXT); | 267 interface->fBlitFramebuffer = GET_PROC_SUFFIX(BlitFramebuffe
r, EXT); |
264 #endif | 268 #endif |
265 } | 269 } |
266 } | 270 } |
267 if (ver >= GR_GL_VER(3,3) || GrGLHasExtensionFromString("GL_ARB_blend_fu
nc_extended", extStr)) { | 271 if (ver >= GR_GL_VER(3,3) || extensions.has("GL_ARB_blend_func_extended"
)) { |
268 // ARB extension doesn't use the ARB suffix on the function name | 272 // ARB extension doesn't use the ARB suffix on the function name |
269 #if GL_VERSION_3_3 || GL_ARB_blend_func_extended | 273 #if GL_VERSION_3_3 || GL_ARB_blend_func_extended |
270 interface->fBindFragDataLocationIndexed = glBindFragDataLocation
Indexed; | 274 interface->fBindFragDataLocationIndexed = glBindFragDataLocation
Indexed; |
271 #else | 275 #else |
272 interface->fBindFragDataLocationIndexed = GET_PROC(BindFragDataL
ocationIndexed); | 276 interface->fBindFragDataLocationIndexed = GET_PROC(BindFragDataL
ocationIndexed); |
273 #endif | 277 #endif |
274 } | 278 } |
275 | |
276 interface->fBindingsExported = kDesktop_GrGLBinding; | |
277 } | 279 } |
278 glInterface.get()->ref(); | 280 glInterface.get()->ref(); |
279 return glInterface.get(); | 281 return glInterface.get(); |
280 } | 282 } |
OLD | NEW |