From de2956d4d53a737f4f64213276acde748fe41fc1 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Tue, 4 Oct 2022 17:10:04 +0200 Subject: vkd3d: Add a workaround to force initial placed transitions. Many games seem to get this wrong, since it happens to work on native drivers. Signed-off-by: Hans-Kristian Arntzen --- include/vkd3d.h | 1 + libs/vkd3d/device.c | 3 +++ libs/vkd3d/resource.c | 7 +++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/vkd3d.h b/include/vkd3d.h index b0817a04..0445d9b9 100644 --- a/include/vkd3d.h +++ b/include/vkd3d.h @@ -93,6 +93,7 @@ extern "C" { #define VKD3D_CONFIG_FLAG_FORCE_NATIVE_FP16 (1ull << 31) #define VKD3D_CONFIG_FLAG_USE_HOST_IMPORT_FALLBACK (1ull << 32) #define VKD3D_CONFIG_FLAG_PREALLOCATE_SRV_MIP_CLAMPS (1ull << 33) +#define VKD3D_CONFIG_FLAG_FORCE_INITIAL_TRANSITION (1ull << 34) typedef HRESULT (*PFN_vkd3d_signal_event)(HANDLE event); diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index b9ad3afe..ff039dc3 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -557,6 +557,8 @@ static const struct vkd3d_instance_application_meta application_override[] = { * Control.exe is the launcher - it doesn't dispaly anything and defaults to DX11 if DXR is not supported. */ { VKD3D_STRING_COMPARE_EXACT, "Control.exe", VKD3D_CONFIG_FLAG_DXR, 0 }, { VKD3D_STRING_COMPARE_EXACT, "Control_DX12.exe", VKD3D_CONFIG_FLAG_DXR, 0 }, + /* Lost Judgment (2058190) */ + { VKD3D_STRING_COMPARE_EXACT, "LostJudgment.exe", VKD3D_CONFIG_FLAG_FORCE_INITIAL_TRANSITION, 0 }, { VKD3D_STRING_COMPARE_NEVER, NULL, 0, 0 } }; @@ -720,6 +722,7 @@ static const struct vkd3d_debug_option vkd3d_config_options[] = {"allow_sbt_collection", VKD3D_CONFIG_FLAG_ALLOW_SBT_COLLECTION}, {"host_import_fallback", VKD3D_CONFIG_FLAG_USE_HOST_IMPORT_FALLBACK}, {"preallocate_srv_mip_clamps", VKD3D_CONFIG_FLAG_PREALLOCATE_SRV_MIP_CLAMPS}, + {"force_initial_transition", VKD3D_CONFIG_FLAG_FORCE_INITIAL_TRANSITION}, }; static void vkd3d_config_flags_init_once(void) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 41c29b51..80c1f400 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -3024,11 +3024,14 @@ HRESULT d3d12_resource_create_placed(struct d3d12_device *device, const D3D12_RE * https://docs.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createplacedresource#notes-on-the-required-resource-initialization. */ if (desc->Flags & (D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET | D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL)) { + if (!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_FORCE_INITIAL_TRANSITION)) + { #ifdef VKD3D_ENABLE_BREADCRUMBS - object->initial_layout_transition_validate_only = true; + object->initial_layout_transition_validate_only = true; #else - object->initial_layout_transition = 0; + object->initial_layout_transition = 0; #endif + } } *resource = object; -- cgit v1.2.3