vkd3d-shader/spirv: Handle thread group UAV barriers.

This commit is contained in:
Conor McCarthy 2023-08-16 13:46:10 +10:00 committed by Alexandre Julliard
parent 18e9148f58
commit 8ae69c745b
Notes: Alexandre Julliard 2024-01-25 23:07:09 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/599
3 changed files with 19 additions and 3 deletions

View File

@ -445,6 +445,11 @@ static void shader_dump_sync_flags(struct vkd3d_d3d_asm_compiler *compiler, uint
vkd3d_string_buffer_printf(&compiler->buffer, "_uglobal");
sync_flags &= ~VKD3DSSF_GLOBAL_UAV;
}
if (sync_flags & VKD3DSSF_THREAD_GROUP_UAV)
{
vkd3d_string_buffer_printf(&compiler->buffer, "_ugroup");
sync_flags &= ~VKD3DSSF_THREAD_GROUP_UAV;
}
if (sync_flags & VKD3DSSF_GROUP_SHARED_MEMORY)
{
vkd3d_string_buffer_printf(&compiler->buffer, "_g");

View File

@ -9343,11 +9343,20 @@ static void spirv_compiler_emit_sync(struct spirv_compiler *compiler,
flags &= ~VKD3DSSF_THREAD_GROUP;
}
if (flags & VKD3DSSF_GLOBAL_UAV)
if (flags & (VKD3DSSF_THREAD_GROUP_UAV | VKD3DSSF_GLOBAL_UAV))
{
memory_scope = SpvScopeDevice;
bool group_uav = flags & VKD3DSSF_THREAD_GROUP_UAV;
bool global_uav = flags & VKD3DSSF_GLOBAL_UAV;
if (group_uav && global_uav)
{
WARN("Invalid UAV sync flag combination; assuming global.\n");
spirv_compiler_warning(compiler, VKD3D_SHADER_WARNING_SPV_INVALID_UAV_FLAGS,
"The flags for a UAV sync instruction are contradictory; assuming global sync.");
}
memory_scope = global_uav ? SpvScopeDevice : SpvScopeWorkgroup;
memory_semantics |= SpvMemorySemanticsUniformMemoryMask | SpvMemorySemanticsImageMemoryMask;
flags &= ~VKD3DSSF_GLOBAL_UAV;
flags &= ~(VKD3DSSF_THREAD_GROUP_UAV | VKD3DSSF_GLOBAL_UAV);
}
if (flags)

View File

@ -99,6 +99,7 @@ enum vkd3d_shader_error
VKD3D_SHADER_ERROR_SPV_INVALID_SHADER = 2009,
VKD3D_SHADER_WARNING_SPV_INVALID_SWIZZLE = 2300,
VKD3D_SHADER_WARNING_SPV_INVALID_UAV_FLAGS = 2301,
VKD3D_SHADER_ERROR_RS_OUT_OF_MEMORY = 3000,
VKD3D_SHADER_ERROR_RS_INVALID_VERSION = 3001,
@ -730,6 +731,7 @@ enum vkd3d_shader_sync_flags
{
VKD3DSSF_THREAD_GROUP = 0x1,
VKD3DSSF_GROUP_SHARED_MEMORY = 0x2,
VKD3DSSF_THREAD_GROUP_UAV = 0x4,
VKD3DSSF_GLOBAL_UAV = 0x8,
};