mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-04 06:06:00 +00:00
Implement IMAGE_STORE_MIP
Not sure if this is the right way to do this, let me know if this needs changing.
This commit is contained in:
parent
21808240d6
commit
cff78b5924
|
@ -220,7 +220,7 @@ public:
|
||||||
void IMAGE_GET_RESINFO(const GcnInst& inst);
|
void IMAGE_GET_RESINFO(const GcnInst& inst);
|
||||||
void IMAGE_SAMPLE(const GcnInst& inst);
|
void IMAGE_SAMPLE(const GcnInst& inst);
|
||||||
void IMAGE_GATHER(const GcnInst& inst);
|
void IMAGE_GATHER(const GcnInst& inst);
|
||||||
void IMAGE_STORE(const GcnInst& inst);
|
void IMAGE_STORE(bool has_mip, const GcnInst& inst);
|
||||||
void IMAGE_LOAD(bool has_mip, const GcnInst& inst);
|
void IMAGE_LOAD(bool has_mip, const GcnInst& inst);
|
||||||
void IMAGE_GET_LOD(const GcnInst& inst);
|
void IMAGE_GET_LOD(const GcnInst& inst);
|
||||||
void IMAGE_ATOMIC(AtomicOp op, const GcnInst& inst);
|
void IMAGE_ATOMIC(AtomicOp op, const GcnInst& inst);
|
||||||
|
|
|
@ -47,8 +47,10 @@ void Translator::EmitVectorMemory(const GcnInst& inst) {
|
||||||
return IMAGE_ATOMIC(AtomicOp::Dec, inst);
|
return IMAGE_ATOMIC(AtomicOp::Dec, inst);
|
||||||
case Opcode::IMAGE_GET_LOD:
|
case Opcode::IMAGE_GET_LOD:
|
||||||
return IMAGE_GET_LOD(inst);
|
return IMAGE_GET_LOD(inst);
|
||||||
|
case Opcode::IMAGE_STORE_MIP:
|
||||||
|
return IMAGE_STORE(true, inst);
|
||||||
case Opcode::IMAGE_STORE:
|
case Opcode::IMAGE_STORE:
|
||||||
return IMAGE_STORE(inst);
|
return IMAGE_STORE(false, inst);
|
||||||
case Opcode::IMAGE_LOAD_MIP:
|
case Opcode::IMAGE_LOAD_MIP:
|
||||||
return IMAGE_LOAD(true, inst);
|
return IMAGE_LOAD(true, inst);
|
||||||
case Opcode::IMAGE_LOAD:
|
case Opcode::IMAGE_LOAD:
|
||||||
|
@ -330,7 +332,7 @@ void Translator::IMAGE_LOAD(bool has_mip, const GcnInst& inst) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Translator::IMAGE_STORE(const GcnInst& inst) {
|
void Translator::IMAGE_STORE(bool has_mip, const GcnInst& inst) {
|
||||||
const auto& mimg = inst.control.mimg;
|
const auto& mimg = inst.control.mimg;
|
||||||
IR::VectorReg addr_reg{inst.src[0].code};
|
IR::VectorReg addr_reg{inst.src[0].code};
|
||||||
IR::VectorReg data_reg{inst.dst[0].code};
|
IR::VectorReg data_reg{inst.dst[0].code};
|
||||||
|
@ -341,6 +343,9 @@ void Translator::IMAGE_STORE(const GcnInst& inst) {
|
||||||
ir.CompositeConstruct(ir.GetVectorReg(addr_reg), ir.GetVectorReg(addr_reg + 1),
|
ir.CompositeConstruct(ir.GetVectorReg(addr_reg), ir.GetVectorReg(addr_reg + 1),
|
||||||
ir.GetVectorReg(addr_reg + 2), ir.GetVectorReg(addr_reg + 3));
|
ir.GetVectorReg(addr_reg + 2), ir.GetVectorReg(addr_reg + 3));
|
||||||
|
|
||||||
|
IR::TextureInstInfo info{};
|
||||||
|
info.explicit_lod.Assign(has_mip);
|
||||||
|
|
||||||
boost::container::static_vector<IR::F32, 4> comps;
|
boost::container::static_vector<IR::F32, 4> comps;
|
||||||
for (u32 i = 0; i < 4; i++) {
|
for (u32 i = 0; i < 4; i++) {
|
||||||
if (((mimg.dmask >> i) & 1) == 0) {
|
if (((mimg.dmask >> i) & 1) == 0) {
|
||||||
|
@ -350,7 +355,7 @@ void Translator::IMAGE_STORE(const GcnInst& inst) {
|
||||||
comps.push_back(ir.GetVectorReg<IR::F32>(data_reg++));
|
comps.push_back(ir.GetVectorReg<IR::F32>(data_reg++));
|
||||||
}
|
}
|
||||||
const IR::Value value = ir.CompositeConstruct(comps[0], comps[1], comps[2], comps[3]);
|
const IR::Value value = ir.CompositeConstruct(comps[0], comps[1], comps[2], comps[3]);
|
||||||
ir.ImageWrite(handle, body, value, {});
|
ir.ImageWrite(handle, body, value, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Translator::BUFFER_LOAD(u32 num_dwords, bool is_typed, const GcnInst& inst) {
|
void Translator::BUFFER_LOAD(u32 num_dwords, bool is_typed, const GcnInst& inst) {
|
||||||
|
|
Loading…
Reference in a new issue