summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 23:47:13 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 23:47:13 +0000
commit32fe9aab6fa3530d25aa4b7be866d9165e026193 (patch)
tree4b3bd3cce3132df7ad653e19f06f7dc9468da253 /gpu
parent7aefb155470efae35c224f1ebb21f5ff893179f5 (diff)
downloadchromium_src-32fe9aab6fa3530d25aa4b7be866d9165e026193.zip
chromium_src-32fe9aab6fa3530d25aa4b7be866d9165e026193.tar.gz
chromium_src-32fe9aab6fa3530d25aa4b7be866d9165e026193.tar.bz2
Get correct backbuffer format when context is on screen.
TEST=none BUG=67873 Review URL: http://codereview.chromium.org/6359009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72233 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc11
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc3
2 files changed, 12 insertions, 2 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 9a5c544..d71f764 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1426,6 +1426,9 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
scoped_ptr<Callback1<gfx::Size>::Type> resize_callback_;
scoped_ptr<Callback0::Type> swap_buffers_callback_;
+ // The format of the back buffer_
+ GLenum back_buffer_color_format_;
+
// The last error message set.
std::string last_error_;
@@ -1756,6 +1759,7 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
offscreen_target_stencil_format_(0),
offscreen_target_samples_(0),
offscreen_saved_color_format_(0),
+ back_buffer_color_format_(0),
current_decoder_error_(error::kNoError),
use_shader_translator_(true),
validators_(group_->feature_info()->validators()),
@@ -1814,6 +1818,10 @@ bool GLES2DecoderImpl::Initialize(gfx::GLContext* context,
vertex_attrib_manager_.Initialize(group_->max_vertex_attribs());
+ GLint v = 0;
+ glGetIntegerv(GL_ALPHA_BITS, &v);
+ back_buffer_color_format_ = v ? GL_RGBA : GL_RGB;
+
// We have to enable vertex array 0 on OpenGL or it won't render. Note that
// OpenGL ES 2.0 does not have this issue.
glEnableVertexAttribArray(0);
@@ -2223,8 +2231,7 @@ GLenum GLES2DecoderImpl::GetBoundReadFrameBufferInternalFormat() {
} else if (offscreen_target_frame_buffer_.get()) {
return offscreen_target_color_format_;
} else {
- // TODO(gman): return correct format
- return GL_RGBA;
+ return back_buffer_color_format_;
}
}
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 370acde..e936276 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
@@ -47,6 +47,9 @@ void GLES2DecoderTestBase::InitDecoder(const char* extensions) {
EXPECT_TRUE(group_->Initialize(extensions));
+ EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _))
+ .WillOnce(SetArgumentPointee<1>(8))
+ .RetiresOnSaturation();
EXPECT_CALL(*gl_, EnableVertexAttribArray(0))
.Times(1)
.RetiresOnSaturation();