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 fba0b90ed602633fe7e2a6d5b1fb67304fa51fa9..0a85a05ea7ca05823e739b00f74c6adb0bd42214 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -3121,6 +3121,8 @@ Capabilities GLES2DecoderImpl::GetCapabilities() { |
caps.egl_image_external = |
feature_info_->feature_flags().oes_egl_image_external; |
+ caps.texture_format_astc = |
+ feature_info_->feature_flags().ext_texture_format_astc; |
caps.texture_format_atc = |
feature_info_->feature_flags().ext_texture_format_atc; |
caps.texture_format_bgra8888 = |
@@ -6869,7 +6871,6 @@ bool GLES2DecoderImpl::PrepareTexturesForRender() { |
!texture_manager()->HaveImages()) { |
return true; |
} |
- |
bool textures_set = false; |
const Program::SamplerIndices& sampler_indices = |
state_.current_program->sampler_indices(); |
@@ -9086,6 +9087,44 @@ const int kS3TCDXT1BlockSize = 8; |
const int kS3TCDXT3AndDXT5BlockSize = 16; |
const int kEACAndETC2BlockSize = 4; |
+typedef struct { |
+ int blockWidth; |
+ int blockHeight; |
+} ASTCBlockSize; |
+ |
+static const ASTCBlockSize kASTCBlockSize[] = |
+ { |
+ 4, 4, /* GL_COMPRESSED_RGBA_ASTC_4x4_KHR */ |
+ 5, 4, |
+ 5, 5, |
+ 6, 5, |
+ 6, 6, |
+ 8, 5, |
+ 8, 6, |
+ 8, 8, |
+ 10, 5, |
+ 10, 6, |
+ 10, 8, |
+ 10, 10, |
+ 12, 10, |
+ 12, 12, |
+ 4, 4, /* GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR */ |
bajones
2015/08/07 21:35:58
These values are not currently used. May want to r
|
+ 5, 4, |
+ 5, 5, |
+ 6, 5, |
+ 6, 6, |
+ 8, 5, |
+ 8, 6, |
+ 8, 8, |
+ 10, 5, |
+ 10, 6, |
+ 10, 8, |
+ 10, 10, |
+ 12, 10, |
+ 12, 12 |
+ }; |
+ |
+ |
bool IsValidDXTSize(GLint level, GLsizei size) { |
return (size == 1) || |
(size == 2) || !(size % kS3TCBlockWidth); |
@@ -9113,6 +9152,49 @@ bool GLES2DecoderImpl::GetCompressedTexSizeInBytes( |
(height + kS3TCBlockHeight - 1) / kS3TCBlockHeight; |
bytes_required *= kS3TCDXT1BlockSize; |
break; |
+ case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: { |
+ const int index = (format < GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR) ? |
+ (int)format - GL_COMPRESSED_RGBA_ASTC_4x4_KHR : |
+ (int)format - GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR; |
bajones
2015/08/07 21:35:58
The way this algorithim is set up it will never in
|
+ |
+ const int kBlockWidth = kASTCBlockSize[index].blockWidth; |
+ const int kBlockHeight = kASTCBlockSize[index].blockHeight; |
+ |
+ int kBlockX = |
+ (std::max(width, kBlockWidth) + kBlockWidth - 1) / kBlockWidth; |
+ int kBlockY = |
+ (std::max(height, kBlockHeight) + kBlockHeight - 1) / kBlockHeight; |
+ |
+ bytes_required = (kBlockX * kBlockY) << 4; |
+ break; |
+ } |
case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: |
case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: |
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: |
@@ -9213,6 +9295,34 @@ bool GLES2DecoderImpl::ValidateCompressedTexDimensions( |
return false; |
} |
return true; |
+ case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: |
+ case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: |
+ case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: |
case GL_ATC_RGB_AMD: |
case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: |
case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: |
@@ -9418,7 +9528,6 @@ error::Error GLES2DecoderImpl::DoCompressedTexImage2D( |
"glCompressedTexImage2D", "texture is immutable"); |
return error::kNoError; |
} |
- |
if (!ValidateCompressedTexDimensions("glCompressedTexImage2D", target, level, |
width, height, 1, internal_format) || |
!ValidateCompressedTexFuncData("glCompressedTexImage2D", width, height, |