panvk: Make panvk_shader per-gen

Move panvk_shader_destroy() to panvk_vX_shader.c so we can get rid
of panvk_shader.c.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28170>
This commit is contained in:
Boris Brezillon
2024-02-02 11:32:46 +01:00
committed by Marge Bot
parent a790f77169
commit cc61d54489
5 changed files with 20 additions and 57 deletions
-1
View File
@@ -47,7 +47,6 @@ libpanvk_files = files(
'panvk_pipeline.c',
'panvk_priv_bo.c',
'panvk_query.c',
'panvk_shader.c',
'panvk_wsi.c',
)
-41
View File
@@ -1,41 +0,0 @@
/*
* Copyright © 2021 Collabora Ltd.
*
* Derived from tu_shader.c which is:
* Copyright © 2019 Google LLC
*
* 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.
*/
#include "panvk_shader.h"
#include "panvk_device.h"
#include "pan_shader.h"
#include "vk_alloc.h"
#include "vk_util.h"
void
panvk_shader_destroy(struct panvk_device *dev, struct panvk_shader *shader,
const VkAllocationCallbacks *alloc)
{
util_dynarray_fini(&shader->binary);
vk_free2(&dev->vk.alloc, alloc, shader);
}
+8 -13
View File
@@ -6,6 +6,10 @@
#ifndef PANVK_SHADER_H
#define PANVK_SHADER_H
#ifndef PAN_ARCH
#error "PAN_ARCH must be defined"
#endif
#include "util/u_dynarray.h"
#include "util/pan_ir.h"
@@ -62,18 +66,6 @@ struct panvk_shader {
bool has_img_access;
};
struct panvk_shader *
panvk_shader_create(struct panvk_device *dev, gl_shader_stage stage,
const VkPipelineShaderStageCreateInfo *stage_info,
const struct panvk_pipeline_layout *layout,
unsigned sysval_ubo, struct pan_blend_state *blend_state,
bool static_blend_constants,
const VkAllocationCallbacks *alloc);
void panvk_shader_destroy(struct panvk_device *dev, struct panvk_shader *shader,
const VkAllocationCallbacks *alloc);
#ifdef PAN_ARCH
bool panvk_per_arch(blend_needs_lowering)(const struct panvk_device *dev,
const struct pan_blend_state *state,
unsigned rt);
@@ -85,9 +77,12 @@ struct panvk_shader *panvk_per_arch(shader_create)(
struct pan_blend_state *blend_state, bool static_blend_constants,
const VkAllocationCallbacks *alloc);
void panvk_per_arch(shader_destroy)(struct panvk_device *dev,
struct panvk_shader *shader,
const VkAllocationCallbacks *alloc);
bool panvk_per_arch(nir_lower_descriptors)(
struct nir_shader *nir, struct panvk_device *dev,
const struct panvk_pipeline_layout *layout, bool *has_img_access_out);
#endif
#endif
+3 -2
View File
@@ -102,8 +102,9 @@ panvk_pipeline_builder_finish(struct panvk_pipeline_builder *builder)
for (uint32_t i = 0; i < MESA_SHADER_STAGES; i++) {
if (!builder->shaders[i])
continue;
panvk_shader_destroy(builder->device, builder->shaders[i],
builder->alloc);
panvk_per_arch(shader_destroy)(builder->device, builder->shaders[i],
builder->alloc);
}
}
+9
View File
@@ -399,6 +399,15 @@ panvk_per_arch(shader_create)(struct panvk_device *dev, gl_shader_stage stage,
return shader;
}
void
panvk_per_arch(shader_destroy)(struct panvk_device *dev,
struct panvk_shader *shader,
const VkAllocationCallbacks *alloc)
{
util_dynarray_fini(&shader->binary);
vk_free2(&dev->vk.alloc, alloc, shader);
}
bool
panvk_per_arch(blend_needs_lowering)(const struct panvk_device *dev,
const struct pan_blend_state *state,