summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-emit-cpp.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-11-16 14:32:33 -0800
committerGitHub <noreply@github.com>2023-11-16 14:32:33 -0800
commit4c78efd0c34442866f20e9d00bbb6908115c9a01 (patch)
tree03ca8584847f0937a926f6b27386dcd982ed7780 /source/slang/slang-emit-cpp.cpp
parent12f7237e4060388494c549623f4a640327b7ca08 (diff)
Unify stdlib `Texture` types into one generic type. (#3327)
* Unify Texture types in stdlib into 1 generic type. * Fixes. * Fix. * Fixes. * Fix reflection. * Fix binding reflection. * Add gather intrinsics. * Fix gather intrinsics. * Fix texture type toText. * Fix intrinsic. * fix cuda intrinsic. * Fix project files. * cleanup. * Fix. * Fix. * Fix sampler feedback test. * Fix getDimension intrinsics. * Fix spirv sample image intrinsics. * Fix test. * Fix GLSL intrinsic. * Cleanup. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit-cpp.cpp')
-rw-r--r--source/slang/slang-emit-cpp.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/source/slang/slang-emit-cpp.cpp b/source/slang/slang-emit-cpp.cpp
index c48fa369d..95a6ea4ff 100644
--- a/source/slang/slang-emit-cpp.cpp
+++ b/source/slang/slang-emit-cpp.cpp
@@ -137,11 +137,8 @@ SlangResult CPPSourceEmitter::_calcCPPTextureTypeName(IRTextureTypeBase* texType
case SLANG_RESOURCE_ACCESS_CONSUME:
outName << "Consume";
break;
- case SLANG_RESOURCE_ACCESS_WRITE:
- if (texType->isFeedback())
- {
- outName << "Feedback";
- }
+ case SLANG_RESOURCE_ACCESS_FEEDBACK:
+ outName << "Feedback";
break;
default:
SLANG_DIAGNOSE_UNEXPECTED(getSink(), SourceLoc(), "unhandled resource access mode");
@@ -150,11 +147,11 @@ SlangResult CPPSourceEmitter::_calcCPPTextureTypeName(IRTextureTypeBase* texType
switch (texType->GetBaseShape())
{
- case TextureFlavor::Shape::Shape1D: outName << "Texture1D"; break;
- case TextureFlavor::Shape::Shape2D: outName << "Texture2D"; break;
- case TextureFlavor::Shape::Shape3D: outName << "Texture3D"; break;
- case TextureFlavor::Shape::ShapeCube: outName << "TextureCube"; break;
- case TextureFlavor::Shape::ShapeBuffer: outName << "Buffer"; break;
+ case SLANG_TEXTURE_1D: outName << "Texture1D"; break;
+ case SLANG_TEXTURE_2D: outName << "Texture2D"; break;
+ case SLANG_TEXTURE_3D: outName << "Texture3D"; break;
+ case SLANG_TEXTURE_CUBE: outName << "TextureCube"; break;
+ case SLANG_TEXTURE_BUFFER: outName << "Buffer"; break;
default:
SLANG_DIAGNOSE_UNEXPECTED(getSink(), SourceLoc(), "unhandled resource shape");
return SLANG_FAIL;
@@ -332,11 +329,7 @@ SlangResult CPPSourceEmitter::calcTypeName(IRType* type, CodeGenTarget target, S
if (auto texType = as<IRTextureTypeBase>(type))
{
- // We don't support TextureSampler, so ignore that
- if (texType->getOp() != kIROp_TextureSamplerType)
- {
- return _calcCPPTextureTypeName(texType, out);
- }
+ return _calcCPPTextureTypeName(texType, out);
}
// If _getResourceTypePrefix returns something, we assume can output any specialization after it in order.