mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
anv: Let spirv_to_nir() set UBO/SSBO base cast alignments
Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21027>
This commit is contained in:
parent
f78e4cec32
commit
85d44b0f97
2 changed files with 3 additions and 25 deletions
|
|
@ -916,31 +916,6 @@ lower_load_vulkan_descriptor(nir_builder *b, nir_intrinsic_instr *intrin,
|
|||
const VkDescriptorType desc_type = nir_intrinsic_desc_type(intrin);
|
||||
nir_address_format addr_format = addr_format_for_desc_type(desc_type, state);
|
||||
|
||||
assert(intrin->dest.is_ssa);
|
||||
nir_foreach_use(src, &intrin->dest.ssa) {
|
||||
if (src->parent_instr->type != nir_instr_type_deref)
|
||||
continue;
|
||||
|
||||
nir_deref_instr *cast = nir_instr_as_deref(src->parent_instr);
|
||||
assert(cast->deref_type == nir_deref_type_cast);
|
||||
switch (desc_type) {
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
||||
cast->cast.align_mul = ANV_UBO_ALIGNMENT;
|
||||
cast->cast.align_offset = 0;
|
||||
break;
|
||||
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
||||
cast->cast.align_mul = ANV_SSBO_ALIGNMENT;
|
||||
cast->cast.align_offset = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assert(intrin->src[0].is_ssa);
|
||||
nir_ssa_def *desc =
|
||||
build_buffer_addr_for_res_index(b, desc_type, intrin->src[0].ssa,
|
||||
|
|
|
|||
|
|
@ -220,6 +220,9 @@ anv_shader_stage_to_nir(struct anv_device *device,
|
|||
* with certain code / code generators.
|
||||
*/
|
||||
.shared_addr_format = nir_address_format_32bit_offset,
|
||||
|
||||
.min_ubo_alignment = ANV_UBO_ALIGNMENT,
|
||||
.min_ssbo_alignment = ANV_SSBO_ALIGNMENT,
|
||||
};
|
||||
|
||||
nir_shader *nir;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue