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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2655073008: [gpu/GLES2DecoderImpl] Force updating scissor state on Nexus 7 gen.2 (Closed)
Patch Set: fix nits Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 6c2986a06d4548ae18e3847bb3dd3a8c91089a69..09ac49c65da16aee04fde0c8df6956e742870da6 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -839,7 +839,7 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
// Get the service side ID for the bound draw framebuffer.
// If it's back buffer, 0 is returned.
- GLuint GetBoundDrawFramebufferServiceId();
+ GLuint GetBoundDrawFramebufferServiceId() const;
// Get the format/type of the currently bound frame buffer (either FBO or
// regular back buffer).
@@ -4457,7 +4457,7 @@ GLuint GLES2DecoderImpl::GetBoundReadFramebufferServiceId() {
return 0;
}
-GLuint GLES2DecoderImpl::GetBoundDrawFramebufferServiceId() {
+GLuint GLES2DecoderImpl::GetBoundDrawFramebufferServiceId() const {
Framebuffer* framebuffer = GetBoundDrawFramebuffer();
if (framebuffer) {
return framebuffer->service_id();
@@ -5613,14 +5613,16 @@ uint32_t GLES2DecoderImpl::GetAndClearBackbufferClearBitsForTest() {
}
void GLES2DecoderImpl::OnFboChanged() const {
- if (workarounds().restore_scissor_on_fbo_change)
- state_.fbo_binding_for_scissor_workaround_dirty = true;
+ state_.fbo_binding_for_scissor_workaround_dirty = true;
}
// Called after the FBO is checked for completeness.
void GLES2DecoderImpl::OnUseFramebuffer() const {
- if (state_.fbo_binding_for_scissor_workaround_dirty) {
- state_.fbo_binding_for_scissor_workaround_dirty = false;
+ if (!state_.fbo_binding_for_scissor_workaround_dirty)
+ return;
+ state_.fbo_binding_for_scissor_workaround_dirty = false;
+
+ if (workarounds().restore_scissor_on_fbo_change) {
// The driver forgets the correct scissor when modifying the FBO binding.
glScissor(state_.scissor_x,
state_.scissor_y,
@@ -5631,6 +5633,26 @@ void GLES2DecoderImpl::OnUseFramebuffer() const {
// it's unclear how this bug works.
glFlush();
}
+
+ if (workarounds().force_update_scissor_state_when_binding_fbo0 &&
+ GetBoundDrawFramebufferServiceId() == 0) {
+ // The theory is that FBO0 keeps some internal (in HW regs maybe?) scissor
+ // test state, but the driver forgets to update it with GL_SCISSOR_TEST
+ // when FBO0 gets bound. (So it stuck with whatever state we last switched
+ // from it.)
+ // If the internal scissor test state was enabled, it does update its
+ // internal scissor rect with GL_SCISSOR_BOX though.
+ if (state_.enable_flags.cached_scissor_test) {
+ // The driver early outs if the new state matches previous state so some
+ // shake up is needed.
+ glDisable(GL_SCISSOR_TEST);
+ glEnable(GL_SCISSOR_TEST);
+ } else {
+ // Ditto.
+ glEnable(GL_SCISSOR_TEST);
+ glDisable(GL_SCISSOR_TEST);
+ }
+ }
}
void GLES2DecoderImpl::DoBindFramebuffer(GLenum target, GLuint client_id) {
« no previous file with comments | « no previous file | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698