mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 01:29:17 +00:00
LibWeb/WebGL2: Implement fenceSync
This commit is contained in:
parent
bc9ae79a47
commit
135ceb387e
Notes:
github-actions[bot]
2024-12-14 08:10:14 +00:00
Author: https://github.com/Lubrsi
Commit: 135ceb387e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2905
7 changed files with 26 additions and 6 deletions
|
@ -845,6 +845,7 @@ class WebGLRenderingContext;
|
||||||
class WebGLSampler;
|
class WebGLSampler;
|
||||||
class WebGLShader;
|
class WebGLShader;
|
||||||
class WebGLShaderPrecisionFormat;
|
class WebGLShaderPrecisionFormat;
|
||||||
|
class WebGLSync;
|
||||||
class WebGLTexture;
|
class WebGLTexture;
|
||||||
class WebGLUniformLocation;
|
class WebGLUniformLocation;
|
||||||
class WebGLVertexArrayObject;
|
class WebGLVertexArrayObject;
|
||||||
|
|
|
@ -15,4 +15,8 @@ using GLenum = unsigned int;
|
||||||
using GLuint = unsigned int;
|
using GLuint = unsigned int;
|
||||||
using GLint = int;
|
using GLint = int;
|
||||||
|
|
||||||
|
// FIXME: This should really be "struct __GLsync*", but the linker doesn't recognise it.
|
||||||
|
// Since this conflicts with the original definition of GLsync, the suffix "Internal" has been added.
|
||||||
|
using GLsyncInternal = void*;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,7 +396,7 @@ interface mixin WebGL2RenderingContextBase {
|
||||||
[FIXME] any getSamplerParameter(WebGLSampler sampler, GLenum pname);
|
[FIXME] any getSamplerParameter(WebGLSampler sampler, GLenum pname);
|
||||||
|
|
||||||
// Sync objects
|
// Sync objects
|
||||||
[FIXME] WebGLSync? fenceSync(GLenum condition, GLbitfield flags);
|
WebGLSync? fenceSync(GLenum condition, GLbitfield flags);
|
||||||
[FIXME] GLboolean isSync(WebGLSync? sync); // [WebGLHandlesContextLoss]
|
[FIXME] GLboolean isSync(WebGLSync? sync); // [WebGLHandlesContextLoss]
|
||||||
[FIXME] undefined deleteSync(WebGLSync? sync);
|
[FIXME] undefined deleteSync(WebGLSync? sync);
|
||||||
[FIXME] GLenum clientWaitSync(WebGLSync sync, GLbitfield flags, GLuint64 timeout);
|
[FIXME] GLenum clientWaitSync(WebGLSync sync, GLbitfield flags, GLuint64 timeout);
|
||||||
|
|
|
@ -13,13 +13,14 @@ namespace Web::WebGL {
|
||||||
|
|
||||||
GC_DEFINE_ALLOCATOR(WebGLSync);
|
GC_DEFINE_ALLOCATOR(WebGLSync);
|
||||||
|
|
||||||
GC::Ref<WebGLSync> WebGLSync::create(JS::Realm& realm, GLuint handle)
|
GC::Ref<WebGLSync> WebGLSync::create(JS::Realm& realm, GLsyncInternal handle)
|
||||||
{
|
{
|
||||||
return realm.create<WebGLSync>(realm, handle);
|
return realm.create<WebGLSync>(realm, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebGLSync::WebGLSync(JS::Realm& realm, GLuint handle)
|
WebGLSync::WebGLSync(JS::Realm& realm, GLsyncInternal handle)
|
||||||
: WebGLObject(realm, handle)
|
: WebGLObject(realm, 0)
|
||||||
|
, m_sync_handle(handle)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,18 @@ class WebGLSync : public WebGLObject {
|
||||||
GC_DECLARE_ALLOCATOR(WebGLSync);
|
GC_DECLARE_ALLOCATOR(WebGLSync);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static GC::Ref<WebGLSync> create(JS::Realm& realm, GLuint handle);
|
static GC::Ref<WebGLSync> create(JS::Realm& realm, GLsyncInternal handle);
|
||||||
|
|
||||||
virtual ~WebGLSync() override;
|
virtual ~WebGLSync() override;
|
||||||
|
|
||||||
|
GLsyncInternal sync_handle() const { return m_sync_handle; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit WebGLSync(JS::Realm&, GLuint handle);
|
explicit WebGLSync(JS::Realm&, GLsyncInternal handle);
|
||||||
|
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
|
|
||||||
|
GLsyncInternal m_sync_handle { nullptr };
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,7 @@ static bool is_platform_object(Type const& type)
|
||||||
"WebGLSampler"sv,
|
"WebGLSampler"sv,
|
||||||
"WebGLShader"sv,
|
"WebGLShader"sv,
|
||||||
"WebGLShaderPrecisionFormat"sv,
|
"WebGLShaderPrecisionFormat"sv,
|
||||||
|
"WebGLSync"sv,
|
||||||
"WebGLTexture"sv,
|
"WebGLTexture"sv,
|
||||||
"WebGLUniformLocation"sv,
|
"WebGLUniformLocation"sv,
|
||||||
"WebGLVertexArrayObject"sv,
|
"WebGLVertexArrayObject"sv,
|
||||||
|
|
|
@ -357,6 +357,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
#include <LibWeb/WebGL/@class_name@.h>
|
#include <LibWeb/WebGL/@class_name@.h>
|
||||||
#include <LibWeb/WebGL/WebGLSampler.h>
|
#include <LibWeb/WebGL/WebGLSampler.h>
|
||||||
#include <LibWeb/WebGL/WebGLShader.h>
|
#include <LibWeb/WebGL/WebGLShader.h>
|
||||||
|
#include <LibWeb/WebGL/WebGLSync.h>
|
||||||
#include <LibWeb/WebGL/WebGLShaderPrecisionFormat.h>
|
#include <LibWeb/WebGL/WebGLShaderPrecisionFormat.h>
|
||||||
#include <LibWeb/WebGL/WebGLTexture.h>
|
#include <LibWeb/WebGL/WebGLTexture.h>
|
||||||
#include <LibWeb/WebGL/WebGLUniformLocation.h>
|
#include <LibWeb/WebGL/WebGLUniformLocation.h>
|
||||||
|
@ -519,6 +520,14 @@ public:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (function.name == "fenceSync"sv) {
|
||||||
|
function_impl_generator.append(R"~~~(
|
||||||
|
GLsync handle = glFenceSync(condition, flags);
|
||||||
|
return WebGLSync::create(m_realm, handle);
|
||||||
|
)~~~");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (function.name == "shaderSource"sv) {
|
if (function.name == "shaderSource"sv) {
|
||||||
function_impl_generator.append(R"~~~(
|
function_impl_generator.append(R"~~~(
|
||||||
Vector<GLchar*> strings;
|
Vector<GLchar*> strings;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue