diff options
author | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-18 22:20:20 +0000 |
---|---|---|
committer | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-18 22:20:20 +0000 |
commit | b71f52cf5517c4aa106f4b81ccb3c443f4032781 (patch) | |
tree | 1347d8089a267f9259a6ac1f5dcf5135bd119158 /gpu | |
parent | 90c23e723735b7641c79d3bb3c6fa4b108351c61 (diff) | |
download | chromium_src-b71f52cf5517c4aa106f4b81ccb3c443f4032781.zip chromium_src-b71f52cf5517c4aa106f4b81ccb3c443f4032781.tar.gz chromium_src-b71f52cf5517c4aa106f4b81ccb3c443f4032781.tar.bz2 |
Map RGBA4/RGB5_A1 to RGBA and RGB565 to RGB in RenderbufferStorage.
Review URL: http://codereview.chromium.org/2868007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50288 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
5 files changed, 40 insertions, 3 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index b60c801..2a7db1f 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -1314,6 +1314,7 @@ _FUNCTION_INFO = { 'RenderbufferStorage': { 'decoder_func': 'DoRenderbufferStorage', 'gl_test_func': 'glRenderbufferStorageEXT', + 'expectation': False, }, 'ReadPixels': { 'cmd_comment': diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 1f4c2e0..80eec9e 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -2699,6 +2699,10 @@ void GLES2DecoderImpl::DoGetRenderbufferParameteriv( "glGetRenderbufferParameteriv: no renderbuffer bound"); return; } + if (pname == GL_RENDERBUFFER_INTERNAL_FORMAT) { + *params = bound_renderbuffer_->internal_format(); + return; + } glGetRenderbufferParameterivEXT(target, pname, params); } @@ -2709,6 +2713,21 @@ void GLES2DecoderImpl::DoRenderbufferStorage( "glGetRenderbufferStorage: no renderbuffer bound"); return; } + bound_renderbuffer_->set_internal_format(internalformat); +#if !defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) + switch (internalformat) { + case GL_DEPTH_COMPONENT16: + internalformat = GL_DEPTH_COMPONENT; + break; + case GL_RGBA4: + case GL_RGB5_A1: + internalformat = GL_RGBA; + break; + case GL_RGB565: + internalformat = GL_RGB; + break; + } +#endif // GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2 glRenderbufferStorageEXT(target, internalformat, width, height); } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc index 8c64240c..e6e6bf2 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc @@ -176,9 +176,15 @@ void GLES2DecoderTestBase::SpecializedSetup<Uniform4fvImmediate, 0>( template <> void GLES2DecoderTestBase::SpecializedSetup<RenderbufferStorage, 0>( - bool /* valid */) { + bool valid) { DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); + if (valid) { + EXPECT_CALL(*gl_, + RenderbufferStorageEXT(GL_RENDERBUFFER, _, 3, 4)) + .Times(1) + .RetiresOnSaturation(); + } }; template <> diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h index 6bf4b6d..9d8cc0a 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h @@ -293,7 +293,6 @@ TEST_F(GLES2DecoderTest2, PolygonOffsetValidArgs) { // TODO(gman): ReleaseShaderCompiler TEST_F(GLES2DecoderTest2, RenderbufferStorageValidArgs) { - EXPECT_CALL(*gl_, RenderbufferStorageEXT(GL_RENDERBUFFER, GL_RGBA4, 3, 4)); SpecializedSetup<RenderbufferStorage, 0>(true); RenderbufferStorage cmd; cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4); diff --git a/gpu/command_buffer/service/renderbuffer_manager.h b/gpu/command_buffer/service/renderbuffer_manager.h index e896117..e5f1c0b 100644 --- a/gpu/command_buffer/service/renderbuffer_manager.h +++ b/gpu/command_buffer/service/renderbuffer_manager.h @@ -26,7 +26,8 @@ class RenderbufferManager { explicit RenderbufferInfo(GLuint service_id) : service_id_(service_id), - cleared_(false) { + cleared_(false), + internal_format_(GL_RGBA4) { } GLuint service_id() const { @@ -41,6 +42,14 @@ class RenderbufferManager { cleared_ = true; } + GLenum internal_format() const { + return internal_format_; + } + + void set_internal_format(GLenum internalformat) { + internal_format_ = internalformat; + } + bool IsDeleted() { return service_id_ == 0; } @@ -60,6 +69,9 @@ class RenderbufferManager { // Whether this renderbuffer has been cleared bool cleared_; + + // Renderbuffer internalformat set through RenderbufferStorage(). + GLenum internal_format_; }; RenderbufferManager() { } |