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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp

Issue 1463503002: Fix TexStorage3D with compressed ETC2/EAC formats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 5 years, 1 month 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 | « third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "config.h" 5 #include "config.h"
6 #include "modules/webgl/WebGL2RenderingContextBase.h" 6 #include "modules/webgl/WebGL2RenderingContextBase.h"
7 7
8 #include "bindings/modules/v8/WebGLAny.h" 8 #include "bindings/modules/v8/WebGLAny.h"
9 #include "core/html/HTMLCanvasElement.h" 9 #include "core/html/HTMLCanvasElement.h"
10 #include "core/html/HTMLImageElement.h" 10 #include "core/html/HTMLImageElement.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 GL_COMPRESSED_RG11_EAC, 99 GL_COMPRESSED_RG11_EAC,
100 GL_COMPRESSED_SIGNED_RG11_EAC, 100 GL_COMPRESSED_SIGNED_RG11_EAC,
101 GL_COMPRESSED_RGB8_ETC2, 101 GL_COMPRESSED_RGB8_ETC2,
102 GL_COMPRESSED_SRGB8_ETC2, 102 GL_COMPRESSED_SRGB8_ETC2,
103 GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, 103 GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
104 GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, 104 GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
105 GL_COMPRESSED_RGBA8_ETC2_EAC, 105 GL_COMPRESSED_RGBA8_ETC2_EAC,
106 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, 106 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
107 }; 107 };
108 108
109 const GLenum kCompressedTextureFormatsETC2EAC[] = {
Ken Russell (switch to Gerrit) 2015/11/19 23:25:55 Less code duplication could have been achieved by
qiankun 2015/11/19 23:50:04 Good suggestion! Done.
110 GL_COMPRESSED_R11_EAC,
111 GL_COMPRESSED_SIGNED_R11_EAC,
112 GL_COMPRESSED_RG11_EAC,
113 GL_COMPRESSED_SIGNED_RG11_EAC,
114 GL_COMPRESSED_RGB8_ETC2,
115 GL_COMPRESSED_SRGB8_ETC2,
116 GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
117 GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
118 GL_COMPRESSED_RGBA8_ETC2_EAC,
119 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
120 };
121
109 WebGL2RenderingContextBase::WebGL2RenderingContextBase(HTMLCanvasElement* passed Canvas, PassOwnPtr<WebGraphicsContext3D> context, const WebGLContextAttributes& requestedAttributes) 122 WebGL2RenderingContextBase::WebGL2RenderingContextBase(HTMLCanvasElement* passed Canvas, PassOwnPtr<WebGraphicsContext3D> context, const WebGLContextAttributes& requestedAttributes)
110 : WebGLRenderingContextBase(passedCanvas, context, requestedAttributes) 123 : WebGLRenderingContextBase(passedCanvas, context, requestedAttributes)
111 { 124 {
112 m_supportedInternalFormatsStorage.insert(kSupportedInternalFormatsStorage, k SupportedInternalFormatsStorage + arraysize(kSupportedInternalFormatsStorage)); 125 m_supportedInternalFormatsStorage.insert(kSupportedInternalFormatsStorage, k SupportedInternalFormatsStorage + arraysize(kSupportedInternalFormatsStorage));
126 m_compressedTextureFormatsETC2EAC.insert(kCompressedTextureFormatsETC2EAC, k CompressedTextureFormatsETC2EAC + arraysize(kCompressedTextureFormatsETC2EAC));
113 } 127 }
114 128
115 WebGL2RenderingContextBase::~WebGL2RenderingContextBase() 129 WebGL2RenderingContextBase::~WebGL2RenderingContextBase()
116 { 130 {
117 m_readFramebufferBinding = nullptr; 131 m_readFramebufferBinding = nullptr;
118 132
119 m_boundCopyReadBuffer = nullptr; 133 m_boundCopyReadBuffer = nullptr;
120 m_boundCopyWriteBuffer = nullptr; 134 m_boundCopyWriteBuffer = nullptr;
121 m_boundPixelPackBuffer = nullptr; 135 m_boundPixelPackBuffer = nullptr;
122 m_boundPixelUnpackBuffer = nullptr; 136 m_boundPixelUnpackBuffer = nullptr;
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 if (target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY) { 592 if (target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY) {
579 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid 3D target" ); 593 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid 3D target" );
580 return false; 594 return false;
581 } 595 }
582 } 596 }
583 597
584 WebGLTexture* tex = validateTextureBinding(functionName, target, false); 598 WebGLTexture* tex = validateTextureBinding(functionName, target, false);
585 if (!tex) 599 if (!tex)
586 return false; 600 return false;
587 601
602 if (functionType == TexStorageType3D && target != GL_TEXTURE_2D_ARRAY && m_c ompressedTextureFormatsETC2EAC.find(internalformat) != m_compressedTextureFormat sETC2EAC.end()) {
603 synthesizeGLError(GL_INVALID_OPERATION, functionName, "target for ETC2/E AC internal formats must be TEXTURE_2D_ARRAY");
604 return false;
605 }
606
588 if (m_supportedInternalFormatsStorage.find(internalformat) == m_supportedInt ernalFormatsStorage.end()) { 607 if (m_supportedInternalFormatsStorage.find(internalformat) == m_supportedInt ernalFormatsStorage.end()) {
589 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid internalformat "); 608 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid internalformat ");
590 return false; 609 return false;
591 } 610 }
592 611
593 if (tex->isImmutable()) { 612 if (tex->isImmutable()) {
594 synthesizeGLError(GL_INVALID_OPERATION, functionName, "attempted to modi fy immutable texture"); 613 synthesizeGLError(GL_INVALID_OPERATION, functionName, "attempted to modi fy immutable texture");
595 return false; 614 return false;
596 } 615 }
597 616
(...skipping 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() 3097 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat()
3079 { 3098 {
3080 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) 3099 if (m_readFramebufferBinding && m_readFramebufferBinding->object())
3081 return m_readFramebufferBinding->colorBufferFormat(); 3100 return m_readFramebufferBinding->colorBufferFormat();
3082 if (m_requestedAttributes.alpha()) 3101 if (m_requestedAttributes.alpha())
3083 return GL_RGBA; 3102 return GL_RGBA;
3084 return GL_RGB; 3103 return GL_RGB;
3085 } 3104 }
3086 3105
3087 } // namespace blink 3106 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698