Commit 32fe9aab authored by gman@chromium.org's avatar gman@chromium.org

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
parent 7aefb155
......@@ -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_;
}
}
......
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment