Fix declaration of coherent images.

This commit is contained in:
Hans-Kristian Arntzen 2017-08-29 15:52:59 +02:00
Родитель 579a056e33
Коммит d55898ec74
6 изменённых файлов: 39 добавлений и 9 удалений

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -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 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()
{

Просмотреть файл

@ -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,20 @@ 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 << DecorationNonWritable))
res += "readonly ";
if (flags & (1ull << DecorationNonReadable))
res += "writeonly ";
}
res += to_precision_qualifiers_glsl(id);
return res;
}