mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d/resource: Write null descriptors with their correct type when using mutable descriptor types.
This fixes crashes in test_null_srv() and test_null_uav() with llvmpipe and NVIDIA GPUs.
This commit is contained in:
committed by
Henri Verbeet
parent
fb91bd7b8b
commit
1a5a2969be
Notes:
Henri Verbeet
2025-07-14 18:54:27 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1616
@@ -2513,19 +2513,20 @@ static enum vkd3d_vk_descriptor_set_index vkd3d_vk_descriptor_set_index_from_vk_
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void d3d12_desc_write_vk_heap_null_descriptor(struct d3d12_descriptor_heap *descriptor_heap,
|
static void d3d12_desc_write_vk_heap_null_descriptor(struct d3d12_descriptor_heap *descriptor_heap,
|
||||||
uint32_t dst_array_element, struct descriptor_writes *writes, struct d3d12_device *device)
|
uint32_t dst_array_element, struct descriptor_writes *writes, struct d3d12_device *device,
|
||||||
|
VkDescriptorType type)
|
||||||
{
|
{
|
||||||
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
|
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
|
||||||
struct d3d12_descriptor_heap_vk_set *descriptor_set;
|
struct d3d12_descriptor_heap_vk_set *descriptor_set;
|
||||||
enum vkd3d_vk_descriptor_set_index set, end;
|
enum vkd3d_vk_descriptor_set_index set;
|
||||||
unsigned int i = writes->count;
|
unsigned int i = writes->count;
|
||||||
|
|
||||||
end = device->vk_info.EXT_mutable_descriptor_type ? VKD3D_SET_INDEX_MUTABLE
|
|
||||||
: VKD3D_SET_INDEX_STORAGE_IMAGE;
|
|
||||||
/* Binding a shader with the wrong null descriptor type works in Windows.
|
/* Binding a shader with the wrong null descriptor type works in Windows.
|
||||||
* To support that here we must write one to all applicable Vulkan sets. */
|
* To support that here we must write one to all applicable Vulkan sets. */
|
||||||
for (set = VKD3D_SET_INDEX_UNIFORM_BUFFER; set <= end; ++set)
|
for (set = VKD3D_SET_INDEX_UNIFORM_BUFFER; set <= VKD3D_SET_INDEX_STORAGE_IMAGE; ++set)
|
||||||
{
|
{
|
||||||
|
if (device->vk_info.EXT_mutable_descriptor_type)
|
||||||
|
set = vkd3d_vk_descriptor_set_index_from_vk_descriptor_type(type);
|
||||||
descriptor_set = &descriptor_heap->vk_descriptor_sets[set];
|
descriptor_set = &descriptor_heap->vk_descriptor_sets[set];
|
||||||
writes->vk_descriptor_writes[i].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
writes->vk_descriptor_writes[i].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||||
writes->vk_descriptor_writes[i].pNext = NULL;
|
writes->vk_descriptor_writes[i].pNext = NULL;
|
||||||
@@ -2566,6 +2567,8 @@ static void d3d12_desc_write_vk_heap_null_descriptor(struct d3d12_descriptor_hea
|
|||||||
VK_CALL(vkUpdateDescriptorSets(device->vk_device, i, writes->vk_descriptor_writes, 0, NULL));
|
VK_CALL(vkUpdateDescriptorSets(device->vk_device, i, writes->vk_descriptor_writes, 0, NULL));
|
||||||
descriptor_writes_free_object_refs(writes, device);
|
descriptor_writes_free_object_refs(writes, device);
|
||||||
i = 0;
|
i = 0;
|
||||||
|
if (device->vk_info.EXT_mutable_descriptor_type)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
writes->count = i;
|
writes->count = i;
|
||||||
@@ -2630,7 +2633,7 @@ static void d3d12_desc_write_vk_heap(struct d3d12_descriptor_heap *descriptor_he
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (is_null && device->vk_info.EXT_robustness2)
|
if (is_null && device->vk_info.EXT_robustness2)
|
||||||
return d3d12_desc_write_vk_heap_null_descriptor(descriptor_heap, dst_array_element, writes, device);
|
return d3d12_desc_write_vk_heap_null_descriptor(descriptor_heap, dst_array_element, writes, device, type);
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
if (u.header->magic == VKD3D_DESCRIPTOR_MAGIC_UAV && u.view->v.vk_counter_view)
|
if (u.header->magic == VKD3D_DESCRIPTOR_MAGIC_UAV && u.view->v.vk_counter_view)
|
||||||
|
@@ -19875,15 +19875,6 @@ static void test_null_srv(void)
|
|||||||
queue = context.queue;
|
queue = context.queue;
|
||||||
device = context.device;
|
device = context.device;
|
||||||
|
|
||||||
if (is_llvmpipe_device_gte(device, 23, 2, 1))
|
|
||||||
{
|
|
||||||
/* llvmpipe crashes when mutable descriptors are used. I don't
|
|
||||||
* know yet whether this is a bug in vkd3d or Mesa. */
|
|
||||||
skip("Test crashes on llvmpipe, skipping.\n");
|
|
||||||
destroy_test_context(&context);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
context.root_signature = create_texture_root_signature(context.device,
|
context.root_signature = create_texture_root_signature(context.device,
|
||||||
D3D12_SHADER_VISIBILITY_PIXEL, 4, 0);
|
D3D12_SHADER_VISIBILITY_PIXEL, 4, 0);
|
||||||
|
|
||||||
@@ -20099,15 +20090,6 @@ static void test_null_uav(void)
|
|||||||
command_list = context.list;
|
command_list = context.list;
|
||||||
queue = context.queue;
|
queue = context.queue;
|
||||||
|
|
||||||
if (is_llvmpipe_device_gte(device, 23, 2, 1))
|
|
||||||
{
|
|
||||||
/* llvmpipe crashes when mutable descriptors are used. I don't
|
|
||||||
* know yet whether this is a bug in vkd3d or Mesa. */
|
|
||||||
skip("Test crashes on llvmpipe, skipping.\n");
|
|
||||||
destroy_test_context(&context);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
descriptor_ranges[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_UAV;
|
descriptor_ranges[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_UAV;
|
||||||
descriptor_ranges[0].NumDescriptors = 1;
|
descriptor_ranges[0].NumDescriptors = 1;
|
||||||
descriptor_ranges[0].BaseShaderRegister = 1;
|
descriptor_ranges[0].BaseShaderRegister = 1;
|
||||||
|
Reference in New Issue
Block a user