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-21 13:29:22 +0300
committerHans-Kristian Arntzen <post@arntzen-software.no>2022-09-14 13:52:31 +0300
commit7394ab8266f99640a9397774aaf6b844f2350f93 (patch)
treedaef15d2f08ae1cccc0cefac75c4c9854f46b39e
parent7bac2e613e39c3b51bec99f4a91d4ef334111c65 (diff)
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>
-rw-r--r--libs/vkd3d/state.c47
1 files changed, 19 insertions, 28 deletions
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 4b1cc16c..13d3ad3d 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -2521,15 +2521,6 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
d3d12_pipeline_state_init_shader_interface(state, device,
VK_SHADER_STAGE_COMPUTE_BIT, &shader_interface);
- if (!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_GLOBAL_PIPELINE_CACHE))
- {
- if ((hr = vkd3d_create_pipeline_cache_from_d3d12_desc(device, cached_pso, &state->vk_pso_cache)) < 0)
- {
- ERR("Failed to create pipeline cache, hr %d.\n", hr);
- return hr;
- }
- }
-
vkd3d_load_spirv_from_cached_state(device, cached_pso,
VK_SHADER_STAGE_COMPUTE_BIT, &state->compute.code);
@@ -3783,15 +3774,6 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
if (can_compile_pipeline_early)
{
- if (!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_GLOBAL_PIPELINE_CACHE))
- {
- if ((hr = vkd3d_create_pipeline_cache_from_d3d12_desc(device, cached_pso, &state->vk_pso_cache)) < 0)
- {
- ERR("Failed to create pipeline cache, hr %d.\n", hr);
- goto fail;
- }
- }
-
if (!(graphics->pipeline = d3d12_pipeline_state_create_pipeline_variant(state, NULL, graphics->dsv_format,
state->vk_pso_cache, &graphics->dynamic_state_flags)))
goto fail;
@@ -3933,19 +3915,28 @@ HRESULT d3d12_pipeline_state_create(struct d3d12_device *device, VkPipelineBindP
object->refcount = 1;
object->internal_refcount = 1;
- switch (bind_point)
+ hr = S_OK;
+
+ if (!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_GLOBAL_PIPELINE_CACHE))
+ if (FAILED(hr = vkd3d_create_pipeline_cache_from_d3d12_desc(device, &desc->cached_pso, &object->vk_pso_cache)))
+ ERR("Failed to create pipeline cache, hr %d.\n", hr);
+
+ if (SUCCEEDED(hr))
{
- case VK_PIPELINE_BIND_POINT_COMPUTE:
- hr = d3d12_pipeline_state_init_compute(object, device, desc, desc_cached_pso);
- break;
+ switch (bind_point)
+ {
+ case VK_PIPELINE_BIND_POINT_COMPUTE:
+ hr = d3d12_pipeline_state_init_compute(object, device, desc, desc_cached_pso);
+ break;
- case VK_PIPELINE_BIND_POINT_GRAPHICS:
- hr = d3d12_pipeline_state_init_graphics(object, device, desc, desc_cached_pso);
- break;
+ case VK_PIPELINE_BIND_POINT_GRAPHICS:
+ hr = d3d12_pipeline_state_init_graphics(object, device, desc, desc_cached_pso);
+ break;
- default:
- ERR("Invalid pipeline type %u.", bind_point);
- hr = E_INVALIDARG;
+ default:
+ ERR("Invalid pipeline type %u.", bind_point);
+ hr = E_INVALIDARG;
+ }
}
if (FAILED(hr))