diff options
author | kkinnunen <kkinnunen@nvidia.com> | 2015-12-04 01:36:31 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-04 09:37:12 +0000 |
commit | 8cefb231216c2777281f37a30e3fb8e67513ee2b (patch) | |
tree | 2d0163eed0729e5f7a8fb55fb03b034eddcb5305 /gpu/command_buffer/service/memory_program_cache_unittest.cc | |
parent | 91db68e8cb2080d1e9e07858efea3f7e198112a9 (diff) | |
download | chromium_src-8cefb231216c2777281f37a30e3fb8e67513ee2b.zip chromium_src-8cefb231216c2777281f37a30e3fb8e67513ee2b.tar.gz chromium_src-8cefb231216c2777281f37a30e3fb8e67513ee2b.tar.bz2 |
command_buffer: Implement EXT_blend_func_extended
Implement EXT_blend_func_extended for command buffer ES 2.0 and ES 3.0
contexts.
For the ES 2.0 context, the extension supports dual-source blending with
pre-defined gl_SecondaryFragColorEXT and gl_SecondaryFragDataEXT
variables.
Currently EXT_blend_func_extended is only exposed if the service context
supports program interface query. This means OpenGL context or OpenGL
ES 3.1 context. This is to simplify the unit test expectation conditions.
Theoretically also ES 2.0 and ES 3.0 service contexts could support
EXT_blend_func_extended, but probably there will never be such a driver.
BUG=506765
Review URL: https://codereview.chromium.org/1309743005
Cr-Commit-Position: refs/heads/master@{#363175}
Diffstat (limited to 'gpu/command_buffer/service/memory_program_cache_unittest.cc')
-rw-r--r-- | gpu/command_buffer/service/memory_program_cache_unittest.cc | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/gpu/command_buffer/service/memory_program_cache_unittest.cc b/gpu/command_buffer/service/memory_program_cache_unittest.cc index a005db9..f92860f 100644 --- a/gpu/command_buffer/service/memory_program_cache_unittest.cc +++ b/gpu/command_buffer/service/memory_program_cache_unittest.cc @@ -100,9 +100,11 @@ class MemoryProgramCacheTest : public GpuServiceTest { AttributeMap vertex_attrib_map; UniformMap vertex_uniform_map; VaryingMap vertex_varying_map; + OutputVariableList vertex_output_variable_list; AttributeMap fragment_attrib_map; UniformMap fragment_uniform_map; VaryingMap fragment_varying_map; + OutputVariableList fragment_output_variable_list; vertex_attrib_map["a"] = TestHelper::ConstructAttribute( GL_FLOAT_VEC2, 34, GL_LOW_FLOAT, false, "a"); @@ -112,24 +114,28 @@ class MemoryProgramCacheTest : public GpuServiceTest { GL_FLOAT_VEC3, 3114, GL_HIGH_FLOAT, true, "b"); vertex_varying_map["c"] = TestHelper::ConstructVarying( GL_FLOAT_VEC4, 2, GL_HIGH_FLOAT, true, "c"); + vertex_output_variable_list.push_back(TestHelper::ConstructOutputVariable( + GL_FLOAT, 0, GL_HIGH_FLOAT, true, "d")); fragment_attrib_map["jjjbb"] = TestHelper::ConstructAttribute( GL_FLOAT_MAT4, 1114, GL_MEDIUM_FLOAT, false, "jjjbb"); fragment_uniform_map["k"] = TestHelper::ConstructUniform( GL_FLOAT_MAT2, 34413, GL_MEDIUM_FLOAT, true, "k"); fragment_varying_map["c"] = TestHelper::ConstructVarying( GL_FLOAT_VEC4, 2, GL_HIGH_FLOAT, true, "c"); + fragment_output_variable_list.push_back(TestHelper::ConstructOutputVariable( + GL_FLOAT, 0, GL_HIGH_FLOAT, true, "d")); vertex_shader_->set_source("bbbalsldkdkdkd"); fragment_shader_->set_source("bbbal sldkdkdkas 134 ad"); + TestHelper::SetShaderStates(gl_.get(), vertex_shader_, true, nullptr, + nullptr, nullptr, &vertex_attrib_map, + &vertex_uniform_map, &vertex_varying_map, + nullptr, &vertex_output_variable_list, nullptr); TestHelper::SetShaderStates( - gl_.get(), vertex_shader_, true, NULL, NULL, NULL, - &vertex_attrib_map, &vertex_uniform_map, &vertex_varying_map, - NULL, NULL); - TestHelper::SetShaderStates( - gl_.get(), fragment_shader_, true, NULL, NULL, NULL, + gl_.get(), fragment_shader_, true, nullptr, nullptr, nullptr, &fragment_attrib_map, &fragment_uniform_map, &fragment_varying_map, - NULL, NULL); + nullptr, &fragment_output_variable_list, nullptr); } void SetExpectationsForSaveLinkedProgram( @@ -254,17 +260,22 @@ TEST_F(MemoryProgramCacheTest, CacheLoadMatchesSave) { AttributeMap vertex_attrib_map = vertex_shader_->attrib_map(); UniformMap vertex_uniform_map = vertex_shader_->uniform_map(); VaryingMap vertex_varying_map = vertex_shader_->varying_map(); + OutputVariableList vertex_output_variable_list = + vertex_shader_->output_variable_list(); AttributeMap fragment_attrib_map = fragment_shader_->attrib_map(); UniformMap fragment_uniform_map = fragment_shader_->uniform_map(); VaryingMap fragment_varying_map = fragment_shader_->varying_map(); + OutputVariableList fragment_output_variable_list = + fragment_shader_->output_variable_list(); vertex_shader_->set_attrib_map(AttributeMap()); vertex_shader_->set_uniform_map(UniformMap()); vertex_shader_->set_varying_map(VaryingMap()); + vertex_shader_->set_output_variable_list(OutputVariableList()); fragment_shader_->set_attrib_map(AttributeMap()); fragment_shader_->set_uniform_map(UniformMap()); fragment_shader_->set_varying_map(VaryingMap()); - + fragment_shader_->set_output_variable_list(OutputVariableList()); SetExpectationsForLoadLinkedProgram(kProgramId, &emulator); EXPECT_EQ(ProgramCache::PROGRAM_LOAD_SUCCESS, cache_->LoadLinkedProgram( @@ -283,9 +294,13 @@ TEST_F(MemoryProgramCacheTest, CacheLoadMatchesSave) { EXPECT_EQ(vertex_attrib_map, vertex_shader_->attrib_map()); EXPECT_EQ(vertex_uniform_map, vertex_shader_->uniform_map()); EXPECT_EQ(vertex_varying_map, vertex_shader_->varying_map()); + EXPECT_EQ(vertex_output_variable_list, + vertex_shader_->output_variable_list()); EXPECT_EQ(fragment_attrib_map, fragment_shader_->attrib_map()); EXPECT_EQ(fragment_uniform_map, fragment_shader_->uniform_map()); EXPECT_EQ(fragment_varying_map, fragment_shader_->varying_map()); + EXPECT_EQ(fragment_output_variable_list, + fragment_shader_->output_variable_list()); #endif } @@ -309,16 +324,22 @@ TEST_F(MemoryProgramCacheTest, LoadProgramMatchesSave) { AttributeMap vertex_attrib_map = vertex_shader_->attrib_map(); UniformMap vertex_uniform_map = vertex_shader_->uniform_map(); VaryingMap vertex_varying_map = vertex_shader_->varying_map(); + OutputVariableList vertex_output_variable_list = + vertex_shader_->output_variable_list(); AttributeMap fragment_attrib_map = fragment_shader_->attrib_map(); UniformMap fragment_uniform_map = fragment_shader_->uniform_map(); VaryingMap fragment_varying_map = fragment_shader_->varying_map(); + OutputVariableList fragment_output_variable_list = + fragment_shader_->output_variable_list(); vertex_shader_->set_attrib_map(AttributeMap()); vertex_shader_->set_uniform_map(UniformMap()); vertex_shader_->set_varying_map(VaryingMap()); + vertex_shader_->set_output_variable_list(OutputVariableList()); fragment_shader_->set_attrib_map(AttributeMap()); fragment_shader_->set_uniform_map(UniformMap()); fragment_shader_->set_varying_map(VaryingMap()); + fragment_shader_->set_output_variable_list(OutputVariableList()); SetExpectationsForLoadLinkedProgram(kProgramId, &emulator); @@ -341,9 +362,13 @@ TEST_F(MemoryProgramCacheTest, LoadProgramMatchesSave) { EXPECT_EQ(vertex_attrib_map, vertex_shader_->attrib_map()); EXPECT_EQ(vertex_uniform_map, vertex_shader_->uniform_map()); EXPECT_EQ(vertex_varying_map, vertex_shader_->varying_map()); + EXPECT_EQ(vertex_output_variable_list, + vertex_shader_->output_variable_list()); EXPECT_EQ(fragment_attrib_map, fragment_shader_->attrib_map()); EXPECT_EQ(fragment_uniform_map, fragment_shader_->uniform_map()); EXPECT_EQ(fragment_varying_map, fragment_shader_->varying_map()); + EXPECT_EQ(fragment_output_variable_list, + fragment_shader_->output_variable_list()); #endif } |