diff options
author | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-14 22:52:48 +0000 |
---|---|---|
committer | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-14 22:52:48 +0000 |
commit | 15cdae73f067c67aa62009292fe6161905c85814 (patch) | |
tree | b12b80ddd96aa8b23ed1204fad03c42fd9650891 /gpu | |
parent | a13d6771b025aeb6028e7e79c2b80b590c3bac01 (diff) | |
download | chromium_src-15cdae73f067c67aa62009292fe6161905c85814.zip chromium_src-15cdae73f067c67aa62009292fe6161905c85814.tar.gz chromium_src-15cdae73f067c67aa62009292fe6161905c85814.tar.bz2 |
Map RGBA4/RGB5_A1 to RGBA and RGB565 to RGB in RenderbufferStorage.
Review URL: http://codereview.chromium.org/2119001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47329 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/gl_utils.h | 1 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 19 | ||||
-rw-r--r-- | gpu/command_buffer/service/renderbuffer_manager.h | 14 |
3 files changed, 33 insertions, 1 deletions
diff --git a/gpu/command_buffer/service/gl_utils.h b/gpu/command_buffer/service/gl_utils.h index de2f044..df04688 100644 --- a/gpu/command_buffer/service/gl_utils.h +++ b/gpu/command_buffer/service/gl_utils.h @@ -71,6 +71,7 @@ #define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD #define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB #define GL_MAX_VARYING_VECTORS 0x8DFC + #define GL_RGB565 0x8D62 #define GL_SHADER_BINARY_FORMATS 0x8DF8 #define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 #define GL_SHADER_COMPILER 0x8DFA diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index d193c1e..2545867 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -2573,6 +2573,10 @@ void GLES2DecoderImpl::DoGetRenderbufferParameteriv( "glGetRenderbufferParameteriv: no renderbuffer bound"); return; } + if (pname == GL_RENDERBUFFER_INTERNAL_FORMAT) { + *params = bound_renderbuffer_->internalformat(); + return; + } glGetRenderbufferParameterivEXT(target, pname, params); } @@ -2583,6 +2587,21 @@ void GLES2DecoderImpl::DoRenderbufferStorage( "glGetRenderbufferStorage: no renderbuffer bound"); return; } + bound_renderbuffer_->set_internalformat(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/renderbuffer_manager.h b/gpu/command_buffer/service/renderbuffer_manager.h index e896117..c3c41b7 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), + internalformat_(GL_RGBA4) { } GLuint service_id() const { @@ -41,6 +42,14 @@ class RenderbufferManager { cleared_ = true; } + GLenum internalformat() const { + return internalformat_; + } + + void set_internalformat(GLenum internalformat) { + internalformat_ = 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 internalformat_; }; RenderbufferManager() { } |