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

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

Issue 2166923002: Add unittests for InvalidateFramebuffer with DEPTH_STENCIL_ATTACHMENT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bots failures Created 4 years, 5 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 5669 matching lines...) Expand 10 before | Expand all | Expand 10 after
5680 5680
5681 void GLES2DecoderImpl::InvalidateFramebufferImpl( 5681 void GLES2DecoderImpl::InvalidateFramebufferImpl(
5682 GLenum target, GLsizei count, const GLenum* attachments, 5682 GLenum target, GLsizei count, const GLenum* attachments,
5683 GLint x, GLint y, GLsizei width, GLsizei height, 5683 GLint x, GLint y, GLsizei width, GLsizei height,
5684 const char* function_name, FramebufferOperation op) { 5684 const char* function_name, FramebufferOperation op) {
5685 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER); 5685 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER);
5686 5686
5687 // Because of performance issues, no-op if the format of the attachment is 5687 // Because of performance issues, no-op if the format of the attachment is
5688 // DEPTH_STENCIL and only one part is intended to be invalidated. 5688 // DEPTH_STENCIL and only one part is intended to be invalidated.
5689 bool has_depth_stencil_format = framebuffer && 5689 bool has_depth_stencil_format = framebuffer &&
5690 framebuffer->HasDepthStencilFormatAttachment(GL_DEPTH_ATTACHMENT) && 5690 framebuffer->HasDepthStencilFormatAttachment();
5691 framebuffer->HasDepthStencilFormatAttachment(GL_STENCIL_ATTACHMENT);
5692 bool invalidate_depth = false; 5691 bool invalidate_depth = false;
5693 bool invalidate_stencil = false; 5692 bool invalidate_stencil = false;
5694 std::unique_ptr<GLenum[]> validated_attachments(new GLenum[count]); 5693 std::unique_ptr<GLenum[]> validated_attachments(new GLenum[count]);
5695 GLsizei validated_count = 0; 5694 GLsizei validated_count = 0;
5696 5695
5697 // Validates the attachments. If one of them fails, the whole command fails. 5696 // Validates the attachments. If one of them fails, the whole command fails.
5698 GLenum thresh0 = GL_COLOR_ATTACHMENT0 + group_->max_color_attachments(); 5697 GLenum thresh0 = GL_COLOR_ATTACHMENT0 + group_->max_color_attachments();
5699 GLenum thresh1 = GL_COLOR_ATTACHMENT15; 5698 GLenum thresh1 = GL_COLOR_ATTACHMENT15;
5700 for (GLsizei i = 0; i < count; ++i) { 5699 for (GLsizei i = 0; i < count; ++i) {
5701 if (framebuffer) { 5700 if (framebuffer) {
5702 if (attachments[i] >= thresh0 && attachments[i] <= thresh1) { 5701 if (attachments[i] >= thresh0 && attachments[i] <= thresh1) {
5703 LOCAL_SET_GL_ERROR( 5702 LOCAL_SET_GL_ERROR(
5704 GL_INVALID_OPERATION, function_name, "invalid attachment"); 5703 GL_INVALID_OPERATION, function_name, "invalid attachment");
5705 return; 5704 return;
5706 } 5705 }
5707 if (!validators_->attachment.IsValid(attachments[i])) { 5706 if (!validators_->attachment.IsValid(attachments[i])) {
5708 LOCAL_SET_GL_ERROR_INVALID_ENUM( 5707 LOCAL_SET_GL_ERROR_INVALID_ENUM(
5709 function_name, attachments[i], "attachments"); 5708 function_name, attachments[i], "attachments");
5710 return; 5709 return;
5711 } 5710 }
5712 if (has_depth_stencil_format) { 5711 if (has_depth_stencil_format) {
5713 switch(attachments[i]) { 5712 switch(attachments[i]) {
5714 case GL_DEPTH_ATTACHMENT: 5713 case GL_DEPTH_ATTACHMENT:
5715 invalidate_depth = true; 5714 invalidate_depth = true;
5716 continue; 5715 continue;
5717 case GL_STENCIL_ATTACHMENT: 5716 case GL_STENCIL_ATTACHMENT:
5718 invalidate_stencil = true; 5717 invalidate_stencil = true;
5719 continue; 5718 continue;
5719 case GL_DEPTH_STENCIL_ATTACHMENT:
5720 invalidate_depth = true;
5721 invalidate_stencil = true;
5722 continue;
5720 } 5723 }
5721 } 5724 }
5722 } else { 5725 } else {
5723 if (!validators_->backbuffer_attachment.IsValid(attachments[i])) { 5726 if (!validators_->backbuffer_attachment.IsValid(attachments[i])) {
5724 LOCAL_SET_GL_ERROR_INVALID_ENUM( 5727 LOCAL_SET_GL_ERROR_INVALID_ENUM(
5725 function_name, attachments[i], "attachments"); 5728 function_name, attachments[i], "attachments");
5726 return; 5729 return;
5727 } 5730 }
5728 } 5731 }
5729 validated_attachments[validated_count++] = attachments[i]; 5732 validated_attachments[validated_count++] = attachments[i];
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
5785 break; 5788 break;
5786 } 5789 }
5787 5790
5788 if (!dirty) 5791 if (!dirty)
5789 return; 5792 return;
5790 5793
5791 // Marks each one of them as not cleared. 5794 // Marks each one of them as not cleared.
5792 for (GLsizei i = 0; i < validated_count; ++i) { 5795 for (GLsizei i = 0; i < validated_count; ++i) {
5793 if (framebuffer) { 5796 if (framebuffer) {
5794 if (validated_attachments[i] == GL_DEPTH_STENCIL_ATTACHMENT) { 5797 if (validated_attachments[i] == GL_DEPTH_STENCIL_ATTACHMENT) {
5798 // TODO(qiankun.miao@intel.com): We should only make DEPTH and STENCIL
Ken Russell (switch to Gerrit) 2016/07/22 18:24:31 Typo? make -> mark?
qiankun 2016/07/22 19:15:06 Done.
5799 // attachments as cleared when command buffer handles DEPTH_STENCIL
5800 // well. http://crbug.com/630568
5795 framebuffer->MarkAttachmentAsCleared(renderbuffer_manager(), 5801 framebuffer->MarkAttachmentAsCleared(renderbuffer_manager(),
5796 texture_manager(), 5802 texture_manager(),
5797 GL_DEPTH_ATTACHMENT, 5803 GL_DEPTH_ATTACHMENT,
5798 false); 5804 false);
5799 framebuffer->MarkAttachmentAsCleared(renderbuffer_manager(), 5805 framebuffer->MarkAttachmentAsCleared(renderbuffer_manager(),
5800 texture_manager(), 5806 texture_manager(),
5801 GL_STENCIL_ATTACHMENT, 5807 GL_STENCIL_ATTACHMENT,
5802 false); 5808 false);
5809 framebuffer->MarkAttachmentAsCleared(renderbuffer_manager(),
5810 texture_manager(),
5811 GL_DEPTH_STENCIL_ATTACHMENT,
5812 false);
5803 } else { 5813 } else {
5804 framebuffer->MarkAttachmentAsCleared(renderbuffer_manager(), 5814 framebuffer->MarkAttachmentAsCleared(renderbuffer_manager(),
5805 texture_manager(), 5815 texture_manager(),
5806 validated_attachments[i], 5816 validated_attachments[i],
5807 false); 5817 false);
5808 } 5818 }
5809 } else { 5819 } else {
5810 switch (validated_attachments[i]) { 5820 switch (validated_attachments[i]) {
5811 case GL_COLOR_EXT: 5821 case GL_COLOR_EXT:
5812 backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT; 5822 backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT;
(...skipping 11729 matching lines...) Expand 10 before | Expand all | Expand 10 after
17542 } 17552 }
17543 17553
17544 // Include the auto-generated part of this file. We split this because it means 17554 // Include the auto-generated part of this file. We split this because it means
17545 // we can easily edit the non-auto generated parts right here in this file 17555 // we can easily edit the non-auto generated parts right here in this file
17546 // instead of having to edit some template or the code generator. 17556 // instead of having to edit some template or the code generator.
17547 #include "base/macros.h" 17557 #include "base/macros.h"
17548 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17558 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17549 17559
17550 } // namespace gles2 17560 } // namespace gles2
17551 } // namespace gpu 17561 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698