SPV: Correct selection of storage-image capabilities. Fixes #986.
Code was reflecting an old historical use of sampled as a SPIR-V 2-valued operand, instead of its current 3 values.
This commit is contained in:
@@ -402,6 +402,8 @@ Id Builder::makeFunctionType(Id returnType, const std::vector<Id>& paramTypes)
|
||||
|
||||
Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, bool ms, unsigned sampled, ImageFormat format)
|
||||
{
|
||||
assert(sampled == 1 || sampled == 2);
|
||||
|
||||
// try to find it
|
||||
Instruction* type;
|
||||
for (int t = 0; t < (int)groupedTypes[OpTypeImage].size(); ++t) {
|
||||
@@ -433,27 +435,27 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
|
||||
// deal with capabilities
|
||||
switch (dim) {
|
||||
case DimBuffer:
|
||||
if (sampled)
|
||||
if (sampled == 1)
|
||||
addCapability(CapabilitySampledBuffer);
|
||||
else
|
||||
addCapability(CapabilityImageBuffer);
|
||||
break;
|
||||
case Dim1D:
|
||||
if (sampled)
|
||||
if (sampled == 1)
|
||||
addCapability(CapabilitySampled1D);
|
||||
else
|
||||
addCapability(CapabilityImage1D);
|
||||
break;
|
||||
case DimCube:
|
||||
if (arrayed) {
|
||||
if (sampled)
|
||||
if (sampled == 1)
|
||||
addCapability(CapabilitySampledCubeArray);
|
||||
else
|
||||
addCapability(CapabilityImageCubeArray);
|
||||
}
|
||||
break;
|
||||
case DimRect:
|
||||
if (sampled)
|
||||
if (sampled == 1)
|
||||
addCapability(CapabilitySampledRect);
|
||||
else
|
||||
addCapability(CapabilityImageRect);
|
||||
@@ -466,10 +468,11 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo
|
||||
}
|
||||
|
||||
if (ms) {
|
||||
if (arrayed)
|
||||
addCapability(CapabilityImageMSArray);
|
||||
if (! sampled)
|
||||
if (sampled == 2) {
|
||||
addCapability(CapabilityStorageImageMultisample);
|
||||
if (arrayed)
|
||||
addCapability(CapabilityImageMSArray);
|
||||
}
|
||||
}
|
||||
|
||||
return type->getResultId();
|
||||
|
||||
Reference in New Issue
Block a user