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

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

Issue 2182443003: WebGL 2: Fix bugs in negativetextureapi.html for Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed feedbacks from zmo and qiankun Created 4 years, 4 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 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 void DoCopyTexSubImage2D( 1000 void DoCopyTexSubImage2D(
1001 GLenum target, 1001 GLenum target,
1002 GLint level, 1002 GLint level,
1003 GLint xoffset, 1003 GLint xoffset,
1004 GLint yoffset, 1004 GLint yoffset,
1005 GLint x, 1005 GLint x,
1006 GLint y, 1006 GLint y,
1007 GLsizei width, 1007 GLsizei width,
1008 GLsizei height); 1008 GLsizei height);
1009 1009
1010 // Wrapper for CopyTexSubImage3D.
1011 void DoCopyTexSubImage3D(
1012 GLenum target,
1013 GLint level,
1014 GLint xoffset,
1015 GLint yoffset,
1016 GLint zoffset,
1017 GLint x,
1018 GLint y,
1019 GLsizei width,
1020 GLsizei height);
1021
1010 void DoCopyTextureCHROMIUM(GLuint source_id, 1022 void DoCopyTextureCHROMIUM(GLuint source_id,
1011 GLuint dest_id, 1023 GLuint dest_id,
1012 GLenum internal_format, 1024 GLenum internal_format,
1013 GLenum dest_type, 1025 GLenum dest_type,
1014 GLboolean unpack_flip_y, 1026 GLboolean unpack_flip_y,
1015 GLboolean unpack_premultiply_alpha, 1027 GLboolean unpack_premultiply_alpha,
1016 GLboolean unpack_unmultiply_alpha); 1028 GLboolean unpack_unmultiply_alpha);
1017 1029
1018 void DoCopySubTextureCHROMIUM(GLuint source_id, 1030 void DoCopySubTextureCHROMIUM(GLuint source_id,
1019 GLuint dest_id, 1031 GLuint dest_id,
(...skipping 11992 matching lines...) Expand 10 before | Expand all | Expand 10 after
13012 gfx::Size size = GetBoundReadFrameBufferSize(); 13024 gfx::Size size = GetBoundReadFrameBufferSize();
13013 13025
13014 if (texture->IsAttachedToFramebuffer()) { 13026 if (texture->IsAttachedToFramebuffer()) {
13015 framebuffer_state_.clear_state_dirty = true; 13027 framebuffer_state_.clear_state_dirty = true;
13016 } 13028 }
13017 13029
13018 bool requires_luma_blit = 13030 bool requires_luma_blit =
13019 CopyTexImageResourceManager::CopyTexImageRequiresBlit(feature_info_.get(), 13031 CopyTexImageResourceManager::CopyTexImageRequiresBlit(feature_info_.get(),
13020 format); 13032 format);
13021 if (requires_luma_blit && 13033 if (requires_luma_blit &&
13022 !InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) { 13034 !InitializeCopyTexImageBlitter(func_name)) {
13023 return; 13035 return;
13024 } 13036 }
13025 13037
13026 // Clip to size to source dimensions 13038 // Clip to size to source dimensions
13027 GLint copyX = 0; 13039 GLint copyX = 0;
13028 GLint copyY = 0; 13040 GLint copyY = 0;
13029 GLint copyWidth = 0; 13041 GLint copyWidth = 0;
13030 GLint copyHeight = 0; 13042 GLint copyHeight = 0;
13031 Clip(x, width, size.width(), &copyX, &copyWidth); 13043 Clip(x, width, size.width(), &copyX, &copyWidth);
13032 Clip(y, height, size.height(), &copyY, &copyHeight); 13044 Clip(y, height, size.height(), &copyY, &copyHeight);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
13233 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth, 13245 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth,
13234 copyHeight); 13246 copyHeight);
13235 } 13247 }
13236 } 13248 }
13237 13249
13238 // This may be a slow command. Exit command processing to allow for 13250 // This may be a slow command. Exit command processing to allow for
13239 // context preemption and GPU watchdog checks. 13251 // context preemption and GPU watchdog checks.
13240 ExitCommandProcessingEarly(); 13252 ExitCommandProcessingEarly();
13241 } 13253 }
13242 13254
13255 void GLES2DecoderImpl::DoCopyTexSubImage3D(
13256 GLenum target,
13257 GLint level,
13258 GLint xoffset,
13259 GLint yoffset,
13260 GLint zoffset,
13261 GLint x,
13262 GLint y,
13263 GLsizei width,
13264 GLsizei height) {
13265 const char* func_name = "glCopyTexSubImage3D";
13266 DCHECK(!ShouldDeferReads());
13267 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget(
13268 &state_, target);
13269 if (!texture_ref) {
13270 LOCAL_SET_GL_ERROR(
13271 GL_INVALID_OPERATION, func_name, "unknown texture for target");
13272 return;
13273 }
13274 Texture* texture = texture_ref->texture();
13275 GLenum type = 0;
13276 GLenum internal_format = 0;
13277 if (!texture->GetLevelType(target, level, &type, &internal_format) ||
13278 !texture->ValidForTexture(
13279 target, level, xoffset, yoffset, zoffset, width, height, 1)) {
13280 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "bad dimensions.");
13281 return;
13282 }
13283
13284 if (!CheckBoundReadFramebufferValid(func_name,
13285 GL_INVALID_FRAMEBUFFER_OPERATION)) {
13286 return;
13287 }
13288
13289 GLenum read_format = GetBoundReadFrameBufferInternalFormat();
13290 GLenum read_type = GetBoundReadFrameBufferTextureType();
13291 if (!ValidateCopyTexFormat(func_name, internal_format,
13292 read_format, read_type)) {
13293 return;
13294 }
13295
13296 // TODO(yunchao): Follow-up CLs are necessary. For instance, feedback loop
13297 // detection, emulation of unsized formats in core profile, clear the 3d
13298 // textures if it is uncleared, out-of-bounds reading, etc.
Zhenyao Mo 2016/07/28 00:10:54 Please do follow up. Can you also add a conforman
yunchao 2016/07/28 00:41:04 Yes. In fact, I have already had a CL to handle th
Zhenyao Mo 2016/07/28 05:13:26 I suggest adding a webgl2 conformance test instead
13299
13300 glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width,
13301 height);
13302
13303 // This may be a slow command. Exit command processing to allow for
13304 // context preemption and GPU watchdog checks.
13305 ExitCommandProcessingEarly();
13306 }
13307
13243 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, 13308 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size,
13244 const void* cmd_data) { 13309 const void* cmd_data) {
13245 const gles2::cmds::TexSubImage2D& c = 13310 const gles2::cmds::TexSubImage2D& c =
13246 *static_cast<const gles2::cmds::TexSubImage2D*>(cmd_data); 13311 *static_cast<const gles2::cmds::TexSubImage2D*>(cmd_data);
13247 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage2D", 13312 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage2D",
13248 "width", c.width, "height", c.height); 13313 "width", c.width, "height", c.height);
13249 GLboolean internal = static_cast<GLboolean>(c.internal); 13314 GLboolean internal = static_cast<GLboolean>(c.internal);
13250 if (internal == GL_TRUE && texture_state_.tex_image_failed) 13315 if (internal == GL_TRUE && texture_state_.tex_image_failed)
13251 return error::kNoError; 13316 return error::kNoError;
13252 13317
(...skipping 4435 matching lines...) Expand 10 before | Expand all | Expand 10 after
17688 } 17753 }
17689 17754
17690 // Include the auto-generated part of this file. We split this because it means 17755 // Include the auto-generated part of this file. We split this because it means
17691 // we can easily edit the non-auto generated parts right here in this file 17756 // we can easily edit the non-auto generated parts right here in this file
17692 // instead of having to edit some template or the code generator. 17757 // instead of having to edit some template or the code generator.
17693 #include "base/macros.h" 17758 #include "base/macros.h"
17694 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17759 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17695 17760
17696 } // namespace gles2 17761 } // namespace gles2
17697 } // namespace gpu 17762 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698