mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibWeb/WebGL: Implement uniform{1,2,3,4}iv
This commit is contained in:
parent
2e1640a6c5
commit
7b0c067f4d
Notes:
github-actions[bot]
2024-12-05 20:42:50 +00:00
Author: https://github.com/Lubrsi
Commit: 7b0c067f4d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2791
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/shannonbooth
2 changed files with 26 additions and 4 deletions
|
@ -633,6 +633,25 @@ public:
|
|||
continue;
|
||||
}
|
||||
|
||||
if (function.name == "uniform1iv"sv || function.name == "uniform2iv"sv || function.name == "uniform3iv"sv || function.name == "uniform4iv"sv) {
|
||||
auto number_of_matrix_elements = function.name.substring_view(7, 1);
|
||||
function_impl_generator.set("number_of_matrix_elements", number_of_matrix_elements);
|
||||
function_impl_generator.append(R"~~~(
|
||||
if (v.has<Vector<int>>()) {
|
||||
auto& data = v.get<Vector<int>>();
|
||||
glUniform@number_of_matrix_elements@iv(location->handle(), data.size() / @number_of_matrix_elements@, data.data());
|
||||
return;
|
||||
}
|
||||
|
||||
auto& typed_array_base = static_cast<JS::TypedArrayBase&>(*v.get<GC::Root<WebIDL::BufferSource>>()->raw_object());
|
||||
auto& int32_array = verify_cast<JS::Int32Array>(typed_array_base);
|
||||
int const* data = int32_array.data().data();
|
||||
auto count = int32_array.array_length().length() / @number_of_matrix_elements@;
|
||||
glUniform@number_of_matrix_elements@iv(location->handle(), count, data);
|
||||
)~~~");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (function.name == "getParameter"sv) {
|
||||
generate_get_parameter(function_impl_generator);
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue