mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb/WebGL2: Implement getInternalformatParameter
This commit is contained in:
parent
ee500df7ec
commit
776328e2e7
Notes:
github-actions[bot]
2024-12-14 08:09:53 +00:00
Author: https://github.com/Lubrsi
Commit: 776328e2e7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2905
2 changed files with 26 additions and 1 deletions
|
@ -278,6 +278,26 @@ static void generate_get_buffer_parameter(SourceGenerator& generator)
|
|||
})~~~");
|
||||
}
|
||||
|
||||
static void generate_get_internal_format_parameter(SourceGenerator& generator)
|
||||
{
|
||||
generator.append(R"~~~(
|
||||
switch (pname) {
|
||||
case GL_SAMPLES: {
|
||||
GLint num_sample_counts { 0 };
|
||||
glGetInternalformativ(target, internalformat, GL_NUM_SAMPLE_COUNTS, 1, &num_sample_counts);
|
||||
auto samples_buffer = MUST(ByteBuffer::create_zeroed(num_sample_counts * sizeof(GLint)));
|
||||
glGetInternalformativ(target, internalformat, GL_SAMPLES, num_sample_counts, reinterpret_cast<GLint*>(samples_buffer.data()));
|
||||
auto array_buffer = JS::ArrayBuffer::create(m_realm, move(samples_buffer));
|
||||
return JS::Int32Array::create(m_realm, num_sample_counts, array_buffer);
|
||||
}
|
||||
default:
|
||||
dbgln("Unknown WebGL internal format parameter name: {:x}", pname);
|
||||
set_error(GL_INVALID_ENUM);
|
||||
return JS::js_null();
|
||||
}
|
||||
)~~~");
|
||||
}
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
StringView generated_header_path;
|
||||
|
@ -835,6 +855,11 @@ public:
|
|||
continue;
|
||||
}
|
||||
|
||||
if (function.name == "getInternalformatParameter") {
|
||||
generate_get_internal_format_parameter(function_impl_generator);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (function.name == "getActiveUniform"sv) {
|
||||
function_impl_generator.append(R"~~~(
|
||||
GLint size = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue