summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-spirv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit-spirv.cpp')
-rw-r--r--source/slang/slang-emit-spirv.cpp57
1 files changed, 43 insertions, 14 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp
index 19c46f373..4c802641d 100644
--- a/source/slang/slang-emit-spirv.cpp
+++ b/source/slang/slang-emit-spirv.cpp
@@ -1361,12 +1361,8 @@ struct SPIRVEmitContext
case kIROp_TextureType:
return ensureTextureType(inst, cast<IRTextureType>(inst));
case kIROp_SamplerStateType:
+ case kIROp_SamplerComparisonStateType:
return emitOpTypeSampler(inst);
- case kIROp_TextureSamplerType:
- return emitOpTypeSampledImage(
- inst,
- ensureTextureType(nullptr, cast<IRTextureTypeBase>(inst))
- );
case kIROp_RaytracingAccelerationStructureType:
requireSPIRVCapability(SpvCapabilityRayTracingKHR);
@@ -1627,22 +1623,19 @@ struct SPIRVEmitContext
SpvDim dim = SpvDim1D; // Silence uninitialized warnings from msvc...
switch(inst->GetBaseShape())
{
- case TextureFlavor::Shape1D:
- case TextureFlavor::Shape1DArray:
+ case SLANG_TEXTURE_1D:
dim = SpvDim1D;
break;
- case TextureFlavor::Shape2D:
- case TextureFlavor::Shape2DArray:
+ case SLANG_TEXTURE_2D:
dim = SpvDim2D;
break;
- case TextureFlavor::Shape3D:
+ case SLANG_TEXTURE_3D:
dim = SpvDim3D;
break;
- case TextureFlavor::ShapeCube:
- case TextureFlavor::ShapeCubeArray:
+ case SLANG_TEXTURE_CUBE:
dim = SpvDimCube;
break;
- case TextureFlavor::ShapeBuffer:
+ case SLANG_TEXTURE_BUFFER:
dim = SpvDimBuffer;
break;
}
@@ -1717,6 +1710,24 @@ struct SPIRVEmitContext
//
// The op itself
//
+
+ if (inst->isCombined())
+ {
+ auto imageType = emitOpTypeImage(
+ nullptr,
+ dropVector(sampledType),
+ dim,
+ SpvLiteralInteger::from32(depth),
+ SpvLiteralInteger::from32(arrayed),
+ SpvLiteralInteger::from32(ms),
+ SpvLiteralInteger::from32(sampled),
+ format
+ );
+ return emitOpTypeSampledImage(
+ assignee,
+ imageType);
+ }
+
return emitOpTypeImage(
assignee,
dropVector(sampledType),
@@ -4578,6 +4589,24 @@ struct SPIRVEmitContext
emitOperand(ensureInst(sampledType));
break;
}
+ case kIROp_SPIRVAsmOperandImageType:
+ case kIROp_SPIRVAsmOperandSampledImageType:
+ {
+ IRBuilder builder(m_irModule);
+ auto textureInst = as<IRTextureTypeBase>(operand->getValue()->getDataType());
+ auto imageType = builder.getTextureType(
+ textureInst->getElementType(),
+ textureInst->getShapeInst(),
+ textureInst->getIsArrayInst(),
+ textureInst->getIsMultisampleInst(),
+ textureInst->getSampleCountInst(),
+ textureInst->getAccessInst(),
+ textureInst->getIsShadowInst(),
+ builder.getIntValue(builder.getIntType(), (operand->getOp() == kIROp_SPIRVAsmOperandSampledImageType ? 1 : 0)),
+ textureInst->getFormatInst());
+ emitOperand(ensureInst(imageType));
+ break;
+ }
case kIROp_SPIRVAsmOperandBuiltinVar:
{
emitOperand(ensureInst(operand));
@@ -4774,7 +4803,7 @@ struct SPIRVEmitContext
}
else
{
- emitInstCustomOperandFunc(
+ last = emitInstCustomOperandFunc(
opParent,
assignedInst,
opcode,