| OLD | NEW |
| 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 "modules/webgl/WebGL2RenderingContextBase.h" | 5 #include "modules/webgl/WebGL2RenderingContextBase.h" |
| 6 | 6 |
| 7 #include "bindings/modules/v8/WebGLAny.h" | 7 #include "bindings/modules/v8/WebGLAny.h" |
| 8 #include "core/frame/ImageBitmap.h" | 8 #include "core/frame/ImageBitmap.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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 GL_COMPRESSED_RG11_EAC, | 107 GL_COMPRESSED_RG11_EAC, |
| 108 GL_COMPRESSED_SIGNED_RG11_EAC, | 108 GL_COMPRESSED_SIGNED_RG11_EAC, |
| 109 GL_COMPRESSED_RGB8_ETC2, | 109 GL_COMPRESSED_RGB8_ETC2, |
| 110 GL_COMPRESSED_SRGB8_ETC2, | 110 GL_COMPRESSED_SRGB8_ETC2, |
| 111 GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, | 111 GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, |
| 112 GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, | 112 GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, |
| 113 GL_COMPRESSED_RGBA8_ETC2_EAC, | 113 GL_COMPRESSED_RGBA8_ETC2_EAC, |
| 114 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, | 114 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 WebGL2RenderingContextBase::WebGL2RenderingContextBase(HTMLCanvasElement* passed
Canvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const Web
GLContextAttributes& requestedAttributes) | 117 WebGL2RenderingContextBase::WebGL2RenderingContextBase(HTMLCanvasElement* passed
Canvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const Can
vasContextCreationAttributes& requestedAttributes) |
| 118 : WebGLRenderingContextBase(passedCanvas, std::move(contextProvider), reques
tedAttributes, 2) | 118 : WebGLRenderingContextBase(passedCanvas, std::move(contextProvider), reques
tedAttributes, 2) |
| 119 { | 119 { |
| 120 m_supportedInternalFormatsStorage.insert(kSupportedInternalFormatsStorage, k
SupportedInternalFormatsStorage + WTF_ARRAY_LENGTH(kSupportedInternalFormatsStor
age)); | 120 m_supportedInternalFormatsStorage.insert(kSupportedInternalFormatsStorage, k
SupportedInternalFormatsStorage + WTF_ARRAY_LENGTH(kSupportedInternalFormatsStor
age)); |
| 121 m_supportedInternalFormatsStorage.insert(kCompressedTextureFormatsETC2EAC, k
CompressedTextureFormatsETC2EAC + WTF_ARRAY_LENGTH(kCompressedTextureFormatsETC2
EAC)); | 121 m_supportedInternalFormatsStorage.insert(kCompressedTextureFormatsETC2EAC, k
CompressedTextureFormatsETC2EAC + WTF_ARRAY_LENGTH(kCompressedTextureFormatsETC2
EAC)); |
| 122 m_compressedTextureFormatsETC2EAC.insert(kCompressedTextureFormatsETC2EAC, k
CompressedTextureFormatsETC2EAC + WTF_ARRAY_LENGTH(kCompressedTextureFormatsETC2
EAC)); | 122 m_compressedTextureFormatsETC2EAC.insert(kCompressedTextureFormatsETC2EAC, k
CompressedTextureFormatsETC2EAC + WTF_ARRAY_LENGTH(kCompressedTextureFormatsETC2
EAC)); |
| 123 m_compressedTextureFormats.append(kCompressedTextureFormatsETC2EAC, WTF_ARRA
Y_LENGTH(kCompressedTextureFormatsETC2EAC)); | 123 m_compressedTextureFormats.append(kCompressedTextureFormatsETC2EAC, WTF_ARRA
Y_LENGTH(kCompressedTextureFormatsETC2EAC)); |
| 124 } | 124 } |
| 125 | 125 |
| 126 WebGL2RenderingContextBase::~WebGL2RenderingContextBase() | 126 WebGL2RenderingContextBase::~WebGL2RenderingContextBase() |
| 127 { | 127 { |
| (...skipping 2922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3050 { | 3050 { |
| 3051 const char kFunctionName[] = "getFramebufferAttachmentParameter"; | 3051 const char kFunctionName[] = "getFramebufferAttachmentParameter"; |
| 3052 if (isContextLost() || !validateGetFramebufferAttachmentParameterFunc(kFunct
ionName, target, attachment)) | 3052 if (isContextLost() || !validateGetFramebufferAttachmentParameterFunc(kFunct
ionName, target, attachment)) |
| 3053 return ScriptValue::createNull(scriptState); | 3053 return ScriptValue::createNull(scriptState); |
| 3054 | 3054 |
| 3055 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target); | 3055 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target); |
| 3056 ASSERT(!framebufferBinding || framebufferBinding->object()); | 3056 ASSERT(!framebufferBinding || framebufferBinding->object()); |
| 3057 | 3057 |
| 3058 // Default framebuffer (an internal fbo) | 3058 // Default framebuffer (an internal fbo) |
| 3059 if (!framebufferBinding) { | 3059 if (!framebufferBinding) { |
| 3060 // We can use m_requestedAttribs because in WebGL 2, they are required t
o be honored. | 3060 // We can use creationAttributes() because in WebGL 2, they are required
to be honored. |
| 3061 bool hasDepth = m_requestedAttributes.depth(); | 3061 bool hasDepth = creationAttributes().depth(); |
| 3062 bool hasStencil = m_requestedAttributes.stencil(); | 3062 bool hasStencil = creationAttributes().stencil(); |
| 3063 bool hasAlpha = m_requestedAttributes.alpha(); | 3063 bool hasAlpha = creationAttributes().alpha(); |
| 3064 bool missingImage = (attachment == GL_DEPTH && !hasDepth) | 3064 bool missingImage = (attachment == GL_DEPTH && !hasDepth) |
| 3065 || (attachment == GL_STENCIL && !hasStencil); | 3065 || (attachment == GL_STENCIL && !hasStencil); |
| 3066 if (missingImage) { | 3066 if (missingImage) { |
| 3067 switch (pname) { | 3067 switch (pname) { |
| 3068 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: | 3068 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 3069 return WebGLAny(scriptState, GL_NONE); | 3069 return WebGLAny(scriptState, GL_NONE); |
| 3070 default: | 3070 default: |
| 3071 synthesizeGLError(GL_INVALID_OPERATION, kFunctionName, "invalid
parameter name"); | 3071 synthesizeGLError(GL_INVALID_OPERATION, kFunctionName, "invalid
parameter name"); |
| 3072 return ScriptValue::createNull(scriptState); | 3072 return ScriptValue::createNull(scriptState); |
| 3073 } | 3073 } |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3361 params.skipPixels = m_unpackSkipPixels; | 3361 params.skipPixels = m_unpackSkipPixels; |
| 3362 params.skipRows = m_unpackSkipRows; | 3362 params.skipRows = m_unpackSkipRows; |
| 3363 if (dimension == Tex3D) { | 3363 if (dimension == Tex3D) { |
| 3364 params.imageHeight = m_unpackImageHeight; | 3364 params.imageHeight = m_unpackImageHeight; |
| 3365 params.skipImages = m_unpackSkipImages; | 3365 params.skipImages = m_unpackSkipImages; |
| 3366 } | 3366 } |
| 3367 return params; | 3367 return params; |
| 3368 } | 3368 } |
| 3369 | 3369 |
| 3370 } // namespace blink | 3370 } // namespace blink |
| OLD | NEW |