Always emit DescriptorSet decoration for Vulkan GLSL.

This commit is contained in:
Hans-Kristian Arntzen 2016-05-05 11:51:18 +02:00
parent b7a30b659e
commit f144b767ce
3 changed files with 16 additions and 9 deletions

View File

@ -2,8 +2,8 @@
precision mediump float;
precision highp int;
layout(input_attachment_index = 0, binding = 0) uniform mediump subpassInput uSubpass0;
layout(input_attachment_index = 1, binding = 1) uniform mediump subpassInput uSubpass1;
layout(input_attachment_index = 0, set = 0, binding = 0) uniform mediump subpassInput uSubpass0;
layout(input_attachment_index = 1, set = 0, binding = 1) uniform mediump subpassInput uSubpass1;
layout(location = 0) out vec4 FragColor;

View File

@ -2,11 +2,11 @@
precision mediump float;
precision highp int;
layout(binding = 1) uniform mediump texture2D uTexture;
layout(binding = 0) uniform mediump sampler uSampler;
layout(binding = 4) uniform mediump texture2DArray uTextureArray;
layout(binding = 3) uniform mediump textureCube uTextureCube;
layout(binding = 2) uniform mediump texture3D uTexture3D;
layout(set = 0, binding = 1) uniform mediump texture2D uTexture;
layout(set = 0, binding = 0) uniform mediump sampler uSampler;
layout(set = 0, binding = 4) uniform mediump texture2DArray uTextureArray;
layout(set = 0, binding = 3) uniform mediump textureCube uTextureCube;
layout(set = 0, binding = 2) uniform mediump texture3D uTexture3D;
layout(location = 0) in vec2 vTex;
layout(location = 1) in vec3 vTex3;

View File

@ -689,8 +689,15 @@ string CompilerGLSL::layout_for_variable(const SPIRVariable &var)
if (flags & (1ull << DecorationLocation))
attr.push_back(join("location = ", dec.location));
if ((flags & (1ull << DecorationDescriptorSet)) && dec.set != 0) // set = 0 is the default.
attr.push_back(join("set = ", dec.set));
// set = 0 is the default. Do not emit set = decoration in regular GLSL output, but
// we should preserve it in Vulkan GLSL mode.
if (var.storage != StorageClassPushConstant)
{
if ((flags & (1ull << DecorationDescriptorSet)) && (dec.set != 0 || options.vulkan_semantics))
attr.push_back(join("set = ", dec.set));
}
if (flags & (1ull << DecorationBinding))
attr.push_back(join("binding = ", dec.binding));
if (flags & (1ull << DecorationCoherent))