mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
479 lines
21 KiB
Diff
479 lines
21 KiB
Diff
From 00aa0577c99eb55b93f4b67d42baecdc9ff9f5d2 Mon Sep 17 00:00:00 2001
|
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
|
Date: Thu, 24 Oct 2024 07:08:51 +1100
|
|
Subject: [PATCH] Updated vkd3d to 91701f83035c0d67d1ab917e0f6b73f91e8583d4.
|
|
|
|
---
|
|
libs/vkd3d/libs/vkd3d-shader/d3dbc.c | 12 --
|
|
libs/vkd3d/libs/vkd3d-shader/dxil.c | 15 ---
|
|
libs/vkd3d/libs/vkd3d-shader/tpf.c | 12 --
|
|
.../libs/vkd3d-shader/vkd3d_shader_main.c | 105 +++++++++---------
|
|
.../libs/vkd3d-shader/vkd3d_shader_private.h | 6 -
|
|
libs/vkd3d/libs/vkd3d/device.c | 65 ++++++-----
|
|
libs/vkd3d/libs/vkd3d/resource.c | 14 ++-
|
|
libs/vkd3d/libs/vkd3d/state.c | 21 ++--
|
|
libs/vkd3d/libs/vkd3d/vkd3d_private.h | 23 ++--
|
|
9 files changed, 123 insertions(+), 150 deletions(-)
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
|
index bbebf86e6d5..9e2eacbcfa6 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/d3dbc.c
|
|
@@ -1391,18 +1391,6 @@ int d3dbc_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t c
|
|
|
|
if (ret < 0)
|
|
{
|
|
- WARN("Failed to parse shader.\n");
|
|
- vsir_program_cleanup(program);
|
|
- return ret;
|
|
- }
|
|
-
|
|
- if ((ret = vkd3d_shader_parser_validate(&sm1.p, config_flags)) < 0)
|
|
- {
|
|
- WARN("Failed to validate shader after parsing, ret %d.\n", ret);
|
|
-
|
|
- if (TRACE_ON())
|
|
- vsir_program_trace(program);
|
|
-
|
|
vsir_program_cleanup(program);
|
|
return ret;
|
|
}
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/dxil.c b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
|
index 570af5eca5a..3235a278769 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/dxil.c
|
|
@@ -10603,22 +10603,7 @@ int dxil_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t co
|
|
vkd3d_free(byte_code);
|
|
|
|
if (ret < 0)
|
|
- {
|
|
- WARN("Failed to parse shader.\n");
|
|
- return ret;
|
|
- }
|
|
-
|
|
- if ((ret = vkd3d_shader_parser_validate(&sm6.p, config_flags)) < 0)
|
|
- {
|
|
- WARN("Failed to validate shader after parsing, ret %d.\n", ret);
|
|
-
|
|
- if (TRACE_ON())
|
|
- vsir_program_trace(program);
|
|
-
|
|
- sm6_parser_cleanup(&sm6);
|
|
- vsir_program_cleanup(program);
|
|
return ret;
|
|
- }
|
|
|
|
sm6_parser_cleanup(&sm6);
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/tpf.c b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
|
index f96d300676c..c937b245559 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/tpf.c
|
|
@@ -2964,22 +2964,10 @@ int tpf_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t con
|
|
|
|
if (sm4.p.failed)
|
|
{
|
|
- WARN("Failed to parse shader.\n");
|
|
vsir_program_cleanup(program);
|
|
return VKD3D_ERROR_INVALID_SHADER;
|
|
}
|
|
|
|
- if ((ret = vkd3d_shader_parser_validate(&sm4.p, config_flags)) < 0)
|
|
- {
|
|
- WARN("Failed to validate shader after parsing, ret %d.\n", ret);
|
|
-
|
|
- if (TRACE_ON())
|
|
- vsir_program_trace(program);
|
|
-
|
|
- vsir_program_cleanup(program);
|
|
- return ret;
|
|
- }
|
|
-
|
|
return VKD3D_OK;
|
|
}
|
|
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
|
index ca012d4948a..3355e18b88e 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_main.c
|
|
@@ -489,13 +489,13 @@ static void vkd3d_shader_dump_shader(const struct shader_dump_data *dump_data,
|
|
if ((f = fopen(filename, "wb")))
|
|
{
|
|
if (fwrite(data, 1, size, f) != size)
|
|
- ERR("Failed to write shader to %s.\n", filename);
|
|
+ WARN("Failed to write shader to %s.\n", filename);
|
|
if (fclose(f))
|
|
- ERR("Failed to close stream %s.\n", filename);
|
|
+ WARN("Failed to close stream %s.\n", filename);
|
|
}
|
|
else
|
|
{
|
|
- ERR("Failed to open %s for dumping shader.\n", filename);
|
|
+ WARN("Failed to open %s for dumping shader.\n", filename);
|
|
}
|
|
}
|
|
|
|
@@ -680,6 +680,50 @@ static int vkd3d_shader_validate_compile_info(const struct vkd3d_shader_compile_
|
|
return VKD3D_OK;
|
|
}
|
|
|
|
+static enum vkd3d_result vsir_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags,
|
|
+ struct vkd3d_shader_message_context *message_context, struct vsir_program *program)
|
|
+{
|
|
+ enum vkd3d_result ret;
|
|
+
|
|
+ switch (compile_info->source_type)
|
|
+ {
|
|
+ case VKD3D_SHADER_SOURCE_D3D_BYTECODE:
|
|
+ ret = d3dbc_parse(compile_info, config_flags, message_context, program);
|
|
+ break;
|
|
+
|
|
+ case VKD3D_SHADER_SOURCE_DXBC_TPF:
|
|
+ ret = tpf_parse(compile_info, config_flags, message_context, program);
|
|
+ break;
|
|
+
|
|
+ case VKD3D_SHADER_SOURCE_DXBC_DXIL:
|
|
+ ret = dxil_parse(compile_info, config_flags, message_context, program);
|
|
+ break;
|
|
+
|
|
+ default:
|
|
+ ERR("Unsupported source type %#x.\n", compile_info->source_type);
|
|
+ ret = VKD3D_ERROR_INVALID_ARGUMENT;
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ if (ret < 0)
|
|
+ {
|
|
+ WARN("Failed to parse shader.\n");
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ if ((ret = vsir_program_validate(program, config_flags, compile_info->source_name, message_context)) < 0)
|
|
+ {
|
|
+ WARN("Failed to validate shader after parsing, ret %d.\n", ret);
|
|
+
|
|
+ if (TRACE_ON())
|
|
+ vsir_program_trace(program);
|
|
+
|
|
+ vsir_program_cleanup(program);
|
|
+ }
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+
|
|
void vkd3d_shader_free_messages(char *messages)
|
|
{
|
|
TRACE("messages %p.\n", messages);
|
|
@@ -1578,31 +1622,7 @@ int vkd3d_shader_scan(const struct vkd3d_shader_compile_info *compile_info, char
|
|
uint64_t config_flags = vkd3d_shader_init_config_flags();
|
|
struct vsir_program program;
|
|
|
|
- switch (compile_info->source_type)
|
|
- {
|
|
- case VKD3D_SHADER_SOURCE_D3D_BYTECODE:
|
|
- ret = d3dbc_parse(compile_info, config_flags, &message_context, &program);
|
|
- break;
|
|
-
|
|
- case VKD3D_SHADER_SOURCE_DXBC_TPF:
|
|
- ret = tpf_parse(compile_info, config_flags, &message_context, &program);
|
|
- break;
|
|
-
|
|
- case VKD3D_SHADER_SOURCE_DXBC_DXIL:
|
|
- ret = dxil_parse(compile_info, config_flags, &message_context, &program);
|
|
- break;
|
|
-
|
|
- default:
|
|
- ERR("Unsupported source type %#x.\n", compile_info->source_type);
|
|
- ret = VKD3D_ERROR_INVALID_ARGUMENT;
|
|
- break;
|
|
- }
|
|
-
|
|
- if (ret < 0)
|
|
- {
|
|
- WARN("Failed to parse shader.\n");
|
|
- }
|
|
- else
|
|
+ if (!(ret = vsir_parse(compile_info, config_flags, &message_context, &program)))
|
|
{
|
|
ret = vsir_program_scan(&program, compile_info, &message_context, NULL);
|
|
vsir_program_cleanup(&program);
|
|
@@ -1719,38 +1739,15 @@ int vkd3d_shader_compile(const struct vkd3d_shader_compile_info *compile_info,
|
|
uint64_t config_flags = vkd3d_shader_init_config_flags();
|
|
struct vsir_program program;
|
|
|
|
- switch (compile_info->source_type)
|
|
- {
|
|
- case VKD3D_SHADER_SOURCE_D3D_BYTECODE:
|
|
- ret = d3dbc_parse(compile_info, config_flags, &message_context, &program);
|
|
- break;
|
|
-
|
|
- case VKD3D_SHADER_SOURCE_DXBC_TPF:
|
|
- ret = tpf_parse(compile_info, config_flags, &message_context, &program);
|
|
- break;
|
|
-
|
|
- case VKD3D_SHADER_SOURCE_DXBC_DXIL:
|
|
- ret = dxil_parse(compile_info, config_flags, &message_context, &program);
|
|
- break;
|
|
-
|
|
- default:
|
|
- ERR("Unsupported source type %#x.\n", compile_info->source_type);
|
|
- ret = VKD3D_ERROR_INVALID_ARGUMENT;
|
|
- break;
|
|
- }
|
|
-
|
|
- if (ret < 0)
|
|
- {
|
|
- WARN("Failed to parse shader.\n");
|
|
- }
|
|
- else
|
|
+ if (!(ret = vsir_parse(compile_info, config_flags, &message_context, &program)))
|
|
{
|
|
ret = vsir_program_compile(&program, config_flags, compile_info, out, &message_context);
|
|
vsir_program_cleanup(&program);
|
|
}
|
|
}
|
|
|
|
- vkd3d_shader_dump_shader(&dump_data, out->code, out->size, false);
|
|
+ if (ret >= 0)
|
|
+ vkd3d_shader_dump_shader(&dump_data, out->code, out->size, false);
|
|
|
|
vkd3d_shader_message_context_trace_messages(&message_context);
|
|
if (!vkd3d_shader_message_context_copy_messages(&message_context, messages))
|
|
diff --git a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
|
index d6c68155ee7..5ae938e0525 100644
|
|
--- a/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
|
+++ b/libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h
|
|
@@ -1477,12 +1477,6 @@ void vkd3d_shader_parser_init(struct vkd3d_shader_parser *parser, struct vsir_pr
|
|
void vkd3d_shader_parser_warning(struct vkd3d_shader_parser *parser,
|
|
enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(3, 4);
|
|
|
|
-static inline enum vkd3d_result vkd3d_shader_parser_validate(struct vkd3d_shader_parser *parser, uint64_t config_flags)
|
|
-{
|
|
- return vsir_program_validate(parser->program, config_flags,
|
|
- parser->location.source_name, parser->message_context);
|
|
-}
|
|
-
|
|
struct vkd3d_shader_descriptor_info1
|
|
{
|
|
enum vkd3d_shader_descriptor_type type;
|
|
diff --git a/libs/vkd3d/libs/vkd3d/device.c b/libs/vkd3d/libs/vkd3d/device.c
|
|
index fd0ca20838f..54a39e18a0f 100644
|
|
--- a/libs/vkd3d/libs/vkd3d/device.c
|
|
+++ b/libs/vkd3d/libs/vkd3d/device.c
|
|
@@ -136,7 +136,8 @@ static HRESULT vkd3d_create_vk_descriptor_heap_layout(struct d3d12_device *devic
|
|
VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
|
|
};
|
|
|
|
- if (device->vk_info.EXT_mutable_descriptor_type && index && index != VKD3D_SET_INDEX_UAV_COUNTER
|
|
+ if (device->vk_info.EXT_mutable_descriptor_type
|
|
+ && index != VKD3D_SET_INDEX_MUTABLE && index != VKD3D_SET_INDEX_UAV_COUNTER
|
|
&& device->vk_descriptor_heap_layouts[index].applicable_heap_type == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV)
|
|
{
|
|
device->vk_descriptor_heap_layouts[index].vk_set_layout = VK_NULL_HANDLE;
|
|
@@ -144,7 +145,7 @@ static HRESULT vkd3d_create_vk_descriptor_heap_layout(struct d3d12_device *devic
|
|
}
|
|
|
|
binding.binding = 0;
|
|
- binding.descriptorType = (device->vk_info.EXT_mutable_descriptor_type && !index)
|
|
+ binding.descriptorType = (device->vk_info.EXT_mutable_descriptor_type && index == VKD3D_SET_INDEX_MUTABLE)
|
|
? VK_DESCRIPTOR_TYPE_MUTABLE_EXT : device->vk_descriptor_heap_layouts[index].type;
|
|
binding.descriptorCount = device->vk_descriptor_heap_layouts[index].count;
|
|
binding.stageFlags = VK_SHADER_STAGE_ALL;
|
|
@@ -200,14 +201,20 @@ static HRESULT vkd3d_vk_descriptor_heap_layouts_init(struct d3d12_device *device
|
|
{
|
|
static const struct vkd3d_vk_descriptor_heap_layout vk_descriptor_heap_layouts[VKD3D_SET_INDEX_COUNT] =
|
|
{
|
|
- {VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, true, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV},
|
|
- {VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, true, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV},
|
|
- {VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, false, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV},
|
|
- {VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, true, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV},
|
|
- {VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, false, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV},
|
|
- {VK_DESCRIPTOR_TYPE_SAMPLER, false, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER},
|
|
- /* UAV counters */
|
|
- {VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, true, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV},
|
|
+ [VKD3D_SET_INDEX_UNIFORM_BUFFER] =
|
|
+ {VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, true, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV},
|
|
+ [VKD3D_SET_INDEX_UNIFORM_TEXEL_BUFFER] =
|
|
+ {VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, true, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV},
|
|
+ [VKD3D_SET_INDEX_SAMPLED_IMAGE] =
|
|
+ {VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, false, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV},
|
|
+ [VKD3D_SET_INDEX_STORAGE_TEXEL_BUFFER] =
|
|
+ {VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, true, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV},
|
|
+ [VKD3D_SET_INDEX_STORAGE_IMAGE] =
|
|
+ {VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, false, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV},
|
|
+ [VKD3D_SET_INDEX_SAMPLER] =
|
|
+ {VK_DESCRIPTOR_TYPE_SAMPLER, false, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER},
|
|
+ [VKD3D_SET_INDEX_UAV_COUNTER] =
|
|
+ {VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, true, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV},
|
|
};
|
|
const struct vkd3d_device_descriptor_limits *limits = &device->vk_info.descriptor_limits;
|
|
enum vkd3d_vk_descriptor_set_index set;
|
|
@@ -1918,24 +1925,26 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
|
|
&& descriptor_indexing->descriptorBindingUniformTexelBufferUpdateAfterBind
|
|
&& descriptor_indexing->descriptorBindingStorageTexelBufferUpdateAfterBind;
|
|
|
|
- /* Many Vulkan implementations allow up to 8 descriptor sets. Unfortunately
|
|
- * using vkd3d with Vulkan heaps and push descriptors currently requires up
|
|
- * to 9 descriptor sets (up to one for the push descriptors, up to one for
|
|
- * the static samplers and seven for Vulkan heaps, one for each needed
|
|
- * descriptor type). If we detect such situation, we disable push
|
|
- * descriptors, which allows us to stay within the limits (not doing so is
|
|
- * fatal on many implmentations).
|
|
- *
|
|
- * It is possible that a different strategy might be used. For example, we
|
|
- * could move the static samplers to one of the seven Vulkan heaps sets. Or
|
|
- * we could decide whether to create the push descriptor set when creating
|
|
- * the root signature, depending on whether there are static samplers or
|
|
- * not. */
|
|
- if (device->vk_info.device_limits.maxBoundDescriptorSets == 8 && device->use_vk_heaps
|
|
- && device->vk_info.KHR_push_descriptor)
|
|
- {
|
|
- TRACE("Disabling VK_KHR_push_descriptor to save a descriptor set.\n");
|
|
- device->vk_info.KHR_push_descriptor = VK_FALSE;
|
|
+ if (device->use_vk_heaps && device->vk_info.KHR_push_descriptor)
|
|
+ {
|
|
+ /* VKD3D_SET_INDEX_COUNT for the Vulkan heaps, one for the push
|
|
+ * descriptors set and one for the static samplers set. */
|
|
+ unsigned int descriptor_set_count = VKD3D_SET_INDEX_COUNT + 2;
|
|
+
|
|
+ /* A mutable descriptor set can replace all those that should otherwise
|
|
+ * back the SRV-UAV-CBV descriptor heap. */
|
|
+ if (device->vk_info.EXT_mutable_descriptor_type)
|
|
+ descriptor_set_count -= VKD3D_SET_INDEX_COUNT - (VKD3D_SET_INDEX_MUTABLE + 1);
|
|
+
|
|
+ /* For many Vulkan implementations maxBoundDescriptorSets == 8; also,
|
|
+ * if mutable descriptors are not available the descriptor set count
|
|
+ * will be 9; so saving a descriptor set is going to be often
|
|
+ * significant. */
|
|
+ if (descriptor_set_count > device->vk_info.device_limits.maxBoundDescriptorSets)
|
|
+ {
|
|
+ WARN("Disabling VK_KHR_push_descriptor to save a descriptor set.\n");
|
|
+ device->vk_info.KHR_push_descriptor = VK_FALSE;
|
|
+ }
|
|
}
|
|
|
|
if (device->use_vk_heaps)
|
|
diff --git a/libs/vkd3d/libs/vkd3d/resource.c b/libs/vkd3d/libs/vkd3d/resource.c
|
|
index 6d6820d3752..1f7d90eb95f 100644
|
|
--- a/libs/vkd3d/libs/vkd3d/resource.c
|
|
+++ b/libs/vkd3d/libs/vkd3d/resource.c
|
|
@@ -2498,7 +2498,7 @@ static void d3d12_desc_write_vk_heap_null_descriptor(struct d3d12_descriptor_hea
|
|
enum vkd3d_vk_descriptor_set_index set, end;
|
|
unsigned int i = writes->count;
|
|
|
|
- end = device->vk_info.EXT_mutable_descriptor_type ? VKD3D_SET_INDEX_UNIFORM_BUFFER
|
|
+ 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.
|
|
* To support that here we must write one to all applicable Vulkan sets. */
|
|
@@ -4250,7 +4250,8 @@ static HRESULT d3d12_descriptor_heap_create_descriptor_pool(struct d3d12_descrip
|
|
if (device->vk_descriptor_heap_layouts[set].applicable_heap_type == desc->Type
|
|
&& device->vk_descriptor_heap_layouts[set].vk_set_layout)
|
|
{
|
|
- pool_sizes[pool_desc.poolSizeCount].type = (device->vk_info.EXT_mutable_descriptor_type && !set)
|
|
+ pool_sizes[pool_desc.poolSizeCount].type =
|
|
+ (device->vk_info.EXT_mutable_descriptor_type && set == VKD3D_SET_INDEX_MUTABLE)
|
|
? VK_DESCRIPTOR_TYPE_MUTABLE_EXT : device->vk_descriptor_heap_layouts[set].type;
|
|
pool_sizes[pool_desc.poolSizeCount++].descriptorCount = desc->NumDescriptors;
|
|
}
|
|
@@ -4280,11 +4281,12 @@ static HRESULT d3d12_descriptor_heap_create_descriptor_set(struct d3d12_descript
|
|
|
|
if (!device->vk_descriptor_heap_layouts[set].vk_set_layout)
|
|
{
|
|
- /* Set 0 uses mutable descriptors, and this set is unused. */
|
|
- if (!descriptor_heap->vk_descriptor_sets[0].vk_set
|
|
- && FAILED(hr = d3d12_descriptor_heap_create_descriptor_set(descriptor_heap, device, 0)))
|
|
+ /* Mutable descriptors are in use, and this set is unused. */
|
|
+ if (!descriptor_heap->vk_descriptor_sets[VKD3D_SET_INDEX_MUTABLE].vk_set
|
|
+ && FAILED(hr = d3d12_descriptor_heap_create_descriptor_set(descriptor_heap,
|
|
+ device, VKD3D_SET_INDEX_MUTABLE)))
|
|
return hr;
|
|
- descriptor_set->vk_set = descriptor_heap->vk_descriptor_sets[0].vk_set;
|
|
+ descriptor_set->vk_set = descriptor_heap->vk_descriptor_sets[VKD3D_SET_INDEX_MUTABLE].vk_set;
|
|
descriptor_set->vk_type = device->vk_descriptor_heap_layouts[set].type;
|
|
return S_OK;
|
|
}
|
|
diff --git a/libs/vkd3d/libs/vkd3d/state.c b/libs/vkd3d/libs/vkd3d/state.c
|
|
index 8e5ec70a577..e7476a01bd7 100644
|
|
--- a/libs/vkd3d/libs/vkd3d/state.c
|
|
+++ b/libs/vkd3d/libs/vkd3d/state.c
|
|
@@ -1016,7 +1016,7 @@ static void vkd3d_descriptor_heap_binding_from_descriptor_range(const struct d3d
|
|
}
|
|
else
|
|
{
|
|
- binding->set = 0;
|
|
+ binding->set = VKD3D_SET_INDEX_MUTABLE;
|
|
descriptor_set_size = descriptor_limits->sampled_image_max_descriptors;
|
|
}
|
|
}
|
|
@@ -1483,21 +1483,24 @@ static unsigned int d3d12_root_signature_copy_descriptor_set_layouts(const struc
|
|
{
|
|
const struct d3d12_device *device = root_signature->device;
|
|
enum vkd3d_vk_descriptor_set_index set;
|
|
+ VkDescriptorSetLayout vk_set_layout;
|
|
unsigned int i;
|
|
|
|
for (i = 0; i < root_signature->vk_set_count; ++i)
|
|
vk_set_layouts[i] = root_signature->descriptor_set_layouts[i].vk_layout;
|
|
|
|
- if (device->use_vk_heaps)
|
|
+ if (!device->use_vk_heaps)
|
|
+ return i;
|
|
+
|
|
+ for (set = 0; set < ARRAY_SIZE(device->vk_descriptor_heap_layouts); ++set)
|
|
{
|
|
- VkDescriptorSetLayout mutable_layout = device->vk_descriptor_heap_layouts[0].vk_set_layout;
|
|
+ vk_set_layout = device->vk_descriptor_heap_layouts[set].vk_set_layout;
|
|
|
|
- for (set = 0; set < ARRAY_SIZE(device->vk_descriptor_heap_layouts); ++set)
|
|
- {
|
|
- VkDescriptorSetLayout vk_set_layout = device->vk_descriptor_heap_layouts[set].vk_set_layout;
|
|
- /* All layouts must be valid, so if null, just set it to the mutable one. */
|
|
- vk_set_layouts[i++] = vk_set_layout ? vk_set_layout : mutable_layout;
|
|
- }
|
|
+ VKD3D_ASSERT(vk_set_layout);
|
|
+ vk_set_layouts[i++] = vk_set_layout;
|
|
+
|
|
+ if (device->vk_info.EXT_mutable_descriptor_type && set == VKD3D_SET_INDEX_MUTABLE)
|
|
+ break;
|
|
}
|
|
|
|
return i;
|
|
diff --git a/libs/vkd3d/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
|
index e6d477a5c12..97a99782d6a 100644
|
|
--- a/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
|
+++ b/libs/vkd3d/libs/vkd3d/vkd3d_private.h
|
|
@@ -772,14 +772,21 @@ void d3d12_dsv_desc_create_dsv(struct d3d12_dsv_desc *dsv_desc, struct d3d12_dev
|
|
|
|
enum vkd3d_vk_descriptor_set_index
|
|
{
|
|
- VKD3D_SET_INDEX_UNIFORM_BUFFER = 0,
|
|
- VKD3D_SET_INDEX_UNIFORM_TEXEL_BUFFER = 1,
|
|
- VKD3D_SET_INDEX_SAMPLED_IMAGE = 2,
|
|
- VKD3D_SET_INDEX_STORAGE_TEXEL_BUFFER = 3,
|
|
- VKD3D_SET_INDEX_STORAGE_IMAGE = 4,
|
|
- VKD3D_SET_INDEX_SAMPLER = 5,
|
|
- VKD3D_SET_INDEX_UAV_COUNTER = 6,
|
|
- VKD3D_SET_INDEX_COUNT = 7
|
|
+ VKD3D_SET_INDEX_SAMPLER,
|
|
+ VKD3D_SET_INDEX_UAV_COUNTER,
|
|
+ VKD3D_SET_INDEX_MUTABLE,
|
|
+
|
|
+ /* These are used when mutable descriptors are not available to back
|
|
+ * SRV-UAV-CBV descriptor heaps. They must stay at the end of this
|
|
+ * enumeration, so that they can be ignored when mutable descriptors are
|
|
+ * used. */
|
|
+ VKD3D_SET_INDEX_UNIFORM_BUFFER = VKD3D_SET_INDEX_MUTABLE,
|
|
+ VKD3D_SET_INDEX_UNIFORM_TEXEL_BUFFER,
|
|
+ VKD3D_SET_INDEX_SAMPLED_IMAGE,
|
|
+ VKD3D_SET_INDEX_STORAGE_TEXEL_BUFFER,
|
|
+ VKD3D_SET_INDEX_STORAGE_IMAGE,
|
|
+
|
|
+ VKD3D_SET_INDEX_COUNT
|
|
};
|
|
|
|
extern const enum vkd3d_vk_descriptor_set_index vk_descriptor_set_index_table[];
|
|
--
|
|
2.45.2
|
|
|