if (pCreateInfo->pLibraryInfo) {
for (uint32_t i = 0; i < pCreateInfo->pLibraryInfo->libraryCount; ++i) {
RADV_FROM_HANDLE(radv_pipeline, lib_pipeline, pCreateInfo->pLibraryInfo->pLibraries[i]);
- struct radv_ray_tracing_lib_pipeline *lib = radv_pipeline_to_ray_tracing_lib(lib_pipeline);
+ struct radv_ray_tracing_pipeline *lib = radv_pipeline_to_ray_tracing(lib_pipeline);
_mesa_sha1_update(&ctx, lib->sha1, SHA1_DIGEST_LENGTH);
}
}
VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR |
VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR |
VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR |
- VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR);
+ VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR |
+ VK_PIPELINE_CREATE_LIBRARY_BIT_KHR);
_mesa_sha1_update(&ctx, &pipeline_flags, 4);
_mesa_sha1_update(&ctx, &flags, 4);
unsigned stage_count = pCreateInfo->stageCount;
for (unsigned i = 0; i < pCreateInfo->pLibraryInfo->libraryCount; ++i) {
RADV_FROM_HANDLE(radv_pipeline, pipeline, pCreateInfo->pLibraryInfo->pLibraries[i]);
- struct radv_ray_tracing_lib_pipeline *library_pipeline =
- radv_pipeline_to_ray_tracing_lib(pipeline);
+ struct radv_ray_tracing_pipeline *library_pipeline =
+ radv_pipeline_to_ray_tracing(pipeline);
for (unsigned j = 0; j < library_pipeline->group_count; ++j) {
struct radv_ray_tracing_group *dst = &groups[idx + j];
if (pCreateInfo->pLibraryInfo) {
for (unsigned i = 0; i < pCreateInfo->pLibraryInfo->libraryCount; ++i) {
RADV_FROM_HANDLE(radv_pipeline, pipeline, pCreateInfo->pLibraryInfo->pLibraries[i]);
- struct radv_ray_tracing_lib_pipeline *library_pipeline =
- radv_pipeline_to_ray_tracing_lib(pipeline);
+ struct radv_ray_tracing_pipeline *library_pipeline =
+ radv_pipeline_to_ray_tracing(pipeline);
for (unsigned j = 0; j < library_pipeline->stage_count; ++j)
stages[idx++].stage = library_pipeline->stages[j].stage;
}
if (pCreateInfo->pLibraryInfo) {
for (unsigned i = 0; i < pCreateInfo->pLibraryInfo->libraryCount; ++i) {
RADV_FROM_HANDLE(radv_pipeline, pipeline, pCreateInfo->pLibraryInfo->pLibraries[i]);
- struct radv_ray_tracing_lib_pipeline *library_pipeline =
- radv_pipeline_to_ray_tracing_lib(pipeline);
+ struct radv_ray_tracing_pipeline *library_pipeline =
+ radv_pipeline_to_ray_tracing(pipeline);
total_stages += library_pipeline->stage_count;
total_groups += library_pipeline->group_count;
if (pCreateInfo->pLibraryInfo) {
for (unsigned i = 0; i < pCreateInfo->pLibraryInfo->libraryCount; ++i) {
RADV_FROM_HANDLE(radv_pipeline, pipeline, pCreateInfo->pLibraryInfo->pLibraries[i]);
- struct radv_ray_tracing_lib_pipeline *library = radv_pipeline_to_ray_tracing_lib(pipeline);
+ struct radv_ray_tracing_pipeline *library = radv_pipeline_to_ray_tracing(pipeline);
for (unsigned j = 0; j < library->stage_count; ++j)
stages[idx++].shader = vk_pipeline_cache_object_ref(library->stages[j].shader);
{
RADV_FROM_HANDLE(radv_device, device, _device);
VK_FROM_HANDLE(vk_pipeline_cache, cache, _cache);
- struct radv_ray_tracing_lib_pipeline *pipeline;
+ struct radv_ray_tracing_pipeline *pipeline;
VkResult result = VK_SUCCESS;
bool keep_statistic_info = radv_pipeline_capture_shader_stats(device, pCreateInfo->flags);
const VkPipelineCreationFeedbackCreateInfo *creation_feedback =
if (!pipeline)
return VK_ERROR_OUT_OF_HOST_MEMORY;
- radv_pipeline_init(device, &pipeline->base.base, RADV_PIPELINE_RAY_TRACING_LIB);
+ radv_pipeline_init(device, &pipeline->base.base, RADV_PIPELINE_RAY_TRACING);
struct radv_pipeline_key key =
radv_generate_pipeline_key(device, &pipeline->base.base, pCreateInfo->flags);
return result;
}
-void
-radv_destroy_ray_tracing_lib_pipeline(struct radv_device *device,
- struct radv_ray_tracing_lib_pipeline *pipeline)
-{
- if (pipeline->stages) {
- for (unsigned i = 0; i < pipeline->stage_count; i++) {
- if (pipeline->stages[i].shader)
- vk_pipeline_cache_object_unref(&device->vk, pipeline->stages[i].shader);
- }
- }
-
- ralloc_free(pipeline->ctx);
-}
-
static bool
radv_rt_pipeline_has_dynamic_stack_size(const VkRayTracingPipelineCreateInfoKHR *pCreateInfo)
{
radv_destroy_ray_tracing_pipeline(struct radv_device *device,
struct radv_ray_tracing_pipeline *pipeline)
{
+ if (pipeline->stages) {
+ for (unsigned i = 0; i < pipeline->stage_count; i++) {
+ if (pipeline->stages[i].shader)
+ vk_pipeline_cache_object_unref(&device->vk, pipeline->stages[i].shader);
+ }
+ }
+
if (pipeline->base.base.shaders[MESA_SHADER_COMPUTE])
radv_shader_unref(device, pipeline->base.base.shaders[MESA_SHADER_COMPUTE]);
if (pipeline->base.base.shaders[MESA_SHADER_RAYGEN])
radv_shader_unref(device, pipeline->base.base.shaders[MESA_SHADER_RAYGEN]);
+
+ ralloc_free(pipeline->ctx);
}
VKAPI_ATTR VkResult VKAPI_CALL
uint32_t groupCount, size_t dataSize, void *pData)
{
RADV_FROM_HANDLE(radv_pipeline, pipeline, _pipeline);
- struct radv_ray_tracing_group *groups;
- if (pipeline->type == RADV_PIPELINE_RAY_TRACING_LIB) {
- groups = radv_pipeline_to_ray_tracing_lib(pipeline)->groups;
- } else {
- groups = radv_pipeline_to_ray_tracing(pipeline)->groups;
- }
+ struct radv_ray_tracing_group *groups = radv_pipeline_to_ray_tracing(pipeline)->groups;
char *data = pData;
STATIC_ASSERT(sizeof(struct radv_pipeline_group_handle) <= RADV_RT_HANDLE_SIZE);
RADV_PIPELINE_GRAPHICS_LIB,
/* Compute pipeline */
RADV_PIPELINE_COMPUTE,
- RADV_PIPELINE_RAY_TRACING_LIB,
/* Raytracing pipeline */
RADV_PIPELINE_RAY_TRACING,
};
gl_shader_stage stage;
};
-struct radv_ray_tracing_lib_pipeline {
+struct radv_ray_tracing_pipeline {
struct radv_compute_pipeline base;
/* ralloc context used for allocating pipeline library resources. */
unsigned group_count;
struct radv_ray_tracing_stage *stages;
uint8_t sha1[SHA1_DIGEST_LENGTH];
+ uint32_t stack_size;
struct radv_ray_tracing_group groups[];
};
VkPipelineShaderStageCreateInfo *stages;
};
-struct radv_ray_tracing_pipeline {
- struct radv_compute_pipeline base;
-
- uint32_t group_count;
- uint32_t stack_size;
- struct radv_ray_tracing_group groups[];
-};
-
#define RADV_DECL_PIPELINE_DOWNCAST(pipe_type, pipe_enum) \
static inline struct radv_##pipe_type##_pipeline * \
radv_pipeline_to_##pipe_type(struct radv_pipeline *pipeline) \
RADV_DECL_PIPELINE_DOWNCAST(graphics, RADV_PIPELINE_GRAPHICS)
RADV_DECL_PIPELINE_DOWNCAST(graphics_lib, RADV_PIPELINE_GRAPHICS_LIB)
RADV_DECL_PIPELINE_DOWNCAST(compute, RADV_PIPELINE_COMPUTE)
-RADV_DECL_PIPELINE_DOWNCAST(ray_tracing_lib, RADV_PIPELINE_RAY_TRACING_LIB)
RADV_DECL_PIPELINE_DOWNCAST(ray_tracing, RADV_PIPELINE_RAY_TRACING)
struct radv_pipeline_stage {
struct radv_graphics_lib_pipeline *pipeline);
void radv_destroy_compute_pipeline(struct radv_device *device,
struct radv_compute_pipeline *pipeline);
-void radv_destroy_ray_tracing_lib_pipeline(struct radv_device *device,
- struct radv_ray_tracing_lib_pipeline *pipeline);
void radv_destroy_ray_tracing_pipeline(struct radv_device *device,
struct radv_ray_tracing_pipeline *pipeline);