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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1379783002: Allow one-copy task tile worker pool to use compressed textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace memory_efficient_format* with preferred_tile_format Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index af0a62f7e1654040e449fcf73891d4a2a83cee72..d0c8614df87fb556febb2e27d39ae4cdaaca45c9 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1782,6 +1782,11 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
GLenum target,
TextureRef* source_texture_ref,
TextureRef* dest_texture_ref);
+ bool ValidateCompressedCopySubTextureDimensions(
reveman 2015/12/02 18:28:50 btw, do we still need this? we're not using copysu
christiank 2015/12/03 12:58:00 No we don't need it at the moment. I'll revert the
+ const char* function_name,
+ GLenum target, GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height, GLenum format,
+ Texture* texture);
void RenderWarning(const char* filename, int line, const std::string& msg);
void PerformanceWarning(
@@ -12732,6 +12737,47 @@ bool GLES2DecoderImpl::ValidateCompressedCopyTextureCHROMIUM(
return true;
}
+bool GLES2DecoderImpl::ValidateCompressedCopySubTextureDimensions(
+ const char* function_name,
+ GLenum target, GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height, GLenum format,
+ Texture* texture) {
+ if (xoffset < 0 || yoffset < 0) {
+ LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "x/y offset < 0");
+ return false;
+ }
+
+ switch (format) {
+ case GL_ATC_RGB_AMD:
+ case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ case GL_ETC1_RGB8_OES: {
+ const int kBlockWidth = 4;
+ const int kBlockHeight = 4;
+ if ((xoffset % kBlockWidth) || (yoffset % kBlockHeight)) {
+ LOCAL_SET_GL_ERROR(
+ GL_INVALID_OPERATION, function_name,
+ "xoffset or yoffset not multiple of 4");
+ return false;
+ }
+ GLsizei tex_width = 0;
+ GLsizei tex_height = 0;
+ if (!texture->GetLevelSize(target, 0, &tex_width, &tex_height, nullptr) ||
+ width - xoffset > tex_width ||
+ height - yoffset > tex_height) {
+ LOCAL_SET_GL_ERROR(
+ GL_INVALID_OPERATION, function_name, "dimensions out of range");
+ return false;
+ }
+ return ValidateCompressedTexDimensions(
+ function_name, target, 0, width, height, 1, format);
+ }
+ default:
+ return false;
+ }
+}
+
void GLES2DecoderImpl::DoCopyTextureCHROMIUM(
GLenum target,
GLuint source_id,
@@ -13291,16 +13337,18 @@ void GLES2DecoderImpl::DoCompressedCopySubTextureCHROMIUM(GLenum target,
return;
}
- if (!ValidateCompressedTexSubDimensions("glCompressedCopySubTextureCHROMIUM",
- source_texture->target(), 0, x, y, 0,
- width, height, 1,
- source_internal_format,
- source_texture) ||
- !ValidateCompressedTexSubDimensions("glCompressedCopySubTextureCHROMIUM",
- dest_texture->target(), 0,
- xoffset, yoffset, 0, width, height, 1,
- dest_internal_format,
- dest_texture)) {
+ if (!ValidateCompressedCopySubTextureDimensions(
+ "glCompressedCopySubTextureCHROMIUM",
+ source_texture->target(), x, y,
+ width, height,
+ source_internal_format,
+ source_texture) ||
+ !ValidateCompressedCopySubTextureDimensions(
+ "glCompressedCopySubTextureCHROMIUM",
+ dest_texture->target(),
+ xoffset, yoffset, width, height,
+ dest_internal_format,
+ dest_texture)) {
return;
}

Powered by Google App Engine
This is Rietveld 408576698