LibWeb/WebGL: Implement getProgramInfoLog()

This commit is contained in:
Aliaksandr Kalenik 2024-12-05 16:09:18 +01:00 committed by Alexander Kalenik
parent b8109c3047
commit ae6edfb845
Notes: github-actions[bot] 2024-12-05 15:43:07 +00:00
2 changed files with 15 additions and 1 deletions

View file

@ -116,7 +116,7 @@ interface mixin WebGLRenderingContextBase {
[FIXME] any getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname);
any getProgramParameter(WebGLProgram program, GLenum pname);
[FIXME] DOMString? getProgramInfoLog(WebGLProgram program);
DOMString? getProgramInfoLog(WebGLProgram program);
[FIXME] any getRenderbufferParameter(GLenum target, GLenum pname);
any getShaderParameter(WebGLShader shader, GLenum pname);
[FIXME] WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);

View file

@ -582,6 +582,20 @@ public:
continue;
}
if (function.name == "getProgramInfoLog"sv) {
function_impl_generator.append(R"~~~(
GLint info_log_length = 0;
glGetProgramiv(program->handle(), GL_INFO_LOG_LENGTH, &info_log_length);
Vector<GLchar> info_log;
info_log.resize(info_log_length);
if (!info_log_length)
return String {};
glGetProgramInfoLog(program->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];