Commit 5ec934e8 authored by jchen10's avatar jchen10 Committed by Commit Bot

Expose KHR_parallel_shader_compile to WebGL

This exposes KHR_parallel_shader_compile extension to WebGL. With this
extension, applications may benefit from background shader compilation
and program linking, avoiding main thread long blocking for complex
shaders.

BUG=849576

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I6b62142d28dc14f85d50a820e6a87409d5a371c8
Reviewed-on: https://chromium-review.googlesource.com/1161747Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Cr-Commit-Position: refs/heads/master@{#591321}
parent 243bc7a0
...@@ -41,6 +41,8 @@ class WebGL2ConformanceExpectations(WebGLConformanceExpectations): ...@@ -41,6 +41,8 @@ class WebGL2ConformanceExpectations(WebGLConformanceExpectations):
['android'], bug=808744) ['android'], bug=808744)
self.Fail('WebglExtension_EXT_disjoint_timer_query_webgl2', self.Fail('WebglExtension_EXT_disjoint_timer_query_webgl2',
['linux', 'intel'], bug=867675) ['linux', 'intel'], bug=867675)
self.Skip('WebglExtension_KHR_parallel_shader_compile',
['no_passthrough'], bug=849576)
# ======================== # ========================
# Conformance expectations # Conformance expectations
......
...@@ -59,6 +59,8 @@ class WebGLConformanceExpectations(GpuTestExpectations): ...@@ -59,6 +59,8 @@ class WebGLConformanceExpectations(GpuTestExpectations):
['android'], bug=808744) ['android'], bug=808744)
self.Fail('WebglExtension_EXT_disjoint_timer_query', self.Fail('WebglExtension_EXT_disjoint_timer_query',
['linux', 'intel'], bug=867675) ['linux', 'intel'], bug=867675)
self.Skip('WebglExtension_KHR_parallel_shader_compile',
['no_passthrough'], bug=849576)
# Extensions not available under D3D9 # Extensions not available under D3D9
self.Fail('WebglExtension_EXT_sRGB', self.Fail('WebglExtension_EXT_sRGB',
......
...@@ -142,6 +142,7 @@ class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -142,6 +142,7 @@ class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
'EXT_shader_texture_lod', 'EXT_shader_texture_lod',
'EXT_sRGB', 'EXT_sRGB',
'EXT_texture_filter_anisotropic', 'EXT_texture_filter_anisotropic',
'KHR_parallel_shader_compile',
'OES_element_index_uint', 'OES_element_index_uint',
'OES_standard_derivatives', 'OES_standard_derivatives',
'OES_texture_float', 'OES_texture_float',
...@@ -166,6 +167,7 @@ class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -166,6 +167,7 @@ class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
'EXT_color_buffer_float', 'EXT_color_buffer_float',
'EXT_disjoint_timer_query_webgl2', 'EXT_disjoint_timer_query_webgl2',
'EXT_texture_filter_anisotropic', 'EXT_texture_filter_anisotropic',
'KHR_parallel_shader_compile',
'OES_texture_float_linear', 'OES_texture_float_linear',
'WEBGL_compressed_texture_astc', 'WEBGL_compressed_texture_astc',
'WEBGL_compressed_texture_etc', 'WEBGL_compressed_texture_etc',
......
...@@ -367,6 +367,7 @@ modules_idl_files = ...@@ -367,6 +367,7 @@ modules_idl_files =
"webgl/ext_shader_texture_lod.idl", "webgl/ext_shader_texture_lod.idl",
"webgl/ext_texture_filter_anisotropic.idl", "webgl/ext_texture_filter_anisotropic.idl",
"webgl/ext_srgb.idl", "webgl/ext_srgb.idl",
"webgl/khr_parallel_shader_compile.idl",
"webgl/oes_element_index_uint.idl", "webgl/oes_element_index_uint.idl",
"webgl/oes_standard_derivatives.idl", "webgl/oes_standard_derivatives.idl",
"webgl/oes_texture_float.idl", "webgl/oes_texture_float.idl",
......
...@@ -27,6 +27,8 @@ blink_modules_sources("webgl") { ...@@ -27,6 +27,8 @@ blink_modules_sources("webgl") {
"ext_texture_filter_anisotropic.cc", "ext_texture_filter_anisotropic.cc",
"ext_texture_filter_anisotropic.h", "ext_texture_filter_anisotropic.h",
"gl_string_query.h", "gl_string_query.h",
"khr_parallel_shader_compile.cc",
"khr_parallel_shader_compile.h",
"oes_element_index_uint.cc", "oes_element_index_uint.cc",
"oes_element_index_uint.h", "oes_element_index_uint.h",
"oes_standard_derivatives.cc", "oes_standard_derivatives.cc",
......
/*
* Copyright (C) 2018 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "third_party/blink/renderer/modules/webgl/khr_parallel_shader_compile.h"
#include "gpu/command_buffer/client/gles2_interface.h"
namespace blink {
KHRParallelShaderCompile::KHRParallelShaderCompile(
WebGLRenderingContextBase* context)
: WebGLExtension(context) {
context->ExtensionsUtil()->EnsureExtensionEnabled(
"GL_KHR_parallel_shader_compile");
// Use 2 background threads per WebGL context by default.
context->ContextGL()->MaxShaderCompilerThreadsKHR(2);
}
WebGLExtensionName KHRParallelShaderCompile::GetName() const {
return kKHRParallelShaderCompileName;
}
KHRParallelShaderCompile* KHRParallelShaderCompile::Create(
WebGLRenderingContextBase* context) {
return new KHRParallelShaderCompile(context);
}
void KHRParallelShaderCompile::maxShaderCompilerThreadsKHR(GLuint count) {
WebGLExtensionScopedContext scoped(this);
if (scoped.IsLost())
return;
// For WebGL contexts, we don't want applications to be able to spin up huge
// numbers of shader compliation threads. Enforce a maximum of 2 here.
scoped.Context()->ContextGL()->MaxShaderCompilerThreadsKHR(
std::max(2u, count));
}
bool KHRParallelShaderCompile::Supported(WebGLRenderingContextBase* context) {
return context->ExtensionsUtil()->SupportsExtension(
"GL_KHR_parallel_shader_compile");
}
const char* KHRParallelShaderCompile::ExtensionName() {
return "KHR_parallel_shader_compile";
}
} // namespace blink
/*
* Copyright (C) 2018 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGL_KHR_PARALLEL_SHADER_COMPILE_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGL_KHR_PARALLEL_SHADER_COMPILE_H_
#include "third_party/blink/renderer/modules/webgl/webgl_extension.h"
namespace blink {
class KHRParallelShaderCompile final : public WebGLExtension {
DEFINE_WRAPPERTYPEINFO();
public:
static KHRParallelShaderCompile* Create(WebGLRenderingContextBase*);
static bool Supported(WebGLRenderingContextBase*);
static const char* ExtensionName();
WebGLExtensionName GetName() const override;
void maxShaderCompilerThreadsKHR(GLuint count);
private:
explicit KHRParallelShaderCompile(WebGLRenderingContextBase*);
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGL_KHR_PARALLEL_SHADER_COMPILE_H_
/*
* Copyright (C) 2018 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/
[
NoInterfaceObject,
DoNotCheckConstants
] interface KHRParallelShaderCompile {
const GLenum MAX_SHADER_COMPILER_THREADS_KHR = 0x91B0;
const GLenum COMPLETION_STATUS_KHR = 0x91B1;
void maxShaderCompilerThreadsKHR(GLuint count);
};
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "third_party/blink/renderer/modules/webgl/ext_color_buffer_float.h" #include "third_party/blink/renderer/modules/webgl/ext_color_buffer_float.h"
#include "third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query_webgl2.h" #include "third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query_webgl2.h"
#include "third_party/blink/renderer/modules/webgl/ext_texture_filter_anisotropic.h" #include "third_party/blink/renderer/modules/webgl/ext_texture_filter_anisotropic.h"
#include "third_party/blink/renderer/modules/webgl/khr_parallel_shader_compile.h"
#include "third_party/blink/renderer/modules/webgl/oes_texture_float_linear.h" #include "third_party/blink/renderer/modules/webgl/oes_texture_float_linear.h"
#include "third_party/blink/renderer/modules/webgl/webgl_compressed_texture_astc.h" #include "third_party/blink/renderer/modules/webgl/webgl_compressed_texture_astc.h"
#include "third_party/blink/renderer/modules/webgl/webgl_compressed_texture_etc.h" #include "third_party/blink/renderer/modules/webgl/webgl_compressed_texture_etc.h"
...@@ -122,6 +123,8 @@ void WebGL2RenderingContext::RegisterContextExtensions() { ...@@ -122,6 +123,8 @@ void WebGL2RenderingContext::RegisterContextExtensions() {
ext_disjoint_timer_query_web_gl2_); ext_disjoint_timer_query_web_gl2_);
RegisterExtension<EXTTextureFilterAnisotropic>( RegisterExtension<EXTTextureFilterAnisotropic>(
ext_texture_filter_anisotropic_); ext_texture_filter_anisotropic_);
RegisterExtension<KHRParallelShaderCompile>(khr_parallel_shader_compile_,
kDraftExtension);
RegisterExtension<OESTextureFloatLinear>(oes_texture_float_linear_); RegisterExtension<OESTextureFloatLinear>(oes_texture_float_linear_);
RegisterExtension<WebGLCompressedTextureASTC>(webgl_compressed_texture_astc_); RegisterExtension<WebGLCompressedTextureASTC>(webgl_compressed_texture_astc_);
RegisterExtension<WebGLCompressedTextureETC>(webgl_compressed_texture_etc_); RegisterExtension<WebGLCompressedTextureETC>(webgl_compressed_texture_etc_);
...@@ -141,6 +144,7 @@ void WebGL2RenderingContext::Trace(blink::Visitor* visitor) { ...@@ -141,6 +144,7 @@ void WebGL2RenderingContext::Trace(blink::Visitor* visitor) {
visitor->Trace(ext_color_buffer_float_); visitor->Trace(ext_color_buffer_float_);
visitor->Trace(ext_disjoint_timer_query_web_gl2_); visitor->Trace(ext_disjoint_timer_query_web_gl2_);
visitor->Trace(ext_texture_filter_anisotropic_); visitor->Trace(ext_texture_filter_anisotropic_);
visitor->Trace(khr_parallel_shader_compile_);
visitor->Trace(oes_texture_float_linear_); visitor->Trace(oes_texture_float_linear_);
visitor->Trace(webgl_compressed_texture_astc_); visitor->Trace(webgl_compressed_texture_astc_);
visitor->Trace(webgl_compressed_texture_etc_); visitor->Trace(webgl_compressed_texture_etc_);
......
...@@ -18,6 +18,7 @@ class OESTextureFloatLinear; ...@@ -18,6 +18,7 @@ class OESTextureFloatLinear;
class WebGLDebugRendererInfo; class WebGLDebugRendererInfo;
class WebGLLoseContext; class WebGLLoseContext;
class WebGLMultiview; class WebGLMultiview;
class KHRParallelShaderCompile;
class WebGL2RenderingContext : public WebGL2RenderingContextBase { class WebGL2RenderingContext : public WebGL2RenderingContextBase {
DEFINE_WRAPPERTYPEINFO(); DEFINE_WRAPPERTYPEINFO();
...@@ -60,6 +61,7 @@ class WebGL2RenderingContext : public WebGL2RenderingContextBase { ...@@ -60,6 +61,7 @@ class WebGL2RenderingContext : public WebGL2RenderingContextBase {
Member<EXTColorBufferFloat> ext_color_buffer_float_; Member<EXTColorBufferFloat> ext_color_buffer_float_;
Member<EXTDisjointTimerQueryWebGL2> ext_disjoint_timer_query_web_gl2_; Member<EXTDisjointTimerQueryWebGL2> ext_disjoint_timer_query_web_gl2_;
Member<EXTTextureFilterAnisotropic> ext_texture_filter_anisotropic_; Member<EXTTextureFilterAnisotropic> ext_texture_filter_anisotropic_;
Member<KHRParallelShaderCompile> khr_parallel_shader_compile_;
Member<OESTextureFloatLinear> oes_texture_float_linear_; Member<OESTextureFloatLinear> oes_texture_float_linear_;
Member<WebGLCompressedTextureASTC> webgl_compressed_texture_astc_; Member<WebGLCompressedTextureASTC> webgl_compressed_texture_astc_;
Member<WebGLCompressedTextureETC> webgl_compressed_texture_etc_; Member<WebGLCompressedTextureETC> webgl_compressed_texture_etc_;
......
...@@ -18,6 +18,7 @@ enum WebGLExtensionName { ...@@ -18,6 +18,7 @@ enum WebGLExtensionName {
kEXTFragDepthName, kEXTFragDepthName,
kEXTShaderTextureLODName, kEXTShaderTextureLODName,
kEXTsRGBName, kEXTsRGBName,
kKHRParallelShaderCompileName,
kEXTTextureFilterAnisotropicName, kEXTTextureFilterAnisotropicName,
kOESElementIndexUintName, kOESElementIndexUintName,
kOESStandardDerivativesName, kOESStandardDerivativesName,
......
...@@ -74,6 +74,14 @@ bool WebGLProgram::LinkStatus(WebGLRenderingContextBase* context) { ...@@ -74,6 +74,14 @@ bool WebGLProgram::LinkStatus(WebGLRenderingContextBase* context) {
return link_status_; return link_status_;
} }
bool WebGLProgram::CompletionStatus(WebGLRenderingContextBase* context) {
GLint completed = 0;
gpu::gles2::GLES2Interface* gl = context->ContextGL();
gl->GetProgramiv(object_, GL_COMPLETION_STATUS_KHR, &completed);
return completed;
}
void WebGLProgram::IncreaseLinkCount() { void WebGLProgram::IncreaseLinkCount() {
++link_count_; ++link_count_;
info_valid_ = false; info_valid_ = false;
......
...@@ -43,6 +43,8 @@ class WebGLProgram final : public WebGLSharedPlatform3DObject { ...@@ -43,6 +43,8 @@ class WebGLProgram final : public WebGLSharedPlatform3DObject {
bool LinkStatus(WebGLRenderingContextBase*); bool LinkStatus(WebGLRenderingContextBase*);
bool CompletionStatus(WebGLRenderingContextBase*);
unsigned LinkCount() const { return link_count_; } unsigned LinkCount() const { return link_count_; }
// This is to be called everytime after the program is successfully linked. // This is to be called everytime after the program is successfully linked.
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "third_party/blink/renderer/modules/webgl/ext_shader_texture_lod.h" #include "third_party/blink/renderer/modules/webgl/ext_shader_texture_lod.h"
#include "third_party/blink/renderer/modules/webgl/ext_srgb.h" #include "third_party/blink/renderer/modules/webgl/ext_srgb.h"
#include "third_party/blink/renderer/modules/webgl/ext_texture_filter_anisotropic.h" #include "third_party/blink/renderer/modules/webgl/ext_texture_filter_anisotropic.h"
#include "third_party/blink/renderer/modules/webgl/khr_parallel_shader_compile.h"
#include "third_party/blink/renderer/modules/webgl/oes_element_index_uint.h" #include "third_party/blink/renderer/modules/webgl/oes_element_index_uint.h"
#include "third_party/blink/renderer/modules/webgl/oes_standard_derivatives.h" #include "third_party/blink/renderer/modules/webgl/oes_standard_derivatives.h"
#include "third_party/blink/renderer/modules/webgl/oes_texture_float.h" #include "third_party/blink/renderer/modules/webgl/oes_texture_float.h"
...@@ -158,6 +159,8 @@ void WebGLRenderingContext::RegisterContextExtensions() { ...@@ -158,6 +159,8 @@ void WebGLRenderingContext::RegisterContextExtensions() {
RegisterExtension<EXTTextureFilterAnisotropic>( RegisterExtension<EXTTextureFilterAnisotropic>(
ext_texture_filter_anisotropic_, kApprovedExtension, kBothPrefixes); ext_texture_filter_anisotropic_, kApprovedExtension, kBothPrefixes);
RegisterExtension<EXTsRGB>(exts_rgb_); RegisterExtension<EXTsRGB>(exts_rgb_);
RegisterExtension<KHRParallelShaderCompile>(khr_parallel_shader_compile_,
kDraftExtension);
RegisterExtension<OESElementIndexUint>(oes_element_index_uint_); RegisterExtension<OESElementIndexUint>(oes_element_index_uint_);
RegisterExtension<OESStandardDerivatives>(oes_standard_derivatives_); RegisterExtension<OESStandardDerivatives>(oes_standard_derivatives_);
RegisterExtension<OESTextureFloat>(oes_texture_float_); RegisterExtension<OESTextureFloat>(oes_texture_float_);
...@@ -194,6 +197,7 @@ void WebGLRenderingContext::Trace(blink::Visitor* visitor) { ...@@ -194,6 +197,7 @@ void WebGLRenderingContext::Trace(blink::Visitor* visitor) {
visitor->Trace(ext_shader_texture_lod_); visitor->Trace(ext_shader_texture_lod_);
visitor->Trace(ext_texture_filter_anisotropic_); visitor->Trace(ext_texture_filter_anisotropic_);
visitor->Trace(exts_rgb_); visitor->Trace(exts_rgb_);
visitor->Trace(khr_parallel_shader_compile_);
visitor->Trace(oes_element_index_uint_); visitor->Trace(oes_element_index_uint_);
visitor->Trace(oes_standard_derivatives_); visitor->Trace(oes_standard_derivatives_);
visitor->Trace(oes_texture_float_); visitor->Trace(oes_texture_float_);
......
...@@ -40,6 +40,7 @@ class EXTFragDepth; ...@@ -40,6 +40,7 @@ class EXTFragDepth;
class EXTShaderTextureLOD; class EXTShaderTextureLOD;
class EXTsRGB; class EXTsRGB;
class EXTTextureFilterAnisotropic; class EXTTextureFilterAnisotropic;
class KHRParallelShaderCompile;
class OESElementIndexUint; class OESElementIndexUint;
class OESStandardDerivatives; class OESStandardDerivatives;
class OESTextureFloat; class OESTextureFloat;
...@@ -98,6 +99,7 @@ class WebGLRenderingContext final : public WebGLRenderingContextBase { ...@@ -98,6 +99,7 @@ class WebGLRenderingContext final : public WebGLRenderingContextBase {
Member<EXTShaderTextureLOD> ext_shader_texture_lod_; Member<EXTShaderTextureLOD> ext_shader_texture_lod_;
Member<EXTTextureFilterAnisotropic> ext_texture_filter_anisotropic_; Member<EXTTextureFilterAnisotropic> ext_texture_filter_anisotropic_;
Member<EXTsRGB> exts_rgb_; Member<EXTsRGB> exts_rgb_;
Member<KHRParallelShaderCompile> khr_parallel_shader_compile_;
Member<OESElementIndexUint> oes_element_index_uint_; Member<OESElementIndexUint> oes_element_index_uint_;
Member<OESStandardDerivatives> oes_standard_derivatives_; Member<OESStandardDerivatives> oes_standard_derivatives_;
Member<OESTextureFloat> oes_texture_float_; Member<OESTextureFloat> oes_texture_float_;
......
...@@ -3342,6 +3342,13 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* script_state, ...@@ -3342,6 +3342,13 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* script_state,
SynthesizeGLError(GL_INVALID_ENUM, "getParameter", SynthesizeGLError(GL_INVALID_ENUM, "getParameter",
"invalid parameter name, WEBGL_multiview not enabled"); "invalid parameter name, WEBGL_multiview not enabled");
return ScriptValue::CreateNull(script_state); return ScriptValue::CreateNull(script_state);
case GL_MAX_SHADER_COMPILER_THREADS_KHR:
if (ExtensionEnabled(kKHRParallelShaderCompileName))
return GetUnsignedIntParameter(script_state, pname);
SynthesizeGLError(
GL_INVALID_ENUM, "getParameter",
"invalid parameter name, KHR_parallel_shader_compile not enabled");
return ScriptValue::CreateNull(script_state);
default: default:
if ((ExtensionEnabled(kWebGLDrawBuffersName) || IsWebGL2OrHigher()) && if ((ExtensionEnabled(kWebGLDrawBuffersName) || IsWebGL2OrHigher()) &&
pname >= GL_DRAW_BUFFER0_EXT && pname >= GL_DRAW_BUFFER0_EXT &&
...@@ -3375,6 +3382,14 @@ ScriptValue WebGLRenderingContextBase::getProgramParameter( ...@@ -3375,6 +3382,14 @@ ScriptValue WebGLRenderingContextBase::getProgramParameter(
return WebGLAny(script_state, static_cast<bool>(value)); return WebGLAny(script_state, static_cast<bool>(value));
case GL_LINK_STATUS: case GL_LINK_STATUS:
return WebGLAny(script_state, program->LinkStatus(this)); return WebGLAny(script_state, program->LinkStatus(this));
case GL_COMPLETION_STATUS_KHR:
if (!ExtensionEnabled(kKHRParallelShaderCompileName)) {
SynthesizeGLError(GL_INVALID_ENUM, "getProgramParameter",
"invalid parameter name");
return ScriptValue::CreateNull(script_state);
}
return WebGLAny(script_state, program->CompletionStatus(this));
case GL_ACTIVE_UNIFORM_BLOCKS: case GL_ACTIVE_UNIFORM_BLOCKS:
case GL_TRANSFORM_FEEDBACK_VARYINGS: case GL_TRANSFORM_FEEDBACK_VARYINGS:
if (!IsWebGL2OrHigher()) { if (!IsWebGL2OrHigher()) {
...@@ -3468,6 +3483,14 @@ ScriptValue WebGLRenderingContextBase::getShaderParameter( ...@@ -3468,6 +3483,14 @@ ScriptValue WebGLRenderingContextBase::getShaderParameter(
case GL_COMPILE_STATUS: case GL_COMPILE_STATUS:
ContextGL()->GetShaderiv(ObjectOrZero(shader), pname, &value); ContextGL()->GetShaderiv(ObjectOrZero(shader), pname, &value);
return WebGLAny(script_state, static_cast<bool>(value)); return WebGLAny(script_state, static_cast<bool>(value));
case GL_COMPLETION_STATUS_KHR:
if (!ExtensionEnabled(kKHRParallelShaderCompileName)) {
SynthesizeGLError(GL_INVALID_ENUM, "getShaderParameter",
"invalid parameter name");
return ScriptValue::CreateNull(script_state);
}
ContextGL()->GetShaderiv(ObjectOrZero(shader), pname, &value);
return WebGLAny(script_state, static_cast<bool>(value));
case GL_SHADER_TYPE: case GL_SHADER_TYPE:
ContextGL()->GetShaderiv(ObjectOrZero(shader), pname, &value); ContextGL()->GetShaderiv(ObjectOrZero(shader), pname, &value);
return WebGLAny(script_state, static_cast<unsigned>(value)); return WebGLAny(script_state, static_cast<unsigned>(value));
......
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