OLD | NEW |
1 // Modified from chromium/src/webkit/glue/gl_bindings_skia_cmd_buffer.cc | 1 // Modified from chromium/src/webkit/glue/gl_bindings_skia_cmd_buffer.cc |
2 | 2 |
3 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 // Use of this source code is governed by a BSD-style license that can be | 4 // Use of this source code is governed by a BSD-style license that can be |
5 // found in the LICENSE file. | 5 // found in the LICENSE file. |
6 | 6 |
7 #include "gl/GrGLExtensions.h" | 7 #include "gl/GrGLExtensions.h" |
8 #include "gl/GrGLInterface.h" | 8 #include "gl/GrGLInterface.h" |
9 #include "gl/GrGLUtil.h" | 9 #include "gl/GrGLUtil.h" |
10 | 10 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 interface->fVertexAttrib4fv = glVertexAttrib4fv; | 140 interface->fVertexAttrib4fv = glVertexAttrib4fv; |
141 interface->fVertexAttribPointer = glVertexAttribPointer; | 141 interface->fVertexAttribPointer = glVertexAttribPointer; |
142 interface->fViewport = glViewport; | 142 interface->fViewport = glViewport; |
143 interface->fBindFramebuffer = glBindFramebuffer; | 143 interface->fBindFramebuffer = glBindFramebuffer; |
144 interface->fBindRenderbuffer = glBindRenderbuffer; | 144 interface->fBindRenderbuffer = glBindRenderbuffer; |
145 interface->fCheckFramebufferStatus = glCheckFramebufferStatus; | 145 interface->fCheckFramebufferStatus = glCheckFramebufferStatus; |
146 interface->fDeleteFramebuffers = glDeleteFramebuffers; | 146 interface->fDeleteFramebuffers = glDeleteFramebuffers; |
147 interface->fDeleteRenderbuffers = glDeleteRenderbuffers; | 147 interface->fDeleteRenderbuffers = glDeleteRenderbuffers; |
148 interface->fFramebufferRenderbuffer = glFramebufferRenderbuffer; | 148 interface->fFramebufferRenderbuffer = glFramebufferRenderbuffer; |
149 interface->fFramebufferTexture2D = glFramebufferTexture2D; | 149 interface->fFramebufferTexture2D = glFramebufferTexture2D; |
| 150 #if GR_GL_IGNORE_ES3_MSAA |
| 151 |
150 if (extensions.has("GL_EXT_multisampled_render_to_texture")) { | 152 if (extensions.has("GL_EXT_multisampled_render_to_texture")) { |
151 #if GL_EXT_multisampled_render_to_texture | 153 #if GL_EXT_multisampled_render_to_texture |
152 interface->fFramebufferTexture2DMultisample = glFramebufferTexture2DMult
isampleEXT; | 154 interface->fFramebufferTexture2DMultisample = glFramebufferTexture2DMult
isampleEXT; |
153 interface->fRenderbufferStorageMultisample = glRenderbufferStorageMultis
ampleEXT; | 155 interface->fRenderbufferStorageMultisample = glRenderbufferStorageMultis
ampleEXT; |
154 #else | 156 #else |
155 interface->fFramebufferTexture2DMultisample = (GrGLFramebufferTexture2DM
ultisampleProc) eglGetProcAddress("glFramebufferTexture2DMultisampleEXT"); | 157 interface->fFramebufferTexture2DMultisample = (GrGLFramebufferTexture2DM
ultisampleProc) eglGetProcAddress("glFramebufferTexture2DMultisampleEXT"); |
156 interface->fRenderbufferStorageMultisample = (GrGLRenderbufferStorageMul
tisampleProc) eglGetProcAddress("glRenderbufferStorageMultisampleEXT"); | 158 interface->fRenderbufferStorageMultisample = (GrGLRenderbufferStorageMul
tisampleProc) eglGetProcAddress("glRenderbufferStorageMultisampleEXT"); |
157 #endif | 159 #endif |
158 } else if (extensions.has("GL_IMG_multisampled_render_to_texture")) { | 160 } else if (extensions.has("GL_IMG_multisampled_render_to_texture")) { |
159 #if GL_IMG_multisampled_render_to_texture | 161 #if GL_IMG_multisampled_render_to_texture |
160 interface->fFramebufferTexture2DMultisample = glFramebufferTexture2DMult
isampleIMG; | 162 interface->fFramebufferTexture2DMultisample = glFramebufferTexture2DMult
isampleIMG; |
161 interface->fRenderbufferStorageMultisample = glRenderbufferStorageMultis
ampleIMG; | 163 interface->fRenderbufferStorageMultisample = glRenderbufferStorageMultis
ampleIMG; |
162 #else | 164 #else |
163 interface->fFramebufferTexture2DMultisample = (GrGLFramebufferTexture2DM
ultisampleProc) eglGetProcAddress("glFramebufferTexture2DMultisampleIMG"); | 165 interface->fFramebufferTexture2DMultisample = (GrGLFramebufferTexture2DM
ultisampleProc) eglGetProcAddress("glFramebufferTexture2DMultisampleIMG"); |
164 interface->fRenderbufferStorageMultisample = (GrGLRenderbufferStorageMul
tisampleProc) eglGetProcAddress("glRenderbufferStorageMultisampleIMG"); | 166 interface->fRenderbufferStorageMultisample = (GrGLRenderbufferStorageMul
tisampleProc) eglGetProcAddress("glRenderbufferStorageMultisampleIMG"); |
165 #endif | 167 #endif |
166 } | 168 } |
| 169 |
| 170 #else // GR_GL_IGNORE_ES3_MSAA |
| 171 |
| 172 if (version >= GR_GL_VER(3,0)) { |
| 173 #if GL_ES_VERSION_3_0 |
| 174 interface->fRenderbufferStorageMultisample = glRenderbufferStorageMu
ltisample; |
| 175 interface->fBlitFramebuffer = glBlitFramebuffer; |
| 176 #else |
| 177 interface->fRenderbufferStorageMultisample = (GrGLRenderbufferStorag
eMultisampleProc) eglGetProcAddress("glRenderbufferStorageMultisample"); |
| 178 interface->fBlitFramebuffer = (GrGLBlitFramebufferProc) eglGetProcAd
dress("glBlitFramebuffer"); |
| 179 #endif |
| 180 } |
| 181 if (extensions.has("GL_EXT_multisampled_render_to_texture")) { |
| 182 #if GL_EXT_multisampled_render_to_texture |
| 183 interface->fFramebufferTexture2DMultisample = glFramebufferTexture2D
MultisampleEXT; |
| 184 interface->fRenderbufferStorageMultisampleES2EXT = glRenderbufferSto
rageMultisampleEXT; |
| 185 #else |
| 186 interface->fFramebufferTexture2DMultisample = (GrGLFramebufferTextur
e2DMultisampleProc) eglGetProcAddress("glFramebufferTexture2DMultisampleEXT"); |
| 187 interface->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbuffer
StorageMultisampleProc) eglGetProcAddress("glRenderbufferStorageMultisampleEXT")
; |
| 188 #endif |
| 189 } else if (extensions.has("GL_IMG_multisampled_render_to_texture")) { |
| 190 #if GL_IMG_multisampled_render_to_texture |
| 191 interface->fFramebufferTexture2DMultisample = glFramebufferTexture2D
MultisampleIMG; |
| 192 interface->fRenderbufferStorageMultisampleES2EXT = glRenderbufferSto
rageMultisampleIMG; |
| 193 #else |
| 194 interface->fFramebufferTexture2DMultisample = (GrGLFramebufferTextur
e2DMultisampleProc) eglGetProcAddress("glFramebufferTexture2DMultisampleIMG"); |
| 195 interface->fRenderbufferStorageMultisampleES2EXT = (GrGLRenderbuffer
StorageMultisampleProc) eglGetProcAddress("glRenderbufferStorageMultisampleIMG")
; |
| 196 #endif |
| 197 } |
| 198 |
| 199 #endif // GR_GL_IGNORE_ES3_MSAA |
167 interface->fGenFramebuffers = glGenFramebuffers; | 200 interface->fGenFramebuffers = glGenFramebuffers; |
168 interface->fGenRenderbuffers = glGenRenderbuffers; | 201 interface->fGenRenderbuffers = glGenRenderbuffers; |
169 interface->fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachment
Parameteriv; | 202 interface->fGetFramebufferAttachmentParameteriv = glGetFramebufferAttachment
Parameteriv; |
170 interface->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv; | 203 interface->fGetRenderbufferParameteriv = glGetRenderbufferParameteriv; |
171 interface->fRenderbufferStorage = glRenderbufferStorage; | 204 interface->fRenderbufferStorage = glRenderbufferStorage; |
172 #if GL_OES_mapbuffer | 205 #if GL_OES_mapbuffer |
173 interface->fMapBuffer = glMapBufferOES; | 206 interface->fMapBuffer = glMapBufferOES; |
174 interface->fUnmapBuffer = glUnmapBufferOES; | 207 interface->fUnmapBuffer = glUnmapBufferOES; |
175 #else | 208 #else |
176 interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOE
S"); | 209 interface->fMapBuffer = (GrGLMapBufferProc) eglGetProcAddress("glMapBufferOE
S"); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 426 } |
394 | 427 |
395 if (kES_GrGLBinding == binding) { | 428 if (kES_GrGLBinding == binding) { |
396 return create_es_interface(version, extensions); | 429 return create_es_interface(version, extensions); |
397 } else if (kDesktop_GrGLBinding == binding) { | 430 } else if (kDesktop_GrGLBinding == binding) { |
398 return create_desktop_interface(version, extensions); | 431 return create_desktop_interface(version, extensions); |
399 } else { | 432 } else { |
400 return NULL; | 433 return NULL; |
401 } | 434 } |
402 } | 435 } |
OLD | NEW |