Merge pull request #269 from KhronosGroup/fix-268
Fix coherent and restrict image qualifiers for images.
This commit is contained in:
commit
e4251b7fea
@ -9,8 +9,8 @@ layout(binding = 4, std140) uniform UBO
|
||||
|
||||
layout(binding = 0) uniform mediump sampler2D uHeight;
|
||||
layout(binding = 1) uniform mediump sampler2D uDisplacement;
|
||||
layout(binding = 2, rgba16f) uniform mediump writeonly image2D iHeightDisplacement;
|
||||
layout(binding = 3, rgba16f) uniform mediump writeonly image2D iGradJacobian;
|
||||
layout(binding = 2, rgba16f) uniform writeonly mediump image2D iHeightDisplacement;
|
||||
layout(binding = 3, rgba16f) uniform writeonly mediump image2D iGradJacobian;
|
||||
|
||||
mediump float jacobian(mediump vec2 dDdx, mediump vec2 dDdy)
|
||||
{
|
||||
|
15
reference/shaders/comp/coherent-image.comp
Normal file
15
reference/shaders/comp/coherent-image.comp
Normal file
@ -0,0 +1,15 @@
|
||||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 1, std430) coherent restrict writeonly buffer SSBO
|
||||
{
|
||||
ivec4 value;
|
||||
} _10;
|
||||
|
||||
layout(binding = 3, r32i) uniform coherent restrict readonly mediump iimage2D uImage;
|
||||
|
||||
void main()
|
||||
{
|
||||
_10.value = imageLoad(uImage, ivec2(10));
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, rgba8) uniform mediump readonly image2D uImageIn;
|
||||
layout(binding = 1, rgba8) uniform mediump writeonly image2D uImageOut;
|
||||
layout(binding = 0, rgba8) uniform readonly mediump image2D uImageIn;
|
||||
layout(binding = 1, rgba8) uniform writeonly mediump image2D uImageOut;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
#extension GL_OES_texture_buffer : require
|
||||
|
||||
layout(binding = 4) uniform highp samplerBuffer uSamp;
|
||||
layout(binding = 5, rgba32f) uniform highp readonly imageBuffer uSampo;
|
||||
layout(binding = 5, rgba32f) uniform readonly highp imageBuffer uSampo;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
14
shaders/comp/coherent-image.comp
Normal file
14
shaders/comp/coherent-image.comp
Normal file
@ -0,0 +1,14 @@
|
||||
#version 310 es
|
||||
layout(local_size_x = 1) in;
|
||||
|
||||
layout(binding = 1) coherent restrict writeonly buffer SSBO
|
||||
{
|
||||
ivec4 value;
|
||||
};
|
||||
|
||||
layout(r32i, binding = 3) coherent readonly restrict uniform mediump iimage2D uImage;
|
||||
|
||||
void main()
|
||||
{
|
||||
value = imageLoad(uImage, ivec2(10));
|
||||
}
|
@ -1001,8 +1001,6 @@ string CompilerGLSL::layout_for_variable(const SPIRVariable &var)
|
||||
|
||||
if (flags & (1ull << DecorationBinding))
|
||||
attr.push_back(join("binding = ", dec.binding));
|
||||
if (flags & (1ull << DecorationCoherent))
|
||||
attr.push_back("coherent");
|
||||
if (flags & (1ull << DecorationOffset))
|
||||
attr.push_back(join("offset = ", dec.offset));
|
||||
|
||||
@ -6075,17 +6073,22 @@ string CompilerGLSL::to_qualifiers_glsl(uint32_t id)
|
||||
res += to_interpolation_qualifiers(flags);
|
||||
if (var)
|
||||
res += to_storage_qualifiers_glsl(*var);
|
||||
res += to_precision_qualifiers_glsl(id);
|
||||
auto &type = expression_type(id);
|
||||
|
||||
auto &type = expression_type(id);
|
||||
if (type.image.dim != DimSubpassData && type.image.sampled == 2)
|
||||
{
|
||||
if (flags & (1ull << DecorationCoherent))
|
||||
res += "coherent ";
|
||||
if (flags & (1ull << DecorationRestrict))
|
||||
res += "restrict ";
|
||||
if (flags & (1ull << DecorationNonWritable))
|
||||
res += "readonly ";
|
||||
if (flags & (1ull << DecorationNonReadable))
|
||||
res += "writeonly ";
|
||||
}
|
||||
|
||||
res += to_precision_qualifiers_glsl(id);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user