radv/rt: Load instance id and custom index on demand

Stats for Quae II RTX:

57fps -> 57fps

Totals from 7 (14.00% of 50) affected shaders:
VGPRs: 800 -> 784 (-2.00%)
CodeSize: 217868 -> 218308 (+0.20%)
MaxWaves: 62 -> 63 (+1.61%)
Instrs: 40384 -> 40420 (+0.09%); split: -0.01%, +0.10%
Latency: 866315 -> 870692 (+0.51%)
InvThroughput: 199189 -> 196595 (-1.30%); split: -1.75%, +0.45%
VClause: 1058 -> 1077 (+1.80%)
SClause: 1126 -> 1130 (+0.36%)
Copies: 5787 -> 5772 (-0.26%); split: -0.40%, +0.14%
PreVGPRs: 764 -> 750 (-1.83%)

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19159>
This commit is contained in:
Konstantin Seurer
2022-10-19 12:05:33 +02:00
committed by Marge Bot
parent 6fcabb3b02
commit ac01f09d57
4 changed files with 30 additions and 66 deletions

View File

@@ -666,11 +666,6 @@ radv_build_ray_traversal(struct radv_device *device, nir_builder *b,
nir_ssa_def *wto_matrix[3];
nir_build_wto_matrix_load(b, instance_node_addr, wto_matrix);
nir_ssa_def *instance_id = nir_build_load_global(
b, 1, 32,
nir_iadd_imm(b, instance_node_addr,
offsetof(struct radv_bvh_instance_node, instance_id)));
nir_store_deref(b, args->vars.top_stack, nir_load_deref(b, args->vars.stack), 1);
nir_store_deref(b, args->vars.bvh_base,
@@ -695,8 +690,6 @@ radv_build_ray_traversal(struct radv_device *device, nir_builder *b,
nir_store_deref(b, args->vars.sbt_offset_and_flags,
nir_channel(b, instance_data, 3), 1);
nir_store_deref(b, args->vars.custom_instance_and_mask, instance_and_mask, 1);
nir_store_deref(b, args->vars.instance_id, instance_id, 1);
nir_store_deref(b, args->vars.instance_addr, instance_node_addr, 1);
}
nir_pop_if(b, NULL);