diff options
Diffstat (limited to 'src/shader_recompiler/frontend')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 14 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.h | 8 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/opcodes.h | 1 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/opcodes.inc | 7 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/type.h | 31 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/value.cpp | 3 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/value.h | 25 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/maxwell/translate/impl/texture_query.cpp | 8 |
8 files changed, 39 insertions, 58 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index eb2e49a68..b7caa4246 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -704,11 +704,6 @@ IR::U32 IREmitter::BitCast<IR::U32, IR::F32>(const IR::F32& value) { | |||
| 704 | } | 704 | } |
| 705 | 705 | ||
| 706 | template <> | 706 | template <> |
| 707 | IR::S32 IREmitter::BitCast<IR::S32, IR::F32>(const IR::F32& value) { | ||
| 708 | return Inst<IR::S32>(Opcode::BitCastS32F32, value); | ||
| 709 | } | ||
| 710 | |||
| 711 | template <> | ||
| 712 | IR::F32 IREmitter::BitCast<IR::F32, IR::U32>(const IR::U32& value) { | 707 | IR::F32 IREmitter::BitCast<IR::F32, IR::U32>(const IR::U32& value) { |
| 713 | return Inst<IR::F32>(Opcode::BitCastF32U32, value); | 708 | return Inst<IR::F32>(Opcode::BitCastF32U32, value); |
| 714 | } | 709 | } |
| @@ -1851,15 +1846,16 @@ Value IREmitter::ImageFetch(const Value& handle, const Value& coords, const Valu | |||
| 1851 | return Inst(op, Flags{info}, handle, coords, offset, lod, multisampling); | 1846 | return Inst(op, Flags{info}, handle, coords, offset, lod, multisampling); |
| 1852 | } | 1847 | } |
| 1853 | 1848 | ||
| 1854 | Value IREmitter::ImageQueryDimension(const Value& handle, const IR::U32& lod) { | 1849 | Value IREmitter::ImageQueryDimension(const Value& handle, const IR::U32& lod, |
| 1850 | const IR::U1& skip_mips) { | ||
| 1855 | const Opcode op{handle.IsImmediate() ? Opcode::BoundImageQueryDimensions | 1851 | const Opcode op{handle.IsImmediate() ? Opcode::BoundImageQueryDimensions |
| 1856 | : Opcode::BindlessImageQueryDimensions}; | 1852 | : Opcode::BindlessImageQueryDimensions}; |
| 1857 | return Inst(op, handle, lod); | 1853 | return Inst(op, handle, lod, skip_mips); |
| 1858 | } | 1854 | } |
| 1859 | 1855 | ||
| 1860 | Value IREmitter::ImageQueryDimension(const Value& handle, const IR::U32& lod, | 1856 | Value IREmitter::ImageQueryDimension(const Value& handle, const IR::U32& lod, |
| 1861 | TextureInstInfo info) { | 1857 | const IR::U1& skip_mips, TextureInstInfo info) { |
| 1862 | return Inst(Opcode::ImageQueryDimensions, Flags{info}, handle, lod); | 1858 | return Inst(Opcode::ImageQueryDimensions, Flags{info}, handle, lod, skip_mips); |
| 1863 | } | 1859 | } |
| 1864 | 1860 | ||
| 1865 | Value IREmitter::ImageQueryLod(const Value& handle, const Value& coords, TextureInstInfo info) { | 1861 | Value IREmitter::ImageQueryLod(const Value& handle, const Value& coords, TextureInstInfo info) { |
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h index 7aaaa4ab0..f3c81dbe1 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.h +++ b/src/shader_recompiler/frontend/ir/ir_emitter.h | |||
| @@ -320,9 +320,10 @@ public: | |||
| 320 | [[nodiscard]] F32 ImageSampleDrefExplicitLod(const Value& handle, const Value& coords, | 320 | [[nodiscard]] F32 ImageSampleDrefExplicitLod(const Value& handle, const Value& coords, |
| 321 | const F32& dref, const F32& lod, | 321 | const F32& dref, const F32& lod, |
| 322 | const Value& offset, TextureInstInfo info); | 322 | const Value& offset, TextureInstInfo info); |
| 323 | [[nodiscard]] Value ImageQueryDimension(const Value& handle, const IR::U32& lod); | ||
| 324 | [[nodiscard]] Value ImageQueryDimension(const Value& handle, const IR::U32& lod, | 323 | [[nodiscard]] Value ImageQueryDimension(const Value& handle, const IR::U32& lod, |
| 325 | TextureInstInfo info); | 324 | const IR::U1& skip_mips); |
| 325 | [[nodiscard]] Value ImageQueryDimension(const Value& handle, const IR::U32& lod, | ||
| 326 | const IR::U1& skip_mips, TextureInstInfo info); | ||
| 326 | 327 | ||
| 327 | [[nodiscard]] Value ImageQueryLod(const Value& handle, const Value& coords, | 328 | [[nodiscard]] Value ImageQueryLod(const Value& handle, const Value& coords, |
| 328 | TextureInstInfo info); | 329 | TextureInstInfo info); |
| @@ -408,7 +409,8 @@ private: | |||
| 408 | } | 409 | } |
| 409 | 410 | ||
| 410 | template <typename T> | 411 | template <typename T> |
| 411 | requires(sizeof(T) <= sizeof(u32) && std::is_trivially_copyable_v<T>) struct Flags { | 412 | requires(sizeof(T) <= sizeof(u32) && std::is_trivially_copyable_v<T>) |
| 413 | struct Flags { | ||
| 412 | Flags() = default; | 414 | Flags() = default; |
| 413 | Flags(T proxy_) : proxy{proxy_} {} | 415 | Flags(T proxy_) : proxy{proxy_} {} |
| 414 | 416 | ||
diff --git a/src/shader_recompiler/frontend/ir/opcodes.h b/src/shader_recompiler/frontend/ir/opcodes.h index d155afd0f..e300714f3 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.h +++ b/src/shader_recompiler/frontend/ir/opcodes.h | |||
| @@ -38,7 +38,6 @@ constexpr Type U8{Type::U8}; | |||
| 38 | constexpr Type U16{Type::U16}; | 38 | constexpr Type U16{Type::U16}; |
| 39 | constexpr Type U32{Type::U32}; | 39 | constexpr Type U32{Type::U32}; |
| 40 | constexpr Type U64{Type::U64}; | 40 | constexpr Type U64{Type::U64}; |
| 41 | constexpr Type S32{Type::S32}; | ||
| 42 | constexpr Type F16{Type::F16}; | 41 | constexpr Type F16{Type::F16}; |
| 43 | constexpr Type F32{Type::F32}; | 42 | constexpr Type F32{Type::F32}; |
| 44 | constexpr Type F64{Type::F64}; | 43 | constexpr Type F64{Type::F64}; |
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc index 1fe3749cc..4447d67b0 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.inc +++ b/src/shader_recompiler/frontend/ir/opcodes.inc | |||
| @@ -175,7 +175,6 @@ OPCODE(SelectF64, F64, U1, | |||
| 175 | OPCODE(BitCastU16F16, U16, F16, ) | 175 | OPCODE(BitCastU16F16, U16, F16, ) |
| 176 | OPCODE(BitCastU32F32, U32, F32, ) | 176 | OPCODE(BitCastU32F32, U32, F32, ) |
| 177 | OPCODE(BitCastU64F64, U64, F64, ) | 177 | OPCODE(BitCastU64F64, U64, F64, ) |
| 178 | OPCODE(BitCastS32F32, S32, F32, ) | ||
| 179 | OPCODE(BitCastF16U16, F16, U16, ) | 178 | OPCODE(BitCastF16U16, F16, U16, ) |
| 180 | OPCODE(BitCastF32U32, F32, U32, ) | 179 | OPCODE(BitCastF32U32, F32, U32, ) |
| 181 | OPCODE(BitCastF64U64, F64, U64, ) | 180 | OPCODE(BitCastF64U64, F64, U64, ) |
| @@ -483,7 +482,7 @@ OPCODE(BindlessImageSampleDrefExplicitLod, F32, U32, | |||
| 483 | OPCODE(BindlessImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) | 482 | OPCODE(BindlessImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) |
| 484 | OPCODE(BindlessImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) | 483 | OPCODE(BindlessImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) |
| 485 | OPCODE(BindlessImageFetch, F32x4, U32, Opaque, Opaque, U32, Opaque, ) | 484 | OPCODE(BindlessImageFetch, F32x4, U32, Opaque, Opaque, U32, Opaque, ) |
| 486 | OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, ) | 485 | OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, U1, ) |
| 487 | OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, ) | 486 | OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, ) |
| 488 | OPCODE(BindlessImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) | 487 | OPCODE(BindlessImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) |
| 489 | OPCODE(BindlessImageRead, U32x4, U32, Opaque, ) | 488 | OPCODE(BindlessImageRead, U32x4, U32, Opaque, ) |
| @@ -496,7 +495,7 @@ OPCODE(BoundImageSampleDrefExplicitLod, F32, U32, | |||
| 496 | OPCODE(BoundImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) | 495 | OPCODE(BoundImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) |
| 497 | OPCODE(BoundImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) | 496 | OPCODE(BoundImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) |
| 498 | OPCODE(BoundImageFetch, F32x4, U32, Opaque, Opaque, U32, Opaque, ) | 497 | OPCODE(BoundImageFetch, F32x4, U32, Opaque, Opaque, U32, Opaque, ) |
| 499 | OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, ) | 498 | OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, U1, ) |
| 500 | OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, ) | 499 | OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, ) |
| 501 | OPCODE(BoundImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) | 500 | OPCODE(BoundImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) |
| 502 | OPCODE(BoundImageRead, U32x4, U32, Opaque, ) | 501 | OPCODE(BoundImageRead, U32x4, U32, Opaque, ) |
| @@ -509,7 +508,7 @@ OPCODE(ImageSampleDrefExplicitLod, F32, Opaq | |||
| 509 | OPCODE(ImageGather, F32x4, Opaque, Opaque, Opaque, Opaque, ) | 508 | OPCODE(ImageGather, F32x4, Opaque, Opaque, Opaque, Opaque, ) |
| 510 | OPCODE(ImageGatherDref, F32x4, Opaque, Opaque, Opaque, Opaque, F32, ) | 509 | OPCODE(ImageGatherDref, F32x4, Opaque, Opaque, Opaque, Opaque, F32, ) |
| 511 | OPCODE(ImageFetch, F32x4, Opaque, Opaque, Opaque, U32, Opaque, ) | 510 | OPCODE(ImageFetch, F32x4, Opaque, Opaque, Opaque, U32, Opaque, ) |
| 512 | OPCODE(ImageQueryDimensions, U32x4, Opaque, U32, ) | 511 | OPCODE(ImageQueryDimensions, U32x4, Opaque, U32, U1, ) |
| 513 | OPCODE(ImageQueryLod, F32x4, Opaque, Opaque, ) | 512 | OPCODE(ImageQueryLod, F32x4, Opaque, Opaque, ) |
| 514 | OPCODE(ImageGradient, F32x4, Opaque, Opaque, Opaque, Opaque, Opaque, ) | 513 | OPCODE(ImageGradient, F32x4, Opaque, Opaque, Opaque, Opaque, Opaque, ) |
| 515 | OPCODE(ImageRead, U32x4, Opaque, Opaque, ) | 514 | OPCODE(ImageRead, U32x4, Opaque, Opaque, ) |
diff --git a/src/shader_recompiler/frontend/ir/type.h b/src/shader_recompiler/frontend/ir/type.h index 5a7c706ad..04c8c4ddb 100644 --- a/src/shader_recompiler/frontend/ir/type.h +++ b/src/shader_recompiler/frontend/ir/type.h | |||
| @@ -24,22 +24,21 @@ enum class Type { | |||
| 24 | U16 = 1 << 7, | 24 | U16 = 1 << 7, |
| 25 | U32 = 1 << 8, | 25 | U32 = 1 << 8, |
| 26 | U64 = 1 << 9, | 26 | U64 = 1 << 9, |
| 27 | S32 = 1 << 10, | 27 | F16 = 1 << 10, |
| 28 | F16 = 1 << 11, | 28 | F32 = 1 << 11, |
| 29 | F32 = 1 << 12, | 29 | F64 = 1 << 12, |
| 30 | F64 = 1 << 13, | 30 | U32x2 = 1 << 13, |
| 31 | U32x2 = 1 << 14, | 31 | U32x3 = 1 << 14, |
| 32 | U32x3 = 1 << 15, | 32 | U32x4 = 1 << 15, |
| 33 | U32x4 = 1 << 16, | 33 | F16x2 = 1 << 16, |
| 34 | F16x2 = 1 << 17, | 34 | F16x3 = 1 << 17, |
| 35 | F16x3 = 1 << 18, | 35 | F16x4 = 1 << 18, |
| 36 | F16x4 = 1 << 19, | 36 | F32x2 = 1 << 19, |
| 37 | F32x2 = 1 << 20, | 37 | F32x3 = 1 << 20, |
| 38 | F32x3 = 1 << 21, | 38 | F32x4 = 1 << 21, |
| 39 | F32x4 = 1 << 22, | 39 | F64x2 = 1 << 22, |
| 40 | F64x2 = 1 << 23, | 40 | F64x3 = 1 << 23, |
| 41 | F64x3 = 1 << 24, | 41 | F64x4 = 1 << 24, |
| 42 | F64x4 = 1 << 25, | ||
| 43 | }; | 42 | }; |
| 44 | DECLARE_ENUM_FLAG_OPERATORS(Type) | 43 | DECLARE_ENUM_FLAG_OPERATORS(Type) |
| 45 | 44 | ||
diff --git a/src/shader_recompiler/frontend/ir/value.cpp b/src/shader_recompiler/frontend/ir/value.cpp index 30ba12316..346169328 100644 --- a/src/shader_recompiler/frontend/ir/value.cpp +++ b/src/shader_recompiler/frontend/ir/value.cpp | |||
| @@ -23,8 +23,6 @@ Value::Value(u16 value) noexcept : type{Type::U16}, imm_u16{value} {} | |||
| 23 | 23 | ||
| 24 | Value::Value(u32 value) noexcept : type{Type::U32}, imm_u32{value} {} | 24 | Value::Value(u32 value) noexcept : type{Type::U32}, imm_u32{value} {} |
| 25 | 25 | ||
| 26 | Value::Value(s32 value) noexcept : type{Type::S32}, imm_s32{value} {} | ||
| 27 | |||
| 28 | Value::Value(f32 value) noexcept : type{Type::F32}, imm_f32{value} {} | 26 | Value::Value(f32 value) noexcept : type{Type::F32}, imm_f32{value} {} |
| 29 | 27 | ||
| 30 | Value::Value(u64 value) noexcept : type{Type::U64}, imm_u64{value} {} | 28 | Value::Value(u64 value) noexcept : type{Type::U64}, imm_u64{value} {} |
| @@ -71,7 +69,6 @@ bool Value::operator==(const Value& other) const { | |||
| 71 | return imm_u16 == other.imm_u16; | 69 | return imm_u16 == other.imm_u16; |
| 72 | case Type::U32: | 70 | case Type::U32: |
| 73 | case Type::F32: | 71 | case Type::F32: |
| 74 | case Type::S32: | ||
| 75 | return imm_u32 == other.imm_u32; | 72 | return imm_u32 == other.imm_u32; |
| 76 | case Type::U64: | 73 | case Type::U64: |
| 77 | case Type::F64: | 74 | case Type::F64: |
diff --git a/src/shader_recompiler/frontend/ir/value.h b/src/shader_recompiler/frontend/ir/value.h index 8b34356fd..c27546b0e 100644 --- a/src/shader_recompiler/frontend/ir/value.h +++ b/src/shader_recompiler/frontend/ir/value.h | |||
| @@ -43,7 +43,6 @@ public: | |||
| 43 | explicit Value(u8 value) noexcept; | 43 | explicit Value(u8 value) noexcept; |
| 44 | explicit Value(u16 value) noexcept; | 44 | explicit Value(u16 value) noexcept; |
| 45 | explicit Value(u32 value) noexcept; | 45 | explicit Value(u32 value) noexcept; |
| 46 | explicit Value(s32 value) noexcept; | ||
| 47 | explicit Value(f32 value) noexcept; | 46 | explicit Value(f32 value) noexcept; |
| 48 | explicit Value(u64 value) noexcept; | 47 | explicit Value(u64 value) noexcept; |
| 49 | explicit Value(f64 value) noexcept; | 48 | explicit Value(f64 value) noexcept; |
| @@ -66,7 +65,6 @@ public: | |||
| 66 | [[nodiscard]] u8 U8() const; | 65 | [[nodiscard]] u8 U8() const; |
| 67 | [[nodiscard]] u16 U16() const; | 66 | [[nodiscard]] u16 U16() const; |
| 68 | [[nodiscard]] u32 U32() const; | 67 | [[nodiscard]] u32 U32() const; |
| 69 | [[nodiscard]] s32 S32() const; | ||
| 70 | [[nodiscard]] f32 F32() const; | 68 | [[nodiscard]] f32 F32() const; |
| 71 | [[nodiscard]] u64 U64() const; | 69 | [[nodiscard]] u64 U64() const; |
| 72 | [[nodiscard]] f64 F64() const; | 70 | [[nodiscard]] f64 F64() const; |
| @@ -86,7 +84,6 @@ private: | |||
| 86 | u8 imm_u8; | 84 | u8 imm_u8; |
| 87 | u16 imm_u16; | 85 | u16 imm_u16; |
| 88 | u32 imm_u32; | 86 | u32 imm_u32; |
| 89 | s32 imm_s32; | ||
| 90 | f32 imm_f32; | 87 | f32 imm_f32; |
| 91 | u64 imm_u64; | 88 | u64 imm_u64; |
| 92 | f64 imm_f64; | 89 | f64 imm_f64; |
| @@ -101,9 +98,8 @@ public: | |||
| 101 | TypedValue() = default; | 98 | TypedValue() = default; |
| 102 | 99 | ||
| 103 | template <IR::Type other_type> | 100 | template <IR::Type other_type> |
| 104 | requires((other_type & type_) != IR::Type::Void) explicit(false) | 101 | requires((other_type & type_) != IR::Type::Void) |
| 105 | TypedValue(const TypedValue<other_type>& value) | 102 | explicit(false) TypedValue(const TypedValue<other_type>& value) : Value(value) {} |
| 106 | : Value(value) {} | ||
| 107 | 103 | ||
| 108 | explicit TypedValue(const Value& value) : Value(value) { | 104 | explicit TypedValue(const Value& value) : Value(value) { |
| 109 | if ((value.Type() & type_) == IR::Type::Void) { | 105 | if ((value.Type() & type_) == IR::Type::Void) { |
| @@ -194,16 +190,16 @@ public: | |||
| 194 | void ReplaceOpcode(IR::Opcode opcode); | 190 | void ReplaceOpcode(IR::Opcode opcode); |
| 195 | 191 | ||
| 196 | template <typename FlagsType> | 192 | template <typename FlagsType> |
| 197 | requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>) | 193 | requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>) |
| 198 | [[nodiscard]] FlagsType Flags() const noexcept { | 194 | [[nodiscard]] FlagsType Flags() const noexcept { |
| 199 | FlagsType ret; | 195 | FlagsType ret; |
| 200 | std::memcpy(reinterpret_cast<char*>(&ret), &flags, sizeof(ret)); | 196 | std::memcpy(reinterpret_cast<char*>(&ret), &flags, sizeof(ret)); |
| 201 | return ret; | 197 | return ret; |
| 202 | } | 198 | } |
| 203 | 199 | ||
| 204 | template <typename FlagsType> | 200 | template <typename FlagsType> |
| 205 | requires(sizeof(FlagsType) <= sizeof(u32) && | 201 | requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>) |
| 206 | std::is_trivially_copyable_v<FlagsType>) void SetFlags(FlagsType value) noexcept { | 202 | void SetFlags(FlagsType value) noexcept { |
| 207 | std::memcpy(&flags, &value, sizeof(value)); | 203 | std::memcpy(&flags, &value, sizeof(value)); |
| 208 | } | 204 | } |
| 209 | 205 | ||
| @@ -268,7 +264,6 @@ using U8 = TypedValue<Type::U8>; | |||
| 268 | using U16 = TypedValue<Type::U16>; | 264 | using U16 = TypedValue<Type::U16>; |
| 269 | using U32 = TypedValue<Type::U32>; | 265 | using U32 = TypedValue<Type::U32>; |
| 270 | using U64 = TypedValue<Type::U64>; | 266 | using U64 = TypedValue<Type::U64>; |
| 271 | using S32 = TypedValue<Type::S32>; | ||
| 272 | using F16 = TypedValue<Type::F16>; | 267 | using F16 = TypedValue<Type::F16>; |
| 273 | using F32 = TypedValue<Type::F32>; | 268 | using F32 = TypedValue<Type::F32>; |
| 274 | using F64 = TypedValue<Type::F64>; | 269 | using F64 = TypedValue<Type::F64>; |
| @@ -380,14 +375,6 @@ inline u32 Value::U32() const { | |||
| 380 | return imm_u32; | 375 | return imm_u32; |
| 381 | } | 376 | } |
| 382 | 377 | ||
| 383 | inline s32 Value::S32() const { | ||
| 384 | if (IsIdentity()) { | ||
| 385 | return inst->Arg(0).S32(); | ||
| 386 | } | ||
| 387 | DEBUG_ASSERT(type == Type::S32); | ||
| 388 | return imm_s32; | ||
| 389 | } | ||
| 390 | |||
| 391 | inline f32 Value::F32() const { | 378 | inline f32 Value::F32() const { |
| 392 | if (IsIdentity()) { | 379 | if (IsIdentity()) { |
| 393 | return inst->Arg(0).F32(); | 380 | return inst->Arg(0).F32(); |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_query.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_query.cpp index f8cfd4ab6..39af62559 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_query.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_query.cpp | |||
| @@ -15,11 +15,13 @@ enum class Mode : u64 { | |||
| 15 | SamplePos = 5, | 15 | SamplePos = 5, |
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | IR::Value Query(TranslatorVisitor& v, const IR::U32& handle, Mode mode, IR::Reg src_reg) { | 18 | IR::Value Query(TranslatorVisitor& v, const IR::U32& handle, Mode mode, IR::Reg src_reg, u64 mask) { |
| 19 | switch (mode) { | 19 | switch (mode) { |
| 20 | case Mode::Dimension: { | 20 | case Mode::Dimension: { |
| 21 | const bool needs_num_mips{((mask >> 3) & 1) != 0}; | ||
| 22 | const IR::U1 skip_mips{v.ir.Imm1(!needs_num_mips)}; | ||
| 21 | const IR::U32 lod{v.X(src_reg)}; | 23 | const IR::U32 lod{v.X(src_reg)}; |
| 22 | return v.ir.ImageQueryDimension(handle, lod); | 24 | return v.ir.ImageQueryDimension(handle, lod, skip_mips); |
| 23 | } | 25 | } |
| 24 | case Mode::TextureType: | 26 | case Mode::TextureType: |
| 25 | case Mode::SamplePos: | 27 | case Mode::SamplePos: |
| @@ -46,7 +48,7 @@ void Impl(TranslatorVisitor& v, u64 insn, std::optional<u32> cbuf_offset) { | |||
| 46 | handle = v.X(src_reg); | 48 | handle = v.X(src_reg); |
| 47 | ++src_reg; | 49 | ++src_reg; |
| 48 | } | 50 | } |
| 49 | const IR::Value query{Query(v, handle, txq.mode, src_reg)}; | 51 | const IR::Value query{Query(v, handle, txq.mode, src_reg, txq.mask)}; |
| 50 | IR::Reg dest_reg{txq.dest_reg}; | 52 | IR::Reg dest_reg{txq.dest_reg}; |
| 51 | for (int element = 0; element < 4; ++element) { | 53 | for (int element = 0; element < 4; ++element) { |
| 52 | if (((txq.mask >> element) & 1) == 0) { | 54 | if (((txq.mask >> element) & 1) == 0) { |