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

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

Issue 2581973002: [Command buffer]: Don't blit color buffer if draw buffers have no image during blitting (Closed)
Patch Set: code rebase Created 3 years, 12 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 | « content/test/gpu/gpu_tests/webgl2_conformance_expectations.py ('k') | no next file » | 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 <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 7997 matching lines...) Expand 10 before | Expand all | Expand 10 after
8008 "invalid filter for integer format"); 8008 "invalid filter for integer format");
8009 return; 8009 return;
8010 } 8010 }
8011 8011
8012 GLenum src_sized_format = 8012 GLenum src_sized_format =
8013 GLES2Util::ConvertToSizedFormat(src_internal_format, src_type); 8013 GLES2Util::ConvertToSizedFormat(src_internal_format, src_type);
8014 DCHECK(read_framebuffer || (is_feedback_loop != FeedbackLoopUnknown)); 8014 DCHECK(read_framebuffer || (is_feedback_loop != FeedbackLoopUnknown));
8015 const Framebuffer::Attachment* read_buffer = 8015 const Framebuffer::Attachment* read_buffer =
8016 is_feedback_loop == FeedbackLoopUnknown ? 8016 is_feedback_loop == FeedbackLoopUnknown ?
8017 read_framebuffer->GetReadBufferAttachment() : nullptr; 8017 read_framebuffer->GetReadBufferAttachment() : nullptr;
8018 bool draw_buffer_has_image = false;
8018 for (uint32_t ii = 0; ii < group_->max_draw_buffers(); ++ii) { 8019 for (uint32_t ii = 0; ii < group_->max_draw_buffers(); ++ii) {
8019 GLenum dst_format = GetBoundColorDrawBufferInternalFormat( 8020 GLenum dst_format = GetBoundColorDrawBufferInternalFormat(
8020 static_cast<GLint>(ii)); 8021 static_cast<GLint>(ii));
8021 GLenum dst_type = GetBoundColorDrawBufferType(static_cast<GLint>(ii)); 8022 GLenum dst_type = GetBoundColorDrawBufferType(static_cast<GLint>(ii));
8022 if (dst_format == 0) 8023 if (dst_format == 0)
8023 continue; 8024 continue;
8025 draw_buffer_has_image = true;
8024 if (!src_internal_format) { 8026 if (!src_internal_format) {
8025 read_framebuffer_miss_image = true; 8027 read_framebuffer_miss_image = true;
8026 } 8028 }
8027 if (GetColorEncodingFromInternalFormat(dst_format) == GL_SRGB) 8029 if (GetColorEncodingFromInternalFormat(dst_format) == GL_SRGB)
8028 draw_buffers_has_srgb = true; 8030 draw_buffers_has_srgb = true;
8029 if (read_buffer_samples > 0 && 8031 if (read_buffer_samples > 0 &&
8030 (src_sized_format != 8032 (src_sized_format !=
8031 GLES2Util::ConvertToSizedFormat(dst_format, dst_type))) { 8033 GLES2Util::ConvertToSizedFormat(dst_format, dst_type))) {
8032 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, 8034 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
8033 "src and dst formats differ for color"); 8035 "src and dst formats differ for color");
(...skipping 16 matching lines...) Expand all
8050 draw_framebuffer->GetAttachment(attachment); 8052 draw_framebuffer->GetAttachment(attachment);
8051 if (!draw_buffer || !read_buffer) { 8053 if (!draw_buffer || !read_buffer) {
8052 continue; 8054 continue;
8053 } 8055 }
8054 if (draw_buffer->IsSameAttachment(read_buffer)) { 8056 if (draw_buffer->IsSameAttachment(read_buffer)) {
8055 is_feedback_loop = FeedbackLoopTrue; 8057 is_feedback_loop = FeedbackLoopTrue;
8056 break; 8058 break;
8057 } 8059 }
8058 } 8060 }
8059 } 8061 }
8062 if (draw_framebuffer && !draw_buffer_has_image)
8063 mask_blit &= ~GL_COLOR_BUFFER_BIT;
8060 } 8064 }
8061 if (is_feedback_loop == FeedbackLoopTrue) { 8065 if (is_feedback_loop == FeedbackLoopTrue) {
8062 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, 8066 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
8063 "source buffer and destination buffers are identical"); 8067 "source buffer and destination buffers are identical");
8064 return; 8068 return;
8065 } 8069 }
8066 if (read_framebuffer_miss_image == true) { 8070 if (read_framebuffer_miss_image == true) {
8067 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, 8071 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
8068 "The designated attachment point(s) in read framebuffer miss image"); 8072 "The designated attachment point(s) in read framebuffer miss image");
8069 return; 8073 return;
(...skipping 11045 matching lines...) Expand 10 before | Expand all | Expand 10 after
19115 } 19119 }
19116 19120
19117 // Include the auto-generated part of this file. We split this because it means 19121 // Include the auto-generated part of this file. We split this because it means
19118 // we can easily edit the non-auto generated parts right here in this file 19122 // we can easily edit the non-auto generated parts right here in this file
19119 // instead of having to edit some template or the code generator. 19123 // instead of having to edit some template or the code generator.
19120 #include "base/macros.h" 19124 #include "base/macros.h"
19121 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 19125 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
19122 19126
19123 } // namespace gles2 19127 } // namespace gles2
19124 } // namespace gpu 19128 } // namespace gpu
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/webgl2_conformance_expectations.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698