intel/fs: fix metadata preserve on trace_ray intrinsic
c78be5da30
("intel/fs: lower ray query intrinsics") introduced a helper function using nir_(push|pop)_if which invalidated dominance & block_index for the replacement of nir_intrinsic_rt_trace_ray. We can still keep dominance/block_index metadata for the lowering of nir_intrinsic_rt_execute_callable though. This change uses 2 different lowering function with correct metadata preservation. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Fixes:c78be5da30
("intel/fs: lower ray query intrinsics") Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15910>
This commit is contained in:
parent
fcd6b2a47a
commit
9c0805ef91
|
@ -125,7 +125,7 @@ store_resume_addr(nir_builder *b, nir_intrinsic_instr *call)
|
|||
}
|
||||
|
||||
static bool
|
||||
lower_shader_calls_instr(struct nir_builder *b, nir_instr *instr, void *data)
|
||||
lower_shader_trace_ray_instr(struct nir_builder *b, nir_instr *instr, void *data)
|
||||
{
|
||||
if (instr->type != nir_instr_type_intrinsic)
|
||||
return false;
|
||||
|
@ -134,9 +134,9 @@ lower_shader_calls_instr(struct nir_builder *b, nir_instr *instr, void *data)
|
|||
* brw_nir_lower_rt_intrinsics()
|
||||
*/
|
||||
nir_intrinsic_instr *call = nir_instr_as_intrinsic(instr);
|
||||
if (call->intrinsic != nir_intrinsic_rt_trace_ray)
|
||||
return false;
|
||||
|
||||
switch (call->intrinsic) {
|
||||
case nir_intrinsic_rt_trace_ray: {
|
||||
b->cursor = nir_instr_remove(instr);
|
||||
|
||||
store_resume_addr(b, call);
|
||||
|
@ -209,6 +209,7 @@ lower_shader_calls_instr(struct nir_builder *b, nir_instr *instr, void *data)
|
|||
.shader_index_multiplier = sbt_stride,
|
||||
};
|
||||
brw_nir_rt_store_mem_ray(b, &ray_defs, BRW_RT_BVH_LEVEL_WORLD);
|
||||
|
||||
nir_trace_ray_intel(b,
|
||||
nir_load_btd_global_arg_addr_intel(b),
|
||||
nir_imm_int(b, BRW_RT_BVH_LEVEL_WORLD),
|
||||
|
@ -217,7 +218,19 @@ lower_shader_calls_instr(struct nir_builder *b, nir_instr *instr, void *data)
|
|||
return true;
|
||||
}
|
||||
|
||||
case nir_intrinsic_rt_execute_callable: {
|
||||
static bool
|
||||
lower_shader_call_instr(struct nir_builder *b, nir_instr *instr, void *data)
|
||||
{
|
||||
if (instr->type != nir_instr_type_intrinsic)
|
||||
return false;
|
||||
|
||||
/* Leave nir_intrinsic_rt_resume to be lowered by
|
||||
* brw_nir_lower_rt_intrinsics()
|
||||
*/
|
||||
nir_intrinsic_instr *call = nir_instr_as_intrinsic(instr);
|
||||
if (call->intrinsic != nir_intrinsic_rt_execute_callable)
|
||||
return false;
|
||||
|
||||
b->cursor = nir_instr_remove(instr);
|
||||
|
||||
store_resume_addr(b, call);
|
||||
|
@ -232,16 +245,16 @@ lower_shader_calls_instr(struct nir_builder *b, nir_instr *instr, void *data)
|
|||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
brw_nir_lower_shader_calls(nir_shader *shader)
|
||||
{
|
||||
return nir_shader_instructions_pass(shader,
|
||||
lower_shader_calls_instr,
|
||||
return
|
||||
nir_shader_instructions_pass(shader,
|
||||
lower_shader_trace_ray_instr,
|
||||
nir_metadata_none,
|
||||
NULL) |
|
||||
nir_shader_instructions_pass(shader,
|
||||
lower_shader_call_instr,
|
||||
nir_metadata_block_index |
|
||||
nir_metadata_dominance,
|
||||
NULL);
|
||||
|
|
Loading…
Reference in New Issue