Commit 8fe7430e authored by qiankun.miao's avatar qiankun.miao Committed by Commit bot

Fix TexStorage3D with compressed ETC2/EAC formats

These formats don't work for TexStorage3D if target is TEXTURE_3D.
TEXTURE_2D_ARRAY should work.

BUG=295792
TEST=conformance2/textures/misc/tex-storage-compressed-formats.html

Committed: https://crrev.com/5b5a54a2d7c287e09f644d04e29718b310949221
Cr-Commit-Position: refs/heads/master@{#360760}

Review URL: https://codereview.chromium.org/1463503002

Cr-Commit-Position: refs/heads/master@{#361180}
parent 4c9d4570
...@@ -94,6 +94,9 @@ const GLenum kSupportedInternalFormatsStorage[] = { ...@@ -94,6 +94,9 @@ const GLenum kSupportedInternalFormatsStorage[] = {
GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT32F,
GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8,
GL_DEPTH32F_STENCIL8, GL_DEPTH32F_STENCIL8,
};
const GLenum kCompressedTextureFormatsETC2EAC[] = {
GL_COMPRESSED_R11_EAC, GL_COMPRESSED_R11_EAC,
GL_COMPRESSED_SIGNED_R11_EAC, GL_COMPRESSED_SIGNED_R11_EAC,
GL_COMPRESSED_RG11_EAC, GL_COMPRESSED_RG11_EAC,
...@@ -110,6 +113,8 @@ WebGL2RenderingContextBase::WebGL2RenderingContextBase(HTMLCanvasElement* passed ...@@ -110,6 +113,8 @@ WebGL2RenderingContextBase::WebGL2RenderingContextBase(HTMLCanvasElement* passed
: WebGLRenderingContextBase(passedCanvas, context, requestedAttributes) : WebGLRenderingContextBase(passedCanvas, context, requestedAttributes)
{ {
m_supportedInternalFormatsStorage.insert(kSupportedInternalFormatsStorage, kSupportedInternalFormatsStorage + arraysize(kSupportedInternalFormatsStorage)); m_supportedInternalFormatsStorage.insert(kSupportedInternalFormatsStorage, kSupportedInternalFormatsStorage + arraysize(kSupportedInternalFormatsStorage));
m_supportedInternalFormatsStorage.insert(kCompressedTextureFormatsETC2EAC, kCompressedTextureFormatsETC2EAC + arraysize(kCompressedTextureFormatsETC2EAC));
m_compressedTextureFormatsETC2EAC.insert(kCompressedTextureFormatsETC2EAC, kCompressedTextureFormatsETC2EAC + arraysize(kCompressedTextureFormatsETC2EAC));
} }
WebGL2RenderingContextBase::~WebGL2RenderingContextBase() WebGL2RenderingContextBase::~WebGL2RenderingContextBase()
...@@ -697,6 +702,11 @@ bool WebGL2RenderingContextBase::validateTexStorage(const char* functionName, GL ...@@ -697,6 +702,11 @@ bool WebGL2RenderingContextBase::validateTexStorage(const char* functionName, GL
if (!tex) if (!tex)
return false; return false;
if (functionType == TexStorageType3D && target != GL_TEXTURE_2D_ARRAY && m_compressedTextureFormatsETC2EAC.find(internalformat) != m_compressedTextureFormatsETC2EAC.end()) {
synthesizeGLError(GL_INVALID_OPERATION, functionName, "target for ETC2/EAC internal formats must be TEXTURE_2D_ARRAY");
return false;
}
if (m_supportedInternalFormatsStorage.find(internalformat) == m_supportedInternalFormatsStorage.end()) { if (m_supportedInternalFormatsStorage.find(internalformat) == m_supportedInternalFormatsStorage.end()) {
synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid internalformat"); synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid internalformat");
return false; return false;
......
...@@ -239,6 +239,7 @@ protected: ...@@ -239,6 +239,7 @@ protected:
GLint m_maxArrayTextureLayers; GLint m_maxArrayTextureLayers;
std::set<GLenum> m_supportedInternalFormatsStorage; std::set<GLenum> m_supportedInternalFormatsStorage;
std::set<GLenum> m_compressedTextureFormatsETC2EAC;
PersistentWillBeMember<WebGLBuffer> m_boundCopyReadBuffer; PersistentWillBeMember<WebGLBuffer> m_boundCopyReadBuffer;
PersistentWillBeMember<WebGLBuffer> m_boundCopyWriteBuffer; PersistentWillBeMember<WebGLBuffer> m_boundCopyWriteBuffer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment