HLSL: phase 3c: add option to use Unknown storage format

This uses the Unknown storage format, instead of deducing the
format from the texture declaration type.
This commit is contained in:
steve-lunarg 2016-10-14 18:36:42 -06:00
parent 8b0227ced9
commit cce8d48bcc
6 changed files with 25 additions and 23 deletions

View file

@ -154,7 +154,10 @@ TLayoutFormat HlslParseContext::getLayoutFromTxType(const TSourceLoc& loc, const
{
const int components = txType.getVectorSize();
const auto selectFormat = [&components](TLayoutFormat v1, TLayoutFormat v2, TLayoutFormat v4) {
const auto selectFormat = [this,&components](TLayoutFormat v1, TLayoutFormat v2, TLayoutFormat v4) {
if (intermediate.getNoStorageFormat())
return ElfNone;
return components == 1 ? v1 :
components == 2 ? v2 : v4;
};
@ -288,13 +291,6 @@ TIntermTyped* HlslParseContext::handleLvalue(const TSourceLoc& loc, const char*
const TSampler& texSampler = object->getType().getSampler();
const TLayoutFormat fmt = object->getType().getQualifier().layoutFormat;
// We only handle this subset of the possible formats.
assert(fmt == ElfRgba32f || fmt == ElfRgba32i || fmt == ElfRgba32ui ||
fmt == ElfRg32f || fmt == ElfRg32i || fmt == ElfRg32ui ||
fmt == ElfR32f || fmt == ElfR32i || fmt == ElfR32ui);
const TType objDerefType(texSampler.type, EvqTemporary, texSampler.vectorSize);
if (nodeAsBinary) {
@ -1452,15 +1448,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
// Too many components. Construct shorter vector from it.
const TType clampedType(result->getType().getBasicType(), EvqTemporary, sampler.vectorSize);
TOperator op;
switch (sampler.type) {
case EbtInt: op = EOpConstructInt; break;
case EbtUint: op = EOpConstructUint; break;
case EbtFloat: op = EOpConstructFloat; break;
default:
error(loc, "unknown basic type in texture op", "", "");
}
const TOperator op = intermediate.mapTypeToConstructorOp(clampedType);
result = constructBuiltIn(clampedType, op, result, loc, false);
}