vkd3d: Move F1 2020 workaround over to quirks system.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
Hans-Kristian Arntzen 2021-06-17 11:16:12 +02:00
parent 28c8a595fa
commit 1ea31701c5
6 changed files with 13 additions and 11 deletions

View File

@ -66,8 +66,7 @@ enum vkd3d_config_flags
VKD3D_CONFIG_FLAG_FORCE_STATIC_CBV = 0x00000008,
VKD3D_CONFIG_FLAG_DXR = 0x00000010,
VKD3D_CONFIG_FLAG_SINGLE_QUEUE = 0x00000020,
VKD3D_CONFIG_FLAG_FORCE_TGSM_BARRIERS = 0x00000040,
VKD3D_CONFIG_FLAG_DESCRIPTOR_QA_CHECKS = 0x00000080
VKD3D_CONFIG_FLAG_DESCRIPTOR_QA_CHECKS = 0x00000040
};
typedef HRESULT (*PFN_vkd3d_signal_event)(HANDLE event);

View File

@ -294,7 +294,11 @@ enum vkd3d_shader_quirk
* this is the pragmatic solution.
* Hoisting gradients is not possible in all cases,
* and would not be worth it until it's a widespread problem. */
VKD3D_SHADER_QUIRK_FORCE_EXPLICIT_LOD_IN_CONTROL_FLOW = (1 << 0)
VKD3D_SHADER_QUIRK_FORCE_EXPLICIT_LOD_IN_CONTROL_FLOW = (1 << 0),
/* After every write to group shared memory, force a memory barrier.
* This works around buggy games which forget to use barrier(). */
VKD3D_SHADER_QUIRK_FORCE_TGSM_BARRIERS = (1 << 1),
};
struct vkd3d_shader_quirk_hash
@ -324,7 +328,6 @@ struct vkd3d_shader_compile_arguments
const unsigned int *output_swizzles;
unsigned int output_swizzle_count;
uint64_t config_flags;
const struct vkd3d_shader_quirk_info *quirks;
};

View File

@ -9767,7 +9767,7 @@ static void vkd3d_dxbc_compiler_emit_store_tgsm(struct vkd3d_dxbc_compiler *comp
vkd3d_spirv_build_op_store(builder, ptr_id, data_id, SpvMemoryAccessMaskNone);
}
if (compiler->compile_args->config_flags & VKD3D_CONFIG_FLAG_FORCE_TGSM_BARRIERS)
if (vkd3d_dxbc_compiler_has_quirk(compiler, VKD3D_SHADER_QUIRK_FORCE_TGSM_BARRIERS))
vkd3d_dxbc_compiler_emit_tgsm_barrier(compiler);
}

View File

@ -416,8 +416,6 @@ struct vkd3d_instance_application_meta
uint64_t global_flags_remove;
};
static const struct vkd3d_instance_application_meta application_override[] = {
/* F1 2020 (1080110) */
{ "F1_2020_dx12.exe", VKD3D_CONFIG_FLAG_FORCE_TGSM_BARRIERS, 0 },
/* MSVC fails to compile empty array. */
{ NULL, 0, 0 }
};
@ -436,9 +434,15 @@ static const struct vkd3d_shader_quirk_info necromunda_quirks = {
necromunda_hashes, ARRAY_SIZE(necromunda_hashes), 0,
};
static const struct vkd3d_shader_quirk_info f1_2020_quirks = {
NULL, 0, VKD3D_SHADER_QUIRK_FORCE_TGSM_BARRIERS,
};
static const struct vkd3d_shader_quirk_meta application_shader_quirks[] = {
/* Necromunda: Hired Gun (1222370) */
{ "Necromunda-Win64-Shipping.exe", &necromunda_quirks },
/* F1 2020 (1080110) */
{ "F1_2020_dx12.exe", &f1_2020_quirks },
};
static void vkd3d_instance_apply_application_workarounds(void)
@ -480,7 +484,6 @@ static const struct vkd3d_debug_option vkd3d_config_options[] =
{"force_static_cbv", VKD3D_CONFIG_FLAG_FORCE_STATIC_CBV},
{"dxr", VKD3D_CONFIG_FLAG_DXR},
{"single_queue", VKD3D_CONFIG_FLAG_SINGLE_QUEUE},
{"force_tgsm_barriers", VKD3D_CONFIG_FLAG_FORCE_TGSM_BARRIERS},
{"descriptor_qa_checks", VKD3D_CONFIG_FLAG_DESCRIPTOR_QA_CHECKS},
};

View File

@ -867,7 +867,6 @@ static HRESULT d3d12_state_object_compile_pipeline(struct d3d12_state_object *ob
compile_args.target_extensions = object->device->vk_info.shader_extensions;
compile_args.target_extension_count = object->device->vk_info.shader_extension_count;
compile_args.target = VKD3D_SHADER_TARGET_SPIRV_VULKAN_1_0;
compile_args.config_flags = vkd3d_config_flags;
compile_args.quirks = vkd3d_shader_quirk_info;
/* TODO: Allow different root signatures per module. */

View File

@ -2112,7 +2112,6 @@ static HRESULT vkd3d_create_compute_pipeline(struct d3d12_device *device,
compile_args.target_extensions = device->vk_info.shader_extensions;
compile_args.target_extension_count = device->vk_info.shader_extension_count;
compile_args.target = VKD3D_SHADER_TARGET_SPIRV_VULKAN_1_0;
compile_args.config_flags = vkd3d_config_flags;
compile_args.quirks = vkd3d_shader_quirk_info;
pipeline_info.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
@ -2975,7 +2974,6 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
compile_args.target = VKD3D_SHADER_TARGET_SPIRV_VULKAN_1_0;
compile_args.target_extension_count = vk_info->shader_extension_count;
compile_args.target_extensions = vk_info->shader_extensions;
compile_args.config_flags = vkd3d_config_flags;
compile_args.quirks = vkd3d_shader_quirk_info;
/* Options which are exclusive to PS. Especially output swizzles must only be used in PS. */