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

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

Issue 2583183002: gles2: Fix glDiscardFramebufferEXT (Closed)
Patch Set: Address CL comment 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 | « no previous file | 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 5898 matching lines...) Expand 10 before | Expand all | Expand 10 after
5909 const char* function_name, 5909 const char* function_name,
5910 FramebufferOperation op) { 5910 FramebufferOperation op) {
5911 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); 5911 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
5912 5912
5913 // Because of performance issues, no-op if the format of the attachment is 5913 // Because of performance issues, no-op if the format of the attachment is
5914 // DEPTH_STENCIL and only one part is intended to be invalidated. 5914 // DEPTH_STENCIL and only one part is intended to be invalidated.
5915 bool has_depth_stencil_format = framebuffer && 5915 bool has_depth_stencil_format = framebuffer &&
5916 framebuffer->HasDepthStencilFormatAttachment(); 5916 framebuffer->HasDepthStencilFormatAttachment();
5917 bool invalidate_depth = false; 5917 bool invalidate_depth = false;
5918 bool invalidate_stencil = false; 5918 bool invalidate_stencil = false;
5919 std::unique_ptr<GLenum[]> validated_attachments(new GLenum[count]); 5919 std::unique_ptr<GLenum[]> validated_attachments(new GLenum[count]);
jbauman 2016/12/19 22:08:58 I think this needs to be changed to "count + 1".
jbriance 2016/12/19 22:45:17 You're right, good catch!
5920 GLsizei validated_count = 0; 5920 GLsizei validated_count = 0;
5921 5921
5922 // Validates the attachments. If one of them fails, the whole command fails. 5922 // Validates the attachments. If one of them fails, the whole command fails.
5923 GLenum thresh0 = GL_COLOR_ATTACHMENT0 + group_->max_color_attachments(); 5923 GLenum thresh0 = GL_COLOR_ATTACHMENT0 + group_->max_color_attachments();
5924 GLenum thresh1 = GL_COLOR_ATTACHMENT15; 5924 GLenum thresh1 = GL_COLOR_ATTACHMENT15;
5925 for (GLsizei i = 0; i < count; ++i) { 5925 for (GLsizei i = 0; i < count; ++i) {
5926 GLenum attachment = attachments[i]; 5926 GLenum attachment = attachments[i];
5927 if (framebuffer) { 5927 if (framebuffer) {
5928 if (attachment >= thresh0 && attachment <= thresh1) { 5928 if (attachment >= thresh0 && attachment <= thresh1) {
5929 LOCAL_SET_GL_ERROR( 5929 LOCAL_SET_GL_ERROR(
(...skipping 22 matching lines...) Expand all
5952 } else { 5952 } else {
5953 if (!validators_->backbuffer_attachment.IsValid(attachment)) { 5953 if (!validators_->backbuffer_attachment.IsValid(attachment)) {
5954 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, attachment, 5954 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, attachment,
5955 "attachments"); 5955 "attachments");
5956 return; 5956 return;
5957 } 5957 }
5958 } 5958 }
5959 validated_attachments[validated_count++] = attachment; 5959 validated_attachments[validated_count++] = attachment;
5960 } 5960 }
5961 if (invalidate_depth && invalidate_stencil) { 5961 if (invalidate_depth && invalidate_stencil) {
5962 validated_attachments[validated_count++] = GL_DEPTH_STENCIL_ATTACHMENT; 5962 // We do not use GL_DEPTH_STENCIL_ATTACHMENT here because
5963 // it is not a valid token for glDiscardFramebufferEXT.
5964 validated_attachments[validated_count++] = GL_DEPTH_ATTACHMENT;
5965 validated_attachments[validated_count++] = GL_STENCIL_ATTACHMENT;
5963 } 5966 }
5964 5967
5965 // If the default framebuffer is bound but we are still rendering to an 5968 // If the default framebuffer is bound but we are still rendering to an
5966 // FBO, translate attachment names that refer to default framebuffer 5969 // FBO, translate attachment names that refer to default framebuffer
5967 // channels to corresponding framebuffer attachments. 5970 // channels to corresponding framebuffer attachments.
5968 std::unique_ptr<GLenum[]> translated_attachments(new GLenum[validated_count]); 5971 std::unique_ptr<GLenum[]> translated_attachments(new GLenum[validated_count]);
5969 for (GLsizei i = 0; i < validated_count; ++i) { 5972 for (GLsizei i = 0; i < validated_count; ++i) {
5970 GLenum attachment = validated_attachments[i]; 5973 GLenum attachment = validated_attachments[i];
5971 if (!framebuffer && GetBackbufferServiceId()) { 5974 if (!framebuffer && GetBackbufferServiceId()) {
5972 switch (attachment) { 5975 switch (attachment) {
(...skipping 13022 matching lines...) Expand 10 before | Expand all | Expand 10 after
18995 } 18998 }
18996 18999
18997 // Include the auto-generated part of this file. We split this because it means 19000 // Include the auto-generated part of this file. We split this because it means
18998 // we can easily edit the non-auto generated parts right here in this file 19001 // we can easily edit the non-auto generated parts right here in this file
18999 // instead of having to edit some template or the code generator. 19002 // instead of having to edit some template or the code generator.
19000 #include "base/macros.h" 19003 #include "base/macros.h"
19001 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 19004 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
19002 19005
19003 } // namespace gles2 19006 } // namespace gles2
19004 } // namespace gpu 19007 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698