diff options
author | Philip Rebohle <philip.rebohle@tu-dortmund.de> | 2023-07-22 18:37:37 +0300 |
---|---|---|
committer | Philip Rebohle <philip.rebohle@tu-dortmund.de> | 2023-07-22 18:37:37 +0300 |
commit | b4d87eaac0aa8c84d3e8f87a14e15bd918ebedc1 (patch) | |
tree | df968c12723993e489ec43458e784af4c01ce02a | |
parent | 1e11db98d0f88b127a24cc2d1c9abceacac66326 (diff) |
[dxbc] Fix constant texture offsets with 1D textures
Fixes #3572.
-rw-r--r-- | src/dxbc/dxbc_compiler.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/dxbc/dxbc_compiler.cpp b/src/dxbc/dxbc_compiler.cpp index 7a97fd57..4b4d71cf 100644 --- a/src/dxbc/dxbc_compiler.cpp +++ b/src/dxbc/dxbc_compiler.cpp @@ -3383,9 +3383,13 @@ namespace dxvk { }; imageOperands.flags |= spv::ImageOperandsConstOffsetMask; - imageOperands.sConstOffset = m_module.constComposite( - getVectorTypeId({ DxbcScalarType::Sint32, imageLayerDim }), - imageLayerDim, offsetIds.data()); + imageOperands.sConstOffset = offsetIds[0]; + + if (imageLayerDim > 1) { + imageOperands.sConstOffset = m_module.constComposite( + getVectorTypeId({ DxbcScalarType::Sint32, imageLayerDim }), + imageLayerDim, offsetIds.data()); + } } // The LOD is not present when reading from @@ -3519,9 +3523,13 @@ namespace dxvk { }; imageOperands.flags |= spv::ImageOperandsConstOffsetMask; - imageOperands.sConstOffset = m_module.constComposite( - getVectorTypeId({ DxbcScalarType::Sint32, imageLayerDim }), - imageLayerDim, offsetIds.data()); + imageOperands.sConstOffset = offsetIds[0]; + + if (imageLayerDim > 1) { + imageOperands.sConstOffset = m_module.constComposite( + getVectorTypeId({ DxbcScalarType::Sint32, imageLayerDim }), + imageLayerDim, offsetIds.data()); + } } // Gathering texels always returns a four-component @@ -3661,9 +3669,13 @@ namespace dxvk { }; imageOperands.flags |= spv::ImageOperandsConstOffsetMask; - imageOperands.sConstOffset = m_module.constComposite( - getVectorTypeId({ DxbcScalarType::Sint32, imageLayerDim }), - imageLayerDim, offsetIds.data()); + imageOperands.sConstOffset = offsetIds[0]; + + if (imageLayerDim > 1) { + imageOperands.sConstOffset = m_module.constComposite( + getVectorTypeId({ DxbcScalarType::Sint32, imageLayerDim }), + imageLayerDim, offsetIds.data()); + } } if (hasMinLod) { |