summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-glsl.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-glsl.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-glsl.cpp')
-rw-r--r--source/slang/slang-emit-glsl.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index 4a75e84a0..bbfefc75c 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -714,11 +714,11 @@ void GLSLSourceEmitter::_emitGLSLTextureOrTextureSamplerType(IRTextureTypeBase*
m_writer->emit(baseName);
switch (type->GetBaseShape())
{
- case TextureFlavor::Shape::Shape1D: m_writer->emit("1D"); break;
- case TextureFlavor::Shape::Shape2D: m_writer->emit("2D"); break;
- case TextureFlavor::Shape::Shape3D: m_writer->emit("3D"); break;
- case TextureFlavor::Shape::ShapeCube: m_writer->emit("Cube"); break;
- case TextureFlavor::Shape::ShapeBuffer: m_writer->emit("Buffer"); break;
+ case SLANG_TEXTURE_1D: m_writer->emit("1D"); break;
+ case SLANG_TEXTURE_2D: m_writer->emit("2D"); break;
+ case SLANG_TEXTURE_3D: m_writer->emit("3D"); break;
+ case SLANG_TEXTURE_CUBE: m_writer->emit("Cube"); break;
+ case SLANG_TEXTURE_BUFFER: m_writer->emit("Buffer"); break;
default:
SLANG_DIAGNOSE_UNEXPECTED(getSink(), SourceLoc(), "unhandled resource shape");
break;
@@ -2355,6 +2355,11 @@ void GLSLSourceEmitter::emitSimpleTypeImpl(IRType* type)
// each of these IR opcodes.
if (auto texType = as<IRTextureType>(type))
{
+ if (texType->isCombined())
+ {
+ _emitGLSLTextureOrTextureSamplerType(texType, "sampler");
+ return;
+ }
switch (texType->getAccess())
{
case SLANG_RESOURCE_ACCESS_READ_WRITE:
@@ -2368,11 +2373,6 @@ void GLSLSourceEmitter::emitSimpleTypeImpl(IRType* type)
}
return;
}
- else if (auto textureSamplerType = as<IRTextureSamplerType>(type))
- {
- _emitGLSLTextureOrTextureSamplerType(textureSamplerType, "sampler");
- return;
- }
else if (auto imageType = as<IRGLSLImageType>(type))
{
_emitGLSLTextureOrTextureSamplerType(imageType, "image");