mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
LibWeb/WebGL: Return correct types from get{Shader,Program}Parameter
Returning numbers instead of booleans for the statuses made Ruffle (through the wgpu crate) think a shader/program failed to compile/link, as it does a strict type comparison.
This commit is contained in:
parent
db2d8f8f17
commit
2b20b8aaff
Notes:
github-actions[bot]
2025-01-08 14:57:22 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/2b20b8aafff Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2943 Reviewed-by: https://github.com/kalenikaliaksandr
1 changed files with 36 additions and 2 deletions
|
@ -897,7 +897,17 @@ public:
|
|||
function_impl_generator.append(R"~~~(
|
||||
GLint result = 0;
|
||||
glGetShaderiv(shader_handle, pname, &result);
|
||||
return JS::Value(result);
|
||||
switch (pname) {
|
||||
case GL_SHADER_TYPE:
|
||||
return JS::Value(result);
|
||||
case GL_DELETE_STATUS:
|
||||
case GL_COMPILE_STATUS:
|
||||
return JS::Value(result == GL_TRUE);
|
||||
default:
|
||||
dbgln("Unknown WebGL shader parameter name: 0x{:04x}", pname);
|
||||
set_error(GL_INVALID_ENUM);
|
||||
return JS::js_null();
|
||||
}
|
||||
)~~~");
|
||||
continue;
|
||||
}
|
||||
|
@ -907,7 +917,31 @@ public:
|
|||
function_impl_generator.append(R"~~~(
|
||||
GLint result = 0;
|
||||
glGetProgramiv(program_handle, pname, &result);
|
||||
return JS::Value(result);
|
||||
switch (pname) {
|
||||
case GL_ATTACHED_SHADERS:
|
||||
case GL_ACTIVE_ATTRIBUTES:
|
||||
case GL_ACTIVE_UNIFORMS:
|
||||
)~~~");
|
||||
|
||||
if (webgl_version == 2) {
|
||||
function_impl_generator.append(R"~~~(
|
||||
case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
|
||||
case GL_TRANSFORM_FEEDBACK_VARYINGS:
|
||||
case GL_ACTIVE_UNIFORM_BLOCKS:
|
||||
)~~~");
|
||||
}
|
||||
|
||||
function_impl_generator.append(R"~~~(
|
||||
return JS::Value(result);
|
||||
case GL_DELETE_STATUS:
|
||||
case GL_LINK_STATUS:
|
||||
case GL_VALIDATE_STATUS:
|
||||
return JS::Value(result == GL_TRUE);
|
||||
default:
|
||||
dbgln("Unknown WebGL program parameter name: 0x{:04x}", pname);
|
||||
set_error(GL_INVALID_ENUM);
|
||||
return JS::js_null();
|
||||
}
|
||||
)~~~");
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue