Skip to content

Commit

Permalink
vkd3d-shader: Add Rebirth quirk for mesh output robustness.
Browse files Browse the repository at this point in the history
Signed-off-by: Hans-Kristian Arntzen <[email protected]>
  • Loading branch information
HansKristian-Work committed Jan 29, 2025
1 parent c81dd06 commit f826bd6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/vkd3d_shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ enum vkd3d_shader_quirk
* This can lead to page faults. Clamps the input index to the private array size
* as the simplest possible workaround. */
VKD3D_SHADER_QUIRK_FORCE_ROBUST_PHYSICAL_CBV_LOAD_FORWARDING = (1 << 23),

/* If SetMeshOutputsEXT will be called out of bounds, exit the meshlet instead. */
VKD3D_SHADER_QUIRK_MESH_OUTPUT_ROBUSTNESS = (1 << 24),
};

struct vkd3d_shader_quirk_hash
Expand Down
14 changes: 14 additions & 0 deletions libs/vkd3d-shader/dxil.c
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,20 @@ int vkd3d_shader_compile_dxil(const struct vkd3d_shader_code *dxbc,
}
}

if (quirks & VKD3D_SHADER_QUIRK_MESH_OUTPUT_ROBUSTNESS)
{
const dxil_spv_option_shader_quirk helper =
{ { DXIL_SPV_OPTION_SHADER_QUIRK },
DXIL_SPV_SHADER_QUIRK_MESH_OUTPUTS_ROBUSTNESS };

if (dxil_spv_converter_add_option(converter, &helper.base) != DXIL_SPV_SUCCESS)
{
ERR("dxil-spirv does not support SHADER_QUIRK.\n");
ret = VKD3D_ERROR_NOT_IMPLEMENTED;
goto end;
}
}

remap_userdata.shader_interface_info = shader_interface_info;
remap_userdata.shader_interface_local_info = NULL;
remap_userdata.num_root_descriptors = num_root_descriptors;
Expand Down
7 changes: 7 additions & 0 deletions libs/vkd3d/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,11 @@ static const struct vkd3d_shader_quirk_info gzw_quirks = {
NULL, 0, VKD3D_SHADER_QUIRK_FORCE_ROBUST_PHYSICAL_CBV_LOAD_FORWARDING,
};

/* Apparently some meshlets may try to allocate too many vertices/primitives. */
static const struct vkd3d_shader_quirk_info rebirth_quirks = {
NULL, 0, VKD3D_SHADER_QUIRK_MESH_OUTPUT_ROBUSTNESS,
};

static const struct vkd3d_shader_quirk_meta application_shader_quirks[] = {
/* F1 2020 (1080110) */
{ VKD3D_STRING_COMPARE_EXACT, "F1_2020_dx12.exe", &f1_2019_2020_quirks },
Expand Down Expand Up @@ -799,6 +804,8 @@ static const struct vkd3d_shader_quirk_meta application_shader_quirks[] = {
{ VKD3D_STRING_COMPARE_EXACT, "M1-Win64-Shipping.exe", &tfd_quirks },
/* Gray Zone Warfare (2479810) */
{ VKD3D_STRING_COMPARE_EXACT, "GZWClientSteam-Win64-Shipping.exe", &gzw_quirks },
/* FFVII Rebirth (2909400) */
{ VKD3D_STRING_COMPARE_EXACT, "ff7rebirth_.exe", &rebirth_quirks },
/* Unreal Engine 4 */
{ VKD3D_STRING_COMPARE_ENDS_WITH, "-Shipping.exe", &ue4_quirks },
/* MSVC fails to compile empty array. */
Expand Down

0 comments on commit f826bd6

Please sign in to comment.