HLSL: Do not emit globallycoherent for SRV ByteAddressBuffer.

This commit is contained in:
Hans-Kristian Arntzen 2020-03-05 10:37:36 +01:00
parent d19f30a90e
commit 185551bfaf
7 changed files with 109 additions and 1 deletions

View File

@ -0,0 +1,21 @@
globallycoherent RWByteAddressBuffer _12 : register(u0);
static float4 FragColor;
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = asfloat(_12.Load4(0));
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -0,0 +1,21 @@
ByteAddressBuffer _12 : register(t0);
static float4 FragColor;
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = asfloat(_12.Load4(0));
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -0,0 +1,21 @@
globallycoherent RWByteAddressBuffer _12 : register(u0);
static float4 FragColor;
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = asfloat(_12.Load4(0));
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -0,0 +1,21 @@
ByteAddressBuffer _12 : register(t0);
static float4 FragColor;
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = asfloat(_12.Load4(0));
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@ -0,0 +1,12 @@
#version 450
layout(set = 0, binding = 0) coherent readonly buffer SSBO
{
vec4 a;
};
layout(location = 0) out vec4 FragColor;
void main()
{
FragColor = a;
}

View File

@ -0,0 +1,12 @@
#version 450
layout(set = 0, binding = 0) coherent readonly buffer SSBO
{
vec4 a;
};
layout(location = 0) out vec4 FragColor;
void main()
{
FragColor = a;
}

View File

@ -1858,7 +1858,7 @@ void CompilerHLSL::emit_buffer_block(const SPIRVariable &var)
{
Bitset flags = ir.get_buffer_block_flags(var);
bool is_readonly = flags.get(DecorationNonWritable) && !hlsl_options.force_storage_buffer_as_uav;
bool is_coherent = flags.get(DecorationCoherent);
bool is_coherent = flags.get(DecorationCoherent) && !is_readonly;
bool is_interlocked = interlocked_resources.count(var.self) > 0;
const char *type_name = "ByteAddressBuffer ";
if (!is_readonly)