GLSL: Construct shadow texture from non-shadow sampler.

Tracks https://github.com/KhronosGroup/GLSL/pull/22.
This commit is contained in:
John Kessenich 2018-07-23 15:59:09 -06:00
parent 0339af3c1f
commit 7d4c9a07b5
5 changed files with 8 additions and 71 deletions

View file

@ -2655,15 +2655,16 @@ bool TParseContext::constructorTextureSamplerError(const TSourceLoc& loc, const
// second argument
// * the constructor's second argument must be a scalar of type
// *sampler* or *samplerShadow*
// * the presence or absence of depth comparison (Shadow) must match
// between the constructed sampler type and the type of the second argument
// * if the second argument is *samplerShadow* the constructor must be a
// shadow constructor (however, shadow constructors are allowed to have
// a second argument of *sampler*)
if ( function[1].type->getBasicType() != EbtSampler ||
! function[1].type->getSampler().isPureSampler() ||
function[1].type->isArray()) {
error(loc, "sampler-constructor second argument must be a scalar type 'sampler'", token, "");
return true;
}
if (function.getType().getSampler().shadow != function[1].type->getSampler().shadow) {
if (!function.getType().getSampler().shadow && function[1].type->getSampler().shadow) {
error(loc, "sampler-constructor second argument presence of shadow must match constructor presence of shadow", token, "");
return true;
}