Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 6359009: Get correct backbuffer format when context is on screen.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 1419
1420 // The copy that is saved when SwapBuffers is called. It is also 1420 // The copy that is saved when SwapBuffers is called. It is also
1421 // used as the destination for multi-sample resolves. 1421 // used as the destination for multi-sample resolves.
1422 scoped_ptr<FrameBuffer> offscreen_saved_frame_buffer_; 1422 scoped_ptr<FrameBuffer> offscreen_saved_frame_buffer_;
1423 scoped_ptr<Texture> offscreen_saved_color_texture_; 1423 scoped_ptr<Texture> offscreen_saved_color_texture_;
1424 GLenum offscreen_saved_color_format_; 1424 GLenum offscreen_saved_color_format_;
1425 1425
1426 scoped_ptr<Callback1<gfx::Size>::Type> resize_callback_; 1426 scoped_ptr<Callback1<gfx::Size>::Type> resize_callback_;
1427 scoped_ptr<Callback0::Type> swap_buffers_callback_; 1427 scoped_ptr<Callback0::Type> swap_buffers_callback_;
1428 1428
1429 // The format of the back buffer_
1430 GLenum back_buffer_color_format_;
1431
1429 // The last error message set. 1432 // The last error message set.
1430 std::string last_error_; 1433 std::string last_error_;
1431 1434
1432 // The current decoder error. 1435 // The current decoder error.
1433 error::Error current_decoder_error_; 1436 error::Error current_decoder_error_;
1434 1437
1435 bool use_shader_translator_; 1438 bool use_shader_translator_;
1436 scoped_ptr<ShaderTranslator> vertex_translator_; 1439 scoped_ptr<ShaderTranslator> vertex_translator_;
1437 scoped_ptr<ShaderTranslator> fragment_translator_; 1440 scoped_ptr<ShaderTranslator> fragment_translator_;
1438 1441
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 mask_stencil_front_(-1), 1752 mask_stencil_front_(-1),
1750 mask_stencil_back_(-1), 1753 mask_stencil_back_(-1),
1751 clear_depth_(1.0f), 1754 clear_depth_(1.0f),
1752 mask_depth_(true), 1755 mask_depth_(true),
1753 enable_scissor_test_(false), 1756 enable_scissor_test_(false),
1754 offscreen_target_color_format_(0), 1757 offscreen_target_color_format_(0),
1755 offscreen_target_depth_format_(0), 1758 offscreen_target_depth_format_(0),
1756 offscreen_target_stencil_format_(0), 1759 offscreen_target_stencil_format_(0),
1757 offscreen_target_samples_(0), 1760 offscreen_target_samples_(0),
1758 offscreen_saved_color_format_(0), 1761 offscreen_saved_color_format_(0),
1762 back_buffer_color_format_(0),
1759 current_decoder_error_(error::kNoError), 1763 current_decoder_error_(error::kNoError),
1760 use_shader_translator_(true), 1764 use_shader_translator_(true),
1761 validators_(group_->feature_info()->validators()), 1765 validators_(group_->feature_info()->validators()),
1762 feature_info_(group_->feature_info()) { 1766 feature_info_(group_->feature_info()) {
1763 attrib_0_value_.v[0] = 0.0f; 1767 attrib_0_value_.v[0] = 0.0f;
1764 attrib_0_value_.v[1] = 0.0f; 1768 attrib_0_value_.v[1] = 0.0f;
1765 attrib_0_value_.v[2] = 0.0f; 1769 attrib_0_value_.v[2] = 0.0f;
1766 attrib_0_value_.v[3] = 1.0f; 1770 attrib_0_value_.v[3] = 1.0f;
1767 1771
1768 // The shader translator is used for WebGL even when running on EGL 1772 // The shader translator is used for WebGL even when running on EGL
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 LOG(ERROR) << "GPUProcessor::InitializeCommon failed because group " 1811 LOG(ERROR) << "GPUProcessor::InitializeCommon failed because group "
1808 << "failed to initialize."; 1812 << "failed to initialize.";
1809 Destroy(); 1813 Destroy();
1810 return false; 1814 return false;
1811 } 1815 }
1812 1816
1813 CHECK_GL_ERROR(); 1817 CHECK_GL_ERROR();
1814 1818
1815 vertex_attrib_manager_.Initialize(group_->max_vertex_attribs()); 1819 vertex_attrib_manager_.Initialize(group_->max_vertex_attribs());
1816 1820
1821 GLint v = 0;
1822 glGetIntegerv(GL_ALPHA_BITS, &v);
1823 back_buffer_color_format_ = v ? GL_RGBA : GL_RGB;
1824
1817 // We have to enable vertex array 0 on OpenGL or it won't render. Note that 1825 // We have to enable vertex array 0 on OpenGL or it won't render. Note that
1818 // OpenGL ES 2.0 does not have this issue. 1826 // OpenGL ES 2.0 does not have this issue.
1819 glEnableVertexAttribArray(0); 1827 glEnableVertexAttribArray(0);
1820 glGenBuffersARB(1, &attrib_0_buffer_id_); 1828 glGenBuffersARB(1, &attrib_0_buffer_id_);
1821 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); 1829 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_);
1822 glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL); 1830 glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL);
1823 glBindBuffer(GL_ARRAY_BUFFER, 0); 1831 glBindBuffer(GL_ARRAY_BUFFER, 0);
1824 glGenBuffersARB(1, &fixed_attrib_buffer_id_); 1832 glGenBuffersARB(1, &fixed_attrib_buffer_id_);
1825 1833
1826 texture_units_.reset( 1834 texture_units_.reset(
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2216 if (bound_read_framebuffer_ != 0) { 2224 if (bound_read_framebuffer_ != 0) {
2217 const FramebufferManager::FramebufferInfo::Attachment* attachment = 2225 const FramebufferManager::FramebufferInfo::Attachment* attachment =
2218 bound_read_framebuffer_->GetAttachment(GL_COLOR_ATTACHMENT0); 2226 bound_read_framebuffer_->GetAttachment(GL_COLOR_ATTACHMENT0);
2219 if (attachment) { 2227 if (attachment) {
2220 return attachment->internal_format(); 2228 return attachment->internal_format();
2221 } 2229 }
2222 return 0; 2230 return 0;
2223 } else if (offscreen_target_frame_buffer_.get()) { 2231 } else if (offscreen_target_frame_buffer_.get()) {
2224 return offscreen_target_color_format_; 2232 return offscreen_target_color_format_;
2225 } else { 2233 } else {
2226 // TODO(gman): return correct format 2234 return back_buffer_color_format_;
2227 return GL_RGBA;
2228 } 2235 }
2229 } 2236 }
2230 2237
2231 bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { 2238 bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() {
2232 if (offscreen_size_ == pending_offscreen_size_) 2239 if (offscreen_size_ == pending_offscreen_size_)
2233 return true; 2240 return true;
2234 2241
2235 offscreen_size_ = pending_offscreen_size_; 2242 offscreen_size_ = pending_offscreen_size_;
2236 2243
2237 // Reallocate the offscreen target buffers. 2244 // Reallocate the offscreen target buffers.
(...skipping 3854 matching lines...) Expand 10 before | Expand all | Expand 10 after
6092 return error::kNoError; 6099 return error::kNoError;
6093 } 6100 }
6094 6101
6095 // Include the auto-generated part of this file. We split this because it means 6102 // Include the auto-generated part of this file. We split this because it means
6096 // we can easily edit the non-auto generated parts right here in this file 6103 // we can easily edit the non-auto generated parts right here in this file
6097 // instead of having to edit some template or the code generator. 6104 // instead of having to edit some template or the code generator.
6098 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 6105 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
6099 6106
6100 } // namespace gles2 6107 } // namespace gles2
6101 } // namespace gpu 6108 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698