anv: Support pushing shader constants

Usually, nir_opt_constant_folding will get rid of any load_constant
intrinsics which might possibly be pushed but there are rare cases where
we can still end up with them.  Better to handle them.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10571>
This commit is contained in:
Jason Ekstrand
2021-05-02 17:55:15 -05:00
committed by Marge Bot
parent 24b3e71fa9
commit c01354d5c4

View File

@@ -3013,6 +3013,13 @@ get_push_range_address(struct anv_cmd_buffer *cmd_buffer,
};
}
case ANV_DESCRIPTOR_SET_SHADER_CONSTANTS:
return (struct anv_address) {
.bo = cmd_buffer->device->instruction_state_pool.block_pool.bo,
.offset = shader->kernel.offset +
shader->prog_data->const_data_offset,
};
default: {
assert(range->set < MAX_SETS);
struct anv_descriptor_set *set =
@@ -3075,6 +3082,9 @@ get_push_range_bound_size(struct anv_cmd_buffer *cmd_buffer,
case ANV_DESCRIPTOR_SET_PUSH_CONSTANTS:
return (range->start + range->length) * 32;
case ANV_DESCRIPTOR_SET_SHADER_CONSTANTS:
return ALIGN(shader->prog_data->const_data_size, ANV_UBO_ALIGNMENT);
default: {
assert(range->set < MAX_SETS);
struct anv_descriptor_set *set =