diff options
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell')
34 files changed, 160 insertions, 180 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/control_flow.cpp b/src/shader_recompiler/frontend/maxwell/control_flow.cpp index 847bb1986..cb8ec7eaa 100644 --- a/src/shader_recompiler/frontend/maxwell/control_flow.cpp +++ b/src/shader_recompiler/frontend/maxwell/control_flow.cpp | |||
| @@ -34,41 +34,37 @@ struct Compare { | |||
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | u32 BranchOffset(Location pc, Instruction inst) { | 36 | u32 BranchOffset(Location pc, Instruction inst) { |
| 37 | return pc.Offset() + inst.branch.Offset() + 8; | 37 | return pc.Offset() + static_cast<u32>(inst.branch.Offset()) + 8u; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | void Split(Block* old_block, Block* new_block, Location pc) { | 40 | void Split(Block* old_block, Block* new_block, Location pc) { |
| 41 | if (pc <= old_block->begin || pc >= old_block->end) { | 41 | if (pc <= old_block->begin || pc >= old_block->end) { |
| 42 | throw InvalidArgument("Invalid address to split={}", pc); | 42 | throw InvalidArgument("Invalid address to split={}", pc); |
| 43 | } | 43 | } |
| 44 | *new_block = Block{ | 44 | *new_block = Block{}; |
| 45 | .begin{pc}, | 45 | new_block->begin = pc; |
| 46 | .end{old_block->end}, | 46 | new_block->end = old_block->end; |
| 47 | .end_class{old_block->end_class}, | 47 | new_block->end_class = old_block->end_class, |
| 48 | .cond{old_block->cond}, | 48 | new_block->cond = old_block->cond; |
| 49 | .stack{old_block->stack}, | 49 | new_block->stack = old_block->stack; |
| 50 | .branch_true{old_block->branch_true}, | 50 | new_block->branch_true = old_block->branch_true; |
| 51 | .branch_false{old_block->branch_false}, | 51 | new_block->branch_false = old_block->branch_false; |
| 52 | .function_call{old_block->function_call}, | 52 | new_block->function_call = old_block->function_call; |
| 53 | .return_block{old_block->return_block}, | 53 | new_block->return_block = old_block->return_block; |
| 54 | .branch_reg{old_block->branch_reg}, | 54 | new_block->branch_reg = old_block->branch_reg; |
| 55 | .branch_offset{old_block->branch_offset}, | 55 | new_block->branch_offset = old_block->branch_offset; |
| 56 | .indirect_branches{std::move(old_block->indirect_branches)}, | 56 | new_block->indirect_branches = std::move(old_block->indirect_branches); |
| 57 | }; | 57 | |
| 58 | *old_block = Block{ | 58 | const Location old_begin{old_block->begin}; |
| 59 | .begin{old_block->begin}, | 59 | Stack old_stack{std::move(old_block->stack)}; |
| 60 | .end{pc}, | 60 | *old_block = Block{}; |
| 61 | .end_class{EndClass::Branch}, | 61 | old_block->begin = old_begin; |
| 62 | .cond{true}, | 62 | old_block->end = pc; |
| 63 | .stack{std::move(old_block->stack)}, | 63 | old_block->end_class = EndClass::Branch; |
| 64 | .branch_true{new_block}, | 64 | old_block->cond = IR::Condition(true); |
| 65 | .branch_false{nullptr}, | 65 | old_block->stack = old_stack; |
| 66 | .function_call{}, | 66 | old_block->branch_true = new_block; |
| 67 | .return_block{}, | 67 | old_block->branch_false = nullptr; |
| 68 | .branch_reg{}, | ||
| 69 | .branch_offset{}, | ||
| 70 | .indirect_branches{}, | ||
| 71 | }; | ||
| 72 | } | 68 | } |
| 73 | 69 | ||
| 74 | Token OpcodeToken(Opcode opcode) { | 70 | Token OpcodeToken(Opcode opcode) { |
| @@ -141,7 +137,7 @@ std::string NameOf(const Block& block) { | |||
| 141 | 137 | ||
| 142 | void Stack::Push(Token token, Location target) { | 138 | void Stack::Push(Token token, Location target) { |
| 143 | entries.push_back({ | 139 | entries.push_back({ |
| 144 | .token{token}, | 140 | .token = token, |
| 145 | .target{target}, | 141 | .target{target}, |
| 146 | }); | 142 | }); |
| 147 | } | 143 | } |
| @@ -177,24 +173,17 @@ bool Block::Contains(Location pc) const noexcept { | |||
| 177 | } | 173 | } |
| 178 | 174 | ||
| 179 | Function::Function(ObjectPool<Block>& block_pool, Location start_address) | 175 | Function::Function(ObjectPool<Block>& block_pool, Location start_address) |
| 180 | : entrypoint{start_address}, labels{{ | 176 | : entrypoint{start_address} { |
| 181 | .address{start_address}, | 177 | Label& label{labels.emplace_back()}; |
| 182 | .block{block_pool.Create(Block{ | 178 | label.address = start_address; |
| 183 | .begin{start_address}, | 179 | label.block = block_pool.Create(Block{}); |
| 184 | .end{start_address}, | 180 | label.block->begin = start_address; |
| 185 | .end_class{EndClass::Branch}, | 181 | label.block->end = start_address; |
| 186 | .cond{true}, | 182 | label.block->end_class = EndClass::Branch; |
| 187 | .stack{}, | 183 | label.block->cond = IR::Condition(true); |
| 188 | .branch_true{nullptr}, | 184 | label.block->branch_true = nullptr; |
| 189 | .branch_false{nullptr}, | 185 | label.block->branch_false = nullptr; |
| 190 | .function_call{}, | 186 | } |
| 191 | .return_block{}, | ||
| 192 | .branch_reg{}, | ||
| 193 | .branch_offset{}, | ||
| 194 | .indirect_branches{}, | ||
| 195 | })}, | ||
| 196 | .stack{}, | ||
| 197 | }} {} | ||
| 198 | 187 | ||
| 199 | CFG::CFG(Environment& env_, ObjectPool<Block>& block_pool_, Location start_address) | 188 | CFG::CFG(Environment& env_, ObjectPool<Block>& block_pool_, Location start_address) |
| 200 | : env{env_}, block_pool{block_pool_}, program_start{start_address} { | 189 | : env{env_}, block_pool{block_pool_}, program_start{start_address} { |
| @@ -327,7 +316,8 @@ CFG::AnalysisState CFG::AnalyzeInst(Block* block, FunctionId function_id, Locati | |||
| 327 | // Insert the function into the list if it doesn't exist | 316 | // Insert the function into the list if it doesn't exist |
| 328 | const auto it{std::ranges::find(functions, cal_pc, &Function::entrypoint)}; | 317 | const auto it{std::ranges::find(functions, cal_pc, &Function::entrypoint)}; |
| 329 | const bool exists{it != functions.end()}; | 318 | const bool exists{it != functions.end()}; |
| 330 | const FunctionId call_id{exists ? std::distance(functions.begin(), it) : functions.size()}; | 319 | const FunctionId call_id{exists ? static_cast<size_t>(std::distance(functions.begin(), it)) |
| 320 | : functions.size()}; | ||
| 331 | if (!exists) { | 321 | if (!exists) { |
| 332 | functions.emplace_back(block_pool, cal_pc); | 322 | functions.emplace_back(block_pool, cal_pc); |
| 333 | } | 323 | } |
| @@ -362,20 +352,14 @@ void CFG::AnalyzeCondInst(Block* block, FunctionId function_id, Location pc, | |||
| 362 | } | 352 | } |
| 363 | // Create a virtual block and a conditional block | 353 | // Create a virtual block and a conditional block |
| 364 | Block* const conditional_block{block_pool.Create()}; | 354 | Block* const conditional_block{block_pool.Create()}; |
| 365 | Block virtual_block{ | 355 | Block virtual_block{}; |
| 366 | .begin{block->begin.Virtual()}, | 356 | virtual_block.begin = block->begin.Virtual(); |
| 367 | .end{block->begin.Virtual()}, | 357 | virtual_block.end = block->begin.Virtual(); |
| 368 | .end_class{EndClass::Branch}, | 358 | virtual_block.end_class = EndClass::Branch; |
| 369 | .cond{cond}, | 359 | virtual_block.stack = block->stack; |
| 370 | .stack{block->stack}, | 360 | virtual_block.cond = cond; |
| 371 | .branch_true{conditional_block}, | 361 | virtual_block.branch_true = conditional_block; |
| 372 | .branch_false{nullptr}, | 362 | virtual_block.branch_false = nullptr; |
| 373 | .function_call{}, | ||
| 374 | .return_block{}, | ||
| 375 | .branch_reg{}, | ||
| 376 | .branch_offset{}, | ||
| 377 | .indirect_branches{}, | ||
| 378 | }; | ||
| 379 | // Save the contents of the visited block in the conditional block | 363 | // Save the contents of the visited block in the conditional block |
| 380 | *conditional_block = std::move(*block); | 364 | *conditional_block = std::move(*block); |
| 381 | // Impersonate the visited block with a virtual block | 365 | // Impersonate the visited block with a virtual block |
| @@ -444,7 +428,7 @@ CFG::AnalysisState CFG::AnalyzeBRX(Block* block, Location pc, Instruction inst, | |||
| 444 | if (!is_absolute) { | 428 | if (!is_absolute) { |
| 445 | target += pc.Offset(); | 429 | target += pc.Offset(); |
| 446 | } | 430 | } |
| 447 | target += brx_table->branch_offset; | 431 | target += static_cast<unsigned int>(brx_table->branch_offset); |
| 448 | target += 8; | 432 | target += 8; |
| 449 | targets.push_back(target); | 433 | targets.push_back(target); |
| 450 | } | 434 | } |
| @@ -455,8 +439,8 @@ CFG::AnalysisState CFG::AnalyzeBRX(Block* block, Location pc, Instruction inst, | |||
| 455 | for (const u32 target : targets) { | 439 | for (const u32 target : targets) { |
| 456 | Block* const branch{AddLabel(block, block->stack, target, function_id)}; | 440 | Block* const branch{AddLabel(block, block->stack, target, function_id)}; |
| 457 | block->indirect_branches.push_back({ | 441 | block->indirect_branches.push_back({ |
| 458 | .block{branch}, | 442 | .block = branch, |
| 459 | .address{target}, | 443 | .address = target, |
| 460 | }); | 444 | }); |
| 461 | } | 445 | } |
| 462 | block->cond = IR::Condition{true}; | 446 | block->cond = IR::Condition{true}; |
| @@ -523,23 +507,17 @@ Block* CFG::AddLabel(Block* block, Stack stack, Location pc, FunctionId function | |||
| 523 | if (label_it != function.labels.end()) { | 507 | if (label_it != function.labels.end()) { |
| 524 | return label_it->block; | 508 | return label_it->block; |
| 525 | } | 509 | } |
| 526 | Block* const new_block{block_pool.Create(Block{ | 510 | Block* const new_block{block_pool.Create()}; |
| 527 | .begin{pc}, | 511 | new_block->begin = pc; |
| 528 | .end{pc}, | 512 | new_block->end = pc; |
| 529 | .end_class{EndClass::Branch}, | 513 | new_block->end_class = EndClass::Branch; |
| 530 | .cond{true}, | 514 | new_block->cond = IR::Condition(true); |
| 531 | .stack{stack}, | 515 | new_block->stack = stack; |
| 532 | .branch_true{nullptr}, | 516 | new_block->branch_true = nullptr; |
| 533 | .branch_false{nullptr}, | 517 | new_block->branch_false = nullptr; |
| 534 | .function_call{}, | ||
| 535 | .return_block{}, | ||
| 536 | .branch_reg{}, | ||
| 537 | .branch_offset{}, | ||
| 538 | .indirect_branches{}, | ||
| 539 | })}; | ||
| 540 | function.labels.push_back(Label{ | 518 | function.labels.push_back(Label{ |
| 541 | .address{pc}, | 519 | .address{pc}, |
| 542 | .block{new_block}, | 520 | .block = new_block, |
| 543 | .stack{std::move(stack)}, | 521 | .stack{std::move(stack)}, |
| 544 | }); | 522 | }); |
| 545 | return new_block; | 523 | return new_block; |
diff --git a/src/shader_recompiler/frontend/maxwell/decode.cpp b/src/shader_recompiler/frontend/maxwell/decode.cpp index bd85afa1e..932d19c1d 100644 --- a/src/shader_recompiler/frontend/maxwell/decode.cpp +++ b/src/shader_recompiler/frontend/maxwell/decode.cpp | |||
| @@ -45,7 +45,7 @@ constexpr MaskValue MaskValueFromEncoding(const char* encoding) { | |||
| 45 | bit >>= 1; | 45 | bit >>= 1; |
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| 48 | return MaskValue{.mask{mask}, .value{value}}; | 48 | return MaskValue{.mask = mask, .value = value}; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | struct InstEncoding { | 51 | struct InstEncoding { |
| @@ -56,7 +56,7 @@ constexpr std::array UNORDERED_ENCODINGS{ | |||
| 56 | #define INST(name, cute, encode) \ | 56 | #define INST(name, cute, encode) \ |
| 57 | InstEncoding{ \ | 57 | InstEncoding{ \ |
| 58 | .mask_value{MaskValueFromEncoding(encode)}, \ | 58 | .mask_value{MaskValueFromEncoding(encode)}, \ |
| 59 | .opcode{Opcode::name}, \ | 59 | .opcode = Opcode::name, \ |
| 60 | }, | 60 | }, |
| 61 | #include "maxwell.inc" | 61 | #include "maxwell.inc" |
| 62 | #undef INST | 62 | #undef INST |
| @@ -116,9 +116,9 @@ constexpr auto MakeFastLookupTableIndex(size_t index) { | |||
| 116 | const size_t value{ToFastLookupIndex(encoding.mask_value.value)}; | 116 | const size_t value{ToFastLookupIndex(encoding.mask_value.value)}; |
| 117 | if ((index & mask) == value) { | 117 | if ((index & mask) == value) { |
| 118 | encodings.at(element) = InstInfo{ | 118 | encodings.at(element) = InstInfo{ |
| 119 | .high_mask{static_cast<u16>(encoding.mask_value.mask >> MASK_SHIFT)}, | 119 | .high_mask = static_cast<u16>(encoding.mask_value.mask >> MASK_SHIFT), |
| 120 | .high_value{static_cast<u16>(encoding.mask_value.value >> MASK_SHIFT)}, | 120 | .high_value = static_cast<u16>(encoding.mask_value.value >> MASK_SHIFT), |
| 121 | .opcode{encoding.opcode}, | 121 | .opcode = encoding.opcode, |
| 122 | }; | 122 | }; |
| 123 | ++element; | 123 | ++element; |
| 124 | } | 124 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/indirect_branch_table_track.cpp b/src/shader_recompiler/frontend/maxwell/indirect_branch_table_track.cpp index 96453509d..008625cb3 100644 --- a/src/shader_recompiler/frontend/maxwell/indirect_branch_table_track.cpp +++ b/src/shader_recompiler/frontend/maxwell/indirect_branch_table_track.cpp | |||
| @@ -97,11 +97,11 @@ std::optional<IndirectBranchTableInfo> TrackIndirectBranchTable(Environment& env | |||
| 97 | } | 97 | } |
| 98 | const u32 imnmx_immediate{static_cast<u32>(imnmx.immediate.Value())}; | 98 | const u32 imnmx_immediate{static_cast<u32>(imnmx.immediate.Value())}; |
| 99 | return IndirectBranchTableInfo{ | 99 | return IndirectBranchTableInfo{ |
| 100 | .cbuf_index{cbuf_index}, | 100 | .cbuf_index = cbuf_index, |
| 101 | .cbuf_offset{cbuf_offset}, | 101 | .cbuf_offset = cbuf_offset, |
| 102 | .num_entries{imnmx_immediate + 1}, | 102 | .num_entries = imnmx_immediate + 1, |
| 103 | .branch_offset{brx_offset}, | 103 | .branch_offset = brx_offset, |
| 104 | .branch_reg{brx_reg}, | 104 | .branch_reg = brx_reg, |
| 105 | }; | 105 | }; |
| 106 | } | 106 | } |
| 107 | 107 | ||
diff --git a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp index c804c2a8e..02cef2645 100644 --- a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp +++ b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp | |||
| @@ -558,7 +558,6 @@ private: | |||
| 558 | const Node label{goto_stmt->label}; | 558 | const Node label{goto_stmt->label}; |
| 559 | const u32 label_id{label->id}; | 559 | const u32 label_id{label->id}; |
| 560 | const Node label_nested_stmt{FindStatementWithLabel(body, goto_stmt)}; | 560 | const Node label_nested_stmt{FindStatementWithLabel(body, goto_stmt)}; |
| 561 | const auto type{label_nested_stmt->type}; | ||
| 562 | 561 | ||
| 563 | Tree loop_body; | 562 | Tree loop_body; |
| 564 | loop_body.splice(loop_body.begin(), body, label_nested_stmt, goto_stmt); | 563 | loop_body.splice(loop_body.begin(), body, label_nested_stmt, goto_stmt); |
| @@ -566,7 +565,7 @@ private: | |||
| 566 | Statement* const variable{pool.Create(Variable{}, label_id)}; | 565 | Statement* const variable{pool.Create(Variable{}, label_id)}; |
| 567 | Statement* const loop_stmt{pool.Create(Loop{}, variable, std::move(loop_body), parent)}; | 566 | Statement* const loop_stmt{pool.Create(Loop{}, variable, std::move(loop_body), parent)}; |
| 568 | UpdateTreeUp(loop_stmt); | 567 | UpdateTreeUp(loop_stmt); |
| 569 | const Node loop_node{body.insert(goto_stmt, *loop_stmt)}; | 568 | body.insert(goto_stmt, *loop_stmt); |
| 570 | 569 | ||
| 571 | Statement* const new_goto{pool.Create(Goto{}, variable, label, loop_stmt)}; | 570 | Statement* const new_goto{pool.Create(Goto{}, variable, label, loop_stmt)}; |
| 572 | loop_stmt->children.push_front(*new_goto); | 571 | loop_stmt->children.push_front(*new_goto); |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/double_add.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/double_add.cpp index ac1433dea..5a1b3a8fc 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/double_add.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/double_add.cpp | |||
| @@ -31,9 +31,9 @@ void DADD(TranslatorVisitor& v, u64 insn, const IR::F64& src_b) { | |||
| 31 | const IR::F64 op_b{v.ir.FPAbsNeg(src_b, dadd.abs_b != 0, dadd.neg_b != 0)}; | 31 | const IR::F64 op_b{v.ir.FPAbsNeg(src_b, dadd.abs_b != 0, dadd.neg_b != 0)}; |
| 32 | 32 | ||
| 33 | const IR::FpControl control{ | 33 | const IR::FpControl control{ |
| 34 | .no_contraction{true}, | 34 | .no_contraction = true, |
| 35 | .rounding{CastFpRounding(dadd.fp_rounding)}, | 35 | .rounding = CastFpRounding(dadd.fp_rounding), |
| 36 | .fmz_mode{IR::FmzMode::None}, | 36 | .fmz_mode = IR::FmzMode::None, |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | v.D(dadd.dest_reg, v.ir.FPAdd(op_a, op_b, control)); | 39 | v.D(dadd.dest_reg, v.ir.FPAdd(op_a, op_b, control)); |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/double_fused_multiply_add.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/double_fused_multiply_add.cpp index ff7321862..723841496 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/double_fused_multiply_add.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/double_fused_multiply_add.cpp | |||
| @@ -25,9 +25,9 @@ void DFMA(TranslatorVisitor& v, u64 insn, const IR::F64& src_b, const IR::F64& s | |||
| 25 | const IR::F64 op_c{v.ir.FPAbsNeg(src_c, false, dfma.neg_c != 0)}; | 25 | const IR::F64 op_c{v.ir.FPAbsNeg(src_c, false, dfma.neg_c != 0)}; |
| 26 | 26 | ||
| 27 | const IR::FpControl control{ | 27 | const IR::FpControl control{ |
| 28 | .no_contraction{true}, | 28 | .no_contraction = true, |
| 29 | .rounding{CastFpRounding(dfma.fp_rounding)}, | 29 | .rounding = CastFpRounding(dfma.fp_rounding), |
| 30 | .fmz_mode{IR::FmzMode::None}, | 30 | .fmz_mode = IR::FmzMode::None, |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | v.D(dfma.dest_reg, v.ir.FPFma(src_a, op_b, op_c, control)); | 33 | v.D(dfma.dest_reg, v.ir.FPFma(src_a, op_b, op_c, control)); |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/double_multiply.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/double_multiply.cpp index 3e83d1c95..4a49299a0 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/double_multiply.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/double_multiply.cpp | |||
| @@ -21,9 +21,9 @@ void DMUL(TranslatorVisitor& v, u64 insn, const IR::F64& src_b) { | |||
| 21 | 21 | ||
| 22 | const IR::F64 src_a{v.ir.FPAbsNeg(v.D(dmul.src_a_reg), false, dmul.neg != 0)}; | 22 | const IR::F64 src_a{v.ir.FPAbsNeg(v.D(dmul.src_a_reg), false, dmul.neg != 0)}; |
| 23 | const IR::FpControl control{ | 23 | const IR::FpControl control{ |
| 24 | .no_contraction{true}, | 24 | .no_contraction = true, |
| 25 | .rounding{CastFpRounding(dmul.fp_rounding)}, | 25 | .rounding = CastFpRounding(dmul.fp_rounding), |
| 26 | .fmz_mode{IR::FmzMode::None}, | 26 | .fmz_mode = IR::FmzMode::None, |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | v.D(dmul.dest_reg, v.ir.FPMul(src_a, src_b, control)); | 29 | v.D(dmul.dest_reg, v.ir.FPMul(src_a, src_b, control)); |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_add.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_add.cpp index b39950c84..b8c89810c 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_add.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_add.cpp | |||
| @@ -23,9 +23,9 @@ void FADD(TranslatorVisitor& v, u64 insn, bool sat, bool cc, bool ftz, FpRoundin | |||
| 23 | const IR::F32 op_a{v.ir.FPAbsNeg(v.F(fadd.src_a), abs_a, neg_a)}; | 23 | const IR::F32 op_a{v.ir.FPAbsNeg(v.F(fadd.src_a), abs_a, neg_a)}; |
| 24 | const IR::F32 op_b{v.ir.FPAbsNeg(src_b, abs_b, neg_b)}; | 24 | const IR::F32 op_b{v.ir.FPAbsNeg(src_b, abs_b, neg_b)}; |
| 25 | IR::FpControl control{ | 25 | IR::FpControl control{ |
| 26 | .no_contraction{true}, | 26 | .no_contraction = true, |
| 27 | .rounding{CastFpRounding(fp_rounding)}, | 27 | .rounding = CastFpRounding(fp_rounding), |
| 28 | .fmz_mode{ftz ? IR::FmzMode::FTZ : IR::FmzMode::None}, | 28 | .fmz_mode = (ftz ? IR::FmzMode::FTZ : IR::FmzMode::None), |
| 29 | }; | 29 | }; |
| 30 | IR::F32 value{v.ir.FPAdd(op_a, op_b, control)}; | 30 | IR::F32 value{v.ir.FPAdd(op_a, op_b, control)}; |
| 31 | if (sat) { | 31 | if (sat) { |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_compare.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_compare.cpp index c02a40209..80109ca0e 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_compare.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_compare.cpp | |||
| @@ -19,8 +19,7 @@ void FCMP(TranslatorVisitor& v, u64 insn, const IR::U32& src_a, const IR::F32& o | |||
| 19 | } const fcmp{insn}; | 19 | } const fcmp{insn}; |
| 20 | 20 | ||
| 21 | const IR::F32 zero{v.ir.Imm32(0.0f)}; | 21 | const IR::F32 zero{v.ir.Imm32(0.0f)}; |
| 22 | const IR::F32 neg_zero{v.ir.Imm32(-0.0f)}; | 22 | const IR::FpControl control{.fmz_mode = (fcmp.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None)}; |
| 23 | const IR::FpControl control{.fmz_mode{fcmp.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None}}; | ||
| 24 | const IR::U1 cmp_result{FloatingPointCompare(v.ir, operand, zero, fcmp.compare_op, control)}; | 23 | const IR::U1 cmp_result{FloatingPointCompare(v.ir, operand, zero, fcmp.compare_op, control)}; |
| 25 | const IR::U32 src_reg{v.X(fcmp.src_reg)}; | 24 | const IR::U32 src_reg{v.X(fcmp.src_reg)}; |
| 26 | const IR::U32 result{v.ir.Select(cmp_result, src_reg, src_a)}; | 25 | const IR::U32 result{v.ir.Select(cmp_result, src_reg, src_a)}; |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_compare_and_set.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_compare_and_set.cpp index c5417775e..b9f4ee0d9 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_compare_and_set.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_compare_and_set.cpp | |||
| @@ -29,9 +29,9 @@ void FSET(TranslatorVisitor& v, u64 insn, const IR::F32& src_b) { | |||
| 29 | const IR::F32 op_a{v.ir.FPAbsNeg(v.F(fset.src_a_reg), fset.abs_a != 0, fset.negate_a != 0)}; | 29 | const IR::F32 op_a{v.ir.FPAbsNeg(v.F(fset.src_a_reg), fset.abs_a != 0, fset.negate_a != 0)}; |
| 30 | const IR::F32 op_b = v.ir.FPAbsNeg(src_b, fset.abs_b != 0, fset.negate_b != 0); | 30 | const IR::F32 op_b = v.ir.FPAbsNeg(src_b, fset.abs_b != 0, fset.negate_b != 0); |
| 31 | const IR::FpControl control{ | 31 | const IR::FpControl control{ |
| 32 | .no_contraction{false}, | 32 | .no_contraction = false, |
| 33 | .rounding{IR::FpRounding::DontCare}, | 33 | .rounding = IR::FpRounding::DontCare, |
| 34 | .fmz_mode{fset.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None}, | 34 | .fmz_mode = (fset.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None), |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | IR::U1 pred{v.ir.GetPred(fset.pred)}; | 37 | IR::U1 pred{v.ir.GetPred(fset.pred)}; |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp index 1e366fde0..035f8782a 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp | |||
| @@ -57,9 +57,9 @@ void F2F(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a, bool abs) { | |||
| 57 | 57 | ||
| 58 | const bool any_fp64{f2f.src_size == FloatFormat::F64 || f2f.dst_size == FloatFormat::F64}; | 58 | const bool any_fp64{f2f.src_size == FloatFormat::F64 || f2f.dst_size == FloatFormat::F64}; |
| 59 | IR::FpControl fp_control{ | 59 | IR::FpControl fp_control{ |
| 60 | .no_contraction{false}, | 60 | .no_contraction = false, |
| 61 | .rounding{IR::FpRounding::DontCare}, | 61 | .rounding = IR::FpRounding::DontCare, |
| 62 | .fmz_mode{f2f.ftz != 0 && !any_fp64 ? IR::FmzMode::FTZ : IR::FmzMode::None}, | 62 | .fmz_mode = (f2f.ftz != 0 && !any_fp64 ? IR::FmzMode::FTZ : IR::FmzMode::None), |
| 63 | }; | 63 | }; |
| 64 | if (f2f.src_size != f2f.dst_size) { | 64 | if (f2f.src_size != f2f.dst_size) { |
| 65 | fp_control.rounding = CastFpRounding(f2f.rounding); | 65 | fp_control.rounding = CastFpRounding(f2f.rounding); |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp index 21ae92be1..cf3cf1ba6 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp | |||
| @@ -123,9 +123,9 @@ void TranslateF2I(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a) { | |||
| 123 | fmz_mode = f2i.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None; | 123 | fmz_mode = f2i.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None; |
| 124 | } | 124 | } |
| 125 | const IR::FpControl fp_control{ | 125 | const IR::FpControl fp_control{ |
| 126 | .no_contraction{true}, | 126 | .no_contraction = true, |
| 127 | .rounding{IR::FpRounding::DontCare}, | 127 | .rounding = IR::FpRounding::DontCare, |
| 128 | .fmz_mode{fmz_mode}, | 128 | .fmz_mode = fmz_mode, |
| 129 | }; | 129 | }; |
| 130 | const IR::F16F32F64 op_a{v.ir.FPAbsNeg(src_a, f2i.abs != 0, f2i.neg != 0)}; | 130 | const IR::F16F32F64 op_a{v.ir.FPAbsNeg(src_a, f2i.abs != 0, f2i.neg != 0)}; |
| 131 | const IR::F16F32F64 rounded_value{[&] { | 131 | const IR::F16F32F64 rounded_value{[&] { |
| @@ -186,14 +186,14 @@ void TranslateF2I(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a) { | |||
| 186 | } else if (f2i.dest_format == DestFormat::I64) { | 186 | } else if (f2i.dest_format == DestFormat::I64) { |
| 187 | handled_special_case = true; | 187 | handled_special_case = true; |
| 188 | result = IR::U64{ | 188 | result = IR::U64{ |
| 189 | v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm64(0x8000'0000'0000'0000ULL), result)}; | 189 | v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm64(0x8000'0000'0000'0000UL), result)}; |
| 190 | } | 190 | } |
| 191 | } | 191 | } |
| 192 | if (!handled_special_case && is_signed) { | 192 | if (!handled_special_case && is_signed) { |
| 193 | if (bitsize != 64) { | 193 | if (bitsize != 64) { |
| 194 | result = IR::U32{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm32(0U), result)}; | 194 | result = IR::U32{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm32(0U), result)}; |
| 195 | } else { | 195 | } else { |
| 196 | result = IR::U64{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm64(0ULL), result)}; | 196 | result = IR::U64{v.ir.Select(v.ir.FPIsNan(op_a), v.ir.Imm64(0UL), result)}; |
| 197 | } | 197 | } |
| 198 | } | 198 | } |
| 199 | 199 | ||
| @@ -211,6 +211,7 @@ void TranslateF2I(TranslatorVisitor& v, u64 insn, const IR::F16F32F64& src_a) { | |||
| 211 | 211 | ||
| 212 | void TranslatorVisitor::F2I_reg(u64 insn) { | 212 | void TranslatorVisitor::F2I_reg(u64 insn) { |
| 213 | union { | 213 | union { |
| 214 | u64 raw; | ||
| 214 | F2I base; | 215 | F2I base; |
| 215 | BitField<20, 8, IR::Reg> src_reg; | 216 | BitField<20, 8, IR::Reg> src_reg; |
| 216 | } const f2i{insn}; | 217 | } const f2i{insn}; |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_fused_multiply_add.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_fused_multiply_add.cpp index 18561bc9c..fa2a7807b 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_fused_multiply_add.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_fused_multiply_add.cpp | |||
| @@ -24,9 +24,9 @@ void FFMA(TranslatorVisitor& v, u64 insn, const IR::F32& src_b, const IR::F32& s | |||
| 24 | const IR::F32 op_b{v.ir.FPAbsNeg(src_b, false, neg_b)}; | 24 | const IR::F32 op_b{v.ir.FPAbsNeg(src_b, false, neg_b)}; |
| 25 | const IR::F32 op_c{v.ir.FPAbsNeg(src_c, false, neg_c)}; | 25 | const IR::F32 op_c{v.ir.FPAbsNeg(src_c, false, neg_c)}; |
| 26 | const IR::FpControl fp_control{ | 26 | const IR::FpControl fp_control{ |
| 27 | .no_contraction{true}, | 27 | .no_contraction = true, |
| 28 | .rounding{CastFpRounding(fp_rounding)}, | 28 | .rounding = CastFpRounding(fp_rounding), |
| 29 | .fmz_mode{CastFmzMode(fmz_mode)}, | 29 | .fmz_mode = CastFmzMode(fmz_mode), |
| 30 | }; | 30 | }; |
| 31 | IR::F32 value{v.ir.FPFma(op_a, op_b, op_c, fp_control)}; | 31 | IR::F32 value{v.ir.FPFma(op_a, op_b, op_c, fp_control)}; |
| 32 | if (fmz_mode == FmzMode::FMZ && !sat) { | 32 | if (fmz_mode == FmzMode::FMZ && !sat) { |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_min_max.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_min_max.cpp index 343d91032..8ae437528 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_min_max.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_min_max.cpp | |||
| @@ -27,9 +27,9 @@ void FMNMX(TranslatorVisitor& v, u64 insn, const IR::F32& src_b) { | |||
| 27 | const IR::F32 op_b{v.ir.FPAbsNeg(src_b, fmnmx.abs_b != 0, fmnmx.negate_b != 0)}; | 27 | const IR::F32 op_b{v.ir.FPAbsNeg(src_b, fmnmx.abs_b != 0, fmnmx.negate_b != 0)}; |
| 28 | 28 | ||
| 29 | const IR::FpControl control{ | 29 | const IR::FpControl control{ |
| 30 | .no_contraction{false}, | 30 | .no_contraction = false, |
| 31 | .rounding{IR::FpRounding::DontCare}, | 31 | .rounding = IR::FpRounding::DontCare, |
| 32 | .fmz_mode{fmnmx.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None}, | 32 | .fmz_mode = (fmnmx.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None), |
| 33 | }; | 33 | }; |
| 34 | IR::F32 max{v.ir.FPMax(op_a, op_b, control)}; | 34 | IR::F32 max{v.ir.FPMax(op_a, op_b, control)}; |
| 35 | IR::F32 min{v.ir.FPMin(op_a, op_b, control)}; | 35 | IR::F32 min{v.ir.FPMin(op_a, op_b, control)}; |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_multiply.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_multiply.cpp index 72f0a18ae..06226b7ce 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_multiply.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_multiply.cpp | |||
| @@ -64,9 +64,9 @@ void FMUL(TranslatorVisitor& v, u64 insn, const IR::F32& src_b, FmzMode fmz_mode | |||
| 64 | } | 64 | } |
| 65 | const IR::F32 op_b{v.ir.FPAbsNeg(src_b, false, neg_b)}; | 65 | const IR::F32 op_b{v.ir.FPAbsNeg(src_b, false, neg_b)}; |
| 66 | const IR::FpControl fp_control{ | 66 | const IR::FpControl fp_control{ |
| 67 | .no_contraction{true}, | 67 | .no_contraction = true, |
| 68 | .rounding{CastFpRounding(fp_rounding)}, | 68 | .rounding = CastFpRounding(fp_rounding), |
| 69 | .fmz_mode{CastFmzMode(fmz_mode)}, | 69 | .fmz_mode = CastFmzMode(fmz_mode), |
| 70 | }; | 70 | }; |
| 71 | IR::F32 value{v.ir.FPMul(op_a, op_b, fp_control)}; | 71 | IR::F32 value{v.ir.FPMul(op_a, op_b, fp_control)}; |
| 72 | if (fmz_mode == FmzMode::FMZ && !sat) { | 72 | if (fmz_mode == FmzMode::FMZ && !sat) { |
| @@ -124,4 +124,4 @@ void TranslatorVisitor::FMUL32I(u64 insn) { | |||
| 124 | fmul32i.sat != 0, fmul32i.cc != 0, false); | 124 | fmul32i.sat != 0, fmul32i.cc != 0, false); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | } // namespace Shader::Maxwell \ No newline at end of file | 127 | } // namespace Shader::Maxwell |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_set_predicate.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_set_predicate.cpp index 8ff9db843..5f93a1513 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_set_predicate.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_set_predicate.cpp | |||
| @@ -29,9 +29,9 @@ void FSETP(TranslatorVisitor& v, u64 insn, const IR::F32& src_b) { | |||
| 29 | const IR::F32 op_a{v.ir.FPAbsNeg(v.F(fsetp.src_a_reg), fsetp.abs_a != 0, fsetp.negate_a != 0)}; | 29 | const IR::F32 op_a{v.ir.FPAbsNeg(v.F(fsetp.src_a_reg), fsetp.abs_a != 0, fsetp.negate_a != 0)}; |
| 30 | const IR::F32 op_b = v.ir.FPAbsNeg(src_b, fsetp.abs_b != 0, fsetp.negate_b != 0); | 30 | const IR::F32 op_b = v.ir.FPAbsNeg(src_b, fsetp.abs_b != 0, fsetp.negate_b != 0); |
| 31 | const IR::FpControl control{ | 31 | const IR::FpControl control{ |
| 32 | .no_contraction{false}, | 32 | .no_contraction = false, |
| 33 | .rounding{IR::FpRounding::DontCare}, | 33 | .rounding = IR::FpRounding::DontCare, |
| 34 | .fmz_mode{fsetp.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None}, | 34 | .fmz_mode = (fsetp.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None), |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | const BooleanOp bop{fsetp.bop}; | 37 | const BooleanOp bop{fsetp.bop}; |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_swizzled_add.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_swizzled_add.cpp index e42921a21..7550a8d4c 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_swizzled_add.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_swizzled_add.cpp | |||
| @@ -28,9 +28,9 @@ void TranslatorVisitor::FSWZADD(u64 insn) { | |||
| 28 | const IR::U32 swizzle{ir.Imm32(static_cast<u32>(fswzadd.swizzle))}; | 28 | const IR::U32 swizzle{ir.Imm32(static_cast<u32>(fswzadd.swizzle))}; |
| 29 | 29 | ||
| 30 | const IR::FpControl fp_control{ | 30 | const IR::FpControl fp_control{ |
| 31 | .no_contraction{false}, | 31 | .no_contraction = false, |
| 32 | .rounding{CastFpRounding(fswzadd.round)}, | 32 | .rounding = CastFpRounding(fswzadd.round), |
| 33 | .fmz_mode{fswzadd.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None}, | 33 | .fmz_mode = (fswzadd.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None), |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | const IR::F32 result{ir.FSwizzleAdd(src_a, src_b, swizzle, fp_control)}; | 36 | const IR::F32 result{ir.FSwizzleAdd(src_a, src_b, swizzle, fp_control)}; |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_add.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_add.cpp index 03e7bf047..f2738a93b 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_add.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_add.cpp | |||
| @@ -34,9 +34,9 @@ void HADD2(TranslatorVisitor& v, u64 insn, Merge merge, bool ftz, bool sat, bool | |||
| 34 | rhs_b = v.ir.FPAbsNeg(rhs_b, abs_b, neg_b); | 34 | rhs_b = v.ir.FPAbsNeg(rhs_b, abs_b, neg_b); |
| 35 | 35 | ||
| 36 | const IR::FpControl fp_control{ | 36 | const IR::FpControl fp_control{ |
| 37 | .no_contraction{true}, | 37 | .no_contraction = true, |
| 38 | .rounding{IR::FpRounding::DontCare}, | 38 | .rounding = IR::FpRounding::DontCare, |
| 39 | .fmz_mode{ftz ? IR::FmzMode::FTZ : IR::FmzMode::None}, | 39 | .fmz_mode = (ftz ? IR::FmzMode::FTZ : IR::FmzMode::None), |
| 40 | }; | 40 | }; |
| 41 | IR::F16F32F64 lhs{v.ir.FPAdd(lhs_a, lhs_b, fp_control)}; | 41 | IR::F16F32F64 lhs{v.ir.FPAdd(lhs_a, lhs_b, fp_control)}; |
| 42 | IR::F16F32F64 rhs{v.ir.FPAdd(rhs_a, rhs_b, fp_control)}; | 42 | IR::F16F32F64 rhs{v.ir.FPAdd(rhs_a, rhs_b, fp_control)}; |
| @@ -102,8 +102,9 @@ void TranslatorVisitor::HADD2_imm(u64 insn) { | |||
| 102 | BitField<20, 9, u64> low; | 102 | BitField<20, 9, u64> low; |
| 103 | } const hadd2{insn}; | 103 | } const hadd2{insn}; |
| 104 | 104 | ||
| 105 | const u32 imm{static_cast<u32>(hadd2.low << 6) | ((hadd2.neg_low != 0 ? 1 : 0) << 15) | | 105 | const u32 imm{ |
| 106 | static_cast<u32>(hadd2.high << 22) | ((hadd2.neg_high != 0 ? 1 : 0) << 31)}; | 106 | static_cast<u32>(hadd2.low << 6) | static_cast<u32>((hadd2.neg_low != 0 ? 1 : 0) << 15) | |
| 107 | static_cast<u32>(hadd2.high << 22) | static_cast<u32>((hadd2.neg_high != 0 ? 1 : 0) << 31)}; | ||
| 107 | HADD2(*this, insn, hadd2.sat != 0, false, false, Swizzle::H1_H0, ir.Imm32(imm)); | 108 | HADD2(*this, insn, hadd2.sat != 0, false, false, Swizzle::H1_H0, ir.Imm32(imm)); |
| 108 | } | 109 | } |
| 109 | 110 | ||
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_fused_multiply_add.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_fused_multiply_add.cpp index 8b234bd6a..fd7986701 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_fused_multiply_add.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_fused_multiply_add.cpp | |||
| @@ -41,9 +41,9 @@ void HFMA2(TranslatorVisitor& v, u64 insn, Merge merge, Swizzle swizzle_a, bool | |||
| 41 | rhs_c = v.ir.FPAbsNeg(rhs_c, false, neg_c); | 41 | rhs_c = v.ir.FPAbsNeg(rhs_c, false, neg_c); |
| 42 | 42 | ||
| 43 | const IR::FpControl fp_control{ | 43 | const IR::FpControl fp_control{ |
| 44 | .no_contraction{true}, | 44 | .no_contraction = true, |
| 45 | .rounding{IR::FpRounding::DontCare}, | 45 | .rounding = IR::FpRounding::DontCare, |
| 46 | .fmz_mode{HalfPrecision2FmzMode(precision)}, | 46 | .fmz_mode = HalfPrecision2FmzMode(precision), |
| 47 | }; | 47 | }; |
| 48 | IR::F16F32F64 lhs{v.ir.FPFma(lhs_a, lhs_b, lhs_c, fp_control)}; | 48 | IR::F16F32F64 lhs{v.ir.FPFma(lhs_a, lhs_b, lhs_c, fp_control)}; |
| 49 | IR::F16F32F64 rhs{v.ir.FPFma(rhs_a, rhs_b, rhs_c, fp_control)}; | 49 | IR::F16F32F64 rhs{v.ir.FPFma(rhs_a, rhs_b, rhs_c, fp_control)}; |
| @@ -143,8 +143,9 @@ void TranslatorVisitor::HFMA2_imm(u64 insn) { | |||
| 143 | BitField<57, 2, HalfPrecision> precision; | 143 | BitField<57, 2, HalfPrecision> precision; |
| 144 | } const hfma2{insn}; | 144 | } const hfma2{insn}; |
| 145 | 145 | ||
| 146 | const u32 imm{static_cast<u32>(hfma2.low << 6) | ((hfma2.neg_low != 0 ? 1 : 0) << 15) | | 146 | const u32 imm{ |
| 147 | static_cast<u32>(hfma2.high << 22) | ((hfma2.neg_high != 0 ? 1 : 0) << 31)}; | 147 | static_cast<u32>(hfma2.low << 6) | static_cast<u32>((hfma2.neg_low != 0 ? 1 : 0) << 15) | |
| 148 | static_cast<u32>(hfma2.high << 22) | static_cast<u32>((hfma2.neg_high != 0 ? 1 : 0) << 31)}; | ||
| 148 | 149 | ||
| 149 | HFMA2(*this, insn, false, hfma2.neg_c != 0, Swizzle::H1_H0, hfma2.swizzle_c, ir.Imm32(imm), | 150 | HFMA2(*this, insn, false, hfma2.neg_c != 0, Swizzle::H1_H0, hfma2.swizzle_c, ir.Imm32(imm), |
| 150 | GetReg39(insn), hfma2.saturate != 0, hfma2.precision); | 151 | GetReg39(insn), hfma2.saturate != 0, hfma2.precision); |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_multiply.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_multiply.cpp index 2451a6ef6..3f548ce76 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_multiply.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_multiply.cpp | |||
| @@ -35,9 +35,9 @@ void HMUL2(TranslatorVisitor& v, u64 insn, Merge merge, bool sat, bool abs_a, bo | |||
| 35 | rhs_b = v.ir.FPAbsNeg(rhs_b, abs_b, neg_b); | 35 | rhs_b = v.ir.FPAbsNeg(rhs_b, abs_b, neg_b); |
| 36 | 36 | ||
| 37 | const IR::FpControl fp_control{ | 37 | const IR::FpControl fp_control{ |
| 38 | .no_contraction{true}, | 38 | .no_contraction = true, |
| 39 | .rounding{IR::FpRounding::DontCare}, | 39 | .rounding = IR::FpRounding::DontCare, |
| 40 | .fmz_mode{HalfPrecision2FmzMode(precision)}, | 40 | .fmz_mode = HalfPrecision2FmzMode(precision), |
| 41 | }; | 41 | }; |
| 42 | IR::F16F32F64 lhs{v.ir.FPMul(lhs_a, lhs_b, fp_control)}; | 42 | IR::F16F32F64 lhs{v.ir.FPMul(lhs_a, lhs_b, fp_control)}; |
| 43 | IR::F16F32F64 rhs{v.ir.FPMul(rhs_a, rhs_b, fp_control)}; | 43 | IR::F16F32F64 rhs{v.ir.FPMul(rhs_a, rhs_b, fp_control)}; |
| @@ -119,8 +119,9 @@ void TranslatorVisitor::HMUL2_imm(u64 insn) { | |||
| 119 | BitField<44, 1, u64> abs_a; | 119 | BitField<44, 1, u64> abs_a; |
| 120 | } const hmul2{insn}; | 120 | } const hmul2{insn}; |
| 121 | 121 | ||
| 122 | const u32 imm{static_cast<u32>(hmul2.low << 6) | ((hmul2.neg_low != 0 ? 1 : 0) << 15) | | 122 | const u32 imm{ |
| 123 | static_cast<u32>(hmul2.high << 22) | ((hmul2.neg_high != 0 ? 1 : 0) << 31)}; | 123 | static_cast<u32>(hmul2.low << 6) | static_cast<u32>((hmul2.neg_low != 0 ? 1 : 0) << 15) | |
| 124 | static_cast<u32>(hmul2.high << 22) | static_cast<u32>((hmul2.neg_high != 0 ? 1 : 0) << 31)}; | ||
| 124 | HMUL2(*this, insn, hmul2.sat != 0, hmul2.abs_a != 0, hmul2.neg_a != 0, false, false, | 125 | HMUL2(*this, insn, hmul2.sat != 0, hmul2.abs_a != 0, hmul2.neg_a != 0, false, false, |
| 125 | Swizzle::H1_H0, ir.Imm32(imm)); | 126 | Swizzle::H1_H0, ir.Imm32(imm)); |
| 126 | } | 127 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_set.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_set.cpp index 7f1f4b88c..cca5b831f 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_set.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_set.cpp | |||
| @@ -41,9 +41,9 @@ void HSET2(TranslatorVisitor& v, u64 insn, const IR::U32& src_b, bool bf, bool f | |||
| 41 | rhs_b = v.ir.FPAbsNeg(rhs_b, abs_b, neg_b); | 41 | rhs_b = v.ir.FPAbsNeg(rhs_b, abs_b, neg_b); |
| 42 | 42 | ||
| 43 | const IR::FpControl control{ | 43 | const IR::FpControl control{ |
| 44 | .no_contraction{false}, | 44 | .no_contraction = false, |
| 45 | .rounding{IR::FpRounding::DontCare}, | 45 | .rounding = IR::FpRounding::DontCare, |
| 46 | .fmz_mode{ftz ? IR::FmzMode::FTZ : IR::FmzMode::None}, | 46 | .fmz_mode = (ftz ? IR::FmzMode::FTZ : IR::FmzMode::None), |
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| 49 | IR::U1 pred{v.ir.GetPred(hset2.pred)}; | 49 | IR::U1 pred{v.ir.GetPred(hset2.pred)}; |
| @@ -106,8 +106,9 @@ void TranslatorVisitor::HSET2_imm(u64 insn) { | |||
| 106 | BitField<20, 9, u64> low; | 106 | BitField<20, 9, u64> low; |
| 107 | } const hset2{insn}; | 107 | } const hset2{insn}; |
| 108 | 108 | ||
| 109 | const u32 imm{static_cast<u32>(hset2.low << 6) | ((hset2.neg_low != 0 ? 1 : 0) << 15) | | 109 | const u32 imm{ |
| 110 | static_cast<u32>(hset2.high << 22) | ((hset2.neg_high != 0 ? 1 : 0) << 31)}; | 110 | static_cast<u32>(hset2.low << 6) | static_cast<u32>((hset2.neg_low != 0 ? 1 : 0) << 15) | |
| 111 | static_cast<u32>(hset2.high << 22) | static_cast<u32>((hset2.neg_high != 0 ? 1 : 0) << 31)}; | ||
| 111 | 112 | ||
| 112 | HSET2(*this, insn, ir.Imm32(imm), hset2.bf != 0, hset2.ftz != 0, false, false, hset2.compare_op, | 113 | HSET2(*this, insn, ir.Imm32(imm), hset2.bf != 0, hset2.ftz != 0, false, false, hset2.compare_op, |
| 113 | Swizzle::H1_H0); | 114 | Swizzle::H1_H0); |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_set_predicate.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_set_predicate.cpp index 3e2a23c92..b3931dae3 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_set_predicate.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/half_floating_point_set_predicate.cpp | |||
| @@ -43,9 +43,9 @@ void HSETP2(TranslatorVisitor& v, u64 insn, const IR::U32& src_b, bool neg_b, bo | |||
| 43 | rhs_b = v.ir.FPAbsNeg(rhs_b, abs_b, neg_b); | 43 | rhs_b = v.ir.FPAbsNeg(rhs_b, abs_b, neg_b); |
| 44 | 44 | ||
| 45 | const IR::FpControl control{ | 45 | const IR::FpControl control{ |
| 46 | .no_contraction{false}, | 46 | .no_contraction = false, |
| 47 | .rounding{IR::FpRounding::DontCare}, | 47 | .rounding = IR::FpRounding::DontCare, |
| 48 | .fmz_mode{hsetp2.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None}, | 48 | .fmz_mode = (hsetp2.ftz != 0 ? IR::FmzMode::FTZ : IR::FmzMode::None), |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | IR::U1 pred{v.ir.GetPred(hsetp2.pred)}; | 51 | IR::U1 pred{v.ir.GetPred(hsetp2.pred)}; |
| @@ -106,8 +106,10 @@ void TranslatorVisitor::HSETP2_imm(u64 insn) { | |||
| 106 | BitField<20, 9, u64> low; | 106 | BitField<20, 9, u64> low; |
| 107 | } const hsetp2{insn}; | 107 | } const hsetp2{insn}; |
| 108 | 108 | ||
| 109 | const u32 imm{static_cast<u32>(hsetp2.low << 6) | ((hsetp2.neg_low != 0 ? 1 : 0) << 15) | | 109 | const u32 imm{static_cast<u32>(hsetp2.low << 6) | |
| 110 | static_cast<u32>(hsetp2.high << 22) | ((hsetp2.neg_high != 0 ? 1 : 0) << 31)}; | 110 | static_cast<u32>((hsetp2.neg_low != 0 ? 1 : 0) << 15) | |
| 111 | static_cast<u32>(hsetp2.high << 22) | | ||
| 112 | static_cast<u32>((hsetp2.neg_high != 0 ? 1 : 0) << 31)}; | ||
| 111 | 113 | ||
| 112 | HSETP2(*this, insn, ir.Imm32(imm), false, false, Swizzle::H1_H0, hsetp2.compare_op, | 114 | HSETP2(*this, insn, ir.Imm32(imm), false, false, Swizzle::H1_H0, hsetp2.compare_op, |
| 113 | hsetp2.h_and != 0); | 115 | hsetp2.h_and != 0); |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp index 30b570ce4..88bbac0a5 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp | |||
| @@ -49,7 +49,7 @@ void TranslatorVisitor::L(IR::Reg dest_reg, const IR::U64& value) { | |||
| 49 | } | 49 | } |
| 50 | const IR::Value result{ir.UnpackUint2x32(value)}; | 50 | const IR::Value result{ir.UnpackUint2x32(value)}; |
| 51 | for (int i = 0; i < 2; i++) { | 51 | for (int i = 0; i < 2; i++) { |
| 52 | X(dest_reg + i, IR::U32{ir.CompositeExtract(result, i)}); | 52 | X(dest_reg + i, IR::U32{ir.CompositeExtract(result, static_cast<size_t>(i))}); |
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | 55 | ||
| @@ -63,7 +63,7 @@ void TranslatorVisitor::D(IR::Reg dest_reg, const IR::F64& value) { | |||
| 63 | } | 63 | } |
| 64 | const IR::Value result{ir.UnpackDouble2x32(value)}; | 64 | const IR::Value result{ir.UnpackDouble2x32(value)}; |
| 65 | for (int i = 0; i < 2; i++) { | 65 | for (int i = 0; i < 2; i++) { |
| 66 | X(dest_reg + i, IR::U32{ir.CompositeExtract(result, i)}); | 66 | X(dest_reg + i, IR::U32{ir.CompositeExtract(result, static_cast<size_t>(i))}); |
| 67 | } | 67 | } |
| 68 | } | 68 | } |
| 69 | 69 | ||
| @@ -156,7 +156,7 @@ IR::F64 TranslatorVisitor::GetDoubleCbuf(u64 insn) { | |||
| 156 | const auto [binding, offset_value]{CbufAddr(insn)}; | 156 | const auto [binding, offset_value]{CbufAddr(insn)}; |
| 157 | const bool unaligned{cbuf.unaligned != 0}; | 157 | const bool unaligned{cbuf.unaligned != 0}; |
| 158 | const u32 offset{offset_value.U32()}; | 158 | const u32 offset{offset_value.U32()}; |
| 159 | const IR::Value addr{unaligned ? offset | 4 : (offset & ~7) | 4}; | 159 | const IR::Value addr{unaligned ? offset | 4u : (offset & ~7u) | 4u}; |
| 160 | 160 | ||
| 161 | const IR::U32 value{ir.GetCbuf(binding, IR::U32{addr})}; | 161 | const IR::U32 value{ir.GetCbuf(binding, IR::U32{addr})}; |
| 162 | const IR::U32 lower_bits{CbufLowerBits(ir, unaligned, binding, offset)}; | 162 | const IR::U32 lower_bits{CbufLowerBits(ir, unaligned, binding, offset)}; |
| @@ -200,7 +200,7 @@ IR::F32 TranslatorVisitor::GetFloatImm20(u64 insn) { | |||
| 200 | BitField<20, 19, u64> value; | 200 | BitField<20, 19, u64> value; |
| 201 | BitField<56, 1, u64> is_negative; | 201 | BitField<56, 1, u64> is_negative; |
| 202 | } const imm{insn}; | 202 | } const imm{insn}; |
| 203 | const u32 sign_bit{imm.is_negative != 0 ? (1ULL << 31) : 0}; | 203 | const u32 sign_bit{static_cast<u32>(imm.is_negative != 0 ? (1ULL << 31) : 0)}; |
| 204 | const u32 value{static_cast<u32>(imm.value) << 12}; | 204 | const u32 value{static_cast<u32>(imm.value) << 12}; |
| 205 | return ir.Imm32(Common::BitCast<f32>(value | sign_bit)); | 205 | return ir.Imm32(Common::BitCast<f32>(value | sign_bit)); |
| 206 | } | 206 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add.cpp index 1493e1815..8ffd84867 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add.cpp | |||
| @@ -68,7 +68,6 @@ void IADD(TranslatorVisitor& v, u64 insn, IR::U32 op_b) { | |||
| 68 | } const iadd{insn}; | 68 | } const iadd{insn}; |
| 69 | 69 | ||
| 70 | const bool po{iadd.three_for_po == 3}; | 70 | const bool po{iadd.three_for_po == 3}; |
| 71 | const bool neg_a{!po && iadd.neg_a != 0}; | ||
| 72 | if (!po && iadd.neg_b != 0) { | 71 | if (!po && iadd.neg_b != 0) { |
| 73 | op_b = v.ir.INeg(op_b); | 72 | op_b = v.ir.INeg(op_b); |
| 74 | } | 73 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_floating_point_conversion.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_floating_point_conversion.cpp index e8b5ae1d2..5a0fc36a0 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_floating_point_conversion.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_floating_point_conversion.cpp | |||
| @@ -131,7 +131,7 @@ void I2F(TranslatorVisitor& v, u64 insn, IR::U32U64 src) { | |||
| 131 | } | 131 | } |
| 132 | const IR::Value vector{v.ir.UnpackDouble2x32(value)}; | 132 | const IR::Value vector{v.ir.UnpackDouble2x32(value)}; |
| 133 | for (int i = 0; i < 2; ++i) { | 133 | for (int i = 0; i < 2; ++i) { |
| 134 | v.X(i2f.dest_reg + i, IR::U32{v.ir.CompositeExtract(vector, i)}); | 134 | v.X(i2f.dest_reg + i, IR::U32{v.ir.CompositeExtract(vector, static_cast<size_t>(i))}); |
| 135 | } | 135 | } |
| 136 | break; | 136 | break; |
| 137 | } | 137 | } |
| @@ -170,4 +170,4 @@ void TranslatorVisitor::I2F_imm(u64 insn) { | |||
| 170 | } | 170 | } |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | } // namespace Shader::Maxwell \ No newline at end of file | 173 | } // namespace Shader::Maxwell |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/load_constant.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/load_constant.cpp index ae3ecea32..2300088e3 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/load_constant.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/load_constant.cpp | |||
| @@ -50,7 +50,7 @@ void TranslatorVisitor::LDC(u64 insn) { | |||
| 50 | } | 50 | } |
| 51 | const IR::Value vector{ir.GetCbuf(index, offset, 64, false)}; | 51 | const IR::Value vector{ir.GetCbuf(index, offset, 64, false)}; |
| 52 | for (int i = 0; i < 2; ++i) { | 52 | for (int i = 0; i < 2; ++i) { |
| 53 | X(ldc.dest_reg + i, IR::U32{ir.CompositeExtract(vector, i)}); | 53 | X(ldc.dest_reg + i, IR::U32{ir.CompositeExtract(vector, static_cast<size_t>(i))}); |
| 54 | } | 54 | } |
| 55 | break; | 55 | break; |
| 56 | } | 56 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_local_shared.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_local_shared.cpp index 68963c8ea..e24b49721 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_local_shared.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_local_shared.cpp | |||
| @@ -40,7 +40,6 @@ std::pair<int, bool> GetSize(u64 insn) { | |||
| 40 | BitField<48, 3, Size> size; | 40 | BitField<48, 3, Size> size; |
| 41 | } const encoding{insn}; | 41 | } const encoding{insn}; |
| 42 | 42 | ||
| 43 | const Size nnn = encoding.size; | ||
| 44 | switch (encoding.size) { | 43 | switch (encoding.size) { |
| 45 | case Size::U8: | 44 | case Size::U8: |
| 46 | return {8, false}; | 45 | return {8, false}; |
| @@ -99,7 +98,7 @@ void TranslatorVisitor::LDL(u64 insn) { | |||
| 99 | case 32: | 98 | case 32: |
| 100 | case 64: | 99 | case 64: |
| 101 | case 128: | 100 | case 128: |
| 102 | if (!IR::IsAligned(dest, bit_size / 32)) { | 101 | if (!IR::IsAligned(dest, static_cast<size_t>(bit_size / 32))) { |
| 103 | throw NotImplementedException("Unaligned destination register {}", dest); | 102 | throw NotImplementedException("Unaligned destination register {}", dest); |
| 104 | } | 103 | } |
| 105 | X(dest, ir.LoadLocal(word_offset)); | 104 | X(dest, ir.LoadLocal(word_offset)); |
| @@ -123,11 +122,11 @@ void TranslatorVisitor::LDS(u64 insn) { | |||
| 123 | break; | 122 | break; |
| 124 | case 64: | 123 | case 64: |
| 125 | case 128: | 124 | case 128: |
| 126 | if (!IR::IsAligned(dest, bit_size / 32)) { | 125 | if (!IR::IsAligned(dest, static_cast<size_t>(bit_size / 32))) { |
| 127 | throw NotImplementedException("Unaligned destination register {}", dest); | 126 | throw NotImplementedException("Unaligned destination register {}", dest); |
| 128 | } | 127 | } |
| 129 | for (int element = 0; element < bit_size / 32; ++element) { | 128 | for (int element = 0; element < bit_size / 32; ++element) { |
| 130 | X(dest + element, IR::U32{ir.CompositeExtract(value, element)}); | 129 | X(dest + element, IR::U32{ir.CompositeExtract(value, static_cast<size_t>(element))}); |
| 131 | } | 130 | } |
| 132 | break; | 131 | break; |
| 133 | } | 132 | } |
| @@ -156,7 +155,7 @@ void TranslatorVisitor::STL(u64 insn) { | |||
| 156 | case 32: | 155 | case 32: |
| 157 | case 64: | 156 | case 64: |
| 158 | case 128: | 157 | case 128: |
| 159 | if (!IR::IsAligned(reg, bit_size / 32)) { | 158 | if (!IR::IsAligned(reg, static_cast<size_t>(bit_size / 32))) { |
| 160 | throw NotImplementedException("Unaligned source register"); | 159 | throw NotImplementedException("Unaligned source register"); |
| 161 | } | 160 | } |
| 162 | ir.WriteLocal(word_offset, src); | 161 | ir.WriteLocal(word_offset, src); |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_memory.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_memory.cpp index 71688b1d7..36c5cff2f 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_memory.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_memory.cpp | |||
| @@ -114,7 +114,7 @@ void TranslatorVisitor::LDG(u64 insn) { | |||
| 114 | } | 114 | } |
| 115 | const IR::Value vector{ir.LoadGlobal64(address)}; | 115 | const IR::Value vector{ir.LoadGlobal64(address)}; |
| 116 | for (int i = 0; i < 2; ++i) { | 116 | for (int i = 0; i < 2; ++i) { |
| 117 | X(dest_reg + i, IR::U32{ir.CompositeExtract(vector, i)}); | 117 | X(dest_reg + i, IR::U32{ir.CompositeExtract(vector, static_cast<size_t>(i))}); |
| 118 | } | 118 | } |
| 119 | break; | 119 | break; |
| 120 | } | 120 | } |
| @@ -125,7 +125,7 @@ void TranslatorVisitor::LDG(u64 insn) { | |||
| 125 | } | 125 | } |
| 126 | const IR::Value vector{ir.LoadGlobal128(address)}; | 126 | const IR::Value vector{ir.LoadGlobal128(address)}; |
| 127 | for (int i = 0; i < 4; ++i) { | 127 | for (int i = 0; i < 4; ++i) { |
| 128 | X(dest_reg + i, IR::U32{ir.CompositeExtract(vector, i)}); | 128 | X(dest_reg + i, IR::U32{ir.CompositeExtract(vector, static_cast<size_t>(i))}); |
| 129 | } | 129 | } |
| 130 | break; | 130 | break; |
| 131 | } | 131 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch.cpp index b2da079f9..95d416586 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch.cpp | |||
| @@ -199,7 +199,7 @@ void Impl(TranslatorVisitor& v, u64 insn, bool aoffi, Blod blod, bool lc, | |||
| 199 | if (tex.dc != 0) { | 199 | if (tex.dc != 0) { |
| 200 | value = element < 3 ? IR::F32{sample} : v.ir.Imm32(1.0f); | 200 | value = element < 3 ? IR::F32{sample} : v.ir.Imm32(1.0f); |
| 201 | } else { | 201 | } else { |
| 202 | value = IR::F32{v.ir.CompositeExtract(sample, element)}; | 202 | value = IR::F32{v.ir.CompositeExtract(sample, static_cast<size_t>(element))}; |
| 203 | } | 203 | } |
| 204 | v.F(dest_reg, value); | 204 | v.F(dest_reg, value); |
| 205 | ++dest_reg; | 205 | ++dest_reg; |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch_swizzled.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch_swizzled.cpp index d5fda20f4..fe2c7db85 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch_swizzled.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch_swizzled.cpp | |||
| @@ -53,7 +53,7 @@ constexpr std::array RGBA_LUT{ | |||
| 53 | R | G | B | A, // | 53 | R | G | B | A, // |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | void CheckAlignment(IR::Reg reg, int alignment) { | 56 | void CheckAlignment(IR::Reg reg, size_t alignment) { |
| 57 | if (!IR::IsAligned(reg, alignment)) { | 57 | if (!IR::IsAligned(reg, alignment)) { |
| 58 | throw NotImplementedException("Unaligned source register {}", reg); | 58 | throw NotImplementedException("Unaligned source register {}", reg); |
| 59 | } | 59 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather_swizzled.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather_swizzled.cpp index beab515ad..2ba9c1018 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather_swizzled.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather_swizzled.cpp | |||
| @@ -37,7 +37,7 @@ union Encoding { | |||
| 37 | BitField<36, 13, u64> cbuf_offset; | 37 | BitField<36, 13, u64> cbuf_offset; |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | void CheckAlignment(IR::Reg reg, int alignment) { | 40 | void CheckAlignment(IR::Reg reg, size_t alignment) { |
| 41 | if (!IR::IsAligned(reg, alignment)) { | 41 | if (!IR::IsAligned(reg, alignment)) { |
| 42 | throw NotImplementedException("Unaligned source register {}", reg); | 42 | throw NotImplementedException("Unaligned source register {}", reg); |
| 43 | } | 43 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_load_swizzled.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_load_swizzled.cpp index 623b8fc23..0863bdfcd 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_load_swizzled.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_load_swizzled.cpp | |||
| @@ -56,7 +56,7 @@ union Encoding { | |||
| 56 | BitField<53, 4, u64> encoding; | 56 | BitField<53, 4, u64> encoding; |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | void CheckAlignment(IR::Reg reg, int alignment) { | 59 | void CheckAlignment(IR::Reg reg, size_t alignment) { |
| 60 | if (!IR::IsAligned(reg, alignment)) { | 60 | if (!IR::IsAligned(reg, alignment)) { |
| 61 | throw NotImplementedException("Unaligned source register {}", reg); | 61 | throw NotImplementedException("Unaligned source register {}", reg); |
| 62 | } | 62 | } |
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 8c7e04bca..0459e5473 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_query.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_query.cpp | |||
| @@ -54,7 +54,7 @@ void Impl(TranslatorVisitor& v, u64 insn, std::optional<u32> cbuf_offset) { | |||
| 54 | if (((txq.mask >> element) & 1) == 0) { | 54 | if (((txq.mask >> element) & 1) == 0) { |
| 55 | continue; | 55 | continue; |
| 56 | } | 56 | } |
| 57 | v.X(dest_reg, IR::U32{v.ir.CompositeExtract(query, element)}); | 57 | v.X(dest_reg, IR::U32{v.ir.CompositeExtract(query, static_cast<size_t>(element))}); |
| 58 | ++dest_reg; | 58 | ++dest_reg; |
| 59 | } | 59 | } |
| 60 | } | 60 | } |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/video_set_predicate.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/video_set_predicate.cpp index af13b3fcc..ec5e74f6d 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/video_set_predicate.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/video_set_predicate.cpp | |||
| @@ -69,7 +69,6 @@ void TranslatorVisitor::VSETP(u64 insn) { | |||
| 69 | const IR::U32 src_b{is_b_imm ? ir.Imm32(static_cast<u32>(vsetp.src_b_imm)) : GetReg20(insn)}; | 69 | const IR::U32 src_b{is_b_imm ? ir.Imm32(static_cast<u32>(vsetp.src_b_imm)) : GetReg20(insn)}; |
| 70 | 70 | ||
| 71 | const u32 a_selector{static_cast<u32>(vsetp.src_a_selector)}; | 71 | const u32 a_selector{static_cast<u32>(vsetp.src_a_selector)}; |
| 72 | const u32 b_selector{is_b_imm ? 0U : static_cast<u32>(vsetp.src_b_selector)}; | ||
| 73 | const VideoWidth a_width{vsetp.src_a_width}; | 72 | const VideoWidth a_width{vsetp.src_a_width}; |
| 74 | const VideoWidth b_width{GetVideoSourceWidth(vsetp.src_b_width, is_b_imm)}; | 73 | const VideoWidth b_width{GetVideoSourceWidth(vsetp.src_b_width, is_b_imm)}; |
| 75 | 74 | ||