diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-18 23:25:17 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-18 23:25:17 +0000 |
commit | 057caaf1e0f45d297032935de0b6f70a038f50d8 (patch) | |
tree | 1da2f84151a96f514fda552228356598699c5af3 | |
parent | a53e7d097761aa379ffdcb573bd51159b9833d4a (diff) | |
download | chromium_src-057caaf1e0f45d297032935de0b6f70a038f50d8.zip chromium_src-057caaf1e0f45d297032935de0b6f70a038f50d8.tar.gz chromium_src-057caaf1e0f45d297032935de0b6f70a038f50d8.tar.bz2 |
Reverting again, will manually build on linux since trybots are apparently not up to the task >:-(
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47589 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | gpu/command_buffer/build_gles2_cmd_buffer.py | 5 | ||||
-rw-r--r-- | gpu/command_buffer/service/context_group.cc | 43 | ||||
-rw-r--r-- | gpu/command_buffer/service/context_group.h | 26 | ||||
-rw-r--r-- | gpu/command_buffer/service/context_group_unittest.cc | 5 | ||||
-rw-r--r-- | gpu/command_buffer/service/gl_utils.h | 6 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 86 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc | 34 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h | 34 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc | 37 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h | 5 | ||||
-rw-r--r-- | gpu/command_buffer/service/shader_manager.h | 22 | ||||
-rw-r--r-- | gpu/command_buffer/service/shader_manager_unittest.cc | 1 | ||||
-rw-r--r-- | gpu/gpu.gyp | 5 |
13 files changed, 85 insertions, 224 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index acea9d3..750dfdb 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -1214,8 +1214,7 @@ _FUNCTION_INFO = { 'type': 'STRn', 'get_len_func': 'glGetShaderiv', 'get_len_enum': 'GL_INFO_LOG_LENGTH', - 'unit_test': False, - }, + }, 'GetShaderPrecisionFormat': { 'type': 'Custom', 'immediate': False, @@ -3750,7 +3749,7 @@ TEST_F(%(test_name)s, %(name)sValidArgs) { if get_len_func[0:2] == 'gl': sub['expect_len_code'] = ( " EXPECT_CALL(*gl_, %s(%s, %s, _))\n" - " .WillOnce(SetArgumentPointee<2>(strlen(kInfo) + 1));") % ( + " .WillOnce(SetArgumentPointee<2>(strlen(kInfo)));") % ( get_len_func[2:], id_name, get_len_enum) self.WriteValidUnitTest(func, file, valid_test, sub) diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc index 71b796c..7a62c72 100644 --- a/gpu/command_buffer/service/context_group.cc +++ b/gpu/command_buffer/service/context_group.cc @@ -17,23 +17,12 @@ namespace gles2 { ContextGroup::ContextGroup() : initialized_(false), max_vertex_attribs_(0u), - max_texture_units_(0u), - max_texture_image_units_(0u), - max_vertex_texture_image_units_(0u), - max_fragment_uniform_vectors_(0u), - max_varying_vectors_(0u), - max_vertex_uniform_vectors_(0u) { + max_texture_units_(0u) { } ContextGroup::~ContextGroup() { } -static void GetIntegerv(GLenum pname, uint32* var) { - GLint value = 0; - glGetIntegerv(pname, &value); - *var = value; -} - bool ContextGroup::Initialize() { if (initialized_) { return true; @@ -46,11 +35,14 @@ bool ContextGroup::Initialize() { program_manager_.reset(new ProgramManager()); // Lookup GL things we need to know. - GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &max_vertex_attribs_); + GLint value; + glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &value); + max_vertex_attribs_ = value; const GLuint kGLES2RequiredMiniumumVertexAttribs = 8u; DCHECK_GE(max_vertex_attribs_, kGLES2RequiredMiniumumVertexAttribs); - GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &max_texture_units_); + glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &value); + max_texture_units_ = value; const GLuint kGLES2RequiredMiniumumTextureUnits = 8u; DCHECK_GE(max_texture_units_, kGLES2RequiredMiniumumTextureUnits); @@ -60,29 +52,6 @@ bool ContextGroup::Initialize() { glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &max_cube_map_texture_size); texture_manager_.reset(new TextureManager(max_texture_size, max_cube_map_texture_size)); - - GetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_texture_image_units_); - GetIntegerv( - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &max_vertex_texture_image_units_); - -#if defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) - - GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &max_fragment_uniform_vectors_); - GetIntegerv(GL_MAX_VARYING_VECTORS, &max_varying_vectors_); - GetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &max_vertex_uniform_vectors_); - -#else // !defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) - - GetIntegerv( - GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &max_fragment_uniform_vectors_); - max_fragment_uniform_vectors_ /= 4; - GetIntegerv(GL_MAX_VARYING_FLOATS, &max_varying_vectors_); - max_varying_vectors_ /= 4; - GetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &max_vertex_uniform_vectors_); - max_vertex_uniform_vectors_ /= 4; - -#endif // !defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) - initialized_ = true; return true; } diff --git a/gpu/command_buffer/service/context_group.h b/gpu/command_buffer/service/context_group.h index 12fa7b6..2b0bf46 100644 --- a/gpu/command_buffer/service/context_group.h +++ b/gpu/command_buffer/service/context_group.h @@ -42,26 +42,6 @@ class ContextGroup { return max_texture_units_; } - uint32 max_texture_image_units() const { - return max_texture_image_units_; - } - - uint32 max_vertex_texture_image_units() const { - return max_vertex_texture_image_units_; - } - - uint32 max_fragment_uniform_vectors() const { - return max_fragment_uniform_vectors_; - } - - uint32 max_varying_vectors() const { - return max_varying_vectors_; - } - - uint32 max_vertex_uniform_vectors() const { - return max_vertex_uniform_vectors_; - } - BufferManager* buffer_manager() const { return buffer_manager_.get(); } @@ -93,12 +73,8 @@ class ContextGroup { bool initialized_; uint32 max_vertex_attribs_; + uint32 max_texture_units_; - uint32 max_texture_image_units_; - uint32 max_vertex_texture_image_units_; - uint32 max_fragment_uniform_vectors_; - uint32 max_varying_vectors_; - uint32 max_vertex_uniform_vectors_; scoped_ptr<BufferManager> buffer_manager_; diff --git a/gpu/command_buffer/service/context_group_unittest.cc b/gpu/command_buffer/service/context_group_unittest.cc index c997f7a..d46bec6 100644 --- a/gpu/command_buffer/service/context_group_unittest.cc +++ b/gpu/command_buffer/service/context_group_unittest.cc @@ -27,11 +27,6 @@ TEST_F(ContextGroupTest, Basic) { // Test it starts off uninitialized. EXPECT_EQ(0u, group_.max_vertex_attribs()); EXPECT_EQ(0u, group_.max_texture_units()); - EXPECT_EQ(0u, group_.max_texture_image_units()); - EXPECT_EQ(0u, group_.max_vertex_texture_image_units()); - EXPECT_EQ(0u, group_.max_fragment_uniform_vectors()); - EXPECT_EQ(0u, group_.max_varying_vectors()); - EXPECT_EQ(0u, group_.max_vertex_uniform_vectors()); EXPECT_TRUE(group_.buffer_manager() == NULL); EXPECT_TRUE(group_.framebuffer_manager() == NULL); EXPECT_TRUE(group_.renderbuffer_manager() == NULL); diff --git a/gpu/command_buffer/service/gl_utils.h b/gpu/command_buffer/service/gl_utils.h index c7cf11b..de2f044 100644 --- a/gpu/command_buffer/service/gl_utils.h +++ b/gpu/command_buffer/service/gl_utils.h @@ -12,15 +12,9 @@ #if defined(UNIT_TEST) #include "gpu/command_buffer/service/gl_mock.h" - // OpenGL constants not defined in OpenGL ES 2.0 needed when compiling - // unit tests. For native OpenGL ES 2.0 backend these are not used. For OpenGL - // backend these must be defined by the local system. #if !defined(GL_VERTEX_PROGRAM_POINT_SIZE) #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 #endif - #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 - #define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A - #define GL_MAX_VARYING_FLOATS 0x8B4B #else #if defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) #include <GLES2/gl2.h> // NOLINT diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 7a9d35f..3d68326 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -41,6 +41,17 @@ #define GL_DEPTH24_STENCIL8 0x88F0 #endif +#if defined(UNIT_TEST) + +// OpenGL constants not defined in OpenGL ES 2.0 needed when compiling +// unit tests. For native OpenGL ES 2.0 backend these are not used. For OpenGL +// backend these must be defined by the local system. +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B + +#endif + namespace gpu { namespace gles2 { @@ -2192,19 +2203,22 @@ bool GLES2DecoderImpl::GetHelper( case GL_MAX_FRAGMENT_UNIFORM_VECTORS: *num_written = 1; if (params) { - *params = group_->max_fragment_uniform_vectors(); + glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, params); + *params /= 4; } return true; case GL_MAX_VARYING_VECTORS: *num_written = 1; if (params) { - *params = group_->max_varying_vectors(); + glGetIntegerv(GL_MAX_VARYING_FLOATS, params); + *params /= 4; } return true; case GL_MAX_VERTEX_UNIFORM_VECTORS: *num_written = 1; if (params) { - *params = group_->max_vertex_uniform_vectors(); + glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, params); + *params /= 4; } return true; #endif @@ -3221,38 +3235,39 @@ void GLES2DecoderImpl::DoCompileShader(GLuint client_id) { const char* shader_src = info->source().c_str(); #if !defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) && !defined(UNIT_TEST) #if defined(GLES2_GPU_SERVICE_TRANSLATE_SHADER) - ShHandle compiler = 0; + ShHandle compiler; if (use_shader_translator_) { int dbg_options = 0; EShLanguage language = info->shader_type() == GL_VERTEX_SHADER ? EShLangVertex : EShLangFragment; TBuiltInResource resources; + // TODO(alokp): Ask gman how to get appropriate values. resources.maxVertexAttribs = group_->max_vertex_attribs(); - resources.maxVertexUniformVectors = - group_->max_vertex_uniform_vectors(); - resources.maxVaryingVectors = group_->max_varying_vectors(); - resources.maxVertexTextureImageUnits = - group_->max_vertex_texture_image_units(); + resources.maxVertexUniformVectors = 128; + resources.maxVaryingVectors = 8; + resources.maxVertexTextureImageUnits = 0; resources.maxCombinedTextureImageUnits = group_->max_texture_units(); - resources.maxTextureImageUnits = group_->max_texture_image_units(); - resources.maxFragmentUniformVectors = - group_->max_fragment_uniform_vectors(); + resources.maxTextureImageUnits = 8; + resources.maxFragmentUniformVectors = 16; resources.maxDrawBuffers = 1; compiler = ShConstructCompiler(language, dbg_options); if (!ShCompile(compiler, &shader_src, 1, EShOptNone, &resources, dbg_options)) { - info->SetTranslationStatus(false, ShGetInfoLog(compiler)); + // TODO(alokp): Ask gman where to set compile-status and info-log. + // May be add member variables to ShaderManager::ShaderInfo? + // const char* info_log = ShGetInfoLog(compiler); ShDestruct(compiler); return; } - info->SetTranslationStatus(true, ""); shader_src = ShGetObjectCode(compiler); } #endif // GLES2_GPU_SERVICE_TRANSLATE_SHADER #endif // GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2 + shader_src = info->source().c_str(); glShaderSource(info->service_id(), 1, &shader_src, NULL); glCompileShader(info->service_id()); + #if !defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) && !defined(UNIT_TEST) #ifdef GLES2_GPU_SERVICE_TRANSLATE_SHADER if (use_shader_translator_) { @@ -3269,26 +3284,11 @@ void GLES2DecoderImpl::DoGetShaderiv( if (!info) { return; } - switch (pname) { - case GL_SHADER_SOURCE_LENGTH: - *params = info->source().size(); - return; - case GL_COMPILE_STATUS: - if (!info->translation_valid()) { - *params = GL_FALSE; - return; - } - break; - case GL_INFO_LOG_LENGTH: - if (!info->translation_valid()) { - *params = info->translation_log().size() + 1; - return; - } - break; - default: - break; + if (pname == GL_SHADER_SOURCE_LENGTH) { + *params = info->source().size(); + } else { + glGetShaderiv(info->service_id(), pname, params); } - glGetShaderiv(info->service_id(), pname, params); } error::Error GLES2DecoderImpl::HandleGetShaderSource( @@ -3318,10 +3318,10 @@ error::Error GLES2DecoderImpl::HandleGetProgramInfoLog( } GLint len = 0; glGetProgramiv(info->service_id(), GL_INFO_LOG_LENGTH, &len); - bucket->SetSize(len); + bucket->SetSize(len + 1); glGetProgramInfoLog( info->service_id(), - len, &len, bucket->GetDataAs<GLchar*>(0, len)); + len + 1, &len, bucket->GetDataAs<GLchar*>(0, len + 1)); return error::kNoError; } @@ -3336,16 +3336,12 @@ error::Error GLES2DecoderImpl::HandleGetShaderInfoLog( bucket->SetSize(0); return error::kNoError; } - if (!info->translation_valid()) { - bucket->SetFromString(info->translation_log()); - } else { - GLint len = 0; - glGetShaderiv(info->service_id(), GL_INFO_LOG_LENGTH, &len); - bucket->SetSize(len); - glGetShaderInfoLog( - info->service_id(), - len, &len, bucket->GetDataAs<GLchar*>(0, len)); - } + GLint len = 0; + glGetShaderiv(info->service_id(), GL_INFO_LOG_LENGTH, &len); + bucket->SetSize(len + 1); + glGetShaderInfoLog( + info->service_id(), + len + 1, &len, bucket->GetDataAs<GLchar*>(0, len + 1)); return error::kNoError; } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc index a45c982..766dfae 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc @@ -906,40 +906,6 @@ TEST_F(GLES2DecoderWithShaderTest, GetActiveAttribBadSharedMemoryFails) { EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); } -TEST_F(GLES2DecoderWithShaderTest, GetShaderInfoLogValidArgs) { - const char* kInfo = "hello"; - const uint32 kBucketId = 123; - CompileShader compile_cmd; - GetShaderInfoLog cmd; - EXPECT_CALL(*gl_, ShaderSource(kServiceShaderId, 1, _, _)); - EXPECT_CALL(*gl_, CompileShader(kServiceShaderId)); - EXPECT_CALL(*gl_, GetShaderiv(kServiceShaderId, GL_INFO_LOG_LENGTH, _)) - .WillOnce(SetArgumentPointee<2>(strlen(kInfo) + 1)) - .RetiresOnSaturation(); - EXPECT_CALL( - *gl_, GetShaderInfoLog(kServiceShaderId, strlen(kInfo) + 1, _, _)) - .WillOnce(DoAll(SetArgumentPointee<2>(strlen(kInfo)), - SetArrayArgument<3>(kInfo, kInfo + strlen(kInfo) + 1))); - compile_cmd.Init(client_shader_id_); - cmd.Init(client_shader_id_, kBucketId); - EXPECT_EQ(error::kNoError, ExecuteCmd(compile_cmd)); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId); - ASSERT_TRUE(bucket != NULL); - EXPECT_EQ(strlen(kInfo) + 1, bucket->size()); - EXPECT_EQ(0, memcmp(bucket->GetData(0, bucket->size()), kInfo, - bucket->size())); - EXPECT_EQ(GL_NO_ERROR, GetGLError()); -} - -TEST_F(GLES2DecoderWithShaderTest, GetShaderInfoLogInvalidArgs) { - const uint32 kBucketId = 123; - GetShaderInfoLog cmd; - cmd.Init(kInvalidClientId, kBucketId); - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); - EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); -} - TEST_F(GLES2DecoderTest, CompileShaderValidArgs) { EXPECT_CALL(*gl_, ShaderSource(kServiceShaderId, 1, _, _)); EXPECT_CALL(*gl_, CompileShader(kServiceShaderId)); diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h index 76000af..824c051 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h @@ -1486,7 +1486,7 @@ TEST_F(GLES2DecoderTest1, GetProgramInfoLogValidArgs) { const uint32 kBucketId = 123; SpecializedSetup<GetProgramInfoLog, 0>(true); EXPECT_CALL(*gl_, GetProgramiv(kServiceProgramId, GL_INFO_LOG_LENGTH, _)) - .WillOnce(SetArgumentPointee<2>(strlen(kInfo) + 1)); + .WillOnce(SetArgumentPointee<2>(strlen(kInfo))); EXPECT_CALL( *gl_, GetProgramInfoLog(kServiceProgramId, strlen(kInfo) + 1, _, _)) .WillOnce(DoAll(SetArgumentPointee<2>(strlen(kInfo)), @@ -1623,7 +1623,37 @@ TEST_F(GLES2DecoderTest1, GetShaderivInvalidArgs2_1) { EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); EXPECT_EQ(0u, result->size); } -// TODO(gman): GetShaderInfoLog + +TEST_F(GLES2DecoderTest1, GetShaderInfoLogValidArgs) { + const char* kInfo = "hello"; + const uint32 kBucketId = 123; + SpecializedSetup<GetShaderInfoLog, 0>(true); + EXPECT_CALL(*gl_, GetShaderiv(kServiceShaderId, GL_INFO_LOG_LENGTH, _)) + .WillOnce(SetArgumentPointee<2>(strlen(kInfo))); + EXPECT_CALL( + *gl_, GetShaderInfoLog(kServiceShaderId, strlen(kInfo) + 1, _, _)) + .WillOnce(DoAll(SetArgumentPointee<2>(strlen(kInfo)), + SetArrayArgument<3>(kInfo, kInfo + strlen(kInfo) + 1))); + GetShaderInfoLog cmd; + cmd.Init(client_shader_id_, kBucketId); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId); + ASSERT_TRUE(bucket != NULL); + EXPECT_EQ(strlen(kInfo) + 1, bucket->size()); + EXPECT_EQ(0, memcmp(bucket->GetData(0, bucket->size()), kInfo, + bucket->size())); + EXPECT_EQ(GL_NO_ERROR, GetGLError()); +} + +TEST_F(GLES2DecoderTest1, GetShaderInfoLogInvalidArgs) { + const uint32 kBucketId = 123; + EXPECT_CALL(*gl_, GetShaderInfoLog(_, _, _, _)) + .Times(0); + GetShaderInfoLog cmd; + cmd.Init(kInvalidClientId, kBucketId); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); +} // TODO(gman): GetShaderPrecisionFormat // TODO(gman): GetShaderSource 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 a9cc632..33fbf54 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc @@ -45,38 +45,6 @@ void GLES2DecoderTestBase::SetUp() { EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, _)) .WillOnce(SetArgumentPointee<1>(kMaxCubeMapTextureSize)) .RetiresOnSaturation(); - EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, _)) - .WillOnce(SetArgumentPointee<1>(kMaxTextureImageUnits)) - .RetiresOnSaturation(); - EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, _)) - .WillOnce(SetArgumentPointee<1>(kMaxVertexTextureImageUnits)) - .RetiresOnSaturation(); - -#if defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) - - EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, _)) - .WillOnce(SetArgumentPointee<1>(kMaxFragmentUniformVectors * 4)) - .RetiresOnSaturation(); - EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_VARYING_VECTORS, _)) - .WillOnce(SetArgumentPointee<1>(kMaxVaryingVectors * 4)) - .RetiresOnSaturation(); - EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, _)) - .WillOnce(SetArgumentPointee<1>(kMaxVertexUniformVectors * 4)) - .RetiresOnSaturation(); - -#else // !defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) - - EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, _)) - .WillOnce(SetArgumentPointee<1>(kMaxFragmentUniformVectors)) - .RetiresOnSaturation(); - EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_VARYING_FLOATS, _)) - .WillOnce(SetArgumentPointee<1>(kMaxVaryingVectors)) - .RetiresOnSaturation(); - EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, _)) - .WillOnce(SetArgumentPointee<1>(kMaxVertexUniformVectors)) - .RetiresOnSaturation(); - -#endif // !defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) EXPECT_CALL(*gl_, EnableVertexAttribArray(0)) .Times(1) @@ -341,11 +309,6 @@ const GLint GLES2DecoderTestBase::kMaxTextureSize; const GLint GLES2DecoderTestBase::kMaxCubeMapTextureSize; const GLint GLES2DecoderTestBase::kNumVertexAttribs; const GLint GLES2DecoderTestBase::kNumTextureUnits; -const GLint GLES2DecoderTestBase::kMaxTextureImageUnits; -const GLint GLES2DecoderTestBase::kMaxVertexTextureImageUnits; -const GLint GLES2DecoderTestBase::kMaxFragmentUniformVectors; -const GLint GLES2DecoderTestBase::kMaxVaryingVectors; -const GLint GLES2DecoderTestBase::kMaxVertexUniformVectors; const GLuint GLES2DecoderTestBase::kServiceBlackTexture2dId; const GLuint GLES2DecoderTestBase::kServiceBlackTextureCubemapId; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h index e4e7be2..f18b598 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h @@ -42,11 +42,6 @@ class GLES2DecoderTestBase : public testing::Test { static const GLint kMaxCubeMapTextureSize = 256; static const GLint kNumVertexAttribs = 16; static const GLint kNumTextureUnits = 8; - static const GLint kMaxTextureImageUnits = 8; - static const GLint kMaxVertexTextureImageUnits = 2; - static const GLint kMaxFragmentUniformVectors = 16; - static const GLint kMaxVaryingVectors = 8; - static const GLint kMaxVertexUniformVectors = 128; static const GLuint kServiceBlackTexture2dId = 701; static const GLuint kServiceBlackTextureCubemapId = 702; diff --git a/gpu/command_buffer/service/shader_manager.h b/gpu/command_buffer/service/shader_manager.h index 3391ff6..caf41b4 100644 --- a/gpu/command_buffer/service/shader_manager.h +++ b/gpu/command_buffer/service/shader_manager.h @@ -30,8 +30,7 @@ class ShaderManager { explicit ShaderInfo(GLuint service_id, GLenum shader_type) : service_id_(service_id), - shader_type_(shader_type), - translation_valid_(true) { + shader_type_(shader_type) { } void Update(const std::string& source) { @@ -50,19 +49,6 @@ class ShaderManager { return source_; } - void SetTranslationStatus(bool valid, const std::string& log) { - translation_valid_ = valid; - translation_log_ = log; - } - - const std::string& translation_log() const { - return translation_log_; - } - - bool translation_valid() const { - return translation_valid_; - } - bool IsDeleted() const { return service_id_ == 0; } @@ -81,14 +67,8 @@ class ShaderManager { // Type of shader - GL_VERTEX_SHADER or GL_FRAGMENT_SHADER. GLenum shader_type_; - // True if translation succeeded. - bool translation_valid_; - // The shader source as passed to glShaderSource. std::string source_; - - // The shader translation log. - std::string translation_log_; }; ShaderManager() { diff --git a/gpu/command_buffer/service/shader_manager_unittest.cc b/gpu/command_buffer/service/shader_manager_unittest.cc index 12ec9e4..70d733b 100644 --- a/gpu/command_buffer/service/shader_manager_unittest.cc +++ b/gpu/command_buffer/service/shader_manager_unittest.cc @@ -37,7 +37,6 @@ TEST_F(ShaderManagerTest, Basic) { EXPECT_EQ(kService1Id, info1->service_id()); // Check if the shader has correct type. EXPECT_EQ(kShader1Type, info1->shader_type()); - EXPECT_EQ(true, info1->translation_valid()); // Check we can set its source. info1->Update(kClient1Source); EXPECT_STREQ(kClient1Source.c_str(), info1->source().c_str()); diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp index ef39e53..b52d1fe 100644 --- a/gpu/gpu.gyp +++ b/gpu/gpu.gyp @@ -40,6 +40,7 @@ 'command_buffer/service/texture_manager.h', 'command_buffer/service/texture_manager.cc', ], + 'enable_shader_translation%': 0, }, 'targets': [ { @@ -269,9 +270,7 @@ '../build/linux/system.gyp:gtk', ], }], - # TODO(gman): Change this condition to be false if the backend is - # native OpenGL ES 2.0 and false if the backend is OpenGL. - ['1==1', { + ['enable_shader_translation==1', { 'defines': [ 'GLES2_GPU_SERVICE_TRANSLATE_SHADER', ], |