GLSL/SPV: Fix #1196: Require resources to have layout(binding=X).

This commit is contained in:
John Kessenich 2018-02-21 18:19:49 -07:00
parent 2d9973de0e
commit 9c9c4e90df
20 changed files with 114 additions and 64 deletions

View file

@ -4663,12 +4663,23 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
return;
}
}
}
} else if (!intermediate.getAutoMapBindings()) {
// some types require bindings
// atomic_uint
if (type.getBasicType() == EbtAtomicUint) {
if (! type.getQualifier().hasBinding())
// atomic_uint
if (type.getBasicType() == EbtAtomicUint)
error(loc, "layout(binding=X) is required", "atomic_uint", "");
// SPIR-V
if (spvVersion.spv > 0) {
if (qualifier.isUniformOrBuffer()) {
if (type.getBasicType() == EbtBlock && !qualifier.layoutPushConstant &&
!qualifier.layoutAttachment)
error(loc, "uniform/buffer blocks require layout(binding=X)", "binding", "");
else if (spvVersion.vulkan > 0 && type.getBasicType() == EbtSampler)
error(loc, "sampler/texture/image requires layout(binding=X)", "binding", "");
}
}
}
// "The offset qualifier can only be used on block members of blocks..."