| 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 #include "gpu/command_buffer/service/context_group.h" | 5 #include "gpu/command_buffer/service/context_group.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 enforce_gl_minimums_(CommandLine::ForCurrentProcess()->HasSwitch( | 39 enforce_gl_minimums_(CommandLine::ForCurrentProcess()->HasSwitch( |
| 40 switches::kEnforceGLMinimums)), | 40 switches::kEnforceGLMinimums)), |
| 41 bind_generates_resource_(bind_generates_resource), | 41 bind_generates_resource_(bind_generates_resource), |
| 42 max_vertex_attribs_(0u), | 42 max_vertex_attribs_(0u), |
| 43 max_texture_units_(0u), | 43 max_texture_units_(0u), |
| 44 max_texture_image_units_(0u), | 44 max_texture_image_units_(0u), |
| 45 max_vertex_texture_image_units_(0u), | 45 max_vertex_texture_image_units_(0u), |
| 46 max_fragment_uniform_vectors_(0u), | 46 max_fragment_uniform_vectors_(0u), |
| 47 max_varying_vectors_(0u), | 47 max_varying_vectors_(0u), |
| 48 max_vertex_uniform_vectors_(0u), | 48 max_vertex_uniform_vectors_(0u), |
| 49 max_color_attachments_(1u), |
| 50 max_draw_buffers_(1u), |
| 49 program_cache_(NULL), | 51 program_cache_(NULL), |
| 50 feature_info_(new FeatureInfo()) { | 52 feature_info_(new FeatureInfo()) { |
| 51 { | 53 { |
| 52 TransferBufferManager* manager = new TransferBufferManager(); | 54 TransferBufferManager* manager = new TransferBufferManager(); |
| 53 transfer_buffer_manager_.reset(manager); | 55 transfer_buffer_manager_.reset(manager); |
| 54 manager->Initialize(); | 56 manager->Initialize(); |
| 55 } | 57 } |
| 56 | 58 |
| 57 id_namespaces_[id_namespaces::kBuffers].reset(new IdAllocator); | 59 id_namespaces_[id_namespaces::kBuffers].reset(new IdAllocator); |
| 58 id_namespaces_[id_namespaces::kFramebuffers].reset(new IdAllocator); | 60 id_namespaces_[id_namespaces::kFramebuffers].reset(new IdAllocator); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } else { | 180 } else { |
| 179 GetIntegerv( | 181 GetIntegerv( |
| 180 GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max_fragment_uniform_vectors_); | 182 GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max_fragment_uniform_vectors_); |
| 181 max_fragment_uniform_vectors_ /= 4; | 183 max_fragment_uniform_vectors_ /= 4; |
| 182 GetIntegerv(GL_MAX_VARYING_FLOATS, &max_varying_vectors_); | 184 GetIntegerv(GL_MAX_VARYING_FLOATS, &max_varying_vectors_); |
| 183 max_varying_vectors_ /= 4; | 185 max_varying_vectors_ /= 4; |
| 184 GetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &max_vertex_uniform_vectors_); | 186 GetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &max_vertex_uniform_vectors_); |
| 185 max_vertex_uniform_vectors_ /= 4; | 187 max_vertex_uniform_vectors_ /= 4; |
| 186 } | 188 } |
| 187 | 189 |
| 190 if (feature_info_->feature_flags().ext_draw_buffers) { |
| 191 GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments_); |
| 192 GetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers_); |
| 193 } |
| 194 |
| 188 const GLint kMinFragmentUniformVectors = 16; | 195 const GLint kMinFragmentUniformVectors = 16; |
| 189 const GLint kMinVaryingVectors = 8; | 196 const GLint kMinVaryingVectors = 8; |
| 190 const GLint kMinVertexUniformVectors = 128; | 197 const GLint kMinVertexUniformVectors = 128; |
| 191 if (!CheckGLFeatureU( | 198 if (!CheckGLFeatureU( |
| 192 kMinFragmentUniformVectors, &max_fragment_uniform_vectors_) || | 199 kMinFragmentUniformVectors, &max_fragment_uniform_vectors_) || |
| 193 !CheckGLFeatureU(kMinVaryingVectors, &max_varying_vectors_) || | 200 !CheckGLFeatureU(kMinVaryingVectors, &max_varying_vectors_) || |
| 194 !CheckGLFeatureU( | 201 !CheckGLFeatureU( |
| 195 kMinVertexUniformVectors, &max_vertex_uniform_vectors_)) { | 202 kMinVertexUniformVectors, &max_vertex_uniform_vectors_)) { |
| 196 LOG(ERROR) << "ContextGroup::Initialize failed because too few " | 203 LOG(ERROR) << "ContextGroup::Initialize failed because too few " |
| 197 << "uniforms or varyings supported."; | 204 << "uniforms or varyings supported."; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 GLenum pname, GLint min_required, uint32* v) { | 332 GLenum pname, GLint min_required, uint32* v) { |
| 326 uint32 value = 0; | 333 uint32 value = 0; |
| 327 GetIntegerv(pname, &value); | 334 GetIntegerv(pname, &value); |
| 328 bool result = CheckGLFeatureU(min_required, &value); | 335 bool result = CheckGLFeatureU(min_required, &value); |
| 329 *v = value; | 336 *v = value; |
| 330 return result; | 337 return result; |
| 331 } | 338 } |
| 332 | 339 |
| 333 } // namespace gles2 | 340 } // namespace gles2 |
| 334 } // namespace gpu | 341 } // namespace gpu |
| OLD | NEW |