LibWeb/WebGL2: Implement getSyncParameter

This commit is contained in:
Luke Wilde 2024-12-31 12:08:24 +00:00 committed by Alexander Kalenik
parent 6bf6cd3f19
commit e5d59a2d42
Notes: github-actions[bot] 2025-01-08 14:56:48 +00:00
2 changed files with 17 additions and 1 deletions

View file

@ -401,7 +401,7 @@ interface mixin WebGL2RenderingContextBase {
undefined deleteSync(WebGLSync? sync);
GLenum clientWaitSync(WebGLSync sync, GLbitfield flags, GLuint64 timeout);
[FIXME] undefined waitSync(WebGLSync sync, GLbitfield flags, GLint64 timeout);
[FIXME] any getSyncParameter(WebGLSync sync, GLenum pname);
any getSyncParameter(WebGLSync sync, GLenum pname);
// Transform Feedback
[FIXME] WebGLTransformFeedback createTransformFeedback();

View file

@ -951,6 +951,22 @@ public:
continue;
}
if (function.name == "getSyncParameter"sv) {
// FIXME: In order to ensure consistent behavior across platforms, sync objects may only transition to the
// signaled state when the user agent's event loop is not executing a task. In other words:
// - A sync object must not become signaled until control has returned to the user agent's main
// loop.
// - Repeatedly fetching a sync object's SYNC_STATUS parameter in a loop, without returning
// control to the user agent, must always return the same value.
// FIXME: Remove the GLsync cast once sync_handle actually returns the proper GLsync type.
function_impl_generator.append(R"~~~(
GLint result = 0;
glGetSynciv((GLsync)(sync ? sync->sync_handle() : nullptr), pname, 1, nullptr, &result);
return JS::Value(result);
)~~~");
continue;
}
if (function.name == "bufferData"sv && function.overload_index == 0) {
function_impl_generator.append(R"~~~(
glBufferData(target, size, 0, usage);