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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 | 8 |
9 #include <GLES2/gl2ext.h> | 9 #include <GLES2/gl2ext.h> |
10 #include <GLES2/gl2extchromium.h> | 10 #include <GLES2/gl2extchromium.h> |
(...skipping 2184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2195 switch (name) { | 2195 switch (name) { |
2196 case GL_EXTENSIONS: | 2196 case GL_EXTENSIONS: |
2197 str += std::string(str.empty() ? "" : " ") + | 2197 str += std::string(str.empty() ? "" : " ") + |
2198 "GL_CHROMIUM_flipy " | 2198 "GL_CHROMIUM_flipy " |
2199 "GL_EXT_unpack_subimage " | 2199 "GL_EXT_unpack_subimage " |
2200 "GL_CHROMIUM_map_sub"; | 2200 "GL_CHROMIUM_map_sub"; |
2201 if (capabilities_.map_image) { | 2201 if (capabilities_.map_image) { |
2202 // The first space character is intentional. | 2202 // The first space character is intentional. |
2203 str += " GL_CHROMIUM_map_image"; | 2203 str += " GL_CHROMIUM_map_image"; |
2204 } | 2204 } |
| 2205 if (capabilities_.future_sync_points) |
| 2206 str += " GL_CHROMIUM_future_sync_point"; |
2205 break; | 2207 break; |
2206 default: | 2208 default: |
2207 break; | 2209 break; |
2208 } | 2210 } |
2209 | 2211 |
2210 // Because of WebGL the extensions can change. We have to cache each unique | 2212 // Because of WebGL the extensions can change. We have to cache each unique |
2211 // result since we don't know when the client will stop referring to a | 2213 // result since we don't know when the client will stop referring to a |
2212 // previous one it queries. | 2214 // previous one it queries. |
2213 GLStringMap::iterator it = gl_strings_.find(name); | 2215 GLStringMap::iterator it = gl_strings_.find(name); |
2214 if (it == gl_strings_.end()) { | 2216 if (it == gl_strings_.end()) { |
(...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3984 CheckGLError(); | 3986 CheckGLError(); |
3985 } | 3987 } |
3986 | 3988 |
3987 GLuint GLES2Implementation::InsertSyncPointCHROMIUM() { | 3989 GLuint GLES2Implementation::InsertSyncPointCHROMIUM() { |
3988 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 3990 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
3989 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertSyncPointCHROMIUM"); | 3991 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertSyncPointCHROMIUM"); |
3990 helper_->CommandBufferHelper::Flush(); | 3992 helper_->CommandBufferHelper::Flush(); |
3991 return gpu_control_->InsertSyncPoint(); | 3993 return gpu_control_->InsertSyncPoint(); |
3992 } | 3994 } |
3993 | 3995 |
| 3996 GLuint GLES2Implementation::InsertFutureSyncPointCHROMIUM() { |
| 3997 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 3998 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertFutureSyncPointCHROMIUM"); |
| 3999 DCHECK(capabilities_.future_sync_points); |
| 4000 helper_->CommandBufferHelper::Flush(); |
| 4001 return gpu_control_->InsertFutureSyncPoint(); |
| 4002 } |
| 4003 |
| 4004 void GLES2Implementation::RetireSyncPointCHROMIUM(GLuint sync_point) { |
| 4005 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 4006 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRetireSyncPointCHROMIUM(" |
| 4007 << sync_point << ")"); |
| 4008 DCHECK(capabilities_.future_sync_points); |
| 4009 helper_->CommandBufferHelper::Flush(); |
| 4010 gpu_control_->RetireSyncPoint(sync_point); |
| 4011 } |
| 4012 |
3994 GLuint GLES2Implementation::CreateImageCHROMIUMHelper(GLsizei width, | 4013 GLuint GLES2Implementation::CreateImageCHROMIUMHelper(GLsizei width, |
3995 GLsizei height, | 4014 GLsizei height, |
3996 GLenum internalformat, | 4015 GLenum internalformat, |
3997 GLenum usage) { | 4016 GLenum usage) { |
3998 if (width <= 0) { | 4017 if (width <= 0) { |
3999 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0"); | 4018 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0"); |
4000 return 0; | 4019 return 0; |
4001 } | 4020 } |
4002 | 4021 |
4003 if (height <= 0) { | 4022 if (height <= 0) { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4167 return true; | 4186 return true; |
4168 } | 4187 } |
4169 | 4188 |
4170 // Include the auto-generated part of this file. We split this because it means | 4189 // Include the auto-generated part of this file. We split this because it means |
4171 // we can easily edit the non-auto generated parts right here in this file | 4190 // we can easily edit the non-auto generated parts right here in this file |
4172 // instead of having to edit some template or the code generator. | 4191 // instead of having to edit some template or the code generator. |
4173 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 4192 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
4174 | 4193 |
4175 } // namespace gles2 | 4194 } // namespace gles2 |
4176 } // namespace gpu | 4195 } // namespace gpu |
OLD | NEW |