radv: Add pipeline type.

I want to keep pointers that need to be freed in the union and need
to figure out the type a destruction time. This seems more reliable
than checking the shader array in case we destroy mid-creation (i.e.
on failure).

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12592>
This commit is contained in:
Bas Nieuwenhuizen
2021-07-31 23:42:32 +02:00
committed by Marge Bot
parent f5362742b9
commit 080400e43c
2 changed files with 9 additions and 0 deletions

View File

@@ -5608,6 +5608,7 @@ radv_graphics_pipeline_create(VkDevice _device, VkPipelineCache _cache,
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
vk_object_base_init(&device->vk, &pipeline->base, VK_OBJECT_TYPE_PIPELINE);
pipeline->type = RADV_PIPELINE_GRAPHICS;
result = radv_pipeline_init(pipeline, device, cache, pCreateInfo, extra);
if (result != VK_SUCCESS) {
@@ -5754,6 +5755,7 @@ radv_compute_pipeline_create(VkDevice _device, VkPipelineCache _cache,
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
vk_object_base_init(&device->vk, &pipeline->base, VK_OBJECT_TYPE_PIPELINE);
pipeline->type = RADV_PIPELINE_COMPUTE;
pipeline->device = device;
pipeline->graphics.last_vgt_api_stage = MESA_SHADER_NONE;

View File

@@ -1729,8 +1729,15 @@ struct radv_binning_state {
#define SI_GS_PER_ES 128
enum radv_pipeline_type {
RADV_PIPELINE_GRAPHICS,
RADV_PIPELINE_COMPUTE,
};
struct radv_pipeline {
struct vk_object_base base;
enum radv_pipeline_type type;
struct radv_device *device;
struct radv_dynamic_state dynamic_state;