| 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 <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 max_cube_map_texture_size(0), | 59 max_cube_map_texture_size(0), |
| 60 max_fragment_uniform_vectors(0), | 60 max_fragment_uniform_vectors(0), |
| 61 max_renderbuffer_size(0), | 61 max_renderbuffer_size(0), |
| 62 max_texture_image_units(0), | 62 max_texture_image_units(0), |
| 63 max_texture_size(0), | 63 max_texture_size(0), |
| 64 max_varying_vectors(0), | 64 max_varying_vectors(0), |
| 65 max_vertex_attribs(0), | 65 max_vertex_attribs(0), |
| 66 max_vertex_texture_image_units(0), | 66 max_vertex_texture_image_units(0), |
| 67 max_vertex_uniform_vectors(0), | 67 max_vertex_uniform_vectors(0), |
| 68 num_compressed_texture_formats(0), | 68 num_compressed_texture_formats(0), |
| 69 num_shader_binary_formats(0) { | 69 num_shader_binary_formats(0) |
| 70 } | 70 #if defined(OS_CHROMEOS) |
| 71 , bind_generates_resource_chromium(0) |
| 72 #endif |
| 73 {} |
| 71 | 74 |
| 72 GLES2Implementation::SingleThreadChecker::SingleThreadChecker( | 75 GLES2Implementation::SingleThreadChecker::SingleThreadChecker( |
| 73 GLES2Implementation* gles2_implementation) | 76 GLES2Implementation* gles2_implementation) |
| 74 : gles2_implementation_(gles2_implementation) { | 77 : gles2_implementation_(gles2_implementation) { |
| 75 CHECK_EQ(0, gles2_implementation_->use_count_); | 78 CHECK_EQ(0, gles2_implementation_->use_count_); |
| 76 ++gles2_implementation_->use_count_; | 79 ++gles2_implementation_->use_count_; |
| 77 } | 80 } |
| 78 | 81 |
| 79 GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() { | 82 GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() { |
| 80 --gles2_implementation_->use_count_; | 83 --gles2_implementation_->use_count_; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) | 184 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) |
| 182 GetIdHandler(id_namespaces::kBuffers)->MakeIds( | 185 GetIdHandler(id_namespaces::kBuffers)->MakeIds( |
| 183 this, kClientSideArrayId, arraysize(reserved_ids_), &reserved_ids_[0]); | 186 this, kClientSideArrayId, arraysize(reserved_ids_), &reserved_ids_[0]); |
| 184 #endif | 187 #endif |
| 185 | 188 |
| 186 vertex_array_object_manager_.reset(new VertexArrayObjectManager( | 189 vertex_array_object_manager_.reset(new VertexArrayObjectManager( |
| 187 static_state_.int_state.max_vertex_attribs, | 190 static_state_.int_state.max_vertex_attribs, |
| 188 reserved_ids_[0], | 191 reserved_ids_[0], |
| 189 reserved_ids_[1])); | 192 reserved_ids_[1])); |
| 190 | 193 |
| 194 #if defined(OS_CHROMEOS) |
| 195 // GL_BIND_GENERATES_RESOURCE_CHROMIUM state must be the same |
| 196 // on Client & Service. |
| 197 if (static_state_.int_state.bind_generates_resource_chromium != |
| 198 (share_group_->bind_generates_resource() ? 1 : 0)) { |
| 199 SetGLError(GL_INVALID_OPERATION, |
| 200 "Initialize", |
| 201 "Service bind_generates_resource mismatch."); |
| 202 return false; |
| 203 } |
| 204 #endif |
| 191 return true; | 205 return true; |
| 192 } | 206 } |
| 193 | 207 |
| 194 bool GLES2Implementation::QueryAndCacheStaticState() { | 208 bool GLES2Implementation::QueryAndCacheStaticState() { |
| 195 // Setup query for multiple GetIntegerv's | 209 // Setup query for multiple GetIntegerv's |
| 196 static const GLenum pnames[] = { | 210 static const GLenum pnames[] = { |
| 197 GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, | 211 GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, |
| 198 GL_MAX_CUBE_MAP_TEXTURE_SIZE, | 212 GL_MAX_CUBE_MAP_TEXTURE_SIZE, |
| 199 GL_MAX_FRAGMENT_UNIFORM_VECTORS, | 213 GL_MAX_FRAGMENT_UNIFORM_VECTORS, |
| 200 GL_MAX_RENDERBUFFER_SIZE, | 214 GL_MAX_RENDERBUFFER_SIZE, |
| 201 GL_MAX_TEXTURE_IMAGE_UNITS, | 215 GL_MAX_TEXTURE_IMAGE_UNITS, |
| 202 GL_MAX_TEXTURE_SIZE, | 216 GL_MAX_TEXTURE_SIZE, |
| 203 GL_MAX_VARYING_VECTORS, | 217 GL_MAX_VARYING_VECTORS, |
| 204 GL_MAX_VERTEX_ATTRIBS, | 218 GL_MAX_VERTEX_ATTRIBS, |
| 205 GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, | 219 GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, |
| 206 GL_MAX_VERTEX_UNIFORM_VECTORS, | 220 GL_MAX_VERTEX_UNIFORM_VECTORS, |
| 207 GL_NUM_COMPRESSED_TEXTURE_FORMATS, | 221 GL_NUM_COMPRESSED_TEXTURE_FORMATS, |
| 208 GL_NUM_SHADER_BINARY_FORMATS, | 222 GL_NUM_SHADER_BINARY_FORMATS, |
| 223 #if defined(OS_CHROMEOS) |
| 224 GL_BIND_GENERATES_RESOURCE_CHROMIUM, |
| 225 #endif |
| 209 }; | 226 }; |
| 210 | 227 |
| 211 GetMultipleIntegervState integerv_state( | 228 GetMultipleIntegervState integerv_state( |
| 212 pnames, arraysize(pnames), | 229 pnames, arraysize(pnames), |
| 213 &static_state_.int_state.max_combined_texture_image_units, | 230 &static_state_.int_state.max_combined_texture_image_units, |
| 214 sizeof(static_state_.int_state)); | 231 sizeof(static_state_.int_state)); |
| 215 if (!GetMultipleIntegervSetup(&integerv_state)) { | 232 if (!GetMultipleIntegervSetup(&integerv_state)) { |
| 216 return false; | 233 return false; |
| 217 } | 234 } |
| 218 | 235 |
| (...skipping 3708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3927 CheckGLError(); | 3944 CheckGLError(); |
| 3928 } | 3945 } |
| 3929 | 3946 |
| 3930 // Include the auto-generated part of this file. We split this because it means | 3947 // Include the auto-generated part of this file. We split this because it means |
| 3931 // we can easily edit the non-auto generated parts right here in this file | 3948 // we can easily edit the non-auto generated parts right here in this file |
| 3932 // instead of having to edit some template or the code generator. | 3949 // instead of having to edit some template or the code generator. |
| 3933 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 3950 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 3934 | 3951 |
| 3935 } // namespace gles2 | 3952 } // namespace gles2 |
| 3936 } // namespace gpu | 3953 } // namespace gpu |
| OLD | NEW |