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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 max_cube_map_texture_size(0), | 60 max_cube_map_texture_size(0), |
61 max_fragment_uniform_vectors(0), | 61 max_fragment_uniform_vectors(0), |
62 max_renderbuffer_size(0), | 62 max_renderbuffer_size(0), |
63 max_texture_image_units(0), | 63 max_texture_image_units(0), |
64 max_texture_size(0), | 64 max_texture_size(0), |
65 max_varying_vectors(0), | 65 max_varying_vectors(0), |
66 max_vertex_attribs(0), | 66 max_vertex_attribs(0), |
67 max_vertex_texture_image_units(0), | 67 max_vertex_texture_image_units(0), |
68 max_vertex_uniform_vectors(0), | 68 max_vertex_uniform_vectors(0), |
69 num_compressed_texture_formats(0), | 69 num_compressed_texture_formats(0), |
70 num_shader_binary_formats(0) { | 70 num_shader_binary_formats(0), |
71 } | 71 bind_generates_resource_chromium(0) {} |
72 | 72 |
73 GLES2Implementation::SingleThreadChecker::SingleThreadChecker( | 73 GLES2Implementation::SingleThreadChecker::SingleThreadChecker( |
74 GLES2Implementation* gles2_implementation) | 74 GLES2Implementation* gles2_implementation) |
75 : gles2_implementation_(gles2_implementation) { | 75 : gles2_implementation_(gles2_implementation) { |
76 CHECK_EQ(0, gles2_implementation_->use_count_); | 76 CHECK_EQ(0, gles2_implementation_->use_count_); |
77 ++gles2_implementation_->use_count_; | 77 ++gles2_implementation_->use_count_; |
78 } | 78 } |
79 | 79 |
80 GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() { | 80 GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() { |
81 --gles2_implementation_->use_count_; | 81 --gles2_implementation_->use_count_; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) | 194 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) |
195 GetIdHandler(id_namespaces::kBuffers)->MakeIds( | 195 GetIdHandler(id_namespaces::kBuffers)->MakeIds( |
196 this, kClientSideArrayId, arraysize(reserved_ids_), &reserved_ids_[0]); | 196 this, kClientSideArrayId, arraysize(reserved_ids_), &reserved_ids_[0]); |
197 #endif | 197 #endif |
198 | 198 |
199 vertex_array_object_manager_.reset(new VertexArrayObjectManager( | 199 vertex_array_object_manager_.reset(new VertexArrayObjectManager( |
200 static_state_.int_state.max_vertex_attribs, | 200 static_state_.int_state.max_vertex_attribs, |
201 reserved_ids_[0], | 201 reserved_ids_[0], |
202 reserved_ids_[1])); | 202 reserved_ids_[1])); |
203 | 203 |
| 204 // GL_BIND_GENERATES_RESOURCE_CHROMIUM state must be the same |
| 205 // on Client & Service. |
| 206 if (static_state_.int_state.bind_generates_resource_chromium != |
| 207 (share_group_->bind_generates_resource() ? 1 : 0)) { |
| 208 SetGLError(GL_INVALID_OPERATION, |
| 209 "Initialize", |
| 210 "Service bind_generates_resource mismatch."); |
| 211 return false; |
| 212 } |
| 213 |
204 return true; | 214 return true; |
205 } | 215 } |
206 | 216 |
207 bool GLES2Implementation::QueryAndCacheStaticState() { | 217 bool GLES2Implementation::QueryAndCacheStaticState() { |
208 // Setup query for multiple GetIntegerv's | 218 // Setup query for multiple GetIntegerv's |
209 static const GLenum pnames[] = { | 219 static const GLenum pnames[] = { |
210 GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, | 220 GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, |
211 GL_MAX_CUBE_MAP_TEXTURE_SIZE, | 221 GL_MAX_CUBE_MAP_TEXTURE_SIZE, |
212 GL_MAX_FRAGMENT_UNIFORM_VECTORS, | 222 GL_MAX_FRAGMENT_UNIFORM_VECTORS, |
213 GL_MAX_RENDERBUFFER_SIZE, | 223 GL_MAX_RENDERBUFFER_SIZE, |
214 GL_MAX_TEXTURE_IMAGE_UNITS, | 224 GL_MAX_TEXTURE_IMAGE_UNITS, |
215 GL_MAX_TEXTURE_SIZE, | 225 GL_MAX_TEXTURE_SIZE, |
216 GL_MAX_VARYING_VECTORS, | 226 GL_MAX_VARYING_VECTORS, |
217 GL_MAX_VERTEX_ATTRIBS, | 227 GL_MAX_VERTEX_ATTRIBS, |
218 GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, | 228 GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, |
219 GL_MAX_VERTEX_UNIFORM_VECTORS, | 229 GL_MAX_VERTEX_UNIFORM_VECTORS, |
220 GL_NUM_COMPRESSED_TEXTURE_FORMATS, | 230 GL_NUM_COMPRESSED_TEXTURE_FORMATS, |
221 GL_NUM_SHADER_BINARY_FORMATS, | 231 GL_NUM_SHADER_BINARY_FORMATS, |
| 232 GL_BIND_GENERATES_RESOURCE_CHROMIUM, |
222 }; | 233 }; |
223 | 234 |
224 GetMultipleIntegervState integerv_state( | 235 GetMultipleIntegervState integerv_state( |
225 pnames, arraysize(pnames), | 236 pnames, arraysize(pnames), |
226 &static_state_.int_state.max_combined_texture_image_units, | 237 &static_state_.int_state.max_combined_texture_image_units, |
227 sizeof(static_state_.int_state)); | 238 sizeof(static_state_.int_state)); |
228 if (!GetMultipleIntegervSetup(&integerv_state)) { | 239 if (!GetMultipleIntegervSetup(&integerv_state)) { |
229 return false; | 240 return false; |
230 } | 241 } |
231 | 242 |
(...skipping 3823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4055 CheckGLError(); | 4066 CheckGLError(); |
4056 } | 4067 } |
4057 | 4068 |
4058 // Include the auto-generated part of this file. We split this because it means | 4069 // Include the auto-generated part of this file. We split this because it means |
4059 // we can easily edit the non-auto generated parts right here in this file | 4070 // we can easily edit the non-auto generated parts right here in this file |
4060 // instead of having to edit some template or the code generator. | 4071 // instead of having to edit some template or the code generator. |
4061 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 4072 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
4062 | 4073 |
4063 } // namespace gles2 | 4074 } // namespace gles2 |
4064 } // namespace gpu | 4075 } // namespace gpu |
OLD | NEW |