Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: gpu/command_buffer/service/texture_definition.cc

Issue 2629633003: Refactor GL bindings so there is no global GLApi or DriverGL. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "gpu/command_buffer/service/texture_definition.h" 5 #include "gpu/command_buffer/service/texture_definition.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <list> 9 #include <list>
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 GLuint texture_id) { 152 GLuint texture_id) {
153 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); 153 EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay();
154 EGLContext egl_context = eglGetCurrentContext(); 154 EGLContext egl_context = eglGetCurrentContext();
155 155
156 DCHECK_NE(EGL_NO_CONTEXT, egl_context); 156 DCHECK_NE(EGL_NO_CONTEXT, egl_context);
157 DCHECK_NE(EGL_NO_DISPLAY, egl_display); 157 DCHECK_NE(EGL_NO_DISPLAY, egl_display);
158 DCHECK(glIsTexture(texture_id)); 158 DCHECK(glIsTexture(texture_id));
159 159
160 DCHECK(gl::g_driver_egl.ext.b_EGL_KHR_image_base && 160 DCHECK(gl::g_driver_egl.ext.b_EGL_KHR_image_base &&
161 gl::g_driver_egl.ext.b_EGL_KHR_gl_texture_2D_image && 161 gl::g_driver_egl.ext.b_EGL_KHR_gl_texture_2D_image &&
162 gl::g_driver_gl.ext.b_GL_OES_EGL_image); 162 gl::g_current_gl_driver->ext.b_GL_OES_EGL_image);
163 163
164 const EGLint egl_attrib_list[] = { 164 const EGLint egl_attrib_list[] = {
165 EGL_GL_TEXTURE_LEVEL_KHR, 0, EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; 165 EGL_GL_TEXTURE_LEVEL_KHR, 0, EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE};
166 EGLClientBuffer egl_buffer = reinterpret_cast<EGLClientBuffer>(texture_id); 166 EGLClientBuffer egl_buffer = reinterpret_cast<EGLClientBuffer>(texture_id);
167 EGLenum egl_target = EGL_GL_TEXTURE_2D_KHR; 167 EGLenum egl_target = EGL_GL_TEXTURE_2D_KHR;
168 168
169 EGLImageKHR egl_image = eglCreateImageKHR( 169 EGLImageKHR egl_image = eglCreateImageKHR(
170 egl_display, egl_context, egl_target, egl_buffer, egl_attrib_list); 170 egl_display, egl_context, egl_target, egl_buffer, egl_attrib_list);
171 171
172 if (egl_image == EGL_NO_IMAGE_KHR) { 172 if (egl_image == EGL_NO_IMAGE_KHR) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } // anonymous namespace 258 } // anonymous namespace
259 259
260 // static 260 // static
261 scoped_refptr<NativeImageBuffer> NativeImageBuffer::Create(GLuint texture_id) { 261 scoped_refptr<NativeImageBuffer> NativeImageBuffer::Create(GLuint texture_id) {
262 switch (gl::GetGLImplementation()) { 262 switch (gl::GetGLImplementation()) {
263 #if !defined(OS_MACOSX) 263 #if !defined(OS_MACOSX)
264 case gl::kGLImplementationEGLGLES2: 264 case gl::kGLImplementationEGLGLES2:
265 return NativeImageBufferEGL::Create(texture_id); 265 return NativeImageBufferEGL::Create(texture_id);
266 #endif 266 #endif
267 case gl::kGLImplementationMockGL: 267 case gl::kGLImplementationMockGL:
268 case gl::kGLImplementationStubGL:
268 return new NativeImageBufferStub; 269 return new NativeImageBufferStub;
269 default: 270 default:
270 NOTREACHED(); 271 NOTREACHED();
271 return NULL; 272 return NULL;
272 } 273 }
273 } 274 }
274 275
275 // static 276 // static
276 void TextureDefinition::AvoidEGLTargetTextureReuse() { 277 void TextureDefinition::AvoidEGLTargetTextureReuse() {
277 g_avoid_egl_target_texture_reuse = true; 278 g_avoid_egl_target_texture_reuse = true;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 return true; 462 return true;
462 } 463 }
463 464
464 bool TextureDefinition::SafeToRenderFrom() const { 465 bool TextureDefinition::SafeToRenderFrom() const {
465 return level_info_.cleared_rect.Contains( 466 return level_info_.cleared_rect.Contains(
466 gfx::Rect(level_info_.width, level_info_.height)); 467 gfx::Rect(level_info_.width, level_info_.height));
467 } 468 }
468 469
469 } // namespace gles2 470 } // namespace gles2
470 } // namespace gpu 471 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/program_manager_unittest.cc ('k') | gpu/command_buffer/tests/fuzzer_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698