Skip to content

Commit 1bc7e9d

Browse files
cqundefinegmta
authored andcommitted
LibWeb: Stub out WebGL getUniform
This makes the function return a dummy value instead of undefined as that fixes a crash while capturing on SpectorJS.
1 parent a2c659e commit 1bc7e9d

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

Libraries/LibWeb/WebGL/WebGL2RenderingContextImpl.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3102,6 +3102,12 @@ Optional<String> WebGL2RenderingContextImpl::get_shader_source(GC::Root<WebGLSha
31023102
return String::from_utf8_without_validation(ReadonlyBytes { shader_source.data(), static_cast<size_t>(shader_source_length - 1) });
31033103
}
31043104

3105+
JS::Value WebGL2RenderingContextImpl::get_uniform(GC::Root<WebGLProgram>, GC::Root<WebGLUniformLocation>)
3106+
{
3107+
dbgln("FIXME: Implement get_uniform");
3108+
return JS::Value(0);
3109+
}
3110+
31053111
GC::Root<WebGLUniformLocation> WebGL2RenderingContextImpl::get_uniform_location(GC::Root<WebGLProgram> program, String name)
31063112
{
31073113
m_context->make_current();

Libraries/LibWeb/WebGL/WebGL2RenderingContextImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ class WebGL2RenderingContextImpl : public WebGLRenderingContextBase {
197197
GC::Root<WebGLShaderPrecisionFormat> get_shader_precision_format(WebIDL::UnsignedLong shadertype, WebIDL::UnsignedLong precisiontype);
198198
Optional<String> get_shader_info_log(GC::Root<WebGLShader> shader);
199199
Optional<String> get_shader_source(GC::Root<WebGLShader> shader);
200+
JS::Value get_uniform(GC::Root<WebGLProgram> program, GC::Root<WebGLUniformLocation> location);
200201
GC::Root<WebGLUniformLocation> get_uniform_location(GC::Root<WebGLProgram> program, String name);
201202
JS::Value get_vertex_attrib(WebIDL::UnsignedLong index, WebIDL::UnsignedLong pname);
202203
void hint(WebIDL::UnsignedLong target, WebIDL::UnsignedLong mode);

Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ interface mixin WebGLRenderingContextBase {
127127

128128
[FIXME] any getTexParameter(GLenum target, GLenum pname);
129129

130-
[FIXME] any getUniform(WebGLProgram program, WebGLUniformLocation location);
130+
any getUniform(WebGLProgram program, WebGLUniformLocation location);
131131

132132
WebGLUniformLocation? getUniformLocation(WebGLProgram program, DOMString name);
133133

Libraries/LibWeb/WebGL/WebGLRenderingContextImpl.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,12 @@ Optional<String> WebGLRenderingContextImpl::get_shader_source(GC::Root<WebGLShad
16661666
return String::from_utf8_without_validation(ReadonlyBytes { shader_source.data(), static_cast<size_t>(shader_source_length - 1) });
16671667
}
16681668

1669+
JS::Value WebGLRenderingContextImpl::get_uniform(GC::Root<WebGLProgram>, GC::Root<WebGLUniformLocation>)
1670+
{
1671+
dbgln("FIXME: Implement get_uniform");
1672+
return JS::Value(0);
1673+
}
1674+
16691675
GC::Root<WebGLUniformLocation> WebGLRenderingContextImpl::get_uniform_location(GC::Root<WebGLProgram> program, String name)
16701676
{
16711677
m_context->make_current();

Libraries/LibWeb/WebGL/WebGLRenderingContextImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class WebGLRenderingContextImpl : public WebGLRenderingContextBase {
112112
GC::Root<WebGLShaderPrecisionFormat> get_shader_precision_format(WebIDL::UnsignedLong shadertype, WebIDL::UnsignedLong precisiontype);
113113
Optional<String> get_shader_info_log(GC::Root<WebGLShader> shader);
114114
Optional<String> get_shader_source(GC::Root<WebGLShader> shader);
115+
JS::Value get_uniform(GC::Root<WebGLProgram> program, GC::Root<WebGLUniformLocation> location);
115116
GC::Root<WebGLUniformLocation> get_uniform_location(GC::Root<WebGLProgram> program, String name);
116117
JS::Value get_vertex_attrib(WebIDL::UnsignedLong index, WebIDL::UnsignedLong pname);
117118
void hint(WebIDL::UnsignedLong target, WebIDL::UnsignedLong mode);

0 commit comments

Comments
 (0)