nir: Make rq_load committed src an index
committed has to be a constant so there is no need to have a src and depend on constant folding to remove the i2b. Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22963>
This commit is contained in:

committed by
Marge Bot

parent
626669bab3
commit
0cf22f9af3
@@ -427,9 +427,8 @@ static nir_ssa_def *
|
||||
lower_rq_load(nir_builder *b, nir_ssa_def *index, nir_intrinsic_instr *instr,
|
||||
struct ray_query_vars *vars)
|
||||
{
|
||||
assert(nir_src_is_const(instr->src[1]));
|
||||
bool closest = nir_src_as_bool(instr->src[1]);
|
||||
struct ray_query_intersection_vars *intersection = closest ? &vars->closest : &vars->candidate;
|
||||
bool committed = nir_intrinsic_committed(instr);
|
||||
struct ray_query_intersection_vars *intersection = committed ? &vars->closest : &vars->candidate;
|
||||
|
||||
uint32_t column = nir_intrinsic_column(instr);
|
||||
|
||||
@@ -494,7 +493,7 @@ lower_rq_load(nir_builder *b, nir_ssa_def *index, nir_intrinsic_instr *instr,
|
||||
return rq_load_var(b, index, intersection->t);
|
||||
case nir_ray_query_value_intersection_type: {
|
||||
nir_ssa_def *intersection_type = rq_load_var(b, index, intersection->intersection_type);
|
||||
if (!closest)
|
||||
if (!committed)
|
||||
intersection_type = nir_iadd_imm(b, intersection_type, -1);
|
||||
|
||||
return intersection_type;
|
||||
|
@@ -261,6 +261,9 @@ index("struct nir_io_xfb", "io_xfb2")
|
||||
# Ray query values accessible from the RayQueryKHR object
|
||||
index("nir_ray_query_value", "ray_query_value")
|
||||
|
||||
# Select between committed and candidate ray queriy intersections
|
||||
index("bool", "committed")
|
||||
|
||||
# Rounding mode for conversions
|
||||
index("nir_rounding_mode", "rounding_mode")
|
||||
|
||||
@@ -559,8 +562,8 @@ intrinsic("rq_proceed", src_comp=[-1], dest_comp=1)
|
||||
intrinsic("rq_generate_intersection", src_comp=[-1, 1])
|
||||
# src[] = { query }
|
||||
intrinsic("rq_confirm_intersection", src_comp=[-1])
|
||||
# src[] = { query, committed }
|
||||
intrinsic("rq_load", src_comp=[-1, 1], dest_comp=0, indices=[RAY_QUERY_VALUE,COLUMN])
|
||||
# src[] = { query }
|
||||
intrinsic("rq_load", src_comp=[-1], dest_comp=0, indices=[RAY_QUERY_VALUE,COMMITTED,COLUMN])
|
||||
|
||||
# Driver independent raytracing helpers
|
||||
|
||||
|
@@ -5808,7 +5808,7 @@ spirv_to_nir_type_ray_query_intrinsic(struct vtn_builder *b,
|
||||
static void
|
||||
ray_query_load_intrinsic_create(struct vtn_builder *b, SpvOp opcode,
|
||||
const uint32_t *w, nir_ssa_def *src0,
|
||||
nir_ssa_def *src1)
|
||||
bool committed)
|
||||
{
|
||||
struct ray_query_value value =
|
||||
spirv_to_nir_type_ray_query_intrinsic(b, opcode);
|
||||
@@ -5823,8 +5823,9 @@ ray_query_load_intrinsic_create(struct vtn_builder *b, SpvOp opcode,
|
||||
nir_build_rq_load(&b->nb,
|
||||
glsl_get_vector_elements(elem_type),
|
||||
glsl_get_bit_size(elem_type),
|
||||
src0, src1,
|
||||
src0,
|
||||
.ray_query_value = value.nir_value,
|
||||
.committed = committed,
|
||||
.column = i);
|
||||
}
|
||||
|
||||
@@ -5836,8 +5837,9 @@ ray_query_load_intrinsic_create(struct vtn_builder *b, SpvOp opcode,
|
||||
nir_rq_load(&b->nb,
|
||||
glsl_get_vector_elements(value.glsl_type),
|
||||
glsl_get_bit_size(value.glsl_type),
|
||||
src0, src1,
|
||||
.ray_query_value = value.nir_value));
|
||||
src0,
|
||||
.ray_query_value = value.nir_value,
|
||||
.committed = committed));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5892,7 +5894,7 @@ vtn_handle_ray_query_intrinsic(struct vtn_builder *b, SpvOp opcode,
|
||||
case SpvOpRayQueryGetIntersectionTriangleVertexPositionsKHR:
|
||||
ray_query_load_intrinsic_create(b, opcode, w,
|
||||
vtn_ssa_value(b, w[3])->def,
|
||||
nir_i2b(&b->nb, vtn_ssa_value(b, w[4])->def));
|
||||
vtn_constant_uint(b, w[4]));
|
||||
break;
|
||||
|
||||
case SpvOpRayQueryGetRayTMinKHR:
|
||||
|
@@ -348,7 +348,7 @@ lower_ray_query_intrinsic(nir_builder *b,
|
||||
}
|
||||
|
||||
case nir_intrinsic_rq_load: {
|
||||
const bool committed = nir_src_as_bool(intrin->src[1]);
|
||||
const bool committed = nir_intrinsic_committed(intrin);
|
||||
|
||||
struct brw_nir_rt_mem_ray_defs world_ray_in = {};
|
||||
struct brw_nir_rt_mem_ray_defs object_ray_in = {};
|
||||
|
Reference in New Issue
Block a user