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

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

Issue 2697503002: CMAA: Avoid DCHECK failure for unsupported internalformats (Closed)
Patch Set: fix gl_tests and report INVALID_OPERATION Created 3 years, 10 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 | gpu/command_buffer/tests/gl_apply_screen_space_antialiasing_CHROMIUM_unittest.cc » ('j') | 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 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 const GLvoid* data); 2021 const GLvoid* data);
2022 bool ValidateCompressedTexSubDimensions( 2022 bool ValidateCompressedTexSubDimensions(
2023 const char* function_name, 2023 const char* function_name,
2024 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 2024 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
2025 GLsizei width, GLsizei height, GLsizei depth, GLenum format, 2025 GLsizei width, GLsizei height, GLsizei depth, GLenum format,
2026 Texture* texture); 2026 Texture* texture);
2027 bool ValidateCopyTextureCHROMIUMTextures(const char* function_name, 2027 bool ValidateCopyTextureCHROMIUMTextures(const char* function_name,
2028 GLenum dest_target, 2028 GLenum dest_target,
2029 TextureRef* source_texture_ref, 2029 TextureRef* source_texture_ref,
2030 TextureRef* dest_texture_ref); 2030 TextureRef* dest_texture_ref);
2031 bool CanUseCopyTextureCHROMIUMInternalFormat(GLenum dest_internal_format);
2031 CopyTextureMethod ValidateCopyTextureCHROMIUMInternalFormats( 2032 CopyTextureMethod ValidateCopyTextureCHROMIUMInternalFormats(
2032 const char* function_name, 2033 const char* function_name,
2033 TextureRef* source_texture_ref, 2034 TextureRef* source_texture_ref,
2034 GLint source_level, 2035 GLint source_level,
2035 GLenum dest_internal_format); 2036 GLenum dest_internal_format);
2036 bool ValidateCompressedCopyTextureCHROMIUM(const char* function_name, 2037 bool ValidateCompressedCopyTextureCHROMIUM(const char* function_name,
2037 TextureRef* source_texture_ref, 2038 TextureRef* source_texture_ref,
2038 TextureRef* dest_texture_ref); 2039 TextureRef* dest_texture_ref);
2039 2040
2040 void RenderWarning(const char* filename, int line, const std::string& msg); 2041 void RenderWarning(const char* filename, int line, const std::string& msg);
(...skipping 14193 matching lines...) Expand 10 before | Expand all | Expand 10 after
16234 case GL_TEXTURE_EXTERNAL_OES: 16235 case GL_TEXTURE_EXTERNAL_OES:
16235 break; 16236 break;
16236 default: 16237 default:
16237 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, 16238 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name,
16238 "invalid source texture target binding"); 16239 "invalid source texture target binding");
16239 return false; 16240 return false;
16240 } 16241 }
16241 return true; 16242 return true;
16242 } 16243 }
16243 16244
16245 bool GLES2DecoderImpl::CanUseCopyTextureCHROMIUMInternalFormat(
16246 GLenum dest_internal_format) {
16247 switch (dest_internal_format) {
16248 case GL_RGB:
16249 case GL_RGBA:
16250 case GL_RGB8:
16251 case GL_RGBA8:
16252 case GL_BGRA_EXT:
16253 case GL_BGRA8_EXT:
16254 case GL_SRGB_EXT:
16255 case GL_SRGB_ALPHA_EXT:
16256 case GL_R8:
16257 case GL_R8UI:
16258 case GL_RG8:
16259 case GL_RG8UI:
16260 case GL_SRGB8:
16261 case GL_RGB565:
16262 case GL_RGB8UI:
16263 case GL_SRGB8_ALPHA8:
16264 case GL_RGB5_A1:
16265 case GL_RGBA4:
16266 case GL_RGBA8UI:
16267 case GL_RGB9_E5:
16268 case GL_R16F:
16269 case GL_R32F:
16270 case GL_RG16F:
16271 case GL_RG32F:
16272 case GL_RGB16F:
16273 case GL_RGB32F:
16274 case GL_RGBA16F:
16275 case GL_RGBA32F:
16276 case GL_R11F_G11F_B10F:
16277 return true;
16278 default:
16279 return false;
16280 }
16281 }
16282
16244 CopyTextureMethod GLES2DecoderImpl::ValidateCopyTextureCHROMIUMInternalFormats( 16283 CopyTextureMethod GLES2DecoderImpl::ValidateCopyTextureCHROMIUMInternalFormats(
16245 const char* function_name, 16284 const char* function_name,
16246 TextureRef* source_texture_ref, 16285 TextureRef* source_texture_ref,
16247 GLint source_level, 16286 GLint source_level,
16248 GLenum dest_internal_format) { 16287 GLenum dest_internal_format) {
16249 GLenum source_type = 0; 16288 GLenum source_type = 0;
16250 GLenum source_internal_format = 0; 16289 GLenum source_internal_format = 0;
16251 Texture* source_texture = source_texture_ref->texture(); 16290 Texture* source_texture = source_texture_ref->texture();
16252 source_texture->GetLevelType(source_texture->target(), source_level, 16291 source_texture->GetLevelType(source_texture->target(), source_level,
16253 &source_type, &source_internal_format); 16292 &source_type, &source_internal_format);
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
17379 apply_framebuffer_attachment_cmaa_intel_->Initialize(this); 17418 apply_framebuffer_attachment_cmaa_intel_->Initialize(this);
17380 RestoreCurrentFramebufferBindings(); 17419 RestoreCurrentFramebufferBindings();
17381 if (LOCAL_PEEK_GL_ERROR("glApplyFramebufferAttachmentCMAAINTEL") != 17420 if (LOCAL_PEEK_GL_ERROR("glApplyFramebufferAttachmentCMAAINTEL") !=
17382 GL_NO_ERROR) 17421 GL_NO_ERROR)
17383 return; 17422 return;
17384 } 17423 }
17385 static const char kFunctionName[] = 17424 static const char kFunctionName[] =
17386 "glApplyScreenSpaceAntialiasingCHROMIUM"; 17425 "glApplyScreenSpaceAntialiasingCHROMIUM";
17387 if (!InitializeCopyTextureCHROMIUM(kFunctionName)) 17426 if (!InitializeCopyTextureCHROMIUM(kFunctionName))
17388 return; 17427 return;
17428 for (uint32_t i = 0; i < group_->max_draw_buffers(); ++i) {
17429 const Framebuffer::Attachment* attachment =
17430 bound_framebuffer->GetAttachment(GL_COLOR_ATTACHMENT0 + i);
17431 if (attachment && attachment->IsTextureAttachment()) {
17432 GLenum internal_format = attachment->internal_format();
17433 if (!CanUseCopyTextureCHROMIUMInternalFormat(internal_format)) {
17434 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
17435 "Apply CMAA on framebuffer with attachment in "
17436 "invalid internalformat.");
17437 return;
17438 }
17439 }
17440 }
17441
17389 apply_framebuffer_attachment_cmaa_intel_ 17442 apply_framebuffer_attachment_cmaa_intel_
17390 ->ApplyFramebufferAttachmentCMAAINTEL(this, bound_framebuffer, 17443 ->ApplyFramebufferAttachmentCMAAINTEL(this, bound_framebuffer,
17391 copy_texture_CHROMIUM_.get(), 17444 copy_texture_CHROMIUM_.get(),
17392 texture_manager()); 17445 texture_manager());
17393 } 17446 }
17394 } 17447 }
17395 17448
17396 void GLES2DecoderImpl::DoInsertEventMarkerEXT( 17449 void GLES2DecoderImpl::DoInsertEventMarkerEXT(
17397 GLsizei length, const GLchar* marker) { 17450 GLsizei length, const GLchar* marker) {
17398 if (!marker) { 17451 if (!marker) {
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after
19250 } 19303 }
19251 19304
19252 // Include the auto-generated part of this file. We split this because it means 19305 // Include the auto-generated part of this file. We split this because it means
19253 // we can easily edit the non-auto generated parts right here in this file 19306 // we can easily edit the non-auto generated parts right here in this file
19254 // instead of having to edit some template or the code generator. 19307 // instead of having to edit some template or the code generator.
19255 #include "base/macros.h" 19308 #include "base/macros.h"
19256 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 19309 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
19257 19310
19258 } // namespace gles2 19311 } // namespace gles2
19259 } // namespace gpu 19312 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/tests/gl_apply_screen_space_antialiasing_CHROMIUM_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698