From d34fd81e7668b14158d63ade844a0e260b6f9152 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 13 Nov 2018 09:45:03 -0600 Subject: nir: Add alignment parameters to SSBO, UBO, and shared access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also changes spirv_to_nir and glsl_to_nir to set them. The one place that doesn't set them is shared memory access lowering in nir_lower_io. That will have to be updated before any consumers of it can effectively use these new alignments. Reviewed-by: Samuel Iglesias Gonsálvez Acked-by: Karol Herbst --- src/compiler/nir/nir_intrinsics.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/compiler/nir/nir_intrinsics.py') diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py index ec3049ca06d..735db43d16a 100644 --- a/src/compiler/nir/nir_intrinsics.py +++ b/src/compiler/nir/nir_intrinsics.py @@ -109,6 +109,9 @@ IMAGE_ARRAY = "NIR_INTRINSIC_IMAGE_ARRAY" ACCESS = "NIR_INTRINSIC_ACCESS" # Image format for image intrinsics FORMAT = "NIR_INTRINSIC_FORMAT" +# Offset or address alignment +ALIGN_MUL = "NIR_INTRINSIC_ALIGN_MUL" +ALIGN_OFFSET = "NIR_INTRINSIC_ALIGN_OFFSET" # # Possible flags: @@ -554,8 +557,8 @@ def load(name, num_srcs, indices=[], flags=[]): # src[] = { offset }. const_index[] = { base, range } load("uniform", 1, [BASE, RANGE], [CAN_ELIMINATE, CAN_REORDER]) -# src[] = { buffer_index, offset }. No const_index -load("ubo", 2, flags=[CAN_ELIMINATE, CAN_REORDER]) +# src[] = { buffer_index, offset }. const_index[] = { align_mul, align_offset } +load("ubo", 2, [ALIGN_MUL, ALIGN_OFFSET], flags=[CAN_ELIMINATE, CAN_REORDER]) # src[] = { offset }. const_index[] = { base, component } load("input", 1, [BASE, COMPONENT], [CAN_ELIMINATE, CAN_REORDER]) # src[] = { vertex, offset }. const_index[] = { base, component } @@ -564,14 +567,15 @@ load("per_vertex_input", 2, [BASE, COMPONENT], [CAN_ELIMINATE, CAN_REORDER]) intrinsic("load_interpolated_input", src_comp=[2, 1], dest_comp=0, indices=[BASE, COMPONENT], flags=[CAN_ELIMINATE, CAN_REORDER]) -# src[] = { buffer_index, offset }. No const_index -load("ssbo", 2, flags=[CAN_ELIMINATE], indices=[ACCESS]) +# src[] = { buffer_index, offset }. +# const_index[] = { access, align_mul, align_offset } +load("ssbo", 2, [ACCESS, ALIGN_MUL, ALIGN_OFFSET], [CAN_ELIMINATE]) # src[] = { offset }. const_index[] = { base, component } load("output", 1, [BASE, COMPONENT], flags=[CAN_ELIMINATE]) # src[] = { vertex, offset }. const_index[] = { base } load("per_vertex_output", 2, [BASE, COMPONENT], [CAN_ELIMINATE]) -# src[] = { offset }. const_index[] = { base } -load("shared", 1, [BASE], [CAN_ELIMINATE]) +# src[] = { offset }. const_index[] = { base, align_mul, align_offset } +load("shared", 1, [BASE, ALIGN_MUL, ALIGN_OFFSET], [CAN_ELIMINATE]) # src[] = { offset }. const_index[] = { base, range } load("push_constant", 1, [BASE, RANGE], [CAN_ELIMINATE, CAN_REORDER]) # src[] = { offset }. const_index[] = { base, range } @@ -590,7 +594,9 @@ store("output", 2, [BASE, WRMASK, COMPONENT]) # src[] = { value, vertex, offset }. # const_index[] = { base, write_mask, component } store("per_vertex_output", 3, [BASE, WRMASK, COMPONENT]) -# src[] = { value, block_index, offset }. const_index[] = { write_mask } -store("ssbo", 3, [WRMASK, ACCESS]) -# src[] = { value, offset }. const_index[] = { base, write_mask } -store("shared", 2, [BASE, WRMASK]) +# src[] = { value, block_index, offset } +# const_index[] = { write_mask, access, align_mul, align_offset } +store("ssbo", 3, [WRMASK, ACCESS, ALIGN_MUL, ALIGN_OFFSET]) +# src[] = { value, offset }. +# const_index[] = { base, write_mask, align_mul, align_offset } +store("shared", 2, [BASE, WRMASK, ALIGN_MUL, ALIGN_OFFSET]) -- cgit v1.2.3