summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-10 23:16:35 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-10 23:16:35 +0000
commit4e4410db807a3e1ed2f197dc42965976b0a34213 (patch)
tree6096f9fcb0b35702875917bce0547ceaf283395f /gpu
parentc7422b9efa963d88b645527f23073cbc62c679fd (diff)
downloadchromium_src-4e4410db807a3e1ed2f197dc42965976b0a34213.zip
chromium_src-4e4410db807a3e1ed2f197dc42965976b0a34213.tar.gz
chromium_src-4e4410db807a3e1ed2f197dc42965976b0a34213.tar.bz2
Add GL_SAMPLER_3D_OES and GL_SAMPLER_2D_RECT_ARB to ClearUniforms
TEST=unit tests BUG=127256,127541 R=apatrick@chromium.org Review URL: https://chromiumcodereview.appspot.com/10386075 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136436 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gl_utils.h2
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc2
-rw-r--r--gpu/command_buffer/service/program_manager.cc2
-rw-r--r--gpu/command_buffer/service/program_manager_unittest.cc147
4 files changed, 153 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/gl_utils.h b/gpu/command_buffer/service/gl_utils.h
index d0d8411..89b5f9d 100644
--- a/gpu/command_buffer/service/gl_utils.h
+++ b/gpu/command_buffer/service/gl_utils.h
@@ -85,6 +85,8 @@
// GL_CHROMIUM_command_buffer_query
#define GL_COMMANDS_ISSUED_CHROMIUM 0x84F2
+// GL_OES_texure_3D
+#define GL_SAMPLER_3D_OES 0x8B5F
#define GL_GLEXT_PROTOTYPES 1
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
index 69f8624..8b7f0ca 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
@@ -1304,6 +1304,8 @@ void GLES2DecoderTestBase::SetupExpectationsForClearingUniforms(
case GL_SAMPLER_2D:
case GL_SAMPLER_CUBE:
case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_3D_OES:
+ case GL_SAMPLER_2D_RECT_ARB:
EXPECT_CALL(*gl_, Uniform1iv(info.real_location, info.size, _))
.Times(1)
.RetiresOnSaturation();
diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc
index 6001299..5d504a4 100644
--- a/gpu/command_buffer/service/program_manager.cc
+++ b/gpu/command_buffer/service/program_manager.cc
@@ -128,6 +128,8 @@ void ProgramManager::ProgramInfo::ClearUniforms(
case GL_SAMPLER_2D:
case GL_SAMPLER_CUBE:
case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_3D_OES:
+ case GL_SAMPLER_2D_RECT_ARB:
glUniform1iv(location, size, reinterpret_cast<const GLint*>(zero));
break;
case GL_INT_VEC2:
diff --git a/gpu/command_buffer/service/program_manager_unittest.cc b/gpu/command_buffer/service/program_manager_unittest.cc
index 3482081..41d15ef 100644
--- a/gpu/command_buffer/service/program_manager_unittest.cc
+++ b/gpu/command_buffer/service/program_manager_unittest.cc
@@ -343,6 +343,85 @@ class ProgramManagerWithShaderTest : public testing::Test {
kServiceProgramId);
}
+ void SetupExpectationsForClearingUniforms(
+ UniformInfo* uniforms, size_t num_uniforms) {
+ for (size_t ii = 0; ii < num_uniforms; ++ii) {
+ const UniformInfo& info = uniforms[ii];
+ switch (info.type) {
+ case GL_FLOAT:
+ EXPECT_CALL(*gl_, Uniform1fv(info.real_location, info.size, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ break;
+ case GL_FLOAT_VEC2:
+ EXPECT_CALL(*gl_, Uniform2fv(info.real_location, info.size, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ break;
+ case GL_FLOAT_VEC3:
+ EXPECT_CALL(*gl_, Uniform3fv(info.real_location, info.size, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ break;
+ case GL_FLOAT_VEC4:
+ EXPECT_CALL(*gl_, Uniform4fv(info.real_location, info.size, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ break;
+ case GL_INT:
+ case GL_BOOL:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_EXTERNAL_OES:
+ case GL_SAMPLER_3D_OES:
+ case GL_SAMPLER_2D_RECT_ARB:
+ EXPECT_CALL(*gl_, Uniform1iv(info.real_location, info.size, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ break;
+ case GL_INT_VEC2:
+ case GL_BOOL_VEC2:
+ EXPECT_CALL(*gl_, Uniform2iv(info.real_location, info.size, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ break;
+ case GL_INT_VEC3:
+ case GL_BOOL_VEC3:
+ EXPECT_CALL(*gl_, Uniform3iv(info.real_location, info.size, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ break;
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC4:
+ EXPECT_CALL(*gl_, Uniform4iv(info.real_location, info.size, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ break;
+ case GL_FLOAT_MAT2:
+ EXPECT_CALL(*gl_, UniformMatrix2fv(
+ info.real_location, info.size, false, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ break;
+ case GL_FLOAT_MAT3:
+ EXPECT_CALL(*gl_, UniformMatrix3fv(
+ info.real_location, info.size, false, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ break;
+ case GL_FLOAT_MAT4:
+ EXPECT_CALL(*gl_, UniformMatrix4fv(
+ info.real_location, info.size, false, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+ }
+ }
+
virtual void TearDown() {
::gfx::GLInterface::SetGLInterface(NULL);
}
@@ -1028,6 +1107,74 @@ TEST_F(ProgramManagerWithShaderTest, BindAttribLocationConflicts) {
EXPECT_TRUE(LinkAsExpected(program_info, false));
}
+TEST_F(ProgramManagerWithShaderTest, ClearWithSamplerTypes) {
+ const GLuint kVShaderClientId = 2001;
+ const GLuint kFShaderClientId = 2002;
+ const GLuint kVShaderServiceId = 3001;
+ const GLuint kFShaderServiceId = 3002;
+ ShaderManager::ShaderInfo* vshader = shader_manager_.CreateShaderInfo(
+ kVShaderClientId, kVShaderServiceId, GL_VERTEX_SHADER);
+ ASSERT_TRUE(vshader != NULL);
+ vshader->SetStatus(true, NULL, NULL);
+ ShaderManager::ShaderInfo* fshader = shader_manager_.CreateShaderInfo(
+ kFShaderClientId, kFShaderServiceId, GL_FRAGMENT_SHADER);
+ ASSERT_TRUE(fshader != NULL);
+ fshader->SetStatus(true, NULL, NULL);
+ static const GLuint kClientProgramId = 1234;
+ static const GLuint kServiceProgramId = 5679;
+ ProgramManager::ProgramInfo* program_info = manager_.CreateProgramInfo(
+ kClientProgramId, kServiceProgramId);
+ ASSERT_TRUE(program_info != NULL);
+ EXPECT_TRUE(program_info->AttachShader(&shader_manager_, vshader));
+ EXPECT_TRUE(program_info->AttachShader(&shader_manager_, fshader));
+
+ static const GLenum kSamplerTypes[] = {
+ GL_SAMPLER_2D,
+ GL_SAMPLER_CUBE,
+ GL_SAMPLER_EXTERNAL_OES,
+ GL_SAMPLER_3D_OES,
+ GL_SAMPLER_2D_RECT_ARB,
+ };
+ const size_t kNumSamplerTypes = arraysize(kSamplerTypes);
+ for (size_t ii = 0; ii < kNumSamplerTypes; ++ii) {
+ static ProgramManagerWithShaderTest::AttribInfo kAttribs[] = {
+ { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, },
+ { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, },
+ { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, },
+ };
+ ProgramManagerWithShaderTest::UniformInfo kUniforms[] = {
+ { kUniform1Name,
+ kUniform1Name,
+ kUniform1Size,
+ kUniform1Type,
+ kUniform1FakeLocation,
+ kUniform1RealLocation,
+ },
+ { kUniform2Name,
+ kUniform2Name,
+ kUniform2Size,
+ kSamplerTypes[ii],
+ kUniform2FakeLocation,
+ kUniform2RealLocation,
+ },
+ { kUniform3BadName,
+ kUniform3GoodName,
+ kUniform3Size,
+ kUniform3Type,
+ kUniform3FakeLocation,
+ kUniform3RealLocation,
+ },
+ };
+ const size_t kNumAttribs = arraysize(kAttribs);
+ const size_t kNumUniforms = arraysize(kUniforms);
+ SetupShader(kAttribs, kNumAttribs, kUniforms, kNumUniforms,
+ kServiceProgramId);
+ program_info->Link();
+ SetupExpectationsForClearingUniforms(kUniforms, kNumUniforms);
+ manager_.ClearUniforms(program_info);
+ }
+}
+
} // namespace gles2
} // namespace gpu