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

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

Issue 1168213003: gpu: Make sure we restore scissor rect after clearing a texture level. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enable scissor test in UnClearedAttachmentsGetClearedOnClear Created 5 years, 6 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 | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h » ('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) 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 <cmath> 10 #include <cmath>
(...skipping 5678 matching lines...) Expand 10 before | Expand all | Expand 10 after
5689 } 5689 }
5690 } 5690 }
5691 5691
5692 void GLES2DecoderImpl::RestoreClearState() { 5692 void GLES2DecoderImpl::RestoreClearState() {
5693 framebuffer_state_.clear_state_dirty = true; 5693 framebuffer_state_.clear_state_dirty = true;
5694 glClearColor( 5694 glClearColor(
5695 state_.color_clear_red, state_.color_clear_green, state_.color_clear_blue, 5695 state_.color_clear_red, state_.color_clear_green, state_.color_clear_blue,
5696 state_.color_clear_alpha); 5696 state_.color_clear_alpha);
5697 glClearStencil(state_.stencil_clear); 5697 glClearStencil(state_.stencil_clear);
5698 glClearDepth(state_.depth_clear); 5698 glClearDepth(state_.depth_clear);
5699 if (state_.enable_flags.scissor_test) { 5699 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST,
5700 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, true); 5700 state_.enable_flags.scissor_test);
5701 } 5701 glScissor(state_.scissor_x, state_.scissor_y, state_.scissor_width,
5702 state_.scissor_height);
5702 } 5703 }
5703 5704
5704 GLenum GLES2DecoderImpl::DoCheckFramebufferStatus(GLenum target) { 5705 GLenum GLES2DecoderImpl::DoCheckFramebufferStatus(GLenum target) {
5705 Framebuffer* framebuffer = 5706 Framebuffer* framebuffer =
5706 GetFramebufferInfoForTarget(target); 5707 GetFramebufferInfoForTarget(target);
5707 if (!framebuffer) { 5708 if (!framebuffer) {
5708 return GL_FRAMEBUFFER_COMPLETE; 5709 return GL_FRAMEBUFFER_COMPLETE;
5709 } 5710 }
5710 GLenum completeness = framebuffer->IsPossiblyComplete(); 5711 GLenum completeness = framebuffer->IsPossiblyComplete();
5711 if (completeness != GL_FRAMEBUFFER_COMPLETE) { 5712 if (completeness != GL_FRAMEBUFFER_COMPLETE) {
(...skipping 3216 matching lines...) Expand 10 before | Expand all | Expand 10 after
8928 } 8929 }
8929 glClearStencil(0); 8930 glClearStencil(0);
8930 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask); 8931 state_.SetDeviceStencilMaskSeparate(GL_FRONT, kDefaultStencilMask);
8931 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask); 8932 state_.SetDeviceStencilMaskSeparate(GL_BACK, kDefaultStencilMask);
8932 glClearDepth(1.0f); 8933 glClearDepth(1.0f);
8933 state_.SetDeviceDepthMask(GL_TRUE); 8934 state_.SetDeviceDepthMask(GL_TRUE);
8934 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, true); 8935 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, true);
8935 glScissor(xoffset, yoffset, width, height); 8936 glScissor(xoffset, yoffset, width, height);
8936 glClear(GL_DEPTH_BUFFER_BIT | (have_stencil ? GL_STENCIL_BUFFER_BIT : 0)); 8937 glClear(GL_DEPTH_BUFFER_BIT | (have_stencil ? GL_STENCIL_BUFFER_BIT : 0));
8937 8938
8938 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
8939 RestoreClearState(); 8939 RestoreClearState();
8940 8940
8941 glDeleteFramebuffersEXT(1, &fb); 8941 glDeleteFramebuffersEXT(1, &fb);
8942 Framebuffer* framebuffer = 8942 Framebuffer* framebuffer =
8943 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); 8943 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
8944 GLuint fb_service_id = 8944 GLuint fb_service_id =
8945 framebuffer ? framebuffer->service_id() : GetBackbufferServiceId(); 8945 framebuffer ? framebuffer->service_id() : GetBackbufferServiceId();
8946 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb_service_id); 8946 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb_service_id);
8947 return true; 8947 return true;
8948 } 8948 }
(...skipping 4480 matching lines...) Expand 10 before | Expand all | Expand 10 after
13429 } 13429 }
13430 } 13430 }
13431 13431
13432 // Include the auto-generated part of this file. We split this because it means 13432 // Include the auto-generated part of this file. We split this because it means
13433 // we can easily edit the non-auto generated parts right here in this file 13433 // we can easily edit the non-auto generated parts right here in this file
13434 // instead of having to edit some template or the code generator. 13434 // instead of having to edit some template or the code generator.
13435 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 13435 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
13436 13436
13437 } // namespace gles2 13437 } // namespace gles2
13438 } // namespace gpu 13438 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698