mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb/WebGL2: Implement samplerParameter{i,f}
This commit is contained in:
parent
aa2eb7ac7d
commit
09ad685238
Notes:
github-actions[bot]
2025-01-08 14:57:55 +00:00
Author: https://github.com/Lubrsi
Commit: 09ad685238
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2943
Reviewed-by: https://github.com/kalenikaliaksandr
2 changed files with 39 additions and 2 deletions
|
@ -391,8 +391,8 @@ interface mixin WebGL2RenderingContextBase {
|
||||||
[FIXME] undefined deleteSampler(WebGLSampler? sampler);
|
[FIXME] undefined deleteSampler(WebGLSampler? sampler);
|
||||||
[FIXME] GLboolean isSampler(WebGLSampler? sampler); // [WebGLHandlesContextLoss]
|
[FIXME] GLboolean isSampler(WebGLSampler? sampler); // [WebGLHandlesContextLoss]
|
||||||
undefined bindSampler(GLuint unit, WebGLSampler? sampler);
|
undefined bindSampler(GLuint unit, WebGLSampler? sampler);
|
||||||
[FIXME] undefined samplerParameteri(WebGLSampler sampler, GLenum pname, GLint param);
|
undefined samplerParameteri(WebGLSampler sampler, GLenum pname, GLint param);
|
||||||
[FIXME] undefined samplerParameterf(WebGLSampler sampler, GLenum pname, GLfloat param);
|
undefined samplerParameterf(WebGLSampler sampler, GLenum pname, GLfloat param);
|
||||||
[FIXME] any getSamplerParameter(WebGLSampler sampler, GLenum pname);
|
[FIXME] any getSamplerParameter(WebGLSampler sampler, GLenum pname);
|
||||||
|
|
||||||
// Sync objects
|
// Sync objects
|
||||||
|
|
|
@ -1404,6 +1404,43 @@ public:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (function.name.starts_with("samplerParameter"sv)) {
|
||||||
|
generate_webgl_object_handle_unwrap(function_impl_generator, "sampler"sv, ""sv);
|
||||||
|
function_impl_generator.set("param_type", function.name.substring_view(16, 1));
|
||||||
|
// pname is given in the following table:
|
||||||
|
// - TEXTURE_COMPARE_FUNC
|
||||||
|
// - TEXTURE_COMPARE_MODE
|
||||||
|
// - TEXTURE_MAG_FILTER
|
||||||
|
// - TEXTURE_MAX_LOD
|
||||||
|
// - TEXTURE_MIN_FILTER
|
||||||
|
// - TEXTURE_MIN_LOD
|
||||||
|
// - TEXTURE_WRAP_R
|
||||||
|
// - TEXTURE_WRAP_S
|
||||||
|
// - TEXTURE_WRAP_T
|
||||||
|
// If pname is not in the table above, generates an INVALID_ENUM error.
|
||||||
|
// NOTE: We have to do this ourselves, as OpenGL does not.
|
||||||
|
function_impl_generator.append(R"~~~(
|
||||||
|
switch (pname) {
|
||||||
|
case GL_TEXTURE_COMPARE_FUNC:
|
||||||
|
case GL_TEXTURE_COMPARE_MODE:
|
||||||
|
case GL_TEXTURE_MAG_FILTER:
|
||||||
|
case GL_TEXTURE_MAX_LOD:
|
||||||
|
case GL_TEXTURE_MIN_FILTER:
|
||||||
|
case GL_TEXTURE_MIN_LOD:
|
||||||
|
case GL_TEXTURE_WRAP_R:
|
||||||
|
case GL_TEXTURE_WRAP_S:
|
||||||
|
case GL_TEXTURE_WRAP_T:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dbgln("Unknown WebGL sampler parameter name: 0x{:04x}", pname);
|
||||||
|
set_error(GL_INVALID_ENUM);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glSamplerParameter@param_type@(sampler_handle, pname, param);
|
||||||
|
)~~~");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Vector<ByteString> gl_call_arguments;
|
Vector<ByteString> gl_call_arguments;
|
||||||
for (size_t i = 0; i < function.parameters.size(); ++i) {
|
for (size_t i = 0; i < function.parameters.size(); ++i) {
|
||||||
auto const& parameter = function.parameters[i];
|
auto const& parameter = function.parameters[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue