LibWeb/WebGL: Return from uniform methods if location is null

If location is null, the spec simply tells us to return and ignore the
passed in data.

Fixes #3708.
This commit is contained in:
Luke Wilde 2025-03-02 20:37:18 +00:00 committed by Andreas Kling
parent b11ba4cc90
commit 6cb0f41c57
Notes: github-actions[bot] 2025-03-03 07:44:34 +00:00

View file

@ -1448,7 +1448,11 @@ public:
function_impl_generator.set("array_argument_name", "data");
}
// "If the passed location is null, the data passed in will be silently ignored and no uniform variables will be changed."
function_impl_generator.append(R"~~~(
if (!location)
return;
auto matrix_size = @number_of_matrix_elements@ * @number_of_matrix_elements@;
float const* raw_data = nullptr;
u64 count = 0;
@ -1501,7 +1505,12 @@ public:
VERIFY_NOT_REACHED();
}
function_impl_generator.set("number_of_vector_elements", number_of_vector_elements);
// "If the passed location is null, the data passed in will be silently ignored and no uniform variables will be changed."
function_impl_generator.append(R"~~~(
if (!location)
return;
@cpp_element_type@ const* data = nullptr;
size_t count = 0;
if (v.has<Vector<@cpp_element_type@>>()) {