Index: Source/modules/webgl/WebGLRenderingContextBase.cpp |
diff --git a/Source/modules/webgl/WebGLRenderingContextBase.cpp b/Source/modules/webgl/WebGLRenderingContextBase.cpp |
index 53aaea0151620316a369e2c80916623f0b6df6ab..225e7651e3476da1c4cb2adffbb3f9713c9d9b6b 100644 |
--- a/Source/modules/webgl/WebGLRenderingContextBase.cpp |
+++ b/Source/modules/webgl/WebGLRenderingContextBase.cpp |
@@ -61,6 +61,7 @@ |
#include "modules/webgl/OESVertexArrayObject.h" |
#include "modules/webgl/WebGLActiveInfo.h" |
#include "modules/webgl/WebGLBuffer.h" |
+#include "modules/webgl/WebGLCompressedTextureASTC.h" |
#include "modules/webgl/WebGLCompressedTextureATC.h" |
#include "modules/webgl/WebGLCompressedTextureETC1.h" |
#include "modules/webgl/WebGLCompressedTexturePVRTC.h" |
@@ -5689,6 +5690,48 @@ bool WebGLRenderingContextBase::validateCompressedTexFuncData(const char* functi |
unsigned bytesRequired = 0; |
switch (format) { |
+ 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; |
+ |
+ const int kBlockSize = 16; |
+ const int kBlockWidth = WebGLCompressedTextureASTC::kBlockSizeCompressASTC[index].blockWidth; |
+ const int kBlockHeight = WebGLCompressedTextureASTC::kBlockSizeCompressASTC[index].blockHeight; |
+ |
+ int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; |
+ int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; |
+ int numBlocks = numBlocksAcross * numBlocksDown; |
+ bytesRequired = numBlocks * kBlockSize; |
+ } |
+ break; |
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: |
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: |
{ |
@@ -5759,6 +5802,38 @@ bool WebGLRenderingContextBase::validateCompressedTexDimensions(const char* func |
bool heightValid = false; |
switch (format) { |
+ 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: { |
+ widthValid = true; |
+ heightValid = true; |
+ break; |
+ } |
case GC3D_COMPRESSED_ATC_RGB_AMD: |
case GC3D_COMPRESSED_ATC_RGBA_EXPLICIT_ALPHA_AMD: |
case GC3D_COMPRESSED_ATC_RGBA_INTERPOLATED_ALPHA_AMD: |