OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gl/gl_gl_api_implementation.h" | 5 #include "ui/gl/gl_gl_api_implementation.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return type; | 124 return type; |
125 } | 125 } |
126 | 126 |
127 static void GL_BINDING_CALL CustomTexImage2D( | 127 static void GL_BINDING_CALL CustomTexImage2D( |
128 GLenum target, GLint level, GLint internalformat, | 128 GLenum target, GLint level, GLint internalformat, |
129 GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, | 129 GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, |
130 const void* pixels) { | 130 const void* pixels) { |
131 GLenum gl_internal_format = GetTexInternalFormat( | 131 GLenum gl_internal_format = GetTexInternalFormat( |
132 internalformat, format, type); | 132 internalformat, format, type); |
133 GLenum gl_type = GetTexType(type); | 133 GLenum gl_type = GetTexType(type); |
134 return g_driver_gl.orig_fn.glTexImage2DFn( | 134 g_driver_gl.orig_fn.glTexImage2DFn( |
135 target, level, gl_internal_format, width, height, border, format, gl_type, | 135 target, level, gl_internal_format, width, height, border, format, gl_type, |
136 pixels); | 136 pixels); |
137 } | 137 } |
138 | 138 |
139 static void GL_BINDING_CALL CustomTexSubImage2D( | 139 static void GL_BINDING_CALL CustomTexSubImage2D( |
140 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, | 140 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, |
141 GLsizei height, GLenum format, GLenum type, const void* pixels) { | 141 GLsizei height, GLenum format, GLenum type, const void* pixels) { |
142 GLenum gl_type = GetTexType(type); | 142 GLenum gl_type = GetTexType(type); |
143 return g_driver_gl.orig_fn.glTexSubImage2DFn( | 143 g_driver_gl.orig_fn.glTexSubImage2DFn( |
144 target, level, xoffset, yoffset, width, height, format, gl_type, pixels); | 144 target, level, xoffset, yoffset, width, height, format, gl_type, pixels); |
145 } | 145 } |
146 | 146 |
147 static void GL_BINDING_CALL CustomTexStorage2DEXT( | 147 static void GL_BINDING_CALL CustomTexStorage2DEXT( |
148 GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, | 148 GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, |
149 GLsizei height) { | 149 GLsizei height) { |
150 GLenum gl_internal_format = GetInternalFormat(internalformat); | 150 GLenum gl_internal_format = GetInternalFormat(internalformat); |
151 return g_driver_gl.orig_fn.glTexStorage2DEXTFn( | 151 g_driver_gl.orig_fn.glTexStorage2DEXTFn( |
152 target, levels, gl_internal_format, width, height); | 152 target, levels, gl_internal_format, width, height); |
153 } | 153 } |
154 | 154 |
155 static void GL_BINDING_CALL CustomRenderbufferStorageEXT( | 155 static void GL_BINDING_CALL CustomRenderbufferStorageEXT( |
156 GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { | 156 GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { |
157 GLenum gl_internal_format = GetInternalFormat(internalformat); | 157 GLenum gl_internal_format = GetInternalFormat(internalformat); |
158 return g_driver_gl.orig_fn.glRenderbufferStorageEXTFn( | 158 g_driver_gl.orig_fn.glRenderbufferStorageEXTFn( |
159 target, gl_internal_format, width, height); | 159 target, gl_internal_format, width, height); |
160 } | 160 } |
161 | 161 |
162 // The ANGLE and IMG variants of glRenderbufferStorageMultisample currently do | 162 // The ANGLE and IMG variants of glRenderbufferStorageMultisample currently do |
163 // not support BGRA render buffers so only the EXT one is customized. If | 163 // not support BGRA render buffers so only the EXT one is customized. If |
164 // GL_CHROMIUM_renderbuffer_format_BGRA8888 support is added to ANGLE then the | 164 // GL_CHROMIUM_renderbuffer_format_BGRA8888 support is added to ANGLE then the |
165 // ANGLE version should also be customized. | 165 // ANGLE version should also be customized. |
166 static void GL_BINDING_CALL CustomRenderbufferStorageMultisampleEXT( | 166 static void GL_BINDING_CALL CustomRenderbufferStorageMultisampleEXT( |
167 GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, | 167 GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, |
168 GLsizei height) { | 168 GLsizei height) { |
169 GLenum gl_internal_format = GetInternalFormat(internalformat); | 169 GLenum gl_internal_format = GetInternalFormat(internalformat); |
170 return g_driver_gl.orig_fn.glRenderbufferStorageMultisampleEXTFn( | 170 g_driver_gl.orig_fn.glRenderbufferStorageMultisampleEXTFn( |
171 target, samples, gl_internal_format, width, height); | 171 target, samples, gl_internal_format, width, height); |
172 } | 172 } |
173 | 173 |
174 } // anonymous namespace | 174 } // anonymous namespace |
175 | 175 |
176 void DriverGL::InitializeCustomDynamicBindings(GLContext* context) { | 176 void DriverGL::InitializeCustomDynamicBindings(GLContext* context) { |
177 InitializeDynamicBindings(context); | 177 InitializeDynamicBindings(context); |
178 | 178 |
179 DCHECK(orig_fn.glTexImage2DFn == NULL); | 179 DCHECK(orig_fn.glTexImage2DFn == NULL); |
180 orig_fn.glTexImage2DFn = fn.glTexImage2DFn; | 180 orig_fn.glTexImage2DFn = fn.glTexImage2DFn; |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 GLApiBase::glFlushFn(); | 482 GLApiBase::glFlushFn(); |
483 GLApiBase::SignalFlush(); | 483 GLApiBase::SignalFlush(); |
484 } | 484 } |
485 | 485 |
486 void VirtualGLApi::glFinishFn() { | 486 void VirtualGLApi::glFinishFn() { |
487 GLApiBase::glFinishFn(); | 487 GLApiBase::glFinishFn(); |
488 GLApiBase::SignalFlush(); | 488 GLApiBase::SignalFlush(); |
489 } | 489 } |
490 | 490 |
491 } // namespace gfx | 491 } // namespace gfx |
OLD | NEW |