mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-28 04:54:30 +00:00
Fix stride and patch phi node blocks
This commit is contained in:
parent
ea4a3563b9
commit
f9e668cc6a
@ -154,6 +154,7 @@ void Traverse(EmitContext& ctx, const IR::Program& program) {
|
|||||||
for (IR::Inst& inst : node.data.block->Instructions()) {
|
for (IR::Inst& inst : node.data.block->Instructions()) {
|
||||||
EmitInst(ctx, &inst);
|
EmitInst(ctx, &inst);
|
||||||
}
|
}
|
||||||
|
ctx.first_to_last_label_map[label.value] = ctx.last_label;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IR::AbstractSyntaxNode::Type::If: {
|
case IR::AbstractSyntaxNode::Type::If: {
|
||||||
@ -391,7 +392,7 @@ void SetupFloatMode(EmitContext& ctx, const Profile& profile, const RuntimeInfo&
|
|||||||
void PatchPhiNodes(const IR::Program& program, EmitContext& ctx) {
|
void PatchPhiNodes(const IR::Program& program, EmitContext& ctx) {
|
||||||
auto inst{program.blocks.front()->begin()};
|
auto inst{program.blocks.front()->begin()};
|
||||||
size_t block_index{0};
|
size_t block_index{0};
|
||||||
ctx.PatchDeferredPhi([&](size_t phi_arg) {
|
ctx.PatchDeferredPhi([&](u32 phi_arg, Id first_parent) {
|
||||||
if (phi_arg == 0) {
|
if (phi_arg == 0) {
|
||||||
++inst;
|
++inst;
|
||||||
if (inst == program.blocks[block_index]->end() ||
|
if (inst == program.blocks[block_index]->end() ||
|
||||||
@ -402,7 +403,9 @@ void PatchPhiNodes(const IR::Program& program, EmitContext& ctx) {
|
|||||||
} while (inst->GetOpcode() != IR::Opcode::Phi);
|
} while (inst->GetOpcode() != IR::Opcode::Phi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ctx.Def(inst->Arg(phi_arg));
|
const Id arg = ctx.Def(inst->Arg(phi_arg));
|
||||||
|
const Id parent = ctx.first_to_last_label_map[first_parent.value];
|
||||||
|
return std::make_pair(arg, parent);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
@ -792,7 +792,7 @@ void EmitContext::DefineBuffers() {
|
|||||||
auto& spv_buffer = buffers.emplace_back(binding.buffer++, desc.buffer_type);
|
auto& spv_buffer = buffers.emplace_back(binding.buffer++, desc.buffer_type);
|
||||||
if (True(desc.used_types & IR::Type::U64)) {
|
if (True(desc.used_types & IR::Type::U64)) {
|
||||||
spv_buffer[PointerType::U64] =
|
spv_buffer[PointerType::U64] =
|
||||||
DefineBuffer(is_storage, desc.is_written, 0, desc.buffer_type, U64);
|
DefineBuffer(is_storage, desc.is_written, 3, desc.buffer_type, U64);
|
||||||
}
|
}
|
||||||
if (True(desc.used_types & IR::Type::U32)) {
|
if (True(desc.used_types & IR::Type::U32)) {
|
||||||
spv_buffer[PointerType::U32] =
|
spv_buffer[PointerType::U32] =
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <unordered_map>
|
||||||
#include <sirit/sirit.h>
|
#include <sirit/sirit.h>
|
||||||
|
|
||||||
#include "shader_recompiler/backend/bindings.h"
|
#include "shader_recompiler/backend/bindings.h"
|
||||||
@ -389,6 +390,7 @@ public:
|
|||||||
boost::container::small_vector<TextureDefinition, 8> images;
|
boost::container::small_vector<TextureDefinition, 8> images;
|
||||||
boost::container::small_vector<Id, 4> samplers;
|
boost::container::small_vector<Id, 4> samplers;
|
||||||
PhysicalPointerTypes physical_pointer_types;
|
PhysicalPointerTypes physical_pointer_types;
|
||||||
|
std::unordered_map<u32, Id> first_to_last_label_map;
|
||||||
|
|
||||||
size_t flatbuf_index{};
|
size_t flatbuf_index{};
|
||||||
size_t bda_pagetable_index{};
|
size_t bda_pagetable_index{};
|
||||||
|
Loading…
Reference in New Issue
Block a user