mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
hk: Stop using strings or common key types for meta keys
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32881>
This commit is contained in:
parent
db4277adf8
commit
32e0e8c8c5
2 changed files with 23 additions and 17 deletions
|
|
@ -811,3 +811,9 @@ void hk_dispatch_precomp(struct hk_cs *cs, struct agx_grid grid,
|
|||
|
||||
void hk_queue_write(struct hk_cmd_buffer *cmd, uint64_t address, uint32_t value,
|
||||
bool after_gfx);
|
||||
|
||||
enum hk_meta_object_key_type {
|
||||
HK_META_OBJECT_KEY_COPY_IMAGE_TO_BUFFER = VK_META_OBJECT_KEY_DRIVER_OFFSET,
|
||||
HK_META_OBJECT_KEY_COPY_BUFFER_TO_IMAGE,
|
||||
HK_META_OBJECT_KEY_COPY_IMAGE,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ struct vk_meta_push_data {
|
|||
nir_imm_int(b, offsetof(struct vk_meta_push_data, name)))
|
||||
|
||||
struct vk_meta_image_copy_key {
|
||||
enum vk_meta_object_key_type key_type;
|
||||
enum hk_meta_object_key_type key_type;
|
||||
enum copy_type type;
|
||||
enum pipe_format src_format, dst_format;
|
||||
unsigned block_size;
|
||||
|
|
@ -624,14 +624,14 @@ get_image_copy_descriptor_set_layout(struct vk_device *device,
|
|||
VkDescriptorSetLayout *layout_out,
|
||||
enum copy_type type)
|
||||
{
|
||||
const char *keys[] = {
|
||||
[IMG2BUF] = "vk-meta-copy-image-to-buffer-descriptor-set-layout",
|
||||
[BUF2IMG] = "vk-meta-copy-buffer-to-image-descriptor-set-layout",
|
||||
[IMG2IMG] = "vk-meta-copy-image-to-image-descriptor-set-layout",
|
||||
enum hk_meta_object_key_type keys[] = {
|
||||
[IMG2BUF] = HK_META_OBJECT_KEY_COPY_IMAGE_TO_BUFFER,
|
||||
[BUF2IMG] = HK_META_OBJECT_KEY_COPY_BUFFER_TO_IMAGE,
|
||||
[IMG2IMG] = HK_META_OBJECT_KEY_COPY_IMAGE,
|
||||
};
|
||||
|
||||
VkDescriptorSetLayout from_cache = vk_meta_lookup_descriptor_set_layout(
|
||||
meta, keys[type], strlen(keys[type]));
|
||||
meta, keys[type], sizeof(keys[type]));
|
||||
if (from_cache != VK_NULL_HANDLE) {
|
||||
*layout_out = from_cache;
|
||||
return VK_SUCCESS;
|
||||
|
|
@ -659,7 +659,7 @@ get_image_copy_descriptor_set_layout(struct vk_device *device,
|
|||
};
|
||||
|
||||
return vk_meta_create_descriptor_set_layout(device, meta, &info, keys[type],
|
||||
strlen(keys[type]), layout_out);
|
||||
sizeof(keys[type]), layout_out);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
|
@ -670,14 +670,14 @@ get_image_copy_pipeline_layout(struct vk_device *device,
|
|||
VkPipelineLayout *layout_out,
|
||||
enum copy_type type)
|
||||
{
|
||||
const char *keys[] = {
|
||||
[IMG2BUF] = "vk-meta-copy-image-to-buffer-pipeline-layout",
|
||||
[BUF2IMG] = "vk-meta-copy-buffer-to-image-pipeline-layout",
|
||||
[IMG2IMG] = "vk-meta-copy-image-to-image-pipeline-layout",
|
||||
enum hk_meta_object_key_type keys[] = {
|
||||
[IMG2BUF] = HK_META_OBJECT_KEY_COPY_IMAGE_TO_BUFFER,
|
||||
[BUF2IMG] = HK_META_OBJECT_KEY_COPY_BUFFER_TO_IMAGE,
|
||||
[IMG2IMG] = HK_META_OBJECT_KEY_COPY_IMAGE,
|
||||
};
|
||||
|
||||
VkPipelineLayout from_cache =
|
||||
vk_meta_lookup_pipeline_layout(meta, keys[type], strlen(keys[type]));
|
||||
vk_meta_lookup_pipeline_layout(meta, keys[type], sizeof(keys[type]));
|
||||
if (from_cache != VK_NULL_HANDLE) {
|
||||
*layout_out = from_cache;
|
||||
return VK_SUCCESS;
|
||||
|
|
@ -699,7 +699,7 @@ get_image_copy_pipeline_layout(struct vk_device *device,
|
|||
info.pPushConstantRanges = &push_range;
|
||||
|
||||
return vk_meta_create_pipeline_layout(device, meta, &info, keys[type],
|
||||
strlen(keys[type]), layout_out);
|
||||
sizeof(keys[type]), layout_out);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
|
@ -797,7 +797,7 @@ hk_meta_copy_image_to_buffer2(struct vk_command_buffer *cmd,
|
|||
bool is_3d = region->imageExtent.depth > 1;
|
||||
|
||||
struct vk_meta_image_copy_key key = {
|
||||
.key_type = VK_META_OBJECT_KEY_COPY_IMAGE_TO_BUFFER,
|
||||
.key_type = HK_META_OBJECT_KEY_COPY_IMAGE_TO_BUFFER,
|
||||
.type = IMG2BUF,
|
||||
.block_size = blocksize_B,
|
||||
.nr_samples = image->samples,
|
||||
|
|
@ -982,7 +982,7 @@ hk_meta_copy_buffer_to_image2(struct vk_command_buffer *cmd,
|
|||
bool is_3d = region->imageExtent.depth > 1;
|
||||
|
||||
struct vk_meta_image_copy_key key = {
|
||||
.key_type = VK_META_OBJECT_KEY_COPY_IMAGE_TO_BUFFER,
|
||||
.key_type = HK_META_OBJECT_KEY_COPY_IMAGE_TO_BUFFER,
|
||||
.type = BUF2IMG,
|
||||
.block_size = blocksize_B,
|
||||
.nr_samples = image->samples,
|
||||
|
|
@ -1141,8 +1141,8 @@ hk_meta_copy_image2(struct vk_command_buffer *cmd, struct vk_meta_device *meta,
|
|||
: (1 << aspect);
|
||||
|
||||
struct vk_meta_image_copy_key key = {
|
||||
.key_type = VK_META_OBJECT_KEY_COPY_IMAGE_TO_BUFFER,
|
||||
.type = IMG2IMG
|
||||
.key_type = HK_META_OBJECT_KEY_COPY_IMAGE_TO_BUFFER,
|
||||
.type = IMG2IMG,
|
||||
.block_size = blocksize_B,
|
||||
.nr_samples = dst_image->samples,
|
||||
.src_format = hk_format_to_pipe_format(canonical),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue