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

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

Issue 448223002: Only switch draw buffers if the extension is supported (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 5067 matching lines...) Expand 10 before | Expand all | Expand 10 after
5078 } 5078 }
5079 GLbitfield clear_bits = 0; 5079 GLbitfield clear_bits = 0;
5080 if (framebuffer->HasUnclearedColorAttachments()) { 5080 if (framebuffer->HasUnclearedColorAttachments()) {
5081 glClearColor( 5081 glClearColor(
5082 0.0f, 0.0f, 0.0f, 5082 0.0f, 0.0f, 0.0f,
5083 (GLES2Util::GetChannelsForFormat( 5083 (GLES2Util::GetChannelsForFormat(
5084 framebuffer->GetColorAttachmentFormat()) & 0x0008) != 0 ? 0.0f : 5084 framebuffer->GetColorAttachmentFormat()) & 0x0008) != 0 ? 0.0f :
5085 1.0f); 5085 1.0f);
5086 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 5086 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
5087 clear_bits |= GL_COLOR_BUFFER_BIT; 5087 clear_bits |= GL_COLOR_BUFFER_BIT;
5088 framebuffer->PrepareDrawBuffersForClear(); 5088 if (feature_info_->feature_flags().ext_draw_buffers)
5089 framebuffer->PrepareDrawBuffersForClear();
5089 } 5090 }
5090 5091
5091 if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) || 5092 if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) ||
5092 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { 5093 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) {
5093 glClearStencil(0); 5094 glClearStencil(0);
5094 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask); 5095 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
5095 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask); 5096 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
5096 clear_bits |= GL_STENCIL_BUFFER_BIT; 5097 clear_bits |= GL_STENCIL_BUFFER_BIT;
5097 } 5098 }
5098 5099
5099 if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) || 5100 if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) ||
5100 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { 5101 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) {
5101 glClearDepth(1.0f); 5102 glClearDepth(1.0f);
5102 state_.SetDeviceDepthMask(GL_TRUE); 5103 state_.SetDeviceDepthMask(GL_TRUE);
5103 clear_bits |= GL_DEPTH_BUFFER_BIT; 5104 clear_bits |= GL_DEPTH_BUFFER_BIT;
5104 } 5105 }
5105 5106
5106 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); 5107 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
5107 glClear(clear_bits); 5108 glClear(clear_bits);
5108 5109
5109 if ((clear_bits | GL_COLOR_BUFFER_BIT) != 0) 5110 if ((clear_bits | GL_COLOR_BUFFER_BIT) != 0 &&
5111 feature_info_->feature_flags().ext_draw_buffers)
5110 framebuffer->RestoreDrawBuffersAfterClear(); 5112 framebuffer->RestoreDrawBuffersAfterClear();
5111 5113
5112 framebuffer_manager()->MarkAttachmentsAsCleared( 5114 framebuffer_manager()->MarkAttachmentsAsCleared(
5113 framebuffer, renderbuffer_manager(), texture_manager()); 5115 framebuffer, renderbuffer_manager(), texture_manager());
5114 5116
5115 RestoreClearState(); 5117 RestoreClearState();
5116 5118
5117 if (target == GL_READ_FRAMEBUFFER_EXT) { 5119 if (target == GL_READ_FRAMEBUFFER_EXT) {
5118 glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, framebuffer->service_id()); 5120 glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, framebuffer->service_id());
5119 Framebuffer* draw_framebuffer = 5121 Framebuffer* draw_framebuffer =
(...skipping 5809 matching lines...) Expand 10 before | Expand all | Expand 10 after
10929 } 10931 }
10930 } 10932 }
10931 10933
10932 // Include the auto-generated part of this file. We split this because it means 10934 // Include the auto-generated part of this file. We split this because it means
10933 // we can easily edit the non-auto generated parts right here in this file 10935 // we can easily edit the non-auto generated parts right here in this file
10934 // instead of having to edit some template or the code generator. 10936 // instead of having to edit some template or the code generator.
10935 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10937 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10936 10938
10937 } // namespace gles2 10939 } // namespace gles2
10938 } // namespace gpu 10940 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698