OLD | NEW |
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 3109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3120 glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat( | 3120 glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat( |
3121 offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1.f); | 3121 offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1.f); |
3122 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | 3122 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
3123 glClearStencil(0); | 3123 glClearStencil(0); |
3124 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask); | 3124 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask); |
3125 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask); | 3125 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask); |
3126 glClearDepth(1.0f); | 3126 glClearDepth(1.0f); |
3127 state_.SetDeviceDepthMask(GL_TRUE); | 3127 state_.SetDeviceDepthMask(GL_TRUE); |
3128 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); | 3128 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); |
3129 bool reset_draw_buffer = false; | 3129 bool reset_draw_buffer = false; |
3130 if ((backbuffer_needs_clear_bits_ | GL_COLOR_BUFFER_BIT) != 0 && | 3130 if ((backbuffer_needs_clear_bits_ & GL_COLOR_BUFFER_BIT) != 0 && |
3131 group_->draw_buffer() == GL_NONE) { | 3131 group_->draw_buffer() == GL_NONE) { |
3132 reset_draw_buffer = true; | 3132 reset_draw_buffer = true; |
3133 GLenum buf = GL_BACK; | 3133 GLenum buf = GL_BACK; |
3134 if (GetBackbufferServiceId() != 0) // emulated backbuffer | 3134 if (GetBackbufferServiceId() != 0) // emulated backbuffer |
3135 buf = GL_COLOR_ATTACHMENT0; | 3135 buf = GL_COLOR_ATTACHMENT0; |
3136 glDrawBuffersARB(1, &buf); | 3136 glDrawBuffersARB(1, &buf); |
3137 } | 3137 } |
3138 glClear(backbuffer_needs_clear_bits_); | 3138 glClear(backbuffer_needs_clear_bits_); |
3139 if (reset_draw_buffer) { | 3139 if (reset_draw_buffer) { |
3140 GLenum buf = GL_NONE; | 3140 GLenum buf = GL_NONE; |
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5095 if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) || | 5095 if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) || |
5096 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { | 5096 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { |
5097 glClearDepth(1.0f); | 5097 glClearDepth(1.0f); |
5098 state_.SetDeviceDepthMask(GL_TRUE); | 5098 state_.SetDeviceDepthMask(GL_TRUE); |
5099 clear_bits |= GL_DEPTH_BUFFER_BIT; | 5099 clear_bits |= GL_DEPTH_BUFFER_BIT; |
5100 } | 5100 } |
5101 | 5101 |
5102 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); | 5102 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); |
5103 glClear(clear_bits); | 5103 glClear(clear_bits); |
5104 | 5104 |
5105 if ((clear_bits | GL_COLOR_BUFFER_BIT) != 0 && | 5105 if ((clear_bits & GL_COLOR_BUFFER_BIT) != 0 && |
5106 feature_info_->feature_flags().ext_draw_buffers) | 5106 feature_info_->feature_flags().ext_draw_buffers) |
5107 framebuffer->RestoreDrawBuffersAfterClear(); | 5107 framebuffer->RestoreDrawBuffersAfterClear(); |
5108 | 5108 |
5109 framebuffer_manager()->MarkAttachmentsAsCleared( | 5109 framebuffer_manager()->MarkAttachmentsAsCleared( |
5110 framebuffer, renderbuffer_manager(), texture_manager()); | 5110 framebuffer, renderbuffer_manager(), texture_manager()); |
5111 | 5111 |
5112 RestoreClearState(); | 5112 RestoreClearState(); |
5113 | 5113 |
5114 if (target == GL_READ_FRAMEBUFFER_EXT) { | 5114 if (target == GL_READ_FRAMEBUFFER_EXT) { |
5115 glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, framebuffer->service_id()); | 5115 glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, framebuffer->service_id()); |
(...skipping 6138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11254 } | 11254 } |
11255 } | 11255 } |
11256 | 11256 |
11257 // Include the auto-generated part of this file. We split this because it means | 11257 // Include the auto-generated part of this file. We split this because it means |
11258 // we can easily edit the non-auto generated parts right here in this file | 11258 // we can easily edit the non-auto generated parts right here in this file |
11259 // instead of having to edit some template or the code generator. | 11259 // instead of having to edit some template or the code generator. |
11260 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11260 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
11261 | 11261 |
11262 } // namespace gles2 | 11262 } // namespace gles2 |
11263 } // namespace gpu | 11263 } // namespace gpu |
OLD | NEW |