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 3051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3062 | 3062 |
3063 bool GLES2DecoderImpl::CheckFramebufferValid( | 3063 bool GLES2DecoderImpl::CheckFramebufferValid( |
3064 Framebuffer* framebuffer, | 3064 Framebuffer* framebuffer, |
3065 GLenum target, const char* func_name) { | 3065 GLenum target, const char* func_name) { |
3066 if (!framebuffer) { | 3066 if (!framebuffer) { |
3067 if (backbuffer_needs_clear_bits_) { | 3067 if (backbuffer_needs_clear_bits_) { |
3068 glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat( | 3068 glClearColor(0, 0, 0, (GLES2Util::GetChannelsForFormat( |
3069 offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1); | 3069 offscreen_target_color_format_) & 0x0008) != 0 ? 0 : 1); |
3070 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | 3070 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
3071 glClearStencil(0); | 3071 glClearStencil(0); |
3072 glStencilMask(-1); | 3072 state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1); |
| 3073 state_.SetDeviceStencilMaskSeparate(GL_BACK, -1); |
3073 glClearDepth(1.0f); | 3074 glClearDepth(1.0f); |
3074 state_.SetDeviceDepthMask(GL_TRUE); | 3075 state_.SetDeviceDepthMask(GL_TRUE); |
3075 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); | 3076 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); |
3076 glClear(backbuffer_needs_clear_bits_); | 3077 glClear(backbuffer_needs_clear_bits_); |
3077 backbuffer_needs_clear_bits_ = 0; | 3078 backbuffer_needs_clear_bits_ = 0; |
3078 RestoreClearState(); | 3079 RestoreClearState(); |
3079 } | 3080 } |
3080 return true; | 3081 return true; |
3081 } | 3082 } |
3082 | 3083 |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5025 (GLES2Util::GetChannelsForFormat( | 5026 (GLES2Util::GetChannelsForFormat( |
5026 framebuffer->GetColorAttachmentFormat()) & 0x0008) != 0 ? 0.0f : | 5027 framebuffer->GetColorAttachmentFormat()) & 0x0008) != 0 ? 0.0f : |
5027 1.0f); | 5028 1.0f); |
5028 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | 5029 state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
5029 clear_bits |= GL_COLOR_BUFFER_BIT; | 5030 clear_bits |= GL_COLOR_BUFFER_BIT; |
5030 } | 5031 } |
5031 | 5032 |
5032 if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) || | 5033 if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) || |
5033 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { | 5034 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { |
5034 glClearStencil(0); | 5035 glClearStencil(0); |
5035 glStencilMask(-1); | 5036 state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1); |
| 5037 state_.SetDeviceStencilMaskSeparate(GL_BACK, -1); |
5036 clear_bits |= GL_STENCIL_BUFFER_BIT; | 5038 clear_bits |= GL_STENCIL_BUFFER_BIT; |
5037 } | 5039 } |
5038 | 5040 |
5039 if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) || | 5041 if (framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT) || |
5040 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { | 5042 framebuffer->HasUnclearedAttachment(GL_DEPTH_STENCIL_ATTACHMENT)) { |
5041 glClearDepth(1.0f); | 5043 glClearDepth(1.0f); |
5042 state_.SetDeviceDepthMask(GL_TRUE); | 5044 state_.SetDeviceDepthMask(GL_TRUE); |
5043 clear_bits |= GL_DEPTH_BUFFER_BIT; | 5045 clear_bits |= GL_DEPTH_BUFFER_BIT; |
5044 } | 5046 } |
5045 | 5047 |
(...skipping 2771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7817 GL_DEPTH_ATTACHMENT; | 7819 GL_DEPTH_ATTACHMENT; |
7818 | 7820 |
7819 glFramebufferTexture2DEXT( | 7821 glFramebufferTexture2DEXT( |
7820 GL_DRAW_FRAMEBUFFER_EXT, attachment, target, service_id, level); | 7822 GL_DRAW_FRAMEBUFFER_EXT, attachment, target, service_id, level); |
7821 // ANGLE promises a depth only attachment ok. | 7823 // ANGLE promises a depth only attachment ok. |
7822 if (glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT) != | 7824 if (glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT) != |
7823 GL_FRAMEBUFFER_COMPLETE) { | 7825 GL_FRAMEBUFFER_COMPLETE) { |
7824 return false; | 7826 return false; |
7825 } | 7827 } |
7826 glClearStencil(0); | 7828 glClearStencil(0); |
7827 glStencilMask(-1); | 7829 state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1); |
| 7830 state_.SetDeviceStencilMaskSeparate(GL_BACK, -1); |
7828 glClearDepth(1.0f); | 7831 glClearDepth(1.0f); |
7829 state_.SetDeviceDepthMask(GL_TRUE); | 7832 state_.SetDeviceDepthMask(GL_TRUE); |
7830 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); | 7833 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); |
7831 glClear(GL_DEPTH_BUFFER_BIT | (have_stencil ? GL_STENCIL_BUFFER_BIT : 0)); | 7834 glClear(GL_DEPTH_BUFFER_BIT | (have_stencil ? GL_STENCIL_BUFFER_BIT : 0)); |
7832 | 7835 |
7833 RestoreClearState(); | 7836 RestoreClearState(); |
7834 | 7837 |
7835 glDeleteFramebuffersEXT(1, &fb); | 7838 glDeleteFramebuffersEXT(1, &fb); |
7836 Framebuffer* framebuffer = | 7839 Framebuffer* framebuffer = |
7837 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); | 7840 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); |
(...skipping 2934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10772 } | 10775 } |
10773 } | 10776 } |
10774 | 10777 |
10775 // Include the auto-generated part of this file. We split this because it means | 10778 // Include the auto-generated part of this file. We split this because it means |
10776 // we can easily edit the non-auto generated parts right here in this file | 10779 // we can easily edit the non-auto generated parts right here in this file |
10777 // instead of having to edit some template or the code generator. | 10780 // instead of having to edit some template or the code generator. |
10778 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10781 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10779 | 10782 |
10780 } // namespace gles2 | 10783 } // namespace gles2 |
10781 } // namespace gpu | 10784 } // namespace gpu |
OLD | NEW |