SPV: Issue #180: push_constants don't have descriptor sets.

This commit is contained in:
John Kessenich 2016-03-08 21:36:22 -07:00
Родитель 2107c76a08
Коммит f7497e289b
5 изменённых файлов: 9 добавлений и 5 удалений

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

@ -521,9 +521,9 @@ spv::ImageFormat TGlslangToSpvTraverser::TranslateImageFormat(const glslang::TTy
// descriptor set.
bool IsDescriptorResource(const glslang::TType& type)
{
// uniform and buffer blocks are included
// uniform and buffer blocks are included, unless it is a push_constant
if (type.getBasicType() == glslang::EbtBlock)
return type.getQualifier().isUniformOrBuffer();
return type.getQualifier().isUniformOrBuffer() && ! type.getQualifier().layoutPushConstant;
// non block...
// basically samplerXXX/subpass/sampler/texture are all included

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

@ -24,7 +24,6 @@ Linked vertex stage:
MemberDecorate 11(Material) 0 Offset 0
MemberDecorate 11(Material) 1 Offset 4
Decorate 11(Material) Block
Decorate 13(matInst) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1

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

@ -22,7 +22,8 @@ ERROR: 0:25: 'packed' : not allowed when using GLSL for Vulkan
ERROR: 0:32: 'initializer' : can't use with types containing arrays sized with a specialization constant
ERROR: 0:34: '=' : can't use with types containing arrays sized with a specialization constant
ERROR: 0:35: '==' : can't use with types containing arrays sized with a specialization constant
ERROR: 22 compilation errors. No code generated.
ERROR: 0:39: 'set' : cannot be used with push_constant
ERROR: 23 compilation errors. No code generated.

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

@ -35,3 +35,5 @@ void foo()
if (a1 == a2) // ERROR, can't compare either
++color;
}
layout(set = 1, push_constant) uniform badpc { int a; } badpcI; // ERROR, no descriptor set with push_constant

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

@ -4483,6 +4483,8 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier
if (qualifier.layoutPushConstant) {
if (qualifier.storage != EvqUniform)
error(loc, "can only be used with a uniform", "push_constant", "");
if (qualifier.hasSet())
error(loc, "cannot be used with push_constant", "set", "");
}
}