nir: make ray query load values visible in NIR prints
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19641>
This commit is contained in:
@@ -781,7 +781,7 @@ radv_nir_lower_ray_queries(struct nir_shader *shader, struct radv_device *device
|
|||||||
break;
|
break;
|
||||||
case nir_intrinsic_rq_load:
|
case nir_intrinsic_rq_load:
|
||||||
new_dest = lower_rq_load(&builder, index, vars, intrinsic->src[1].ssa,
|
new_dest = lower_rq_load(&builder, index, vars, intrinsic->src[1].ssa,
|
||||||
(nir_ray_query_value)nir_intrinsic_base(intrinsic),
|
nir_intrinsic_ray_query_value(intrinsic),
|
||||||
nir_intrinsic_column(intrinsic));
|
nir_intrinsic_column(intrinsic));
|
||||||
break;
|
break;
|
||||||
case nir_intrinsic_rq_proceed:
|
case nir_intrinsic_rq_proceed:
|
||||||
|
@@ -227,6 +227,30 @@ typedef enum {
|
|||||||
nir_rounding_mode_rtz = 4, /* round towards zero */
|
nir_rounding_mode_rtz = 4, /* round towards zero */
|
||||||
} nir_rounding_mode;
|
} nir_rounding_mode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ray query values that can read from a RayQueryKHR object.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
nir_ray_query_value_intersection_type,
|
||||||
|
nir_ray_query_value_intersection_t,
|
||||||
|
nir_ray_query_value_intersection_instance_custom_index,
|
||||||
|
nir_ray_query_value_intersection_instance_id,
|
||||||
|
nir_ray_query_value_intersection_instance_sbt_index,
|
||||||
|
nir_ray_query_value_intersection_geometry_index,
|
||||||
|
nir_ray_query_value_intersection_primitive_index,
|
||||||
|
nir_ray_query_value_intersection_barycentrics,
|
||||||
|
nir_ray_query_value_intersection_front_face,
|
||||||
|
nir_ray_query_value_intersection_object_ray_direction,
|
||||||
|
nir_ray_query_value_intersection_object_ray_origin,
|
||||||
|
nir_ray_query_value_intersection_object_to_world,
|
||||||
|
nir_ray_query_value_intersection_world_to_object,
|
||||||
|
nir_ray_query_value_intersection_candidate_aabb_opaque,
|
||||||
|
nir_ray_query_value_tmin,
|
||||||
|
nir_ray_query_value_flags,
|
||||||
|
nir_ray_query_value_world_ray_direction,
|
||||||
|
nir_ray_query_value_world_ray_origin,
|
||||||
|
} nir_ray_query_value;
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
bool b;
|
bool b;
|
||||||
float f32;
|
float f32;
|
||||||
@@ -5703,27 +5727,6 @@ nir_addition_might_overflow(nir_shader *shader, struct hash_table *range_ht,
|
|||||||
nir_ssa_scalar ssa, unsigned const_val,
|
nir_ssa_scalar ssa, unsigned const_val,
|
||||||
const nir_unsigned_upper_bound_config *config);
|
const nir_unsigned_upper_bound_config *config);
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
nir_ray_query_value_intersection_type,
|
|
||||||
nir_ray_query_value_intersection_t,
|
|
||||||
nir_ray_query_value_intersection_instance_custom_index,
|
|
||||||
nir_ray_query_value_intersection_instance_id,
|
|
||||||
nir_ray_query_value_intersection_instance_sbt_index,
|
|
||||||
nir_ray_query_value_intersection_geometry_index,
|
|
||||||
nir_ray_query_value_intersection_primitive_index,
|
|
||||||
nir_ray_query_value_intersection_barycentrics,
|
|
||||||
nir_ray_query_value_intersection_front_face,
|
|
||||||
nir_ray_query_value_intersection_object_ray_direction,
|
|
||||||
nir_ray_query_value_intersection_object_ray_origin,
|
|
||||||
nir_ray_query_value_intersection_object_to_world,
|
|
||||||
nir_ray_query_value_intersection_world_to_object,
|
|
||||||
nir_ray_query_value_intersection_candidate_aabb_opaque,
|
|
||||||
nir_ray_query_value_tmin,
|
|
||||||
nir_ray_query_value_flags,
|
|
||||||
nir_ray_query_value_world_ray_direction,
|
|
||||||
nir_ray_query_value_world_ray_origin,
|
|
||||||
} nir_ray_query_value;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* True if gl_DrawID is considered uniform, i.e. if the preamble is run
|
/* True if gl_DrawID is considered uniform, i.e. if the preamble is run
|
||||||
* at least once per "internal" draw rather than per user-visible draw.
|
* at least once per "internal" draw rather than per user-visible draw.
|
||||||
|
@@ -263,6 +263,9 @@ index("struct nir_io_semantics", "io_semantics")
|
|||||||
index("struct nir_io_xfb", "io_xfb")
|
index("struct nir_io_xfb", "io_xfb")
|
||||||
index("struct nir_io_xfb", "io_xfb2")
|
index("struct nir_io_xfb", "io_xfb2")
|
||||||
|
|
||||||
|
# Ray query values accessible from the RayQueryKHR object
|
||||||
|
index("nir_ray_query_value", "ray_query_value")
|
||||||
|
|
||||||
# Rounding mode for conversions
|
# Rounding mode for conversions
|
||||||
index("nir_rounding_mode", "rounding_mode")
|
index("nir_rounding_mode", "rounding_mode")
|
||||||
|
|
||||||
@@ -550,8 +553,8 @@ intrinsic("rq_proceed", src_comp=[-1], dest_comp=1)
|
|||||||
intrinsic("rq_generate_intersection", src_comp=[-1, 1])
|
intrinsic("rq_generate_intersection", src_comp=[-1, 1])
|
||||||
# src[] = { query }
|
# src[] = { query }
|
||||||
intrinsic("rq_confirm_intersection", src_comp=[-1])
|
intrinsic("rq_confirm_intersection", src_comp=[-1])
|
||||||
# src[] = { query, committed } BASE=nir_ray_query_value
|
# src[] = { query, committed }
|
||||||
intrinsic("rq_load", src_comp=[-1, 1], dest_comp=0, indices=[BASE,COLUMN])
|
intrinsic("rq_load", src_comp=[-1, 1], dest_comp=0, indices=[RAY_QUERY_VALUE,COLUMN])
|
||||||
|
|
||||||
# Driver independent raytracing helpers
|
# Driver independent raytracing helpers
|
||||||
|
|
||||||
|
@@ -1134,6 +1134,34 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case NIR_INTRINSIC_RAY_QUERY_VALUE: {
|
||||||
|
fprintf(fp, "ray_query_value=");
|
||||||
|
switch (nir_intrinsic_ray_query_value(instr)) {
|
||||||
|
#define VAL(_name) case nir_ray_query_value_##_name: fprintf(fp, #_name); break
|
||||||
|
VAL(intersection_type);
|
||||||
|
VAL(intersection_t);
|
||||||
|
VAL(intersection_instance_custom_index);
|
||||||
|
VAL(intersection_instance_id);
|
||||||
|
VAL(intersection_instance_sbt_index);
|
||||||
|
VAL(intersection_geometry_index);
|
||||||
|
VAL(intersection_primitive_index);
|
||||||
|
VAL(intersection_barycentrics);
|
||||||
|
VAL(intersection_front_face);
|
||||||
|
VAL(intersection_object_ray_direction);
|
||||||
|
VAL(intersection_object_ray_origin);
|
||||||
|
VAL(intersection_object_to_world);
|
||||||
|
VAL(intersection_world_to_object);
|
||||||
|
VAL(intersection_candidate_aabb_opaque);
|
||||||
|
VAL(tmin);
|
||||||
|
VAL(flags);
|
||||||
|
VAL(world_ray_direction);
|
||||||
|
VAL(world_ray_origin);
|
||||||
|
#undef VAL
|
||||||
|
default: fprintf(fp, "unknown"); break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
unsigned off = info->index_map[idx] - 1;
|
unsigned off = info->index_map[idx] - 1;
|
||||||
fprintf(fp, "%s=%d", nir_intrinsic_index_names[idx], instr->const_index[off]);
|
fprintf(fp, "%s=%d", nir_intrinsic_index_names[idx], instr->const_index[off]);
|
||||||
|
@@ -5739,7 +5739,7 @@ ray_query_load_intrinsic_create(struct vtn_builder *b, SpvOp opcode,
|
|||||||
glsl_get_vector_elements(elem_type),
|
glsl_get_vector_elements(elem_type),
|
||||||
glsl_get_bit_size(elem_type),
|
glsl_get_bit_size(elem_type),
|
||||||
src0, src1,
|
src0, src1,
|
||||||
.base = value.nir_value,
|
.ray_query_value = value.nir_value,
|
||||||
.column = i);
|
.column = i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5752,7 +5752,7 @@ ray_query_load_intrinsic_create(struct vtn_builder *b, SpvOp opcode,
|
|||||||
glsl_get_vector_elements(value.glsl_type),
|
glsl_get_vector_elements(value.glsl_type),
|
||||||
glsl_get_bit_size(value.glsl_type),
|
glsl_get_bit_size(value.glsl_type),
|
||||||
src0, src1,
|
src0, src1,
|
||||||
.base = value.nir_value));
|
.ray_query_value = value.nir_value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -360,7 +360,7 @@ lower_ray_query_intrinsic(nir_builder *b,
|
|||||||
brw_nir_rt_load_mem_hit_from_addr(b, &hit_in, stack_addr, committed);
|
brw_nir_rt_load_mem_hit_from_addr(b, &hit_in, stack_addr, committed);
|
||||||
|
|
||||||
nir_ssa_def *sysval = NULL;
|
nir_ssa_def *sysval = NULL;
|
||||||
switch (nir_intrinsic_base(intrin)) {
|
switch (nir_intrinsic_ray_query_value(intrin)) {
|
||||||
case nir_ray_query_value_intersection_type:
|
case nir_ray_query_value_intersection_type:
|
||||||
if (committed) {
|
if (committed) {
|
||||||
/* Values we want to generate :
|
/* Values we want to generate :
|
||||||
|
Reference in New Issue
Block a user