diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2025-02-20 18:59:49 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-20 16:59:49 -0800 |
| commit | 4d286aab2ec23c081f23846f5dfdb30b1c05728b (patch) | |
| tree | 98be13f2d72d90d69901d463a94c292d562cee67 /source | |
| parent | 19867ffca6dca7995c799354081219c9e76f13d1 (diff) | |
Metal fix (#6413)
Partially fix #6378
* Fix invalid access mode for texture_buffer
* Fix texture view create issue in metal
In newTextureView, levelRange should represent the mipmap level range,
while sliceRange should represent the texture layer range for texture
array. But the implement inverse those two wrongly.
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-emit-metal.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/slang/slang-emit-metal.cpp b/source/slang/slang-emit-metal.cpp index 166f02535..0a7db8b28 100644 --- a/source/slang/slang-emit-metal.cpp +++ b/source/slang/slang-emit-metal.cpp @@ -136,8 +136,15 @@ void MetalSourceEmitter::_emitHLSLTextureType(IRTextureTypeBase* texType) switch (texType->getAccess()) { case SLANG_RESOURCE_ACCESS_READ: - m_writer->emit("access::sample"); - break; + { + // Metal does not support access::sample for texture buffers, so we need to emit + // access::read instead. + if (texType->GetBaseShape() == SLANG_TEXTURE_BUFFER) + m_writer->emit("access::read"); + else + m_writer->emit("access::sample"); + break; + } case SLANG_RESOURCE_ACCESS_WRITE: m_writer->emit("access::write"); |
