summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir/value.h
diff options
context:
space:
mode:
authorGravatar Feng Chen2022-11-04 14:39:42 +0800
committerGravatar GitHub2022-11-04 02:39:42 -0400
commit75596c07e0fc1462c2a19484e168f4944c33d3d3 (patch)
tree1aa919ea76f467c51b3fc591a72c57f5ade92560 /src/shader_recompiler/frontend/ir/value.h
parentUI: Add options to hide extra columns (#9093) (diff)
downloadyuzu-75596c07e0fc1462c2a19484e168f4944c33d3d3.tar.gz
yuzu-75596c07e0fc1462c2a19484e168f4944c33d3d3.tar.xz
yuzu-75596c07e0fc1462c2a19484e168f4944c33d3d3.zip
video_core: Fix SNORM texture buffer emulating error (#9001)
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/frontend/ir/value.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/value.h b/src/shader_recompiler/frontend/ir/value.h
index 6a673ca05..e8bbb93a5 100644
--- a/src/shader_recompiler/frontend/ir/value.h
+++ b/src/shader_recompiler/frontend/ir/value.h
@@ -44,6 +44,7 @@ public:
44 explicit Value(u8 value) noexcept; 44 explicit Value(u8 value) noexcept;
45 explicit Value(u16 value) noexcept; 45 explicit Value(u16 value) noexcept;
46 explicit Value(u32 value) noexcept; 46 explicit Value(u32 value) noexcept;
47 explicit Value(s32 value) noexcept;
47 explicit Value(f32 value) noexcept; 48 explicit Value(f32 value) noexcept;
48 explicit Value(u64 value) noexcept; 49 explicit Value(u64 value) noexcept;
49 explicit Value(f64 value) noexcept; 50 explicit Value(f64 value) noexcept;
@@ -66,6 +67,7 @@ public:
66 [[nodiscard]] u8 U8() const; 67 [[nodiscard]] u8 U8() const;
67 [[nodiscard]] u16 U16() const; 68 [[nodiscard]] u16 U16() const;
68 [[nodiscard]] u32 U32() const; 69 [[nodiscard]] u32 U32() const;
70 [[nodiscard]] s32 S32() const;
69 [[nodiscard]] f32 F32() const; 71 [[nodiscard]] f32 F32() const;
70 [[nodiscard]] u64 U64() const; 72 [[nodiscard]] u64 U64() const;
71 [[nodiscard]] f64 F64() const; 73 [[nodiscard]] f64 F64() const;
@@ -85,6 +87,7 @@ private:
85 u8 imm_u8; 87 u8 imm_u8;
86 u16 imm_u16; 88 u16 imm_u16;
87 u32 imm_u32; 89 u32 imm_u32;
90 s32 imm_s32;
88 f32 imm_f32; 91 f32 imm_f32;
89 u64 imm_u64; 92 u64 imm_u64;
90 f64 imm_f64; 93 f64 imm_f64;
@@ -266,6 +269,7 @@ using U8 = TypedValue<Type::U8>;
266using U16 = TypedValue<Type::U16>; 269using U16 = TypedValue<Type::U16>;
267using U32 = TypedValue<Type::U32>; 270using U32 = TypedValue<Type::U32>;
268using U64 = TypedValue<Type::U64>; 271using U64 = TypedValue<Type::U64>;
272using S32 = TypedValue<Type::S32>;
269using F16 = TypedValue<Type::F16>; 273using F16 = TypedValue<Type::F16>;
270using F32 = TypedValue<Type::F32>; 274using F32 = TypedValue<Type::F32>;
271using F64 = TypedValue<Type::F64>; 275using F64 = TypedValue<Type::F64>;
@@ -377,6 +381,14 @@ inline u32 Value::U32() const {
377 return imm_u32; 381 return imm_u32;
378} 382}
379 383
384inline s32 Value::S32() const {
385 if (IsIdentity()) {
386 return inst->Arg(0).S32();
387 }
388 DEBUG_ASSERT(type == Type::S32);
389 return imm_s32;
390}
391
380inline f32 Value::F32() const { 392inline f32 Value::F32() const {
381 if (IsIdentity()) { 393 if (IsIdentity()) {
382 return inst->Arg(0).F32(); 394 return inst->Arg(0).F32();