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>
(cherry picked from commit c01354d5c4)
This commit is contained in:
Jason Ekstrand 2021-05-02 17:55:15 -05:00 committed by Eric Engestrom
parent 49f846f596
commit 29c18f3c3b
2 changed files with 11 additions and 1 deletions

View file

@ -193,7 +193,7 @@
"description": "anv: Support pushing shader constants",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -2999,6 +2999,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 =
@ -3061,6 +3068,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 =