mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 20:18:12 +02:00
brw/rt: fix ray_object_(direction|origin) for closest-hit shaders
We were returning world BVH level for origin/direction, this commit fixes by retuning correct object BVH level origin/direction. Fixes:aaff191356("brw/rt: fix ray_object_(direction|origin) for closest-hit shaders") Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36853> (cherry picked from commit89fbcc8c34)
This commit is contained in:
parent
9b825e08be
commit
c54942215e
2 changed files with 20 additions and 3 deletions
|
|
@ -1264,7 +1264,7 @@
|
|||
"description": "brw/rt: fix ray_object_(direction|origin) for closest-hit shaders",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "aaff19135644049cde3bd3ddd649b48f96111fa4",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ lower_ray_query_intrinsic(nir_builder *b,
|
|||
brw_nir_rt_sync_stack_addr(b, state->globals.base_mem_addr,
|
||||
state->globals.num_dss_rt_stacks);
|
||||
nir_def *stack_addr = shadow_stack_addr ? shadow_stack_addr : hw_stack_addr;
|
||||
gl_shader_stage stage = b->shader->info.stage;
|
||||
|
||||
switch (intrin->intrinsic) {
|
||||
case nir_intrinsic_rq_initialize: {
|
||||
|
|
@ -447,11 +448,27 @@ lower_ray_query_intrinsic(nir_builder *b,
|
|||
break;
|
||||
|
||||
case nir_ray_query_value_intersection_object_ray_direction:
|
||||
sysval = world_ray_in.dir;
|
||||
if (stage == MESA_SHADER_CLOSEST_HIT) {
|
||||
struct brw_nir_rt_bvh_instance_leaf_defs leaf;
|
||||
brw_nir_rt_load_bvh_instance_leaf(b, &leaf, hit_in.inst_leaf_ptr,
|
||||
state->devinfo);
|
||||
sysval = brw_nir_build_vec3_mat_mult_col_major(
|
||||
b, world_ray_in.dir, leaf.world_to_object, false);
|
||||
} else {
|
||||
sysval = object_ray_in.dir;
|
||||
}
|
||||
break;
|
||||
|
||||
case nir_ray_query_value_intersection_object_ray_origin:
|
||||
sysval = world_ray_in.orig;
|
||||
if (stage == MESA_SHADER_CLOSEST_HIT) {
|
||||
struct brw_nir_rt_bvh_instance_leaf_defs leaf;
|
||||
brw_nir_rt_load_bvh_instance_leaf(b, &leaf, hit_in.inst_leaf_ptr,
|
||||
state->devinfo);
|
||||
sysval = brw_nir_build_vec3_mat_mult_col_major(
|
||||
b, world_ray_in.orig, leaf.world_to_object, true);
|
||||
} else {
|
||||
sysval = object_ray_in.orig;
|
||||
}
|
||||
break;
|
||||
|
||||
case nir_ray_query_value_intersection_object_to_world: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue