LibWeb/WebGL: Implement getShaderInfoLog()
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run

With this change we have enough WebGL support to display demos on
https://ciechanow.ski/lights-and-shadows/ but most of them are not
redering correctly yet.
This commit is contained in:
Aliaksandr Kalenik 2024-12-04 22:48:32 +01:00 committed by Alexander Kalenik
parent fd263d3755
commit 110f89ee25
Notes: github-actions[bot] 2024-12-05 00:24:02 +00:00
2 changed files with 20 additions and 1 deletions

View file

@ -120,7 +120,7 @@ interface mixin WebGLRenderingContextBase {
[FIXME] any getRenderbufferParameter(GLenum target, GLenum pname);
any getShaderParameter(WebGLShader shader, GLenum pname);
[FIXME] WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
[FIXME] DOMString? getShaderInfoLog(WebGLShader shader);
DOMString? getShaderInfoLog(WebGLShader shader);
[FIXME] DOMString? getShaderSource(WebGLShader shader);

View file

@ -37,6 +37,11 @@ static ByteString to_cpp_type(const IDL::Type& type, const IDL::Interface& inter
return "JS::Object*"sv;
return "JS::Object&"sv;
}
if (type.name() == "DOMString"sv) {
if (type.is_nullable())
return "Optional<String>"sv;
return "String"sv;
}
auto cpp_type = idl_type_name_to_cpp_type(type, interface);
return cpp_type.name;
}
@ -563,6 +568,20 @@ public:
continue;
}
if (function.name == "getShaderInfoLog"sv) {
function_impl_generator.append(R"~~~(
GLint info_log_length = 0;
glGetShaderiv(shader->handle(), GL_INFO_LOG_LENGTH, &info_log_length);
Vector<GLchar> info_log;
info_log.resize(info_log_length);
if (!info_log_length)
return String {};
glGetShaderInfoLog(shader->handle(), info_log_length, nullptr, info_log.data());
return String::from_utf8_without_validation(ReadonlyBytes { info_log.data(), static_cast<size_t>(info_log_length - 1) });
)~~~");
continue;
}
Vector<ByteString> gl_call_arguments;
for (size_t i = 0; i < function.parameters.size(); ++i) {
auto const& parameter = function.parameters[i];