Compare commits
19 Commits
master
...
shader-mod
Author | SHA1 | Date |
---|---|---|
Hans-Kristian Arntzen | fc69f469d5 | |
Hans-Kristian Arntzen | 4d708bd7fe | |
Hans-Kristian Arntzen | d9dc4b862a | |
Hans-Kristian Arntzen | b42caa0bff | |
Hans-Kristian Arntzen | b0a706cb4e | |
Hans-Kristian Arntzen | f510e92f6e | |
Hans-Kristian Arntzen | 0123e5fe5c | |
Hans-Kristian Arntzen | 131ff90ca3 | |
Hans-Kristian Arntzen | 7f758e5904 | |
Hans-Kristian Arntzen | 4384b708d7 | |
Hans-Kristian Arntzen | f16875d195 | |
Hans-Kristian Arntzen | ef7924ce86 | |
Hans-Kristian Arntzen | a098cce48a | |
Hans-Kristian Arntzen | 73fa8b9588 | |
Hans-Kristian Arntzen | dc45142b93 | |
Hans-Kristian Arntzen | f816eeb60e | |
Hans-Kristian Arntzen | b387def67c | |
Hans-Kristian Arntzen | 1495ead2c4 | |
Hans-Kristian Arntzen | e438c42da0 |
|
@ -1,6 +1,6 @@
|
||||||
#ifndef __VULKAN_PRIVATE_EXTENSIONS_H__
|
#ifndef __VULKAN_PRIVATE_EXTENSIONS_H__
|
||||||
#define __VULKAN_PRIVATE_EXTENSIONS_H__
|
#define __VULKAN_PRIVATE_EXTENSIONS_H__
|
||||||
|
|
||||||
/* Nothing here at the moment. Add hacks here! */
|
/* Add hacks here! */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -198,6 +198,8 @@ enum vkd3d_pipeline_blob_chunk_type
|
||||||
/* VkShaderStage is stored in upper 16 bits. */
|
/* VkShaderStage is stored in upper 16 bits. */
|
||||||
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_SHADER_META = 4,
|
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_SHADER_META = 4,
|
||||||
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_PSO_COMPAT = 5,
|
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_TYPE_MASK = 0xffff,
|
||||||
VKD3D_PIPELINE_BLOB_CHUNK_INDEX_SHIFT = 16,
|
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)
|
if (memcmp(blob->cache_uuid, device_properties->pipelineCacheUUID, VK_UUID_SIZE) != 0)
|
||||||
return D3D12_ERROR_DRIVER_VERSION_MISMATCH;
|
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.
|
/* In stream archives, we perform checksums ahead of time before accepting a stream blob into internal cache.
|
||||||
* No need to do redundant work. */
|
* No need to do redundant work. */
|
||||||
if (!(pipeline_library_flags & VKD3D_PIPELINE_LIBRARY_FLAG_STREAM_ARCHIVE))
|
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))
|
VKD3D_PIPELINE_BLOB_CHUNK_TYPE_MASK))
|
||||||
return false;
|
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;
|
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(
|
HRESULT vkd3d_get_cached_spirv_code_from_d3d12_desc(
|
||||||
const struct d3d12_cached_pipeline_state *state,
|
const struct d3d12_cached_pipeline_state *state,
|
||||||
VkShaderStageFlagBits stage,
|
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 *blob = state->blob.pCachedBlob;
|
||||||
const struct vkd3d_pipeline_blob_chunk_shader_meta *meta;
|
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);
|
meta = CONST_CAST_CHUNK_DATA(chunk, shader_meta);
|
||||||
memcpy(&spirv_code->meta, &meta->meta, sizeof(meta->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. */
|
/* Aim to pull SPIR-V either from inlined chunk, or a link. */
|
||||||
chunk = find_blob_chunk(CONST_CAST_CHUNK_BASE(blob), payload_size,
|
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));
|
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;
|
*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,
|
static void vkd3d_shader_code_serialize_referenced(struct d3d12_pipeline_library *pipeline_library,
|
||||||
const struct vkd3d_shader_code *code,
|
const struct vkd3d_shader_code *code,
|
||||||
VkShaderStageFlagBits stage, size_t varint_size,
|
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);
|
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,
|
for (i = 0; i < state->graphics.stage_count; i++)
|
||||||
varint_size[i], &chunk);
|
{
|
||||||
|
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;
|
return VK_SUCCESS;
|
||||||
|
@ -994,7 +1053,8 @@ static VkResult vkd3d_serialize_pipeline_state_referenced(struct d3d12_pipeline_
|
||||||
chunk = finish_and_iterate_blob_chunk(chunk);
|
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))
|
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;
|
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);
|
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))
|
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;
|
total_size += vk_blob_size;
|
||||||
|
|
||||||
if (blob && *size < total_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_shader_interface_key = state->device->shader_interface_key;
|
||||||
blob->vkd3d_build = vkd3d_build;
|
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);
|
memcpy(blob->cache_uuid, device_properties->pipelineCacheUUID, VK_UUID_SIZE);
|
||||||
else
|
else
|
||||||
memset(blob->cache_uuid, 0, VK_UUID_SIZE);
|
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)
|
if (root_signature)
|
||||||
pipeline_cache_compat.root_signature_compat_hash = root_signature->compatibility_hash;
|
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,
|
/* 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;
|
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->reserved = 0;
|
||||||
header->vkd3d_build = vkd3d_build;
|
header->vkd3d_build = vkd3d_build;
|
||||||
header->vkd3d_shader_interface_key = pipeline_library->device->shader_interface_key;
|
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);
|
memcpy(header->cache_uuid, device_properties->pipelineCacheUUID, VK_UUID_SIZE);
|
||||||
else
|
else
|
||||||
memset(header->cache_uuid, 0, VK_UUID_SIZE);
|
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_build = vkd3d_build;
|
||||||
header->vkd3d_shader_interface_key = pipeline_library->device->shader_interface_key;
|
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);
|
memcpy(header->cache_uuid, device_properties->pipelineCacheUUID, VK_UUID_SIZE);
|
||||||
else
|
else
|
||||||
memset(header->cache_uuid, 0, VK_UUID_SIZE);
|
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)
|
if (memcmp(header->cache_uuid, device_properties->pipelineCacheUUID, VK_UUID_SIZE) != 0)
|
||||||
return D3D12_ERROR_DRIVER_VERSION_MISMATCH;
|
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;
|
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;
|
total_toc_entries = header->pipeline_count + header->spirv_count + header->driver_cache_count;
|
||||||
|
|
||||||
header_entry_size = offsetof(struct vkd3d_serialized_pipeline_library_toc, entries) +
|
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->internal_refcount = 1;
|
||||||
pipeline_library->flags = flags;
|
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)
|
if (!blob_length && blob)
|
||||||
return E_INVALIDARG;
|
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))
|
if (!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_SHADER_CACHE_SYNC))
|
||||||
flags |= VKD3D_PIPELINE_LIBRARY_FLAG_STREAM_ARCHIVE_PARSE_ASYNC;
|
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;
|
flags |= VKD3D_PIPELINE_LIBRARY_FLAG_SAVE_FULL_SPIRV;
|
||||||
|
|
||||||
/* For internal caches, we're mostly just concerned with caching SPIR-V.
|
/* For internal caches, we're mostly just concerned with caching SPIR-V.
|
||||||
|
|
|
@ -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_SHADER_IMAGE_ATOMIC_INT64, EXT_shader_image_atomic_int64),
|
||||||
VK_EXTENSION(EXT_SCALAR_BLOCK_LAYOUT, EXT_scalar_block_layout),
|
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_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 */
|
/* AMD extensions */
|
||||||
VK_EXTENSION(AMD_BUFFER_MARKER, AMD_buffer_marker),
|
VK_EXTENSION(AMD_BUFFER_MARKER, AMD_buffer_marker),
|
||||||
VK_EXTENSION(AMD_DEVICE_COHERENT_MEMORY, AMD_device_coherent_memory),
|
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);
|
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. */
|
/* Core in Vulkan 1.1. */
|
||||||
info->shader_draw_parameters_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES;
|
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);
|
vk_prepend_struct(&info->features2, &info->shader_draw_parameters_features);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -160,6 +160,8 @@ struct vkd3d_vulkan_info
|
||||||
bool EXT_shader_image_atomic_int64;
|
bool EXT_shader_image_atomic_int64;
|
||||||
bool EXT_scalar_block_layout;
|
bool EXT_scalar_block_layout;
|
||||||
bool EXT_pipeline_creation_feedback;
|
bool EXT_pipeline_creation_feedback;
|
||||||
|
bool EXT_pipeline_creation_cache_control;
|
||||||
|
bool EXT_shader_module_identifier;
|
||||||
/* AMD device extensions */
|
/* AMD device extensions */
|
||||||
bool AMD_buffer_marker;
|
bool AMD_buffer_marker;
|
||||||
bool AMD_device_coherent_memory;
|
bool AMD_device_coherent_memory;
|
||||||
|
@ -1471,13 +1473,31 @@ enum vkd3d_plane_optimal_flag
|
||||||
VKD3D_DEPTH_STENCIL_PLANE_GENERAL = (1 << 2),
|
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 d3d12_graphics_pipeline_state
|
||||||
{
|
{
|
||||||
struct vkd3d_shader_debug_ring_spec_info spec_info[VKD3D_MAX_SHADER_STAGES];
|
struct vkd3d_shader_debug_ring_spec_info spec_info[VKD3D_MAX_SHADER_STAGES];
|
||||||
VkPipelineShaderStageCreateInfo stages[VKD3D_MAX_SHADER_STAGES];
|
VkPipelineShaderStageCreateInfo stages[VKD3D_MAX_SHADER_STAGES];
|
||||||
struct vkd3d_shader_code code[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;
|
size_t stage_count;
|
||||||
|
|
||||||
|
struct d3d12_graphics_pipeline_state_cached_desc cached_desc;
|
||||||
|
|
||||||
VkVertexInputAttributeDescription attributes[D3D12_VS_INPUT_REGISTER_COUNT];
|
VkVertexInputAttributeDescription attributes[D3D12_VS_INPUT_REGISTER_COUNT];
|
||||||
VkVertexInputRate input_rates[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
|
VkVertexInputRate input_rates[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
|
||||||
VkVertexInputBindingDivisorDescriptionEXT instance_divisors[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;
|
VkPipeline vk_pipeline;
|
||||||
struct vkd3d_shader_code code;
|
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,
|
/* 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;
|
VkPipelineBindPoint vk_bind_point;
|
||||||
VkPipelineCache vk_pso_cache;
|
VkPipelineCache vk_pso_cache;
|
||||||
spinlock_t lock;
|
rwlock_t lock;
|
||||||
|
|
||||||
struct vkd3d_pipeline_cache_compatibility pipeline_cache_compat;
|
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;
|
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;
|
struct vkd3d_private_store private_store;
|
||||||
};
|
};
|
||||||
|
@ -1748,6 +1772,7 @@ enum vkd3d_pipeline_library_flags
|
||||||
VKD3D_PIPELINE_LIBRARY_FLAG_STREAM_ARCHIVE = 1 << 4,
|
VKD3D_PIPELINE_LIBRARY_FLAG_STREAM_ARCHIVE = 1 << 4,
|
||||||
/* We expect to parse archive from thread, so consider thread safety and cancellation points. */
|
/* 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_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,
|
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(
|
HRESULT vkd3d_get_cached_spirv_code_from_d3d12_desc(
|
||||||
const struct d3d12_cached_pipeline_state *state,
|
const struct d3d12_cached_pipeline_state *state,
|
||||||
VkShaderStageFlagBits stage,
|
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,
|
VkResult vkd3d_serialize_pipeline_state(struct d3d12_pipeline_library *pipeline_library,
|
||||||
const struct d3d12_pipeline_state *state, size_t *size, void *data);
|
const struct d3d12_pipeline_state *state, size_t *size, void *data);
|
||||||
HRESULT d3d12_cached_pipeline_state_validate(struct d3d12_device *device,
|
HRESULT d3d12_cached_pipeline_state_validate(struct d3d12_device *device,
|
||||||
|
@ -3149,6 +3175,7 @@ struct vkd3d_physical_device_info
|
||||||
VkPhysicalDeviceDriverPropertiesKHR driver_properties;
|
VkPhysicalDeviceDriverPropertiesKHR driver_properties;
|
||||||
VkPhysicalDeviceMaintenance4PropertiesKHR maintenance4_properties;
|
VkPhysicalDeviceMaintenance4PropertiesKHR maintenance4_properties;
|
||||||
VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV device_generated_commands_properties_nv;
|
VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV device_generated_commands_properties_nv;
|
||||||
|
VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT shader_module_identifier_properties;
|
||||||
|
|
||||||
VkPhysicalDeviceProperties2KHR properties2;
|
VkPhysicalDeviceProperties2KHR properties2;
|
||||||
|
|
||||||
|
@ -3194,6 +3221,8 @@ struct vkd3d_physical_device_info
|
||||||
VkPhysicalDeviceMaintenance4FeaturesKHR maintenance4_features;
|
VkPhysicalDeviceMaintenance4FeaturesKHR maintenance4_features;
|
||||||
VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR ray_tracing_maintenance1_features;
|
VkPhysicalDeviceRayTracingMaintenance1FeaturesKHR ray_tracing_maintenance1_features;
|
||||||
VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV device_generated_commands_features_nv;
|
VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV device_generated_commands_features_nv;
|
||||||
|
VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT pipeline_creation_cache_control_features;
|
||||||
|
VkPhysicalDeviceShaderModuleIdentifierFeaturesEXT shader_module_identifier_features;
|
||||||
|
|
||||||
VkPhysicalDeviceFeatures2 features2;
|
VkPhysicalDeviceFeatures2 features2;
|
||||||
|
|
||||||
|
|
|
@ -311,6 +311,10 @@ VK_DEVICE_EXT_PFN(vkDestroyIndirectCommandsLayoutNV)
|
||||||
VK_DEVICE_EXT_PFN(vkGetGeneratedCommandsMemoryRequirementsNV)
|
VK_DEVICE_EXT_PFN(vkGetGeneratedCommandsMemoryRequirementsNV)
|
||||||
VK_DEVICE_EXT_PFN(vkCmdExecuteGeneratedCommandsNV)
|
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_PFN
|
||||||
#undef VK_INSTANCE_EXT_PFN
|
#undef VK_INSTANCE_EXT_PFN
|
||||||
#undef VK_DEVICE_PFN
|
#undef VK_DEVICE_PFN
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 245d25ce8c3337919dc7916d0e62e31a0d8748ab
|
Subproject commit 2c823b7f27590ec0a489f7fbe14b154e13fa5cfb
|
Loading…
Reference in New Issue