Preserve signedness in SPV image query ops
The AST->SPIRV translation of image queries was dropping signedness, causing some validation troubles.
This commit is contained in:
@@ -1662,7 +1662,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse,
|
||||
}
|
||||
|
||||
// Comments in header
|
||||
Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameters)
|
||||
Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameters, bool isUnsignedResult)
|
||||
{
|
||||
// All these need a capability
|
||||
addCapability(CapabilityImageQuery);
|
||||
@@ -1695,10 +1695,12 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
|
||||
}
|
||||
if (isArrayedImageType(getImageType(parameters.sampler)))
|
||||
++numComponents;
|
||||
|
||||
Id intType = isUnsignedResult ? makeUintType(32) : makeIntType(32);
|
||||
if (numComponents == 1)
|
||||
resultType = makeIntType(32);
|
||||
resultType = intType;
|
||||
else
|
||||
resultType = makeVectorType(makeIntType(32), numComponents);
|
||||
resultType = makeVectorType(intType, numComponents);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1707,7 +1709,7 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter
|
||||
break;
|
||||
case OpImageQueryLevels:
|
||||
case OpImageQuerySamples:
|
||||
resultType = makeIntType(32);
|
||||
resultType = isUnsignedResult ? makeUintType(32) : makeIntType(32);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
|
||||
Reference in New Issue
Block a user