OLD | NEW |
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 "gpu/command_buffer/service/texture_manager.h" | 7 #include "gpu/command_buffer/service/texture_manager.h" |
8 #include "ui/gl/gl_image.h" | 8 #include "ui/gl/gl_image.h" |
9 #include "ui/gl/gl_implementation.h" | 9 #include "ui/gl/gl_implementation.h" |
10 #include "ui/gl/scoped_binders.h" | 10 #include "ui/gl/scoped_binders.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 scoped_refptr<NativeImageBufferEGL> NativeImageBufferEGL::Create( | 114 scoped_refptr<NativeImageBufferEGL> NativeImageBufferEGL::Create( |
115 GLuint texture_id) { | 115 GLuint texture_id) { |
116 EGLDisplay egl_display = gfx::GLSurfaceEGL::GetHardwareDisplay(); | 116 EGLDisplay egl_display = gfx::GLSurfaceEGL::GetHardwareDisplay(); |
117 EGLContext egl_context = eglGetCurrentContext(); | 117 EGLContext egl_context = eglGetCurrentContext(); |
118 | 118 |
119 DCHECK_NE(EGL_NO_CONTEXT, egl_context); | 119 DCHECK_NE(EGL_NO_CONTEXT, egl_context); |
120 DCHECK_NE(EGL_NO_DISPLAY, egl_display); | 120 DCHECK_NE(EGL_NO_DISPLAY, egl_display); |
121 DCHECK(glIsTexture(texture_id)); | 121 DCHECK(glIsTexture(texture_id)); |
122 | 122 |
123 // TODO: Need to generate and check EGL_KHR_gl_texture_2D_image | 123 DCHECK(gfx::g_driver_egl.ext.b_EGL_KHR_image_base && |
124 if (!gfx::g_driver_egl.ext.b_EGL_KHR_image_base || | 124 gfx::g_driver_egl.ext.b_EGL_KHR_gl_texture_2D_image && |
125 !gfx::g_driver_gl.ext.b_GL_OES_EGL_image) { | 125 gfx::g_driver_gl.ext.b_GL_OES_EGL_image && |
126 return NULL; | 126 gfx::g_driver_egl.ext.b_EGL_KHR_fence_sync); |
127 } | |
128 | 127 |
129 const EGLint egl_attrib_list[] = { | 128 const EGLint egl_attrib_list[] = { |
130 EGL_GL_TEXTURE_LEVEL_KHR, 0, EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; | 129 EGL_GL_TEXTURE_LEVEL_KHR, 0, EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; |
131 EGLClientBuffer egl_buffer = reinterpret_cast<EGLClientBuffer>(texture_id); | 130 EGLClientBuffer egl_buffer = reinterpret_cast<EGLClientBuffer>(texture_id); |
132 EGLenum egl_target = EGL_GL_TEXTURE_2D_KHR; // TODO | 131 EGLenum egl_target = EGL_GL_TEXTURE_2D_KHR; // TODO |
133 | 132 |
134 EGLImageKHR egl_image = eglCreateImageKHR( | 133 EGLImageKHR egl_image = eglCreateImageKHR( |
135 egl_display, egl_context, egl_target, egl_buffer, egl_attrib_list); | 134 egl_display, egl_context, egl_target, egl_buffer, egl_attrib_list); |
136 | 135 |
137 if (egl_image == EGL_NO_IMAGE_KHR) | 136 if (egl_image == EGL_NO_IMAGE_KHR) |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 435 |
437 // All structural changes should have orphaned the texture. | 436 // All structural changes should have orphaned the texture. |
438 if (image_buffer_ && !texture->GetLevelImage(texture->target(), 0)) | 437 if (image_buffer_ && !texture->GetLevelImage(texture->target(), 0)) |
439 return false; | 438 return false; |
440 | 439 |
441 return true; | 440 return true; |
442 } | 441 } |
443 | 442 |
444 } // namespace gles2 | 443 } // namespace gles2 |
445 } // namespace gpu | 444 } // namespace gpu |
OLD | NEW |