radv: add radv_pipeline_rt.h

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28526>
This commit is contained in:
Samuel Pitoiset 2024-04-02 08:45:36 +02:00 committed by Marge Bot
parent 7807d49f82
commit 987f3351b3
12 changed files with 132 additions and 90 deletions

View file

@ -22,6 +22,7 @@
*/
#include "radv_cs.h"
#include "radv_pipeline_rt.h"
#include "radv_private.h"
#include "radv_queue.h"
#include "radv_shader.h"
@ -31,8 +32,6 @@
#include "ac_rgp.h"
#include "ac_sqtt.h"
#include "vk_pipeline.h"
void
radv_sqtt_emit_relocated_shaders(struct radv_cmd_buffer *cmd_buffer, struct radv_graphics_pipeline *pipeline)
{

View file

@ -142,6 +142,7 @@ libradv_files = files(
'radv_pipeline_compute.h',
'radv_pipeline_graphics.c',
'radv_pipeline_rt.c',
'radv_pipeline_rt.h',
'radv_printf.c',
'radv_private.h',
'radv_queue.c',

View file

@ -30,6 +30,7 @@
#include "nir/radv_nir_rt_common.h"
#include "ac_nir.h"
#include "radv_pipeline_cache.h"
#include "radv_pipeline_rt.h"
#include "radv_private.h"
#include "radv_shader.h"

View file

@ -30,6 +30,7 @@
#include "radv_debug.h"
#include "radv_device_generated_commands.h"
#include "radv_event.h"
#include "radv_pipeline_rt.h"
#include "radv_private.h"
#include "radv_radeon_winsys.h"
#include "radv_shader.h"

View file

@ -37,6 +37,7 @@
#include "ac_debug.h"
#include "radv_buffer.h"
#include "radv_debug.h"
#include "radv_pipeline_rt.h"
#include "radv_shader.h"
#include "sid.h"

View file

@ -35,6 +35,7 @@
#include "util/hex.h"
#include "util/u_debug.h"
#include "radv_debug.h"
#include "radv_pipeline_rt.h"
#include "radv_private.h"
#include "radv_video.h"

View file

@ -37,6 +37,7 @@
#include "util/u_atomic.h"
#include "radv_cs.h"
#include "radv_debug.h"
#include "radv_pipeline_rt.h"
#include "radv_private.h"
#include "radv_shader.h"
#include "radv_shader_args.h"

View file

@ -31,6 +31,7 @@
#include "aco_interface.h"
#include "nir_serialize.h"
#include "radv_debug.h"
#include "radv_pipeline_rt.h"
#include "radv_private.h"
#include "radv_shader.h"
#include "vk_pipeline.h"

View file

@ -27,9 +27,9 @@
#include "nir/radv_nir.h"
#include "radv_debug.h"
#include "radv_pipeline_cache.h"
#include "radv_pipeline_rt.h"
#include "radv_private.h"
#include "radv_shader.h"
#include "vk_pipeline.h"
struct rt_handle_hash_entry {
uint32_t key;

View file

@ -0,0 +1,122 @@
/*
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*
* based in part on anv driver which is:
* Copyright © 2015 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef RADV_PIPELINE_RT_H
#define RADV_PIPELINE_RT_H
#include "radv_pipeline_compute.h"
#include "radv_shader.h"
struct radv_ray_tracing_pipeline {
struct radv_compute_pipeline base;
struct radv_shader *prolog;
struct radv_ray_tracing_stage *stages;
struct radv_ray_tracing_group *groups;
unsigned stage_count;
unsigned non_imported_stage_count;
unsigned group_count;
uint8_t sha1[SHA1_DIGEST_LENGTH];
uint32_t stack_size;
/* set if any shaders from this pipeline require robustness2 in the merged traversal shader */
bool traversal_storage_robustness2 : 1;
bool traversal_uniform_robustness2 : 1;
};
RADV_DECL_PIPELINE_DOWNCAST(ray_tracing, RADV_PIPELINE_RAY_TRACING)
struct radv_pipeline_group_handle {
uint64_t recursive_shader_ptr;
union {
uint32_t general_index;
uint32_t closest_hit_index;
};
union {
uint32_t intersection_index;
uint32_t any_hit_index;
};
};
struct radv_rt_capture_replay_handle {
struct radv_serialized_shader_arena_block recursive_shader_alloc;
uint32_t non_recursive_idx;
};
struct radv_ray_tracing_group {
VkRayTracingShaderGroupTypeKHR type;
uint32_t recursive_shader; /* generalShader or closestHitShader */
uint32_t any_hit_shader;
uint32_t intersection_shader;
struct radv_pipeline_group_handle handle;
};
enum radv_rt_const_arg_state {
RADV_RT_CONST_ARG_STATE_UNINITIALIZED,
RADV_RT_CONST_ARG_STATE_VALID,
RADV_RT_CONST_ARG_STATE_INVALID,
};
struct radv_rt_const_arg_info {
enum radv_rt_const_arg_state state;
uint32_t value;
};
struct radv_ray_tracing_stage_info {
bool can_inline;
BITSET_DECLARE(unused_args, AC_MAX_ARGS);
struct radv_rt_const_arg_info tmin;
struct radv_rt_const_arg_info tmax;
struct radv_rt_const_arg_info sbt_offset;
struct radv_rt_const_arg_info sbt_stride;
struct radv_rt_const_arg_info miss_index;
uint32_t set_flags;
uint32_t unset_flags;
};
struct radv_ray_tracing_stage {
struct vk_pipeline_cache_object *nir;
struct radv_shader *shader;
gl_shader_stage stage;
uint32_t stack_size;
struct radv_ray_tracing_stage_info info;
uint8_t sha1[SHA1_DIGEST_LENGTH];
};
void radv_destroy_ray_tracing_pipeline(struct radv_device *device, struct radv_ray_tracing_pipeline *pipeline);
#endif /* RADV_PIPELINE_RT */

View file

@ -1058,27 +1058,8 @@ void radv_indirect_dispatch(struct radv_cmd_buffer *cmd_buffer, struct radeon_wi
struct radv_ray_tracing_group;
struct radv_ray_tracing_stage;
struct radv_pipeline_group_handle {
uint64_t recursive_shader_ptr;
union {
uint32_t general_index;
uint32_t closest_hit_index;
};
union {
uint32_t intersection_index;
uint32_t any_hit_index;
};
};
struct radv_rt_capture_replay_handle {
struct radv_serialized_shader_arena_block recursive_shader_alloc;
uint32_t non_recursive_idx;
};
struct radv_sqtt_shaders_reloc {
struct radeon_winsys_bo *bo;
union radv_shader_arena_block *alloc;
@ -1145,72 +1126,6 @@ struct radv_graphics_pipeline {
struct radv_sqtt_shaders_reloc *sqtt_shaders_reloc;
};
struct radv_ray_tracing_group {
VkRayTracingShaderGroupTypeKHR type;
uint32_t recursive_shader; /* generalShader or closestHitShader */
uint32_t any_hit_shader;
uint32_t intersection_shader;
struct radv_pipeline_group_handle handle;
};
enum radv_rt_const_arg_state {
RADV_RT_CONST_ARG_STATE_UNINITIALIZED,
RADV_RT_CONST_ARG_STATE_VALID,
RADV_RT_CONST_ARG_STATE_INVALID,
};
struct radv_rt_const_arg_info {
enum radv_rt_const_arg_state state;
uint32_t value;
};
struct radv_ray_tracing_stage_info {
bool can_inline;
BITSET_DECLARE(unused_args, AC_MAX_ARGS);
struct radv_rt_const_arg_info tmin;
struct radv_rt_const_arg_info tmax;
struct radv_rt_const_arg_info sbt_offset;
struct radv_rt_const_arg_info sbt_stride;
struct radv_rt_const_arg_info miss_index;
uint32_t set_flags;
uint32_t unset_flags;
};
struct radv_ray_tracing_stage {
struct vk_pipeline_cache_object *nir;
struct radv_shader *shader;
gl_shader_stage stage;
uint32_t stack_size;
struct radv_ray_tracing_stage_info info;
uint8_t sha1[SHA1_DIGEST_LENGTH];
};
struct radv_ray_tracing_pipeline {
struct radv_compute_pipeline base;
struct radv_shader *prolog;
struct radv_ray_tracing_stage *stages;
struct radv_ray_tracing_group *groups;
unsigned stage_count;
unsigned non_imported_stage_count;
unsigned group_count;
uint8_t sha1[SHA1_DIGEST_LENGTH];
uint32_t stack_size;
/* set if any shaders from this pipeline require robustness2 in the merged traversal shader */
bool traversal_storage_robustness2 : 1;
bool traversal_uniform_robustness2 : 1;
};
struct radv_retained_shaders {
struct {
void *serialized_nir;
@ -1240,7 +1155,6 @@ struct radv_graphics_lib_pipeline {
RADV_DECL_PIPELINE_DOWNCAST(graphics, RADV_PIPELINE_GRAPHICS)
RADV_DECL_PIPELINE_DOWNCAST(graphics_lib, RADV_PIPELINE_GRAPHICS_LIB)
RADV_DECL_PIPELINE_DOWNCAST(ray_tracing, RADV_PIPELINE_RAY_TRACING)
static inline bool
radv_pipeline_has_stage(const struct radv_graphics_pipeline *pipeline, gl_shader_stage stage)
@ -1893,7 +1807,6 @@ void radv_emit_spm_setup(struct radv_device *device, struct radeon_cmdbuf *cs, e
void radv_destroy_graphics_pipeline(struct radv_device *device, struct radv_graphics_pipeline *pipeline);
void radv_destroy_graphics_lib_pipeline(struct radv_device *device, struct radv_graphics_lib_pipeline *pipeline);
void radv_destroy_ray_tracing_pipeline(struct radv_device *device, struct radv_ray_tracing_pipeline *pipeline);
void radv_begin_conditional_rendering(struct radv_cmd_buffer *cmd_buffer, uint64_t va, bool draw_visible);
void radv_end_conditional_rendering(struct radv_cmd_buffer *cmd_buffer);

View file

@ -34,6 +34,7 @@
#include "radv_device_memory.h"
#include "radv_event.h"
#include "radv_image.h"
#include "radv_pipeline_rt.h"
#include "radv_private.h"
#include "radv_query.h"