mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 13:10:10 +01:00
vtn: Set alignment on initial UBO/SSBO casts
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
e29001d0e7
commit
f78e4cec32
2 changed files with 17 additions and 0 deletions
|
|
@ -101,6 +101,18 @@ struct spirv_to_nir_options {
|
|||
nir_address_format temp_addr_format;
|
||||
nir_address_format constant_addr_format;
|
||||
|
||||
/** Minimum UBO alignment.
|
||||
*
|
||||
* This should match VkPhysicalDeviceLimits::minUniformBufferOffsetAlignment
|
||||
*/
|
||||
uint32_t min_ubo_alignment;
|
||||
|
||||
/** Minimum SSBO alignment.
|
||||
*
|
||||
* This should match VkPhysicalDeviceLimits::minStorageBufferOffsetAlignment
|
||||
*/
|
||||
uint32_t min_ssbo_alignment;
|
||||
|
||||
const nir_shader *clc_shader;
|
||||
|
||||
struct {
|
||||
|
|
|
|||
|
|
@ -413,10 +413,15 @@ vtn_pointer_dereference(struct vtn_builder *b,
|
|||
base->mode == vtn_variable_mode_ubo);
|
||||
nir_variable_mode nir_mode =
|
||||
base->mode == vtn_variable_mode_ssbo ? nir_var_mem_ssbo : nir_var_mem_ubo;
|
||||
const uint32_t align = base->mode == vtn_variable_mode_ssbo ?
|
||||
b->options->min_ssbo_alignment : b->options->min_ubo_alignment;
|
||||
|
||||
tail = nir_build_deref_cast(&b->nb, desc, nir_mode,
|
||||
vtn_type_get_nir_type(b, type, base->mode),
|
||||
base->ptr_type->stride);
|
||||
tail->cast.align_mul = align;
|
||||
tail->cast.align_offset = 0;
|
||||
|
||||
} else if (base->mode == vtn_variable_mode_shader_record) {
|
||||
/* For ShaderRecordBufferKHR variables, we don't have a nir_variable.
|
||||
* It's just a fancy handle around a pointer to the shader record for
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue