From 8a9d1de1cfd94e906438854ea1b3bd1dff680825 Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Fri, 13 Dec 2024 14:06:57 +0000 Subject: [PATCH] LibWeb/WebGL2: Implement createSampler --- Libraries/LibWeb/Forward.h | 1 + Libraries/LibWeb/WebGL/WebGL2RenderingContextBase.idl | 3 ++- .../LibWeb/BindingsGenerator/IDLGenerators.cpp | 1 + .../LibWeb/GenerateWebGLRenderingContext.cpp | 10 ++++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index 966a8a858dc..cf07f60cf87 100644 --- a/Libraries/LibWeb/Forward.h +++ b/Libraries/LibWeb/Forward.h @@ -842,6 +842,7 @@ class WebGLObject; class WebGLProgram; class WebGLRenderbuffer; class WebGLRenderingContext; +class WebGLSampler; class WebGLShader; class WebGLShaderPrecisionFormat; class WebGLTexture; diff --git a/Libraries/LibWeb/WebGL/WebGL2RenderingContextBase.idl b/Libraries/LibWeb/WebGL/WebGL2RenderingContextBase.idl index 6c46beb1c61..0e4b510bb35 100644 --- a/Libraries/LibWeb/WebGL/WebGL2RenderingContextBase.idl +++ b/Libraries/LibWeb/WebGL/WebGL2RenderingContextBase.idl @@ -7,6 +7,7 @@ #import #import #import +#import #import #import #import @@ -386,7 +387,7 @@ interface mixin WebGL2RenderingContextBase { [FIXME] any getQueryParameter(WebGLQuery query, GLenum pname); // Sampler Objects - [FIXME] WebGLSampler createSampler(); + WebGLSampler createSampler(); [FIXME] undefined deleteSampler(WebGLSampler? sampler); [FIXME] GLboolean isSampler(WebGLSampler? sampler); // [WebGLHandlesContextLoss] [FIXME] undefined bindSampler(GLuint unit, WebGLSampler? sampler); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index 8b546ca8816..c2296ce36c2 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -113,6 +113,7 @@ static bool is_platform_object(Type const& type) "WebGLProgram"sv, "WebGLRenderbuffer"sv, "WebGLRenderingContext"sv, + "WebGLSampler"sv, "WebGLShader"sv, "WebGLShaderPrecisionFormat"sv, "WebGLTexture"sv, diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWebGLRenderingContext.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWebGLRenderingContext.cpp index da21c582955..0c899991cc9 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWebGLRenderingContext.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWebGLRenderingContext.cpp @@ -354,6 +354,7 @@ ErrorOr serenity_main(Main::Arguments arguments) #include #include #include +#include #include #include #include @@ -508,6 +509,15 @@ public: continue; } + if (function.name == "createSampler"sv) { + function_impl_generator.append(R"~~~( + GLuint handle = 0; + glGenSamplers(1, &handle); + return WebGLSampler::create(m_realm, handle); +)~~~"); + continue; + } + if (function.name == "shaderSource"sv) { function_impl_generator.append(R"~~~( Vector strings;