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