Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HansKristian-Work/vkd3d-proton.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2022-03-18 17:50:00 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2022-09-13 17:04:58 +0300
commitcbad3d27b5520086e18ab8bcc6dcd7b7c36714e5 (patch)
treea6f92d37b46bed724fa257a34413c12e7da2fb02
parentcd61a1091d1c2c639b55a469b31676943fbf368d (diff)
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>
-rw-r--r--libs/vkd3d/cache.c5
-rw-r--r--libs/vkd3d/state.c38
-rw-r--r--libs/vkd3d/vkd3d_private.h3
3 files changed, 22 insertions, 24 deletions
diff --git a/libs/vkd3d/cache.c b/libs/vkd3d/cache.c
index 7df66ff3..eef6ebd8 100644
--- a/libs/vkd3d/cache.c
+++ b/libs/vkd3d/cache.c
@@ -1573,10 +1573,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;
}
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index e659c301..d1f6c66e 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -2020,8 +2020,8 @@ void d3d12_pipeline_state_dec_ref(struct d3d12_pipeline_state *state)
VK_CALL(vkDestroyPipelineCache(device->vk_device, state->vk_pso_cache, NULL));
- if (state->private_root_signature)
- d3d12_root_signature_dec_ref(state->private_root_signature);
+ if (state->root_signature)
+ d3d12_root_signature_dec_ref(state->root_signature);
vkd3d_free(state);
}
@@ -2399,11 +2399,7 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
HRESULT hr;
state->pipeline_type = VKD3D_PIPELINE_TYPE_COMPUTE;
-
- if (desc->root_signature)
- root_signature = impl_from_ID3D12RootSignature(desc->root_signature);
- else
- root_signature = state->private_root_signature;
+ root_signature = state->root_signature;
memset(&shader_interface, 0, sizeof(shader_interface));
shader_interface.flags = d3d12_root_signature_get_shader_interface_flags(root_signature);
@@ -3172,10 +3168,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
}
}
- if (desc->root_signature)
- root_signature = impl_from_ID3D12RootSignature(desc->root_signature);
- else
- root_signature = state->private_root_signature;
+ root_signature = state->root_signature;
sample_count = vk_samples_from_dxgi_sample_desc(&desc->sample_desc);
if (desc->sample_desc.Count != 1 && desc->sample_desc.Quality)
@@ -3824,7 +3817,6 @@ HRESULT d3d12_pipeline_state_create(struct d3d12_device *device, VkPipelineBindP
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
const struct d3d12_cached_pipeline_state *desc_cached_pso;
struct d3d12_cached_pipeline_state cached_pso;
- struct d3d12_root_signature *root_signature;
struct d3d12_pipeline_state *object;
HRESULT hr;
@@ -3836,20 +3828,24 @@ HRESULT d3d12_pipeline_state_create(struct d3d12_device *device, VkPipelineBindP
if (!desc->root_signature)
{
if (FAILED(hr = d3d12_pipeline_create_private_root_signature(device,
- bind_point, desc, &object->private_root_signature)))
+ bind_point, desc, &object->root_signature)))
{
ERR("No root signature for pipeline.\n");
vkd3d_free(object);
return hr;
}
- root_signature = object->private_root_signature;
+ object->root_signature_compat_hash_is_dxbc_derived = true;
}
else
- root_signature = impl_from_ID3D12RootSignature(desc->root_signature);
+ {
+ object->root_signature = impl_from_ID3D12RootSignature(desc->root_signature);
+ /* Hold a private reference on this root signature in case we have to create fallback PSOs. */
+ d3d12_root_signature_inc_ref(object->root_signature);
+ }
vkd3d_pipeline_cache_compat_from_state_desc(&object->pipeline_cache_compat, desc);
- if (root_signature)
- object->pipeline_cache_compat.root_signature_compat_hash = root_signature->compatibility_hash;
+ if (object->root_signature)
+ object->pipeline_cache_compat.root_signature_compat_hash = object->root_signature->compatibility_hash;
desc_cached_pso = &desc->cached_pso;
@@ -3858,8 +3854,8 @@ HRESULT d3d12_pipeline_state_create(struct d3d12_device *device, VkPipelineBindP
if (FAILED(hr = d3d12_cached_pipeline_state_validate(device, &desc->cached_pso,
&object->pipeline_cache_compat)))
{
- if (object->private_root_signature)
- d3d12_root_signature_dec_ref(object->private_root_signature);
+ if (object->root_signature)
+ d3d12_root_signature_dec_ref(object->root_signature);
vkd3d_free(object);
return hr;
}
@@ -3911,8 +3907,8 @@ HRESULT d3d12_pipeline_state_create(struct d3d12_device *device, VkPipelineBindP
if (FAILED(hr))
{
- if (object->private_root_signature)
- d3d12_root_signature_dec_ref(object->private_root_signature);
+ if (object->root_signature)
+ d3d12_root_signature_dec_ref(object->root_signature);
d3d12_pipeline_state_free_spirv_code(object);
d3d12_pipeline_state_destroy_shader_modules(object, device);
VK_CALL(vkDestroyPipelineCache(device->vk_device, object->vk_pso_cache, NULL));
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index d892c4cd..0325a903 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -1670,8 +1670,9 @@ struct d3d12_pipeline_state
spinlock_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;
struct vkd3d_private_store private_store;
};