mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Allow memory barriers in SM4+ target profiles.
This commit is contained in:
Notes:
Henri Verbeet
2025-06-24 16:31:45 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1553
@@ -5144,10 +5144,10 @@ static bool intrinsic_InterlockedXor(struct hlsl_ctx *ctx,
|
||||
|
||||
static void validate_group_barrier_profile(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
if (ctx->profile->type != VKD3D_SHADER_TYPE_COMPUTE || hlsl_version_lt(ctx, 5, 0))
|
||||
if (ctx->profile->type != VKD3D_SHADER_TYPE_COMPUTE)
|
||||
{
|
||||
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INCOMPATIBLE_PROFILE,
|
||||
"Group barriers can only be used in compute shaders 5.0 or higher.");
|
||||
"Group barriers can only be used in compute shaders.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5171,10 +5171,10 @@ static bool intrinsic_DeviceMemoryBarrier(struct hlsl_ctx *ctx,
|
||||
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
if ((ctx->profile->type != VKD3D_SHADER_TYPE_COMPUTE && ctx->profile->type != VKD3D_SHADER_TYPE_PIXEL)
|
||||
|| hlsl_version_lt(ctx, 5, 0))
|
||||
|| hlsl_version_lt(ctx, 4, 0))
|
||||
{
|
||||
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INCOMPATIBLE_PROFILE,
|
||||
"DeviceMemoryBarrier() can only be used in pixel and compute shaders 5.0 or higher.");
|
||||
"DeviceMemoryBarrier() can only be used in compute and pixel shaders 4.0 or higher.");
|
||||
}
|
||||
return !!hlsl_block_add_sync(ctx, params->instrs, VKD3DSSF_GLOBAL_UAV, loc);
|
||||
}
|
||||
|
@@ -1,9 +1,10 @@
|
||||
[require]
|
||||
shader model >= 5.0
|
||||
shader model >= 4.0
|
||||
|
||||
% These are just parsing tests.
|
||||
|
||||
% This is just a parsing test.
|
||||
[compute shader]
|
||||
[numthreads(1024, 1, 1)]
|
||||
[numthreads(768, 1, 1)]
|
||||
void main(uint local_idx : SV_GroupIndex, uint group_id : SV_GroupID)
|
||||
{
|
||||
GroupMemoryBarrier();
|
||||
@@ -14,6 +15,52 @@ void main(uint local_idx : SV_GroupIndex, uint group_id : SV_GroupID)
|
||||
AllMemoryBarrierWithGroupSync();
|
||||
}
|
||||
|
||||
[pixel shader]
|
||||
float4 main() : sv_target
|
||||
{
|
||||
DeviceMemoryBarrier();
|
||||
return 0;
|
||||
}
|
||||
|
||||
[pixel shader fail]
|
||||
float4 main() : sv_target
|
||||
{
|
||||
DeviceMemoryBarrierWithGroupSync();
|
||||
return 0;
|
||||
}
|
||||
|
||||
[pixel shader fail]
|
||||
float4 main() : sv_target
|
||||
{
|
||||
GroupMemoryBarrier();
|
||||
return 0;
|
||||
}
|
||||
|
||||
[pixel shader fail]
|
||||
float4 main() : sv_target
|
||||
{
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
return 0;
|
||||
}
|
||||
|
||||
[pixel shader fail]
|
||||
float4 main() : sv_target
|
||||
{
|
||||
AllMemoryBarrier();
|
||||
return 0;
|
||||
}
|
||||
|
||||
[pixel shader fail]
|
||||
float4 main() : sv_target
|
||||
{
|
||||
AllMemoryBarrierWithGroupSync();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
[require]
|
||||
shader model >= 5.0
|
||||
|
||||
[uav 2]
|
||||
format r32g32b32a32-float
|
||||
size (buffer, 3)
|
||||
|
Reference in New Issue
Block a user