diff options
| author | Yong He <yonghe@outlook.com> | 2023-11-16 14:32:33 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-16 14:32:33 -0800 |
| commit | 4c78efd0c34442866f20e9d00bbb6908115c9a01 (patch) | |
| tree | 03ca8584847f0937a926f6b27386dcd982ed7780 /source/slang/slang-emit-hlsl.cpp | |
| parent | 12f7237e4060388494c549623f4a640327b7ca08 (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-hlsl.cpp')
| -rw-r--r-- | source/slang/slang-emit-hlsl.cpp | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp index 9defc9adc..9b333c281 100644 --- a/source/slang/slang-emit-hlsl.cpp +++ b/source/slang/slang-emit-hlsl.cpp @@ -253,11 +253,8 @@ void HLSLSourceEmitter::_emitHLSLTextureType(IRTextureTypeBase* texType) m_writer->emit("Consume"); break; - case SLANG_RESOURCE_ACCESS_WRITE: - if (texType->isFeedback()) - { - m_writer->emit("Feedback"); - } + case SLANG_RESOURCE_ACCESS_FEEDBACK: + m_writer->emit("Feedback"); break; default: @@ -267,11 +264,11 @@ void HLSLSourceEmitter::_emitHLSLTextureType(IRTextureTypeBase* texType) switch (texType->GetBaseShape()) { - case TextureFlavor::Shape::Shape1D: m_writer->emit("Texture1D"); break; - case TextureFlavor::Shape::Shape2D: m_writer->emit("Texture2D"); break; - case TextureFlavor::Shape::Shape3D: m_writer->emit("Texture3D"); break; - case TextureFlavor::Shape::ShapeCube: m_writer->emit("TextureCube"); break; - case TextureFlavor::Shape::ShapeBuffer: m_writer->emit("Buffer"); break; + case SLANG_TEXTURE_1D: m_writer->emit("Texture1D"); break; + case SLANG_TEXTURE_2D: m_writer->emit("Texture2D"); break; + case SLANG_TEXTURE_3D: m_writer->emit("Texture3D"); break; + case SLANG_TEXTURE_CUBE: m_writer->emit("TextureCube"); break; + case SLANG_TEXTURE_BUFFER: m_writer->emit("Buffer"); break; default: SLANG_DIAGNOSE_UNEXPECTED(getSink(), SourceLoc(), "unhandled resource shape"); break; @@ -287,14 +284,11 @@ void HLSLSourceEmitter::_emitHLSLTextureType(IRTextureTypeBase* texType) } m_writer->emit("<"); emitType(texType->getElementType()); - if (texType->getOperandCount() == 2) + auto sampleCount = as<IRIntLit>(texType->getSampleCount()); + if (sampleCount->getValue() != 0) { - auto sampleCount = as<IRIntLit>(texType->getSampleCount()); - if (sampleCount->getValue() != 0) - { - m_writer->emit(", "); - m_writer->emit(sampleCount->getValue()); - } + m_writer->emit(", "); + m_writer->emit(sampleCount->getValue()); } m_writer->emit(" >"); } @@ -954,11 +948,6 @@ void HLSLSourceEmitter::emitSimpleTypeImpl(IRType* type) _emitHLSLTextureType(texType); return; } - else if (const auto textureSamplerType = as<IRTextureSamplerType>(type)) - { - SLANG_DIAGNOSE_UNEXPECTED(getSink(), SourceLoc(), "this target should see combined texture-sampler types"); - return; - } else if (auto imageType = as<IRGLSLImageType>(type)) { _emitHLSLTextureType(imageType); |
