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