radv: Refactor ray tracing support checks

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15860>
This commit is contained in:
Konstantin Seurer
2022-04-11 18:11:26 +02:00
committed by Marge Bot
parent a9fce44dd6
commit 521492e8b1
5 changed files with 24 additions and 10 deletions

View File

@@ -400,7 +400,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
*ext = (struct vk_device_extension_table){
.KHR_8bit_storage = true,
.KHR_16bit_storage = true,
.KHR_acceleration_structure = !!(device->instance->perftest_flags & RADV_PERFTEST_RT),
.KHR_acceleration_structure = radv_enable_rt(device),
.KHR_bind_memory2 = true,
.KHR_buffer_device_address = true,
.KHR_copy_commands2 = true,
@@ -435,10 +435,8 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
.KHR_pipeline_executable_properties = true,
.KHR_pipeline_library = !device->use_llvm,
.KHR_push_descriptor = true,
.KHR_ray_query =
(device->instance->perftest_flags & RADV_PERFTEST_RT) && !device->use_llvm,
.KHR_ray_tracing_pipeline =
(device->instance->perftest_flags & RADV_PERFTEST_RT) && !device->use_llvm,
.KHR_ray_query = radv_enable_rt(device),
.KHR_ray_tracing_pipeline = radv_enable_rt(device),
.KHR_relaxed_block_layout = true,
.KHR_sampler_mirror_clamp_to_edge = true,
.KHR_sampler_ycbcr_conversion = true,

View File

@@ -27,7 +27,6 @@
#include "util/hash_table.h"
#include "radv_acceleration_structure.h"
#include "radv_debug.h"
#include "radv_private.h"
#include "radv_rt_common.h"
#include "radv_shader.h"
@@ -715,8 +714,7 @@ lower_rq_proceed(nir_builder *b, nir_ssa_def *index, struct ray_query_vars *vars
bvh_node =
nir_iadd(b, rq_load_var(b, index, vars->trav.bvh_base), nir_u2u(b, bvh_node, 64));
nir_ssa_def *intrinsic_result = NULL;
if (device->physical_device->rad_info.chip_class >= GFX10_3 &&
!(device->instance->perftest_flags & RADV_PERFTEST_FORCE_EMULATE_RT)) {
if (!radv_emulate_rt(device->physical_device)) {
intrinsic_result = nir_bvh64_intersect_ray_amd(
b, 32, desc, nir_unpack_64_2x32(b, bvh_node), rq_load_var(b, index, vars->closest.t),
rq_load_var(b, index, vars->trav.origin),

View File

@@ -1472,8 +1472,7 @@ insert_traversal(struct radv_device *device, const VkRayTracingPipelineCreateInf
bvh_node = nir_iadd(b, nir_load_var(b, trav_vars.bvh_base), nir_u2u(b, bvh_node, 64));
nir_ssa_def *intrinsic_result = NULL;
if (device->physical_device->rad_info.chip_class >= GFX10_3
&& !(device->instance->perftest_flags & RADV_PERFTEST_FORCE_EMULATE_RT)) {
if (!radv_emulate_rt(device->physical_device)) {
intrinsic_result = nir_bvh64_intersect_ray_amd(
b, 32, desc, nir_unpack_64_2x32(b, bvh_node), nir_load_var(b, vars->tmax),
nir_load_var(b, trav_vars.origin), nir_load_var(b, trav_vars.dir),

View File

@@ -1760,6 +1760,10 @@ uint32_t radv_get_hash_flags(const struct radv_device *device, bool stats);
bool radv_rt_pipeline_has_dynamic_stack_size(const VkRayTracingPipelineCreateInfoKHR *pCreateInfo);
bool radv_enable_rt(const struct radv_physical_device *pdevice);
bool radv_emulate_rt(const struct radv_physical_device *pdevice);
#define RADV_STAGE_MASK ((1 << MESA_VULKAN_SHADER_STAGES) - 1)
#define radv_foreach_stage(stage, stage_bits) \

View File

@@ -21,9 +21,24 @@
* IN THE SOFTWARE.
*/
#include "radv_debug.h"
#include "radv_rt_common.h"
#include "radv_acceleration_structure.h"
bool
radv_enable_rt(const struct radv_physical_device *pdevice)
{
return (pdevice->instance->perftest_flags & RADV_PERFTEST_RT) && !pdevice->use_llvm;
}
bool
radv_emulate_rt(const struct radv_physical_device *pdevice)
{
assert(radv_enable_rt(pdevice));
return pdevice->rad_info.chip_class < GFX10_3 ||
(pdevice->instance->perftest_flags & RADV_PERFTEST_FORCE_EMULATE_RT);
}
void
nir_sort_hit_pair(nir_builder *b, nir_variable *var_distances, nir_variable *var_indices,
uint32_t chan_1, uint32_t chan_2)