209 if (push_constant_layout ==
nullptr) {
216 uint8_t *bytes =
static_cast<uint8_t *
>(data_);
217 T *dst =
static_cast<T *
>(
static_cast<void *
>(&bytes[push_constant_layout->
offset]));
219 const bool is_tightly_std140_packed = (comp_len % 4) == 0;
221 const bool is_tightly_std430_packed = comp_len != 3 || array_size == 0;
222 if (inner_row_padding == 0 &&
224 is_tightly_std430_packed) ||
225 array_size == 0 || push_constant_layout->
array_size == 0 || is_tightly_std140_packed))
227 const size_t copy_size_in_bytes = comp_len *
max_ii(array_size, 1) *
sizeof(
T);
229 "Tried to write outside the push constant allocated memory.");
230 memcpy(dst, input_data, copy_size_in_bytes);
237 const T *src = input_data;
238 if (inner_row_padding == 0) {
241 memcpy(dst, src, comp_len *
sizeof(
T));
247 BLI_assert_msg(array_size == 1,
"No support for MAT3 arrays, but can be added when needed");
248 for (
const int component_index :
IndexRange(comp_len)) {
252 if ((component_index % inner_row_padding) == (inner_row_padding - 1)) {