diff options
| author | 2021-05-17 02:52:01 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:31 -0400 | |
| commit | ec6fc5fe78c9038fc9ad7259b7b3a7be751ecef6 (patch) | |
| tree | 063963b0a197526467902ef9bfceff1be8f5b9ef /src/shader_recompiler/frontend/ir | |
| parent | glasm: Add support for non-2D texture samples (diff) | |
| download | yuzu-ec6fc5fe78c9038fc9ad7259b7b3a7be751ecef6.tar.gz yuzu-ec6fc5fe78c9038fc9ad7259b7b3a7be751ecef6.tar.xz yuzu-ec6fc5fe78c9038fc9ad7259b7b3a7be751ecef6.zip | |
glasm: Implement TEX and TEXS instructions
Remove lod clamp from texture instructions with lod, as this is not
needed (nor supported).
Diffstat (limited to 'src/shader_recompiler/frontend/ir')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 11 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.h | 5 |
2 files changed, 6 insertions, 10 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index def29143e..94bdbe39c 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -1778,12 +1778,10 @@ Value IREmitter::ImageSampleImplicitLod(const Value& handle, const Value& coords | |||
| 1778 | } | 1778 | } |
| 1779 | 1779 | ||
| 1780 | Value IREmitter::ImageSampleExplicitLod(const Value& handle, const Value& coords, const F32& lod, | 1780 | Value IREmitter::ImageSampleExplicitLod(const Value& handle, const Value& coords, const F32& lod, |
| 1781 | const Value& offset, const F32& lod_clamp, | 1781 | const Value& offset, TextureInstInfo info) { |
| 1782 | TextureInstInfo info) { | ||
| 1783 | const Value lod_lc{MakeLodClampPair(*this, lod, lod_clamp)}; | ||
| 1784 | const Opcode op{handle.IsImmediate() ? Opcode::BoundImageSampleExplicitLod | 1782 | const Opcode op{handle.IsImmediate() ? Opcode::BoundImageSampleExplicitLod |
| 1785 | : Opcode::BindlessImageSampleExplicitLod}; | 1783 | : Opcode::BindlessImageSampleExplicitLod}; |
| 1786 | return Inst(op, Flags{info}, handle, coords, lod_lc, offset); | 1784 | return Inst(op, Flags{info}, handle, coords, lod, offset); |
| 1787 | } | 1785 | } |
| 1788 | 1786 | ||
| 1789 | F32 IREmitter::ImageSampleDrefImplicitLod(const Value& handle, const Value& coords, const F32& dref, | 1787 | F32 IREmitter::ImageSampleDrefImplicitLod(const Value& handle, const Value& coords, const F32& dref, |
| @@ -1796,12 +1794,11 @@ F32 IREmitter::ImageSampleDrefImplicitLod(const Value& handle, const Value& coor | |||
| 1796 | } | 1794 | } |
| 1797 | 1795 | ||
| 1798 | F32 IREmitter::ImageSampleDrefExplicitLod(const Value& handle, const Value& coords, const F32& dref, | 1796 | F32 IREmitter::ImageSampleDrefExplicitLod(const Value& handle, const Value& coords, const F32& dref, |
| 1799 | const F32& lod, const Value& offset, const F32& lod_clamp, | 1797 | const F32& lod, const Value& offset, |
| 1800 | TextureInstInfo info) { | 1798 | TextureInstInfo info) { |
| 1801 | const Value lod_lc{MakeLodClampPair(*this, lod, lod_clamp)}; | ||
| 1802 | const Opcode op{handle.IsImmediate() ? Opcode::BoundImageSampleDrefExplicitLod | 1799 | const Opcode op{handle.IsImmediate() ? Opcode::BoundImageSampleDrefExplicitLod |
| 1803 | : Opcode::BindlessImageSampleDrefExplicitLod}; | 1800 | : Opcode::BindlessImageSampleDrefExplicitLod}; |
| 1804 | return Inst<F32>(op, Flags{info}, handle, coords, dref, lod_lc, offset); | 1801 | return Inst<F32>(op, Flags{info}, handle, coords, dref, lod, offset); |
| 1805 | } | 1802 | } |
| 1806 | 1803 | ||
| 1807 | Value IREmitter::ImageGather(const Value& handle, const Value& coords, const Value& offset, | 1804 | Value IREmitter::ImageGather(const Value& handle, const Value& coords, const Value& offset, |
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h index 4f7c820fe..4ae69b788 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.h +++ b/src/shader_recompiler/frontend/ir/ir_emitter.h | |||
| @@ -302,15 +302,14 @@ public: | |||
| 302 | const F32& lod_clamp, TextureInstInfo info); | 302 | const F32& lod_clamp, TextureInstInfo info); |
| 303 | [[nodiscard]] Value ImageSampleExplicitLod(const Value& handle, const Value& coords, | 303 | [[nodiscard]] Value ImageSampleExplicitLod(const Value& handle, const Value& coords, |
| 304 | const F32& lod, const Value& offset, | 304 | const F32& lod, const Value& offset, |
| 305 | const F32& lod_clamp, TextureInstInfo info); | 305 | TextureInstInfo info); |
| 306 | [[nodiscard]] F32 ImageSampleDrefImplicitLod(const Value& handle, const Value& coords, | 306 | [[nodiscard]] F32 ImageSampleDrefImplicitLod(const Value& handle, const Value& coords, |
| 307 | const F32& dref, const F32& bias, | 307 | const F32& dref, const F32& bias, |
| 308 | const Value& offset, const F32& lod_clamp, | 308 | const Value& offset, const F32& lod_clamp, |
| 309 | TextureInstInfo info); | 309 | TextureInstInfo info); |
| 310 | [[nodiscard]] F32 ImageSampleDrefExplicitLod(const Value& handle, const Value& coords, | 310 | [[nodiscard]] F32 ImageSampleDrefExplicitLod(const Value& handle, const Value& coords, |
| 311 | const F32& dref, const F32& lod, | 311 | const F32& dref, const F32& lod, |
| 312 | const Value& offset, const F32& lod_clamp, | 312 | const Value& offset, TextureInstInfo info); |
| 313 | TextureInstInfo info); | ||
| 314 | [[nodiscard]] Value ImageQueryDimension(const Value& handle, const IR::U32& lod); | 313 | [[nodiscard]] Value ImageQueryDimension(const Value& handle, const IR::U32& lod); |
| 315 | 314 | ||
| 316 | [[nodiscard]] Value ImageQueryLod(const Value& handle, const Value& coords, | 315 | [[nodiscard]] Value ImageQueryLod(const Value& handle, const Value& coords, |