anv: Zero out the last dword of UBO/SSBO descriptors in the shader

This way, NIR can constant fold it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8635>
This commit is contained in:
Jason Ekstrand 2021-01-15 17:20:22 -06:00 committed by Marge Bot
parent 422798caef
commit 8a61e3a0c0

View file

@ -549,7 +549,14 @@ build_ssbo_descriptor_load(nir_builder *b, const VkDescriptorType desc_type,
.range_base = 0,
.range = ~0);
return desc_load;
/* The last element of the vec4 is always zero.
*
* See also struct anv_address_range_descriptor
*/
return nir_vec4(b, nir_channel(b, desc_load, 0),
nir_channel(b, desc_load, 1),
nir_channel(b, desc_load, 2),
nir_imm_int(b, 0));
}
static bool