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

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

Issue 2351093002: Fix crash in BlitFramebufferCHROMIUM if a read or draw depth/stencil buffer is not present (Closed)
Patch Set: rebase Created 4 years, 2 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
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 <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 7577 matching lines...) Expand 10 before | Expand all | Expand 10 after
7588 // and draw framebuffe is default framebuffer, but the other is fbo, they 7588 // and draw framebuffe is default framebuffer, but the other is fbo, they
7589 // always have no identical image. 7589 // always have no identical image.
7590 if (!read_framebuffer && !draw_framebuffer) { 7590 if (!read_framebuffer && !draw_framebuffer) {
7591 is_feedback_loop = FeedbackLoopTrue; 7591 is_feedback_loop = FeedbackLoopTrue;
7592 } else if (!read_framebuffer || !draw_framebuffer) { 7592 } else if (!read_framebuffer || !draw_framebuffer) {
7593 is_feedback_loop = FeedbackLoopFalse; 7593 is_feedback_loop = FeedbackLoopFalse;
7594 } else { 7594 } else {
7595 DCHECK(read_framebuffer && draw_framebuffer); 7595 DCHECK(read_framebuffer && draw_framebuffer);
7596 if ((mask & GL_DEPTH_BUFFER_BIT) != 0) { 7596 if ((mask & GL_DEPTH_BUFFER_BIT) != 0) {
7597 const Framebuffer::Attachment* depth_buffer_read = 7597 const Framebuffer::Attachment* depth_buffer_read =
7598 read_framebuffer->GetAttachment(GL_DEPTH_ATTACHMENT); 7598 read_framebuffer->GetDepthAttachment();
7599 const Framebuffer::Attachment* depth_buffer_draw = 7599 const Framebuffer::Attachment* depth_buffer_draw =
7600 draw_framebuffer->GetAttachment(GL_DEPTH_ATTACHMENT); 7600 draw_framebuffer->GetDepthAttachment();
7601 if (depth_buffer_draw && 7601 if (!depth_buffer_draw || !depth_buffer_read) {
7602 depth_buffer_draw->IsSameAttachment(depth_buffer_read)) { 7602 mask &= ~GL_DEPTH_BUFFER_BIT;
7603 } else if (depth_buffer_draw->IsSameAttachment(depth_buffer_read)) {
7603 is_feedback_loop = FeedbackLoopTrue; 7604 is_feedback_loop = FeedbackLoopTrue;
7604 } 7605 }
7605 } 7606 }
7606 if ((mask & GL_STENCIL_BUFFER_BIT) != 0) { 7607 if ((mask & GL_STENCIL_BUFFER_BIT) != 0) {
7607 const Framebuffer::Attachment* stencil_buffer_read = 7608 const Framebuffer::Attachment* stencil_buffer_read =
7608 read_framebuffer->GetAttachment(GL_STENCIL_ATTACHMENT); 7609 read_framebuffer->GetStencilAttachment();
7609 const Framebuffer::Attachment* stencil_buffer_draw = 7610 const Framebuffer::Attachment* stencil_buffer_draw =
7610 draw_framebuffer->GetAttachment(GL_STENCIL_ATTACHMENT); 7611 draw_framebuffer->GetStencilAttachment();
7611 if (stencil_buffer_draw && 7612 if (!stencil_buffer_draw || !stencil_buffer_read) {
7612 stencil_buffer_draw->IsSameAttachment(stencil_buffer_read)) { 7613 mask &= ~GL_STENCIL_BUFFER_BIT;
7614 } else if (stencil_buffer_draw->IsSameAttachment(stencil_buffer_read)) {
7613 is_feedback_loop = FeedbackLoopTrue; 7615 is_feedback_loop = FeedbackLoopTrue;
7614 } 7616 }
7615 } 7617 }
7618 if (!mask)
7619 return;
7616 } 7620 }
7617 7621
7618 GLenum src_internal_format = GetBoundReadFramebufferInternalFormat(); 7622 GLenum src_internal_format = GetBoundReadFramebufferInternalFormat();
7619 GLenum src_type = GetBoundReadFramebufferTextureType(); 7623 GLenum src_type = GetBoundReadFramebufferTextureType();
7620 7624
7621 bool read_buffer_has_srgb = 7625 bool read_buffer_has_srgb =
7622 GetColorEncodingFromInternalFormat(src_internal_format) == GL_SRGB; 7626 GetColorEncodingFromInternalFormat(src_internal_format) == GL_SRGB;
7623 bool draw_buffers_has_srgb = false; 7627 bool draw_buffers_has_srgb = false;
7624 if ((mask & GL_COLOR_BUFFER_BIT) != 0) { 7628 if ((mask & GL_COLOR_BUFFER_BIT) != 0) {
7625 bool is_src_signed_int = 7629 bool is_src_signed_int =
(...skipping 10447 matching lines...) Expand 10 before | Expand all | Expand 10 after
18073 } 18077 }
18074 18078
18075 // Include the auto-generated part of this file. We split this because it means 18079 // Include the auto-generated part of this file. We split this because it means
18076 // we can easily edit the non-auto generated parts right here in this file 18080 // we can easily edit the non-auto generated parts right here in this file
18077 // instead of having to edit some template or the code generator. 18081 // instead of having to edit some template or the code generator.
18078 #include "base/macros.h" 18082 #include "base/macros.h"
18079 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 18083 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
18080 18084
18081 } // namespace gles2 18085 } // namespace gles2
18082 } // namespace gpu 18086 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698