Skip to content

Commit

Permalink
vkd3d-shader: Add path to use FlushNanToZero instrumentation.
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 Dec 4, 2024
1 parent 5d64c24 commit 3b6e861
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/vkd3d_shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ enum vkd3d_shader_interface_flag
VKD3D_SHADER_INTERFACE_RAW_VA_ALIAS_DESCRIPTOR_BUFFER = 0x00000020u,
VKD3D_SHADER_INTERFACE_INSTRUCTION_QA_BUFFER = 0x00000040u,
VKD3D_SHADER_INTERFACE_INSTRUCTION_QA_BUFFER_FULL = 0x00000080u,
VKD3D_SHADER_INTERFACE_INSTRUCTION_QA_BUFFER_FLUSH_NAN = 0x00000100u,
};

struct vkd3d_shader_stage_io_entry
Expand Down
2 changes: 2 additions & 0 deletions libs/vkd3d-shader/dxil.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,8 @@ int vkd3d_shader_compile_dxil(const struct vkd3d_shader_code *dxbc,
helper.type = DXIL_SPV_INSTRUCTION_INSTRUMENTATION_TYPE_EXTERNALLY_VISIBLE_WRITE_NAN_INF;
if (shader_interface_info->flags & VKD3D_SHADER_INTERFACE_INSTRUCTION_QA_BUFFER_FULL)
helper.type = DXIL_SPV_INSTRUCTION_INSTRUMENTATION_TYPE_FULL_NAN_INF;
else if (shader_interface_info->flags & VKD3D_SHADER_INTERFACE_INSTRUCTION_QA_BUFFER_FLUSH_NAN)
helper.type = DXIL_SPV_INSTRUCTION_INSTRUMENTATION_TYPE_FLUSH_NAN_TO_ZERO;

if (dxil_spv_converter_add_option(converter, &helper.base) != DXIL_SPV_SUCCESS)
{
Expand Down
2 changes: 2 additions & 0 deletions libs/vkd3d/debug_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ void vkd3d_shader_hash_range_parse(FILE *file, struct vkd3d_shader_hash_range **
(*ranges)[new_count].flags = VKD3D_SHADER_HASH_RANGE_QA_FLAG_DISALLOW;
else if (strcmp(end_ptr, "full") == 0)
(*ranges)[new_count].flags = VKD3D_SHADER_HASH_RANGE_QA_FLAG_FULL_QA;
else if (strcmp(end_ptr, "flush-nan") == 0)
(*ranges)[new_count].flags = VKD3D_SHADER_HASH_RANGE_QA_FLAG_FLUSH_NAN;
else
end_ptr = "N/A";

Expand Down
5 changes: 5 additions & 0 deletions libs/vkd3d/descriptor_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ uint32_t vkd3d_descriptor_debug_get_shader_interface_flags(
flags = VKD3D_SHADER_INTERFACE_INSTRUCTION_QA_BUFFER_FULL |
VKD3D_SHADER_INTERFACE_INSTRUCTION_QA_BUFFER;
}
else if (flags & VKD3D_SHADER_HASH_RANGE_QA_FLAG_FLUSH_NAN)
{
flags = VKD3D_SHADER_INTERFACE_INSTRUCTION_QA_BUFFER_FLUSH_NAN |
VKD3D_SHADER_INTERFACE_INSTRUCTION_QA_BUFFER;
}
else if (flags & VKD3D_SHADER_HASH_RANGE_QA_FLAG_ALLOW)
flags = VKD3D_SHADER_INTERFACE_INSTRUCTION_QA_BUFFER;
}
Expand Down
3 changes: 2 additions & 1 deletion libs/vkd3d/vkd3d_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -3523,7 +3523,8 @@ enum vkd3d_shader_hash_range_qa_flags
{
VKD3D_SHADER_HASH_RANGE_QA_FLAG_ALLOW = 1 << 0,
VKD3D_SHADER_HASH_RANGE_QA_FLAG_DISALLOW = 1 << 1,
VKD3D_SHADER_HASH_RANGE_QA_FLAG_FULL_QA = 1 << 2
VKD3D_SHADER_HASH_RANGE_QA_FLAG_FULL_QA = 1 << 2,
VKD3D_SHADER_HASH_RANGE_QA_FLAG_FLUSH_NAN = 1 << 3
};

struct vkd3d_shader_hash_range
Expand Down

0 comments on commit 3b6e861

Please sign in to comment.