diff options
author | cwallez <cwallez@google.com> | 2016-03-14 17:18:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-15 00:20:01 +0000 |
commit | e96e24bd1b3e8e8b986d6b00fa5317ba55a0a9d2 (patch) | |
tree | 47a4411dffd5624edaee24503246b2f0151f4961 /gpu | |
parent | fd8b3beec887d3a9a1d9d278af4b121bcd2ec72f (diff) | |
download | chromium_src-e96e24bd1b3e8e8b986d6b00fa5317ba55a0a9d2.zip chromium_src-e96e24bd1b3e8e8b986d6b00fa5317ba55a0a9d2.tar.gz chromium_src-e96e24bd1b3e8e8b986d6b00fa5317ba55a0a9d2.tar.bz2 |
Initialize the GLES3 builtin shader constants
Previously the default values were used which didn't match the same
values queried from the API, causing a subset of the
deqp/functional/gles3/shaderbuiltinvar tests to fail.
BUG=587781
CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel
Review URL: https://codereview.chromium.org/1759883003
Cr-Commit-Position: refs/heads/master@{#381127}
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/context_group.cc | 61 | ||||
-rw-r--r-- | gpu/command_buffer/service/context_group.h | 17 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 13 | ||||
-rw-r--r-- | gpu/command_buffer/service/test_helper.cc | 21 | ||||
-rw-r--r-- | gpu/command_buffer/service/test_helper.h | 6 |
5 files changed, 115 insertions, 3 deletions
diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc index c16ca3b..56f7030 100644 --- a/gpu/command_buffer/service/context_group.cc +++ b/gpu/command_buffer/service/context_group.cc @@ -97,6 +97,10 @@ ContextGroup::ContextGroup( max_color_attachments_(1u), max_draw_buffers_(1u), max_dual_source_draw_buffers_(0u), + max_vertex_output_components_(0u), + max_fragment_input_components_(0u), + min_program_texel_offset_(0), + max_program_texel_offset_(0), program_cache_(NULL), feature_info_(feature_info) { { @@ -213,7 +217,6 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder, GLint max_3d_texture_size = 0; const GLint kMinTextureSize = 2048; // GL actually says 64!?!? - // TODO(zmo): In ES3, max cubemap size is required to be at least 2048. const GLint kMinCubeMapSize = 256; // GL actually says 16!?!? const GLint kMinRectangleTextureSize = 64; const GLint kMin3DTextureSize = 256; @@ -341,6 +344,62 @@ bool ContextGroup::Initialize(GLES2Decoder* decoder, feature_info_->workarounds().max_vertex_uniform_vectors)); } + if (context_type != CONTEXT_TYPE_WEBGL1 && + context_type != CONTEXT_TYPE_OPENGLES2) { + const GLuint kMinVertexOutputComponents = 64; + const GLuint kMinFragmentInputComponents = 60; + const GLint kMin_MaxProgramTexelOffset = 7; + const GLint kMax_MinProgramTexelOffset = -8; + + if (!QueryGLFeatureU(GL_MAX_VERTEX_OUTPUT_COMPONENTS, + kMinVertexOutputComponents, + &max_vertex_output_components_)) { + LOG(ERROR) << "ContextGroup::Initialize failed because maximum " + << "vertex output components is too small (" + << max_vertex_output_components_ << ", should be " + << kMinVertexOutputComponents << ")."; + return false; + } + if (!QueryGLFeatureU(GL_MAX_FRAGMENT_INPUT_COMPONENTS, + kMinFragmentInputComponents, + &max_fragment_input_components_)) { + LOG(ERROR) << "ContextGroup::Initialize failed because maximum " + << "fragment input components is too small (" + << max_fragment_input_components_ << ", should be " + << kMinFragmentInputComponents << ")."; + return false; + } + if (!QueryGLFeature(GL_MAX_PROGRAM_TEXEL_OFFSET, kMin_MaxProgramTexelOffset, + &max_program_texel_offset_)) { + LOG(ERROR) << "ContextGroup::Initialize failed because maximum " + << "program texel offset is too small (" + << max_program_texel_offset_ << ", should be " + << kMin_MaxProgramTexelOffset << ")."; + return false; + } + glGetIntegerv(GL_MIN_PROGRAM_TEXEL_OFFSET, &min_program_texel_offset_); + if (enforce_gl_minimums_) { + min_program_texel_offset_ = + std::max(min_program_texel_offset_, kMax_MinProgramTexelOffset); + } + if (min_program_texel_offset_ > kMax_MinProgramTexelOffset) { + LOG(ERROR) << "ContextGroup::Initialize failed because minimum " + << "program texel offset is too big (" + << min_program_texel_offset_ << ", should be " + << kMax_MinProgramTexelOffset << ")."; + return false; + } + + const GLint kES3MinCubeMapSize = 2048; + if (max_cube_map_texture_size < kES3MinCubeMapSize) { + LOG(ERROR) << "ContextGroup::Initialize failed because maximum " + << "cube texture size is too small (" + << max_cube_map_texture_size << ", should be " + << kES3MinCubeMapSize << ")."; + return false; + } + } + path_manager_.reset(new PathManager()); program_manager_.reset( diff --git a/gpu/command_buffer/service/context_group.h b/gpu/command_buffer/service/context_group.h index 3641d1a..b4d861a 100644 --- a/gpu/command_buffer/service/context_group.h +++ b/gpu/command_buffer/service/context_group.h @@ -121,6 +121,18 @@ class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { return max_dual_source_draw_buffers_; } + uint32_t max_vertex_output_components() const { + return max_vertex_output_components_; + } + + uint32_t max_fragment_input_components() const { + return max_fragment_input_components_; + } + + int32_t min_program_texel_offset() const { return min_program_texel_offset_; } + + int32_t max_program_texel_offset() const { return max_program_texel_offset_; } + FeatureInfo* feature_info() { return feature_info_.get(); } @@ -262,6 +274,11 @@ class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { uint32_t max_draw_buffers_; uint32_t max_dual_source_draw_buffers_; + uint32_t max_vertex_output_components_; + uint32_t max_fragment_input_components_; + int32_t min_program_texel_offset_; + int32_t max_program_texel_offset_; + ProgramCache* program_cache_; scoped_ptr<BufferManager> buffer_manager_; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 0311e96..bd2a7f4 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -3213,6 +3213,17 @@ bool GLES2DecoderImpl::InitializeShaderTranslator() { resources.MaxCallStackDepth = 256; resources.MaxDualSourceDrawBuffers = group_->max_dual_source_draw_buffers(); + ContextType context_type = feature_info_->context_type(); + if (context_type != CONTEXT_TYPE_WEBGL1 && + context_type != CONTEXT_TYPE_OPENGLES2) { + resources.MaxVertexOutputVectors = + group_->max_vertex_output_components() / 4; + resources.MaxFragmentInputVectors = + group_->max_fragment_input_components() / 4; + resources.MaxProgramTexelOffset = group_->max_program_texel_offset(); + resources.MinProgramTexelOffset = group_->min_program_texel_offset(); + } + GLint range[2] = { 0, 0 }; GLint precision = 0; GetShaderPrecisionFormatImpl(GL_FRAGMENT_SHADER, GL_HIGH_FLOAT, @@ -3221,7 +3232,7 @@ bool GLES2DecoderImpl::InitializeShaderTranslator() { PrecisionMeetsSpecForHighpFloat(range[0], range[1], precision); ShShaderSpec shader_spec; - switch (feature_info_->context_type()) { + switch (context_type) { case CONTEXT_TYPE_WEBGL1: shader_spec = SH_WEBGL_SPEC; resources.OES_standard_derivatives = derivatives_explicitly_enabled_; diff --git a/gpu/command_buffer/service/test_helper.cc b/gpu/command_buffer/service/test_helper.cc index 7d22557..632d2af 100644 --- a/gpu/command_buffer/service/test_helper.cc +++ b/gpu/command_buffer/service/test_helper.cc @@ -89,6 +89,10 @@ const GLint TestHelper::kMaxVaryingVectors; const GLint TestHelper::kMaxVaryingFloats; const GLint TestHelper::kMaxVertexUniformVectors; const GLint TestHelper::kMaxVertexUniformComponents; +const GLint TestHelper::kMaxVertexOutputComponents; +const GLint TestHelper::kMaxFragmentInputComponents; +const GLint TestHelper::kMaxProgramTexelOffset; +const GLint TestHelper::kMinProgramTexelOffset; #endif std::vector<std::string> TestHelper::split_extensions_; @@ -405,6 +409,23 @@ void TestHelper::SetupContextGroupInitExpectations( .RetiresOnSaturation(); } + EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VERTEX_OUTPUT_COMPONENTS, _)) + .Times(testing::Between(0, 1)) + .WillRepeatedly(SetArgumentPointee<1>(kMaxVertexOutputComponents)) + .RetiresOnSaturation(); + EXPECT_CALL(*gl, GetIntegerv(GL_MAX_FRAGMENT_INPUT_COMPONENTS, _)) + .Times(testing::Between(0, 1)) + .WillRepeatedly(SetArgumentPointee<1>(kMaxFragmentInputComponents)) + .RetiresOnSaturation(); + EXPECT_CALL(*gl, GetIntegerv(GL_MAX_PROGRAM_TEXEL_OFFSET, _)) + .Times(testing::Between(0, 1)) + .WillRepeatedly(SetArgumentPointee<1>(kMaxProgramTexelOffset)) + .RetiresOnSaturation(); + EXPECT_CALL(*gl, GetIntegerv(GL_MIN_PROGRAM_TEXEL_OFFSET, _)) + .Times(testing::Between(0, 1)) + .WillRepeatedly(SetArgumentPointee<1>(kMinProgramTexelOffset)) + .RetiresOnSaturation(); + bool use_default_textures = bind_generates_resource; SetupTextureManagerInitExpectations( gl, false, gl_info.is_desktop_core_profile, extensions, diff --git a/gpu/command_buffer/service/test_helper.h b/gpu/command_buffer/service/test_helper.h index 84bab2f..d0e2399 100644 --- a/gpu/command_buffer/service/test_helper.h +++ b/gpu/command_buffer/service/test_helper.h @@ -44,7 +44,7 @@ class TestHelper { static const GLint kMaxSamples = 4; static const GLint kMaxRenderbufferSize = 1024; static const GLint kMaxTextureSize = 2048; - static const GLint kMaxCubeMapTextureSize = 256; + static const GLint kMaxCubeMapTextureSize = 2048; static const GLint kMax3DTextureSize = 1024; static const GLint kMaxRectangleTextureSize = 64; static const GLint kNumVertexAttribs = 16; @@ -58,6 +58,10 @@ class TestHelper { static const GLint kMaxVaryingFloats = kMaxVaryingVectors * 4; static const GLint kMaxVertexUniformVectors = 128; static const GLint kMaxVertexUniformComponents = kMaxVertexUniformVectors * 4; + static const GLint kMaxVertexOutputComponents = 64; + static const GLint kMaxFragmentInputComponents = 60; + static const GLint kMaxProgramTexelOffset = 7; + static const GLint kMinProgramTexelOffset = -8; struct AttribInfo { const char* name; |