wine-staging/patches/vkd3d-latest/0004-Updated-vkd3d-to-7eb63a7c0d23a83bbdfcfa5ed83b9434370.patch
2024-07-18 10:07:39 +10:00

154 lines
7.3 KiB
Diff

From 45adbbc810744d699a90f672f84115239ad48169 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Thu, 18 Jul 2024 10:01:10 +1000
Subject: [PATCH] Updated vkd3d to 7eb63a7c0d23a83bbdfcfa5ed83b943437051138.
---
libs/vkd3d/libs/vkd3d/command.c | 58 ++++++++++++++++-----------------
libs/vkd3d/libs/vkd3d/device.c | 4 ++-
2 files changed, 32 insertions(+), 30 deletions(-)
diff --git a/libs/vkd3d/libs/vkd3d/command.c b/libs/vkd3d/libs/vkd3d/command.c
index 2354938c08d..a484da94092 100644
--- a/libs/vkd3d/libs/vkd3d/command.c
+++ b/libs/vkd3d/libs/vkd3d/command.c
@@ -2977,30 +2977,20 @@ static void d3d12_command_list_update_push_descriptors(struct d3d12_command_list
enum vkd3d_pipeline_bind_point bind_point)
{
struct vkd3d_pipeline_bindings *bindings = &list->pipeline_bindings[bind_point];
+ VkWriteDescriptorSet descriptor_writes[ARRAY_SIZE(bindings->push_descriptors)] = {0};
+ VkDescriptorBufferInfo buffer_infos[ARRAY_SIZE(bindings->push_descriptors)] = {0};
const struct d3d12_root_signature *root_signature = bindings->root_signature;
- VkWriteDescriptorSet *descriptor_writes = NULL, *current_descriptor_write;
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
- VkDescriptorBufferInfo *buffer_infos = NULL, *current_buffer_info;
const struct d3d12_root_parameter *root_parameter;
struct vkd3d_push_descriptor *push_descriptor;
struct d3d12_device *device = list->device;
VkDescriptorBufferInfo *vk_buffer_info;
- unsigned int i, descriptor_count;
+ unsigned int i, descriptor_count = 0;
VkBufferView *vk_buffer_view;
if (!bindings->push_descriptor_dirty_mask)
return;
- descriptor_count = vkd3d_popcount(bindings->push_descriptor_dirty_mask);
-
- if (!(descriptor_writes = vkd3d_calloc(descriptor_count, sizeof(*descriptor_writes))))
- return;
- if (!(buffer_infos = vkd3d_calloc(descriptor_count, sizeof(*buffer_infos))))
- goto done;
-
- descriptor_count = 0;
- current_buffer_info = buffer_infos;
- current_descriptor_write = descriptor_writes;
for (i = 0; i < ARRAY_SIZE(bindings->push_descriptors); ++i)
{
if (!(bindings->push_descriptor_dirty_mask & (1u << i)))
@@ -3012,7 +3002,7 @@ static void d3d12_command_list_update_push_descriptors(struct d3d12_command_list
if (root_parameter->parameter_type == D3D12_ROOT_PARAMETER_TYPE_CBV)
{
vk_buffer_view = NULL;
- vk_buffer_info = current_buffer_info;
+ vk_buffer_info = &buffer_infos[descriptor_count];
vk_buffer_info->buffer = push_descriptor->u.cbv.vk_buffer;
vk_buffer_info->offset = push_descriptor->u.cbv.offset;
vk_buffer_info->range = VK_WHOLE_SIZE;
@@ -3023,21 +3013,15 @@ static void d3d12_command_list_update_push_descriptors(struct d3d12_command_list
vk_buffer_info = NULL;
}
- if (!vk_write_descriptor_set_from_root_descriptor(current_descriptor_write,
+ if (!vk_write_descriptor_set_from_root_descriptor(&descriptor_writes[descriptor_count],
root_parameter, bindings->descriptor_sets[0], vk_buffer_view, vk_buffer_info))
continue;
++descriptor_count;
- ++current_descriptor_write;
- ++current_buffer_info;
}
VK_CALL(vkUpdateDescriptorSets(device->vk_device, descriptor_count, descriptor_writes, 0, NULL));
bindings->push_descriptor_dirty_mask = 0;
-
-done:
- vkd3d_free(descriptor_writes);
- vkd3d_free(buffer_infos);
}
static void d3d12_command_list_update_uav_counter_descriptors(struct d3d12_command_list *list,
@@ -5289,11 +5273,13 @@ static void d3d12_command_list_clear_uav(struct d3d12_command_list *list,
struct d3d12_resource *resource, struct vkd3d_view *descriptor, const VkClearColorValue *clear_colour,
unsigned int rect_count, const D3D12_RECT *rects)
{
+ const VkPhysicalDeviceLimits *device_limits = &list->device->vk_info.device_limits;
const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs;
unsigned int i, miplevel_idx, layer_count;
struct vkd3d_uav_clear_pipeline pipeline;
struct vkd3d_uav_clear_args clear_args;
const struct vkd3d_resource_view *view;
+ uint32_t count_x, count_y, count_z;
VkDescriptorImageInfo image_info;
D3D12_RECT full_rect, curr_rect;
VkWriteDescriptorSet write_set;
@@ -5384,18 +5370,32 @@ static void d3d12_command_list_clear_uav(struct d3d12_command_list *list,
if (curr_rect.left >= curr_rect.right || curr_rect.top >= curr_rect.bottom)
continue;
- clear_args.offset.x = curr_rect.left;
clear_args.offset.y = curr_rect.top;
- clear_args.extent.width = curr_rect.right - curr_rect.left;
clear_args.extent.height = curr_rect.bottom - curr_rect.top;
- VK_CALL(vkCmdPushConstants(list->vk_command_buffer, pipeline.vk_pipeline_layout,
- VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(clear_args), &clear_args));
+ count_y = vkd3d_compute_workgroup_count(clear_args.extent.height, pipeline.group_size.height);
+ count_z = vkd3d_compute_workgroup_count(layer_count, pipeline.group_size.depth);
+ if (count_y > device_limits->maxComputeWorkGroupCount[1])
+ FIXME("Group Y count %u exceeds max %u.\n", count_y, device_limits->maxComputeWorkGroupCount[1]);
+ if (count_z > device_limits->maxComputeWorkGroupCount[2])
+ FIXME("Group Z count %u exceeds max %u.\n", count_z, device_limits->maxComputeWorkGroupCount[2]);
- VK_CALL(vkCmdDispatch(list->vk_command_buffer,
- vkd3d_compute_workgroup_count(clear_args.extent.width, pipeline.group_size.width),
- vkd3d_compute_workgroup_count(clear_args.extent.height, pipeline.group_size.height),
- vkd3d_compute_workgroup_count(layer_count, pipeline.group_size.depth)));
+ do
+ {
+ clear_args.offset.x = curr_rect.left;
+ clear_args.extent.width = curr_rect.right - curr_rect.left;
+
+ count_x = vkd3d_compute_workgroup_count(clear_args.extent.width, pipeline.group_size.width);
+ count_x = min(count_x, device_limits->maxComputeWorkGroupCount[0]);
+
+ VK_CALL(vkCmdPushConstants(list->vk_command_buffer, pipeline.vk_pipeline_layout,
+ VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(clear_args), &clear_args));
+
+ VK_CALL(vkCmdDispatch(list->vk_command_buffer, count_x, count_y, count_z));
+
+ curr_rect.left += count_x * pipeline.group_size.width;
+ }
+ while (curr_rect.right > curr_rect.left);
}
}
diff --git a/libs/vkd3d/libs/vkd3d/device.c b/libs/vkd3d/libs/vkd3d/device.c
index 2bbc170504e..ff3e41e6b70 100644
--- a/libs/vkd3d/libs/vkd3d/device.c
+++ b/libs/vkd3d/libs/vkd3d/device.c
@@ -2563,7 +2563,9 @@ static void device_init_descriptor_pool_sizes(struct d3d12_device *device)
VKD3D_MAX_UAV_CLEAR_DESCRIPTORS_PER_TYPE);
pool_sizes[1].type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE;
pool_sizes[1].descriptorCount = pool_sizes[0].descriptorCount;
- device->vk_pool_count = 2;
+ pool_sizes[2].type = VK_DESCRIPTOR_TYPE_SAMPLER;
+ pool_sizes[2].descriptorCount = min(limits->sampler_max_descriptors, D3D12_MAX_LIVE_STATIC_SAMPLERS);
+ device->vk_pool_count = 3;
return;
}
--
2.43.0