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

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

Issue 2241593003: [Command buffer] CopyTexSubImage3D: emulate unsized format in desktop core profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed zmo@'s feedback Created 4 years, 3 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 | « gpu/command_buffer/service/gles2_cmd_copy_tex_image.cc ('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 12991 matching lines...) Expand 10 before | Expand all | Expand 10 after
13002 memset(zero.get(), 0, pixels_size); 13002 memset(zero.get(), 0, pixels_size);
13003 glTexImage2D(target, level, TextureManager::AdjustTexInternalFormat( 13003 glTexImage2D(target, level, TextureManager::AdjustTexInternalFormat(
13004 feature_info_.get(), internal_format), 13004 feature_info_.get(), internal_format),
13005 width, height, border, format, type, zero.get()); 13005 width, height, border, format, type, zero.get());
13006 if (copyHeight > 0 && copyWidth > 0) { 13006 if (copyHeight > 0 && copyWidth > 0) {
13007 GLint dx = copyX - x; 13007 GLint dx = copyX - x;
13008 GLint dy = copyY - y; 13008 GLint dy = copyY - y;
13009 GLint destX = dx; 13009 GLint destX = dx;
13010 GLint destY = dy; 13010 GLint destY = dy;
13011 if (requires_luma_blit) { 13011 if (requires_luma_blit) {
13012 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMACompatibilityTexture( 13012 copy_tex_image_blit_->DoCopyTexSubImageToLUMACompatibilityTexture(
13013 this, texture->service_id(), texture->target(), target, format, 13013 this, texture->service_id(), texture->target(), target, format,
13014 type, level, destX, destY, copyX, copyY, copyWidth, copyHeight, 13014 type, level, destX, destY, 0, copyX, copyY, copyWidth, copyHeight,
13015 GetBoundReadFrameBufferServiceId(), 13015 GetBoundReadFrameBufferServiceId(),
13016 GetBoundReadFrameBufferInternalFormat()); 13016 GetBoundReadFrameBufferInternalFormat());
13017 } else { 13017 } else {
13018 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, 13018 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY,
13019 copyWidth, copyHeight); 13019 copyWidth, copyHeight);
13020 } 13020 }
13021 } 13021 }
13022 } else { 13022 } else {
13023 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat( 13023 GLenum final_internal_format = TextureManager::AdjustTexInternalFormat(
13024 feature_info_.get(), internal_format); 13024 feature_info_.get(), internal_format);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
13176 // Write all pixels in below. 13176 // Write all pixels in below.
13177 texture_manager()->SetLevelCleared(texture_ref, target, level, true); 13177 texture_manager()->SetLevelCleared(texture_ref, target, level, true);
13178 } 13178 }
13179 13179
13180 if (copyHeight > 0 && copyWidth > 0) { 13180 if (copyHeight > 0 && copyWidth > 0) {
13181 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit( 13181 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit(
13182 feature_info_.get(), internal_format)) { 13182 feature_info_.get(), internal_format)) {
13183 if (!InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) { 13183 if (!InitializeCopyTexImageBlitter("glCopyTexSubImage2D")) {
13184 return; 13184 return;
13185 } 13185 }
13186 copy_tex_image_blit_->DoCopyTexSubImage2DToLUMACompatibilityTexture( 13186 copy_tex_image_blit_->DoCopyTexSubImageToLUMACompatibilityTexture(
13187 this, texture->service_id(), texture->target(), target, 13187 this, texture->service_id(), texture->target(), target,
13188 internal_format, type, level, xoffset, yoffset, x, y, width, height, 13188 internal_format, type, level, destX, destY, 0,
13189 copyX, copyY, copyWidth, copyHeight,
13189 GetBoundReadFrameBufferServiceId(), 13190 GetBoundReadFrameBufferServiceId(),
13190 GetBoundReadFrameBufferInternalFormat()); 13191 GetBoundReadFrameBufferInternalFormat());
13191 } else { 13192 } else {
13192 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth, 13193 glCopyTexSubImage2D(target, level, destX, destY, copyX, copyY, copyWidth,
13193 copyHeight); 13194 copyHeight);
13194 } 13195 }
13195 } 13196 }
13196 13197
13197 // This may be a slow command. Exit command processing to allow for 13198 // This may be a slow command. Exit command processing to allow for
13198 // context preemption and GPU watchdog checks. 13199 // context preemption and GPU watchdog checks.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
13265 // for TexSubImage3D. 13266 // for TexSubImage3D.
13266 if (!texture->IsLevelCleared(target, level)) { 13267 if (!texture->IsLevelCleared(target, level)) {
13267 if (!texture_manager()->ClearTextureLevel(this, texture_ref, target, 13268 if (!texture_manager()->ClearTextureLevel(this, texture_ref, target,
13268 level)) { 13269 level)) {
13269 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "dimensions too big"); 13270 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "dimensions too big");
13270 return; 13271 return;
13271 } 13272 }
13272 DCHECK(texture->IsLevelCleared(target, level)); 13273 DCHECK(texture->IsLevelCleared(target, level));
13273 } 13274 }
13274 13275
13275 // TODO(yunchao): Follow-up CLs are necessary. For instance:
13276 // 1. emulation of unsized formats in core profile
13277
13278 if (copyHeight > 0 && copyWidth > 0) { 13276 if (copyHeight > 0 && copyWidth > 0) {
13279 glCopyTexSubImage3D(target, level, destX, destY, zoffset, 13277 if (CopyTexImageResourceManager::CopyTexImageRequiresBlit(
13280 copyX, copyY, copyWidth, copyHeight); 13278 feature_info_.get(), internal_format)) {
13279 if (!InitializeCopyTexImageBlitter(func_name)) {
13280 return;
13281 }
13282 copy_tex_image_blit_->DoCopyTexSubImageToLUMACompatibilityTexture(
13283 this, texture->service_id(), texture->target(), target,
13284 internal_format, type, level, destX, destY, zoffset,
13285 copyX, copyY, copyWidth, copyHeight,
13286 GetBoundReadFrameBufferServiceId(),
13287 GetBoundReadFrameBufferInternalFormat());
13288 } else {
13289 glCopyTexSubImage3D(target, level, destX, destY, zoffset,
13290 copyX, copyY, copyWidth, copyHeight);
13291 }
13281 } 13292 }
13282 13293
13283 // This may be a slow command. Exit command processing to allow for 13294 // This may be a slow command. Exit command processing to allow for
13284 // context preemption and GPU watchdog checks. 13295 // context preemption and GPU watchdog checks.
13285 ExitCommandProcessingEarly(); 13296 ExitCommandProcessingEarly();
13286 } 13297 }
13287 13298
13288 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, 13299 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size,
13289 const void* cmd_data) { 13300 const void* cmd_data) {
13290 const gles2::cmds::TexSubImage2D& c = 13301 const gles2::cmds::TexSubImage2D& c =
(...skipping 4422 matching lines...) Expand 10 before | Expand all | Expand 10 after
17713 } 17724 }
17714 17725
17715 // Include the auto-generated part of this file. We split this because it means 17726 // Include the auto-generated part of this file. We split this because it means
17716 // we can easily edit the non-auto generated parts right here in this file 17727 // we can easily edit the non-auto generated parts right here in this file
17717 // instead of having to edit some template or the code generator. 17728 // instead of having to edit some template or the code generator.
17718 #include "base/macros.h" 17729 #include "base/macros.h"
17719 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17730 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17720 17731
17721 } // namespace gles2 17732 } // namespace gles2
17722 } // namespace gpu 17733 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_copy_tex_image.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698