summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.cpp12
-rw-r--r--src/shader_recompiler/frontend/ir/microinstruction.h4
-rw-r--r--src/shader_recompiler/frontend/ir/modifiers.h5
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.inc1
-rw-r--r--src/shader_recompiler/frontend/ir/value.cpp14
-rw-r--r--src/shader_recompiler/frontend/ir/value.h1
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather.cpp28
7 files changed, 19 insertions, 46 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
index b8d36f362..0296f8773 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
@@ -398,16 +398,15 @@ Value IREmitter::CompositeConstruct(const Value& e1, const Value& e2) {
if (e1.Type() != e2.Type()) {
throw InvalidArgument("Mismatching types {} and {}", e1.Type(), e2.Type());
}
- CompositeDecoration decor{};
switch (e1.Type()) {
case Type::U32:
- return Inst(Opcode::CompositeConstructU32x2, Flags{decor}, e1, e2);
+ return Inst(Opcode::CompositeConstructU32x2, e1, e2);
case Type::F16:
- return Inst(Opcode::CompositeConstructF16x2, Flags{decor}, e1, e2);
+ return Inst(Opcode::CompositeConstructF16x2, e1, e2);
case Type::F32:
- return Inst(Opcode::CompositeConstructF32x2, Flags{decor}, e1, e2);
+ return Inst(Opcode::CompositeConstructF32x2, e1, e2);
case Type::F64:
- return Inst(Opcode::CompositeConstructF64x2, Flags{decor}, e1, e2);
+ return Inst(Opcode::CompositeConstructF64x2, e1, e2);
default:
ThrowInvalidType(e1.Type());
}
@@ -437,7 +436,6 @@ Value IREmitter::CompositeConstruct(const Value& e1, const Value& e2, const Valu
throw InvalidArgument("Mismatching types {}, {}, {}, and {}", e1.Type(), e2.Type(),
e3.Type(), e4.Type());
}
- CompositeDecoration decor{};
switch (e1.Type()) {
case Type::U32:
return Inst(Opcode::CompositeConstructU32x4, e1, e2, e3, e4);
@@ -447,8 +445,6 @@ Value IREmitter::CompositeConstruct(const Value& e1, const Value& e2, const Valu
return Inst(Opcode::CompositeConstructF32x4, e1, e2, e3, e4);
case Type::F64:
return Inst(Opcode::CompositeConstructF64x4, e1, e2, e3, e4);
- case Type::U32x2:
- return Inst(Opcode::CompositeConstructArrayU32x2, Flags{decor}, e1, e2, e3, e4);
default:
ThrowInvalidType(e1.Type());
}
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.h b/src/shader_recompiler/frontend/ir/microinstruction.h
index 77296cfa4..6658dc674 100644
--- a/src/shader_recompiler/frontend/ir/microinstruction.h
+++ b/src/shader_recompiler/frontend/ir/microinstruction.h
@@ -101,8 +101,8 @@ public:
template <typename FlagsType>
requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>)
- [[nodiscard]] void SetFlags(FlagsType& new_val) noexcept {
- std::memcpy(&flags, &new_val, sizeof(new_val));
+ [[nodiscard]] void SetFlags(FlagsType value) noexcept {
+ std::memcpy(&flags, &value, sizeof(value));
}
/// Intrusively store the host definition of this instruction.
diff --git a/src/shader_recompiler/frontend/ir/modifiers.h b/src/shader_recompiler/frontend/ir/modifiers.h
index 20fb14fea..4f09a4b39 100644
--- a/src/shader_recompiler/frontend/ir/modifiers.h
+++ b/src/shader_recompiler/frontend/ir/modifiers.h
@@ -32,11 +32,6 @@ struct FpControl {
};
static_assert(sizeof(FpControl) <= sizeof(u32));
-struct CompositeDecoration {
- bool is_constant{false};
-};
-static_assert(sizeof(CompositeDecoration) <= sizeof(u32));
-
union TextureInstInfo {
u32 raw;
BitField<0, 8, TextureType> type;
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc
index 3dacd7b6b..e12b92c47 100644
--- a/src/shader_recompiler/frontend/ir/opcodes.inc
+++ b/src/shader_recompiler/frontend/ir/opcodes.inc
@@ -126,7 +126,6 @@ OPCODE(CompositeExtractF64x4, F64, F64x
OPCODE(CompositeInsertF64x2, F64x2, F64x2, F64, U32, )
OPCODE(CompositeInsertF64x3, F64x3, F64x3, F64, U32, )
OPCODE(CompositeInsertF64x4, F64x4, F64x4, F64, U32, )
-OPCODE(CompositeConstructArrayU32x2, Opaque, U32x2, U32x2, U32x2, U32x2, )
// Select operations
OPCODE(SelectU1, U1, U1, U1, U1, )
diff --git a/src/shader_recompiler/frontend/ir/value.cpp b/src/shader_recompiler/frontend/ir/value.cpp
index 7671fc3d8..e8e4662e7 100644
--- a/src/shader_recompiler/frontend/ir/value.cpp
+++ b/src/shader_recompiler/frontend/ir/value.cpp
@@ -44,20 +44,6 @@ bool Value::IsEmpty() const noexcept {
return type == Type::Void;
}
-bool Value::IsConstantContainer() const {
- if (IsImmediate()) {
- return true;
- }
- ValidateAccess(Type::Opaque);
- auto num_args = inst->NumArgs();
- for (size_t i = 0; i < num_args; i++) {
- if (!inst->Arg(i).IsConstantContainer()) {
- return false;
- }
- }
- return true;
-}
-
bool Value::IsImmediate() const noexcept {
if (IsIdentity()) {
return inst->Arg(0).IsImmediate();
diff --git a/src/shader_recompiler/frontend/ir/value.h b/src/shader_recompiler/frontend/ir/value.h
index 5d6e74c14..b27601e70 100644
--- a/src/shader_recompiler/frontend/ir/value.h
+++ b/src/shader_recompiler/frontend/ir/value.h
@@ -38,7 +38,6 @@ public:
[[nodiscard]] bool IsImmediate() const noexcept;
[[nodiscard]] bool IsLabel() const noexcept;
[[nodiscard]] IR::Type Type() const noexcept;
- [[nodiscard]] bool IsConstantContainer() const;
[[nodiscard]] IR::Inst* Inst() const;
[[nodiscard]] IR::Block* Label() const;
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather.cpp
index cdf5cb5c4..b2f9cda46 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather.cpp
@@ -106,17 +106,17 @@ IR::Value MakeOffset(TranslatorVisitor& v, IR::Reg& reg, TextureType type) {
throw NotImplementedException("Invalid texture type {}", type);
}
-IR::Value MakeOffsetPTP(TranslatorVisitor& v, IR::Reg& reg) {
+std::pair<IR::Value, IR::Value> MakeOffsetPTP(TranslatorVisitor& v, IR::Reg& reg) {
const IR::U32 value1{v.X(reg++)};
const IR::U32 value2{v.X(reg++)};
- const IR::U32 bitsize = v.ir.Imm32(6);
- const auto getVector = ([&v, &bitsize](const IR::U32& value, u32 base) {
- return v.ir.CompositeConstruct(
- v.ir.BitFieldExtract(value, v.ir.Imm32(base + 0), bitsize, true),
- v.ir.BitFieldExtract(value, v.ir.Imm32(base + 8), bitsize, true));
- });
- return v.ir.CompositeConstruct(getVector(value1, 0), getVector(value1, 16),
- getVector(value2, 0), getVector(value2, 16));
+ const IR::U32 bitsize{v.ir.Imm32(6)};
+ const auto make_vector{[&v, &bitsize](const IR::U32& value) {
+ return v.ir.CompositeConstruct(v.ir.BitFieldExtract(value, v.ir.Imm32(0), bitsize, true),
+ v.ir.BitFieldExtract(value, v.ir.Imm32(8), bitsize, true),
+ v.ir.BitFieldExtract(value, v.ir.Imm32(16), bitsize, true),
+ v.ir.BitFieldExtract(value, v.ir.Imm32(24), bitsize, true));
+ }};
+ return {make_vector(value1), make_vector(value2)};
}
void Impl(TranslatorVisitor& v, u64 insn, ComponentType component_type, OffsetType offset_type,
@@ -150,14 +150,12 @@ void Impl(TranslatorVisitor& v, u64 insn, ComponentType component_type, OffsetTy
switch (offset_type) {
case OffsetType::None:
break;
- case OffsetType::AOFFI: {
+ case OffsetType::AOFFI:
offset = MakeOffset(v, meta_reg, tld4.type);
break;
- }
- case OffsetType::PTP: {
- offset2 = MakeOffsetPTP(v, meta_reg);
+ case OffsetType::PTP:
+ std::tie(offset, offset2) = MakeOffsetPTP(v, meta_reg);
break;
- }
default:
throw NotImplementedException("Invalid offset type {}", offset_type);
}
@@ -167,7 +165,7 @@ void Impl(TranslatorVisitor& v, u64 insn, ComponentType component_type, OffsetTy
IR::TextureInstInfo info{};
info.type.Assign(GetType(tld4.type, tld4.dc != 0));
info.gather_component.Assign(static_cast<u32>(component_type));
- const IR::Value sample{[&]() -> IR::Value {
+ const IR::Value sample{[&] {
if (tld4.dc == 0) {
return v.ir.ImageGather(handle, coords, offset, offset2, info);
}