From 37125b7cc220fd9b77e9882268892ca4e79a0627 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Fri, 27 Dec 2019 17:49:27 +0100 Subject: r600/sfn: Add lowering UBO access to r600 specific codes r600 reads vec4 from the UBO, but the offsets in nir are evaluated to the component. If the offsets are not literal then all non-vec4 reads must resolve the component after reading a vec4 component (TODO: figure out whether there is a consistent way to deduct the component that is actually read). Signed-off-by: Gert Wollny Part-of: --- src/compiler/nir/nir_intrinsics.py | 8 ++++++++ src/compiler/nir/nir_validate.c | 2 ++ 2 files changed, 10 insertions(+) (limited to 'src/compiler') diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py index 026f715edca..33012d4bb01 100644 --- a/src/compiler/nir/nir_intrinsics.py +++ b/src/compiler/nir/nir_intrinsics.py @@ -866,6 +866,14 @@ load("output_u8_as_fp16_pan", 0, [], [CAN_ELIMINATE, CAN_REORDER]) # src[] = { sampler_index } load("sampler_lod_parameters_pan", 1, [CAN_ELIMINATE, CAN_REORDER]) +# R600 specific instrincs +# +# R600 can only fetch 16 byte aligned data from an UBO, and the actual offset +# is given in vec4 units, so we have to fetch the a vec4 and get the component +# later +# src[] = { buffer_index, offset }. +load("ubo_r600", 2, [ACCESS, ALIGN_MUL, ALIGN_OFFSET], flags=[CAN_ELIMINATE, CAN_REORDER]) + # V3D-specific instrinc for tile buffer color reads. # # The hardware requires that we read the samples and components of a pixel diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index 38e32e4ce3d..e0da743144a 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -531,6 +531,7 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state) case nir_intrinsic_load_deref: { nir_deref_instr *src = nir_src_as_deref(instr->src[0]); + assert(src); validate_assert(state, glsl_type_is_vector_or_scalar(src->type) || (src->mode == nir_var_uniform && glsl_get_base_type(src->type) == GLSL_TYPE_SUBROUTINE)); @@ -545,6 +546,7 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state) case nir_intrinsic_store_deref: { nir_deref_instr *dst = nir_src_as_deref(instr->src[0]); + assert(dst); validate_assert(state, glsl_type_is_vector_or_scalar(dst->type)); validate_assert(state, instr->num_components == glsl_get_vector_elements(dst->type)); -- cgit v1.2.3