Untangle SPIR-V sampler creation logic.

Evolution over time led to a bit of gnarly logic around sampler
creation in SPIR-V. I've untangled it a bit.

Change-Id: I1987dd9b06c66f55051d72a6de4e950813697dbb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/529499
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
John Stiles 2022-04-12 11:46:30 -04:00 committed by SkCQ
parent fcbd099bcc
commit cc6892dbd7

View File

@ -670,15 +670,13 @@ SpvId SPIRVCodeGenerator::getType(const Type& rawType, const MemoryLayout& layou
break;
}
case Type::TypeKind::kSampler: {
SpvId image = result;
if (SpvDimSubpassData != type->dimensions()) {
image = this->getType(type->textureType(), layout);
if (type->dimensions() != SpvDimSubpassData) {
if (type->dimensions() == SpvDimBuffer) {
fCapabilities |= 1ULL << SpvCapabilitySampledBuffer;
}
if (SpvDimBuffer == type->dimensions()) {
fCapabilities |= (((uint64_t) 1) << SpvCapabilitySampledBuffer);
}
if (SpvDimSubpassData != type->dimensions()) {
this->writeInstruction(SpvOpTypeSampledImage, result, image, fConstantBuffer);
SpvId imageTypeId = this->getType(type->textureType(), layout);
this->writeInstruction(SpvOpTypeSampledImage, result, imageTypeId,
fConstantBuffer);
}
break;
}