GLSL/SPV: If a texture is used with a shadow sampler, force 'shadow'.

Fixes #854. But, only good if we are not trying to use the same
texture for both shadow and non-shadow constructors.

Force the type of the texture to have 'shadow' set when it is
constructed with a samplerShadow.
This commit is contained in:
John Kessenich 2018-07-20 19:04:15 -06:00
parent fa4952c31c
commit 0339af3c1f
2 changed files with 280 additions and 274 deletions

View file

@ -5917,8 +5917,14 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode*
// Combined texture-sampler constructors are completely semantic checked
// in constructorTextureSamplerError()
if (op == EOpConstructTextureSampler)
if (op == EOpConstructTextureSampler) {
if (aggrNode->getSequence()[1]->getAsTyped()->getType().getSampler().shadow) {
// Transfer depth into the texture (SPIR-V image) type, as a hint
// for tools to know this texture/image is a depth image.
aggrNode->getSequence()[0]->getAsTyped()->getWritableType().getSampler().shadow = true;
}
return intermediate.setAggregateOperator(aggrNode, op, type, loc);
}
TTypeList::const_iterator memberTypes;
if (op == EOpConstructStruct)