Compare commits

...

19 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen fc69f469d5 vkd3d: Prototype implementation of shader module identifier.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:37:38 +02:00
Hans-Kristian Arntzen 4d708bd7fe vkd3d: Enable prototype extension VK_EXT_shader_module_identifier.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:36:58 +02:00
Hans-Kristian Arntzen d9dc4b862a vkd3d: Add helper for late compilation of DXBC -> SPIR-V.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen b42caa0bff vkd3d: Use rwlock instead of spinlock in PSO fallback cache.
If we defer SPIR-V compilation we risk holding the lock for quite a long
time.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen b0a706cb4e cache: Explicitly do not serialize SPIR-V code for cached PSOs.
With upcoming refactor, we might have to compile code on the fly.
To avoid any race conditions on fallback compile storing code[i] <-> StorePipeline reading code[i],
explicitly mark that code[] should be ignored.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen f510e92f6e vkd3d: Separate compilation to SPIR-V and creation of VkShaderModule.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen 0123e5fe5c vkd3d: Stub out DXBC code duplication for later.
When we have the ability to load PSO from identifiers only, we need to
retain DXBC blobs for later.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen 131ff90ca3 vkd3d: Separate out the different stages of graphics PSO creation.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen 7f758e5904 vkd3d: Refactor stages of obtaining SPIR-V modules.
- Try to load SPIR-V from cache
- Fallback compile to SPIR-V if necessary
- Parse PSO metadata obtained from either compilation or cache lookup

Also moves SPIR-V compilation to end of PSO init.
Prepares for refactor where we completely decouple PSO creation info
setup and SPIR-V compilation.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen 4384b708d7 vkd3d: Prepare for system where we can retain DXBC blobs in pipeline.
Simplifies the code somewhat. Only iterate over the shader_stages LUT
once.

Adds concept of duped DXBC blobs as well.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen f16875d195 vkd3d: Add FIXME for dubious use of dsv_plane_optimal_mask.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen ef7924ce86 vkd3d: Hoist out pipeline cache creation.
Not super useful to create a local pipeline cache if we're not going to
compile early, but it's super rare, and cleans up the code either way.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen a098cce48a vkd3d: Streamline vkd3d_create_compute_pipeline.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen 73fa8b9588 vkd3d: Sink shader interface struct build to where we need it.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen dc45142b93 vkd3d: Refactor out how XFB info is stored.
For deferred compilation, we need to dupe the structs.
XFB is kinda rare, so it's okay to eat allocations here.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen f816eeb60e vkd3d: Ensure shader interface is set up per vkd3d_create_shader_stage.
Prepares for a situation where we can move this code into
vkd3d_create_shader_stage itself.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen b387def67c vkd3d: Refactor how we set compiler options.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen 1495ead2c4 vkd3d: Refactor out shader interface struct plumbing.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
Hans-Kristian Arntzen e438c42da0 vkd3d: Unify how we hold on to root signatures in PSO state.
Make use of private references to hold on to the root signature object.
This is important in situations where we end up compiling pipelines
late.

With private references like this, there is no longer a need to
distinguish a "private_root_signature", so just rename.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2022-07-01 12:33:40 +02:00
7 changed files with 863 additions and 310 deletions

View File

@ -1,6 +1,6 @@
#ifndef __VULKAN_PRIVATE_EXTENSIONS_H__
#define __VULKAN_PRIVATE_EXTENSIONS_H__
/* Nothing here at the moment. Add hacks here! */
/* Add hacks here! */
#endif

View File

@ -198,6 +198,8 @@ enum vkd3d_pipeline_blob_chunk_type
/* VkShaderStage is stored in upper 16 bits. */
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_SHADER_META = 4,
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_PSO_COMPAT = 5,
/* VkShaderStage is stored in upper 16 bits. */
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_SHADER_IDENTIFIER = 6,
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_MASK = 0xffff,
VKD3D_PIPELINE_BLOB_CHUNK_INDEX_SHIFT = 16,
};
@ -380,6 +382,11 @@ HRESULT d3d12_cached_pipeline_state_validate(struct d3d12_device *device,
if (memcmp(blob->cache_uuid, device_properties->pipelineCacheUUID, VK_UUID_SIZE) != 0)
return D3D12_ERROR_DRIVER_VERSION_MISMATCH;
if (pipeline_library_flags & VKD3D_PIPELINE_LIBRARY_FLAG_SHADER_IDENTIFIER)
if (memcmp(blob->cache_uuid, device->device_info.shader_module_identifier_properties.shaderModuleIdentifierAlgorithmUUID,
VK_UUID_SIZE) != 0)
return D3D12_ERROR_DRIVER_VERSION_MISMATCH;
/* In stream archives, we perform checksums ahead of time before accepting a stream blob into internal cache.
* No need to do redundant work. */
if (!(pipeline_library_flags & VKD3D_PIPELINE_LIBRARY_FLAG_STREAM_ARCHIVE))
@ -473,6 +480,11 @@ bool d3d12_cached_pipeline_state_is_dummy(const struct d3d12_cached_pipeline_sta
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_MASK))
return false;
if (find_blob_chunk_masked(chunk, payload_size,
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_SHADER_IDENTIFIER,
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_MASK))
return false;
return true;
}
@ -599,7 +611,8 @@ HRESULT vkd3d_create_pipeline_cache_from_d3d12_desc(struct d3d12_device *device,
HRESULT vkd3d_get_cached_spirv_code_from_d3d12_desc(
const struct d3d12_cached_pipeline_state *state,
VkShaderStageFlagBits stage,
struct vkd3d_shader_code *spirv_code)
struct vkd3d_shader_code *spirv_code,
VkPipelineShaderStageModuleIdentifierCreateInfoEXT *identifier)
{
const struct vkd3d_pipeline_blob *blob = state->blob.pCachedBlob;
const struct vkd3d_pipeline_blob_chunk_shader_meta *meta;
@ -623,6 +636,22 @@ HRESULT vkd3d_get_cached_spirv_code_from_d3d12_desc(
meta = CONST_CAST_CHUNK_DATA(chunk, shader_meta);
memcpy(&spirv_code->meta, &meta->meta, sizeof(meta->meta));
if (state->library && (state->library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_SHADER_IDENTIFIER))
{
/* Only return identifier if we can use it. */
chunk = find_blob_chunk(CONST_CAST_CHUNK_BASE(blob), payload_size,
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_SHADER_IDENTIFIER | (stage << VKD3D_PIPELINE_BLOB_CHUNK_INDEX_SHIFT));
if (chunk && chunk->size <= VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT)
{
identifier->identifierSize = chunk->size;
identifier->pIdentifier = chunk->data;
spirv_code->size = 0;
spirv_code->code = NULL;
return S_OK;
}
}
/* Aim to pull SPIR-V either from inlined chunk, or a link. */
chunk = find_blob_chunk(CONST_CAST_CHUNK_BASE(blob), payload_size,
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_VARINT_SPIRV | (stage << VKD3D_PIPELINE_BLOB_CHUNK_INDEX_SHIFT));
@ -797,6 +826,33 @@ static void vkd3d_shader_code_serialize_inline(const struct vkd3d_shader_code *c
*inout_chunk = chunk;
}
static void vkd3d_shader_code_serialize_identifier(struct d3d12_pipeline_library *pipeline_library,
const struct vkd3d_shader_code *code,
const VkShaderModuleIdentifierEXT *identifier, VkShaderStageFlagBits stage,
struct vkd3d_pipeline_blob_chunk **inout_chunk)
{
struct vkd3d_pipeline_blob_chunk *chunk = *inout_chunk;
struct vkd3d_pipeline_blob_chunk_shader_meta *meta;
if (!identifier->identifierSize)
return;
/* Store identifier. */
chunk->type = VKD3D_PIPELINE_BLOB_CHUNK_TYPE_SHADER_IDENTIFIER | (stage << VKD3D_PIPELINE_BLOB_CHUNK_INDEX_SHIFT);
chunk->size = identifier->identifierSize;
memcpy(chunk->data, identifier->identifier, chunk->size);
chunk = finish_and_iterate_blob_chunk(chunk);
/* Store meta information for SPIR-V. */
chunk->type = VKD3D_PIPELINE_BLOB_CHUNK_TYPE_SHADER_META | (stage << VKD3D_PIPELINE_BLOB_CHUNK_INDEX_SHIFT);
chunk->size = sizeof(*meta);
meta = CAST_CHUNK_DATA(chunk, shader_meta);
meta->meta = code->meta;
chunk = finish_and_iterate_blob_chunk(chunk);
*inout_chunk = chunk;
}
static void vkd3d_shader_code_serialize_referenced(struct d3d12_pipeline_library *pipeline_library,
const struct vkd3d_shader_code *code,
VkShaderStageFlagBits stage, size_t varint_size,
@ -903,18 +959,21 @@ static VkResult vkd3d_serialize_pipeline_state_inline(const struct d3d12_pipelin
chunk = finish_and_iterate_blob_chunk(chunk);
}
if (d3d12_pipeline_state_is_graphics(state))
if (!state->pso_is_loaded_from_cached_blob)
{
for (i = 0; i < state->graphics.stage_count; i++)
if (d3d12_pipeline_state_is_graphics(state))
{
vkd3d_shader_code_serialize_inline(&state->graphics.code[i], state->graphics.stages[i].stage,
varint_size[i], &chunk);
for (i = 0; i < state->graphics.stage_count; i++)
{
vkd3d_shader_code_serialize_inline(&state->graphics.code[i], state->graphics.stages[i].stage,
varint_size[i], &chunk);
}
}
else if (d3d12_pipeline_state_is_compute(state))
{
vkd3d_shader_code_serialize_inline(&state->compute.code, VK_SHADER_STAGE_COMPUTE_BIT,
varint_size[0], &chunk);
}
}
else if (d3d12_pipeline_state_is_compute(state))
{
vkd3d_shader_code_serialize_inline(&state->compute.code, VK_SHADER_STAGE_COMPUTE_BIT,
varint_size[0], &chunk);
}
return VK_SUCCESS;
@ -994,7 +1053,8 @@ static VkResult vkd3d_serialize_pipeline_state_referenced(struct d3d12_pipeline_
chunk = finish_and_iterate_blob_chunk(chunk);
}
if (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_SAVE_FULL_SPIRV)
if ((pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_SAVE_FULL_SPIRV) &&
!state->pso_is_loaded_from_cached_blob)
{
if (d3d12_pipeline_state_is_graphics(state))
{
@ -1013,6 +1073,27 @@ static VkResult vkd3d_serialize_pipeline_state_referenced(struct d3d12_pipeline_
}
}
if (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_SHADER_IDENTIFIER)
{
if (d3d12_pipeline_state_is_graphics(state))
{
for (i = 0; i < state->graphics.stage_count; i++)
{
vkd3d_shader_code_serialize_identifier(pipeline_library,
&state->graphics.code[i],
&state->graphics.identifiers[i], state->graphics.stages[i].stage,
&chunk);
}
}
else if (d3d12_pipeline_state_is_compute(state))
{
vkd3d_shader_code_serialize_identifier(pipeline_library,
&state->compute.code,
&state->compute.identifier, VK_SHADER_STAGE_COMPUTE_BIT,
&chunk);
}
}
return VK_SUCCESS;
}
@ -1054,7 +1135,8 @@ VkResult vkd3d_serialize_pipeline_state(struct d3d12_pipeline_library *pipeline_
vk_blob_size += VKD3D_PIPELINE_BLOB_CHUNK_SIZE_RAW(vk_blob_size_pipeline_cache);
}
if (!pipeline_library || (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_SAVE_FULL_SPIRV))
if ((!pipeline_library || (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_SAVE_FULL_SPIRV)) &&
!state->pso_is_loaded_from_cached_blob)
{
if (d3d12_pipeline_state_is_graphics(state))
{
@ -1071,6 +1153,29 @@ VkResult vkd3d_serialize_pipeline_state(struct d3d12_pipeline_library *pipeline_
}
}
if (pipeline_library && (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_SHADER_IDENTIFIER))
{
if (d3d12_pipeline_state_is_graphics(state))
{
for (i = 0; i < state->graphics.stage_count; i++)
{
if (state->graphics.identifiers[i].identifierSize)
{
vk_blob_size += VKD3D_PIPELINE_BLOB_CHUNK_SIZE_RAW(state->graphics.identifiers[i].identifierSize);
vk_blob_size += VKD3D_PIPELINE_BLOB_CHUNK_SIZE(shader_meta);
}
}
}
else if (d3d12_pipeline_state_is_compute(state))
{
if (state->compute.identifier.identifierSize)
{
vk_blob_size += VKD3D_PIPELINE_BLOB_CHUNK_SIZE_RAW(state->compute.identifier.identifierSize);
vk_blob_size += VKD3D_PIPELINE_BLOB_CHUNK_SIZE(shader_meta);
}
}
}
total_size += vk_blob_size;
if (blob && *size < total_size)
@ -1084,7 +1189,13 @@ VkResult vkd3d_serialize_pipeline_state(struct d3d12_pipeline_library *pipeline_
blob->vkd3d_shader_interface_key = state->device->shader_interface_key;
blob->vkd3d_build = vkd3d_build;
if (!pipeline_library || (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_USE_PIPELINE_CACHE_UUID))
if (pipeline_library && (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_SHADER_IDENTIFIER))
{
memcpy(blob->cache_uuid,
pipeline_library->device->device_info.shader_module_identifier_properties.shaderModuleIdentifierAlgorithmUUID,
VK_UUID_SIZE);
}
else if (!pipeline_library || (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_USE_PIPELINE_CACHE_UUID))
memcpy(blob->cache_uuid, device_properties->pipelineCacheUUID, VK_UUID_SIZE);
else
memset(blob->cache_uuid, 0, VK_UUID_SIZE);
@ -1573,10 +1684,11 @@ static HRESULT d3d12_pipeline_library_load_pipeline(struct d3d12_pipeline_librar
if (root_signature)
pipeline_cache_compat.root_signature_compat_hash = root_signature->compatibility_hash;
}
else if (!cached_state->private_root_signature)
else if (cached_state->root_signature_compat_hash_is_dxbc_derived)
{
/* If we have no explicit root signature and the existing PSO didn't either,
* just inherit the compat hash from PSO to avoid comparing them. */
* just inherit the compat hash from PSO to avoid comparing them.
* The hash depends entirely on the DXBC blob either way. */
pipeline_cache_compat.root_signature_compat_hash = cached_state->pipeline_cache_compat.root_signature_compat_hash;
}
@ -1770,7 +1882,14 @@ static void d3d12_pipeline_library_serialize_stream_archive_header(struct d3d12_
header->reserved = 0;
header->vkd3d_build = vkd3d_build;
header->vkd3d_shader_interface_key = pipeline_library->device->shader_interface_key;
if (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_USE_PIPELINE_CACHE_UUID)
if (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_SHADER_IDENTIFIER)
{
memcpy(header->cache_uuid,
pipeline_library->device->device_info.shader_module_identifier_properties.shaderModuleIdentifierAlgorithmUUID,
VK_UUID_SIZE);
}
else if (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_USE_PIPELINE_CACHE_UUID)
memcpy(header->cache_uuid, device_properties->pipelineCacheUUID, VK_UUID_SIZE);
else
memset(header->cache_uuid, 0, VK_UUID_SIZE);
@ -1808,7 +1927,13 @@ static HRESULT d3d12_pipeline_library_serialize(struct d3d12_pipeline_library *p
header->vkd3d_build = vkd3d_build;
header->vkd3d_shader_interface_key = pipeline_library->device->shader_interface_key;
if (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_USE_PIPELINE_CACHE_UUID)
if (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_SHADER_IDENTIFIER)
{
memcpy(header->cache_uuid,
pipeline_library->device->device_info.shader_module_identifier_properties.shaderModuleIdentifierAlgorithmUUID,
VK_UUID_SIZE);
}
else if (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_USE_PIPELINE_CACHE_UUID)
memcpy(header->cache_uuid, device_properties->pipelineCacheUUID, VK_UUID_SIZE);
else
memset(header->cache_uuid, 0, VK_UUID_SIZE);
@ -2010,6 +2135,11 @@ static HRESULT d3d12_pipeline_library_validate_stream_format_header(struct d3d12
if (memcmp(header->cache_uuid, device_properties->pipelineCacheUUID, VK_UUID_SIZE) != 0)
return D3D12_ERROR_DRIVER_VERSION_MISMATCH;
if (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_SHADER_IDENTIFIER)
if (memcmp(header->cache_uuid, device->device_info.shader_module_identifier_properties.shaderModuleIdentifierAlgorithmUUID,
VK_UUID_SIZE) != 0)
return D3D12_ERROR_DRIVER_VERSION_MISMATCH;
return S_OK;
}
@ -2192,6 +2322,17 @@ static HRESULT d3d12_pipeline_library_read_blob_toc_format(struct d3d12_pipeline
}
}
if (pipeline_library->flags & VKD3D_PIPELINE_LIBRARY_FLAG_SHADER_IDENTIFIER)
{
if (memcmp(header->cache_uuid, device->device_info.shader_module_identifier_properties.shaderModuleIdentifierAlgorithmUUID,
VK_UUID_SIZE) != 0)
{
if (vkd3d_config_flags & VKD3D_CONFIG_FLAG_PIPELINE_LIBRARY_LOG)
INFO("Rejecting pipeline library due to shaderModuleIdentifierAlgorithmUUID mismatch.\n");
return D3D12_ERROR_DRIVER_VERSION_MISMATCH;
}
}
total_toc_entries = header->pipeline_count + header->spirv_count + header->driver_cache_count;
header_entry_size = offsetof(struct vkd3d_serialized_pipeline_library_toc, entries) +
@ -2271,6 +2412,11 @@ static HRESULT d3d12_pipeline_library_init(struct d3d12_pipeline_library *pipeli
pipeline_library->internal_refcount = 1;
pipeline_library->flags = flags;
/* Mutually exclusive features. */
if ((flags & VKD3D_PIPELINE_LIBRARY_FLAG_USE_PIPELINE_CACHE_UUID) &&
(flags & VKD3D_PIPELINE_LIBRARY_FLAG_SHADER_IDENTIFIER))
return E_INVALIDARG;
if (!blob_length && blob)
return E_INVALIDARG;
@ -3004,7 +3150,9 @@ HRESULT vkd3d_pipeline_library_init_disk_cache(struct vkd3d_pipeline_library_dis
if (!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_SHADER_CACHE_SYNC))
flags |= VKD3D_PIPELINE_LIBRARY_FLAG_STREAM_ARCHIVE_PARSE_ASYNC;
if (!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_PIPELINE_LIBRARY_NO_SERIALIZE_SPIRV))
if (device->device_info.shader_module_identifier_features.shaderModuleIdentifier)
flags |= VKD3D_PIPELINE_LIBRARY_FLAG_SHADER_IDENTIFIER;
else if (!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_PIPELINE_LIBRARY_NO_SERIALIZE_SPIRV))
flags |= VKD3D_PIPELINE_LIBRARY_FLAG_SAVE_FULL_SPIRV;
/* For internal caches, we're mostly just concerned with caching SPIR-V.

View File

@ -115,6 +115,8 @@ static const struct vkd3d_optional_extension_info optional_device_extensions[] =
VK_EXTENSION(EXT_SHADER_IMAGE_ATOMIC_INT64, EXT_shader_image_atomic_int64),
VK_EXTENSION(EXT_SCALAR_BLOCK_LAYOUT, EXT_scalar_block_layout),
VK_EXTENSION(EXT_PIPELINE_CREATION_FEEDBACK, EXT_pipeline_creation_feedback),
VK_EXTENSION(EXT_PIPELINE_CREATION_CACHE_CONTROL, EXT_pipeline_creation_cache_control),
VK_EXTENSION(EXT_SHADER_MODULE_IDENTIFIER, EXT_shader_module_identifier),
/* AMD extensions */
VK_EXTENSION(AMD_BUFFER_MARKER, AMD_buffer_marker),
VK_EXTENSION(AMD_DEVICE_COHERENT_MEMORY, AMD_device_coherent_memory),
@ -1490,6 +1492,23 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i
vk_prepend_struct(&info->features2, &info->device_coherent_memory_features_amd);
}
if (vulkan_info->EXT_pipeline_creation_cache_control)
{
info->pipeline_creation_cache_control_features.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES;
vk_prepend_struct(&info->features2, &info->pipeline_creation_cache_control_features);
}
if (vulkan_info->EXT_shader_module_identifier)
{
info->shader_module_identifier_features.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT;
info->shader_module_identifier_properties.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT;
vk_prepend_struct(&info->features2, &info->shader_module_identifier_features);
vk_prepend_struct(&info->properties2, &info->shader_module_identifier_properties);
}
/* Core in Vulkan 1.1. */
info->shader_draw_parameters_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES;
vk_prepend_struct(&info->features2, &info->shader_draw_parameters_features);

File diff suppressed because it is too large Load Diff

View File

@ -160,6 +160,8 @@ struct vkd3d_vulkan_info
bool EXT_shader_image_atomic_int64;
bool EXT_scalar_block_layout;
bool EXT_pipeline_creation_feedback;
bool EXT_pipeline_creation_cache_control;
bool EXT_shader_module_identifier;
/* AMD device extensions */
bool AMD_buffer_marker;
bool AMD_device_coherent_memory;
@ -1471,13 +1473,31 @@ enum vkd3d_plane_optimal_flag
VKD3D_DEPTH_STENCIL_PLANE_GENERAL = (1 << 2),
};
struct d3d12_graphics_pipeline_state_cached_desc
{
/* Information needed to compile to SPIR-V. */
unsigned int ps_output_swizzle[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT];
struct vkd3d_shader_parameter ps_shader_parameters[1];
bool is_dual_source_blending;
VkShaderStageFlagBits xfb_stage;
struct vkd3d_shader_transform_feedback_info *xfb_info;
D3D12_SHADER_BYTECODE bytecode[VKD3D_MAX_SHADER_STAGES];
VkShaderStageFlagBits bytecode_stages[VKD3D_MAX_SHADER_STAGES];
uint32_t bytecode_duped_mask;
};
struct d3d12_graphics_pipeline_state
{
struct vkd3d_shader_debug_ring_spec_info spec_info[VKD3D_MAX_SHADER_STAGES];
VkPipelineShaderStageCreateInfo stages[VKD3D_MAX_SHADER_STAGES];
struct vkd3d_shader_code code[VKD3D_MAX_SHADER_STAGES];
VkShaderModuleIdentifierEXT identifiers[VKD3D_MAX_SHADER_STAGES];
VkPipelineShaderStageModuleIdentifierCreateInfoEXT identifier_create_infos[VKD3D_MAX_SHADER_STAGES];
size_t stage_count;
struct d3d12_graphics_pipeline_state_cached_desc cached_desc;
VkVertexInputAttributeDescription attributes[D3D12_VS_INPUT_REGISTER_COUNT];
VkVertexInputRate input_rates[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
VkVertexInputBindingDivisorDescriptionEXT instance_divisors[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
@ -1528,6 +1548,8 @@ struct d3d12_compute_pipeline_state
{
VkPipeline vk_pipeline;
struct vkd3d_shader_code code;
VkShaderModuleIdentifierEXT identifier;
VkPipelineShaderStageModuleIdentifierCreateInfoEXT identifier_create_info;
};
/* To be able to load a pipeline from cache, this information must match exactly,
@ -1553,11 +1575,13 @@ struct d3d12_pipeline_state
};
VkPipelineBindPoint vk_bind_point;
VkPipelineCache vk_pso_cache;
spinlock_t lock;
rwlock_t lock;
struct vkd3d_pipeline_cache_compatibility pipeline_cache_compat;
struct d3d12_root_signature *private_root_signature;
struct d3d12_root_signature *root_signature;
struct d3d12_device *device;
bool root_signature_compat_hash_is_dxbc_derived;
bool pso_is_loaded_from_cached_blob;
struct vkd3d_private_store private_store;
};
@ -1748,6 +1772,7 @@ enum vkd3d_pipeline_library_flags
VKD3D_PIPELINE_LIBRARY_FLAG_STREAM_ARCHIVE = 1 << 4,
/* We expect to parse archive from thread, so consider thread safety and cancellation points. */
VKD3D_PIPELINE_LIBRARY_FLAG_STREAM_ARCHIVE_PARSE_ASYNC = 1 << 5,
VKD3D_PIPELINE_LIBRARY_FLAG_SHADER_IDENTIFIER = 1 << 6,
};
HRESULT d3d12_pipeline_library_create(struct d3d12_device *device, const void *blob,
@ -1761,7 +1786,8 @@ HRESULT vkd3d_create_pipeline_cache_from_d3d12_desc(struct d3d12_device *device,
HRESULT vkd3d_get_cached_spirv_code_from_d3d12_desc(
const struct d3d12_cached_pipeline_state *state,
VkShaderStageFlagBits stage,
struct vkd3d_shader_code *spirv_code);
struct vkd3d_shader_code *spirv_code,
VkPipelineShaderStageModuleIdentifierCreateInfoEXT *identifier);
VkResult vkd3d_serialize_pipeline_state(struct d3d12_pipeline_library *pipeline_library,
const struct d3d12_pipeline_state *state, size_t *size, void *data);
HRESULT d3d12_cached_pipeline_state_validate(struct d3d12_device *device,
@ -3149,6 +3175,7 @@ struct vkd3d_physical_device_info
VkPhysicalDeviceDriverPropertiesKHR driver_properties;
VkPhysicalDeviceMaintenance4PropertiesKHR maintenance4_properties;
VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV device_generated_commands_properties_nv;
VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT shader_module_identifier_properties;
VkPhysicalDeviceProperties2KHR properties2;
@ -3194,6 +3221,8 @@ struct vkd3d_physical_device_info
VkPhysicalDeviceMaintenance4FeaturesKHR maintenance4_features;
VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR ray_tracing_maintenance1_features;
VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV device_generated_commands_features_nv;
VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT pipeline_creation_cache_control_features;
VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT shader_module_identifier_features;
VkPhysicalDeviceFeatures2 features2;

View File

@ -311,6 +311,10 @@ VK_DEVICE_EXT_PFN(vkDestroyIndirectCommandsLayoutNV)
VK_DEVICE_EXT_PFN(vkGetGeneratedCommandsMemoryRequirementsNV)
VK_DEVICE_EXT_PFN(vkCmdExecuteGeneratedCommandsNV)
/* VK_EXT_shader_module_identifier */
VK_DEVICE_EXT_PFN(vkGetShaderModuleIdentifierEXT)
VK_DEVICE_EXT_PFN(vkGetShaderModuleCreateInfoIdentifierEXT)
#undef VK_INSTANCE_PFN
#undef VK_INSTANCE_EXT_PFN
#undef VK_DEVICE_PFN

@ -1 +1 @@
Subproject commit 245d25ce8c3337919dc7916d0e62e31a0d8748ab
Subproject commit 2c823b7f27590ec0a489f7fbe14b154e13fa5cfb