panvk: Move CmdPushConstants2KHR to panvk_vX_cmd_push_constant.c

Turns out the panvk_cmd_buffer structures for CSF/JM are similar enough
to make CmdPushConstants2KHR() generic. Let's move this function out
of the JM specific code.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: John Anthony <john.anthony@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30969>
This commit is contained in:
Boris Brezillon
2024-08-26 11:40:56 +02:00
committed by Marge Bot
parent 173939ed9b
commit eb0b1c36f2
4 changed files with 26 additions and 23 deletions

View File

@@ -440,19 +440,3 @@ panvk_per_arch(BeginCommandBuffer)(VkCommandBuffer commandBuffer,
return VK_SUCCESS;
}
VKAPI_ATTR void VKAPI_CALL
panvk_per_arch(CmdPushConstants2KHR)(
VkCommandBuffer commandBuffer,
const VkPushConstantsInfoKHR *pPushConstantsInfo)
{
VK_FROM_HANDLE(panvk_cmd_buffer, cmdbuf, commandBuffer);
if (pPushConstantsInfo->stageFlags & VK_SHADER_STAGE_ALL_GRAPHICS)
cmdbuf->state.gfx.push_uniforms = 0;
if (pPushConstantsInfo->stageFlags & VK_SHADER_STAGE_COMPUTE_BIT)
cmdbuf->state.compute.push_uniforms = 0;
panvk_cmd_push_constants(&cmdbuf->state.push_constants, pPushConstantsInfo);
}

View File

@@ -63,6 +63,7 @@ common_per_arch_files = [
'panvk_vX_buffer_view.c',
'panvk_vX_cmd_desc_state.c',
'panvk_vX_cmd_meta.c',
'panvk_vX_cmd_push_constant.c',
'panvk_vX_descriptor_set.c',
'panvk_vX_descriptor_set_layout.c',
'panvk_vX_device.c',

View File

@@ -35,11 +35,4 @@ panvk_cmd_prepare_push_uniforms(struct pan_pool *desc_pool_base,
return push_uniforms.gpu;
}
static inline void
panvk_cmd_push_constants(struct panvk_push_constant_state *push,
const VkPushConstantsInfoKHR *info)
{
memcpy(push->data + info->offset, info->pValues, info->size);
}
#endif

View File

@@ -0,0 +1,25 @@
/*
* Copyright © 2024 Collabora Ltd.
* SPDX-License-Identifier: MIT
*/
#include "panvk_cmd_buffer.h"
#include "panvk_cmd_push_constant.h"
#include "panvk_entrypoints.h"
VKAPI_ATTR void VKAPI_CALL
panvk_per_arch(CmdPushConstants2KHR)(
VkCommandBuffer commandBuffer,
const VkPushConstantsInfoKHR *pPushConstantsInfo)
{
VK_FROM_HANDLE(panvk_cmd_buffer, cmdbuf, commandBuffer);
if (pPushConstantsInfo->stageFlags & VK_SHADER_STAGE_ALL_GRAPHICS)
cmdbuf->state.gfx.push_uniforms = 0;
if (pPushConstantsInfo->stageFlags & VK_SHADER_STAGE_COMPUTE_BIT)
cmdbuf->state.compute.push_uniforms = 0;
memcpy(cmdbuf->state.push_constants.data + pPushConstantsInfo->offset,
pPushConstantsInfo->pValues, pPushConstantsInfo->size);
}