mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-21 12:15:45 +00:00
[Texture_cache] Better memory handling for devices with lower memory allocations (#233)
Means games like Minecraft Dungeons, Sea of Stars, Luigi Mansion 2, Astroneer, Alan Wake, etc are now playable. It also cleans up the recent abi.cpp and bindless texture commits a bit. Everything is in #ifdef ANDROID - The biggest change is CACHING_PAGEBITS = 12. Without that the way the buffercache grows and joins buffers can cause Android to run out of memory (as you end up with just one big buffer that needs to be copied every time it grows) Also patches up ffmpeg issues. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/233 Co-authored-by: JPikachu <jpikachu.eden@gmail.com> Co-committed-by: JPikachu <jpikachu.eden@gmail.com>
This commit is contained in:
parent
b5b1d20e1e
commit
91a662431c
15 changed files with 96 additions and 53 deletions
|
@ -4,6 +4,7 @@
|
|||
#include "common/bit_field.h"
|
||||
#include "common/common_types.h"
|
||||
#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
|
||||
#include <fstream>
|
||||
|
||||
namespace Shader::Maxwell {
|
||||
namespace {
|
||||
|
@ -33,6 +34,17 @@ enum class ShuffleMode : u64 {
|
|||
}
|
||||
}
|
||||
|
||||
bool IsKONA() {
|
||||
std::ifstream machineFile("/sys/devices/soc0/machine");
|
||||
if (machineFile.is_open()) {
|
||||
std::string line;
|
||||
std::getline(machineFile, line);
|
||||
if (line == "KONA")
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Shuffle(TranslatorVisitor& v, u64 insn, const IR::U32& index, const IR::U32& mask) {
|
||||
union {
|
||||
u64 insn;
|
||||
|
@ -44,7 +56,10 @@ void Shuffle(TranslatorVisitor& v, u64 insn, const IR::U32& index, const IR::U32
|
|||
|
||||
const IR::U32 result{ShuffleOperation(v.ir, v.X(shfl.src_reg), index, mask, shfl.mode)};
|
||||
v.ir.SetPred(shfl.pred, v.ir.GetInBoundsFromOp(result));
|
||||
v.X(shfl.dest_reg, result);
|
||||
if (IsKONA())
|
||||
v.X(shfl.dest_reg, v.ir.Imm32(0xffffffff)); // This fixes the freeze for Retroid / Snapdragon SD865
|
||||
else
|
||||
v.X(shfl.dest_reg, result);
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
|
|
|
@ -327,30 +327,14 @@ std::optional<ConstBufferAddr> TryGetConstBuffer(const IR::Inst* inst, Environme
|
|||
};
|
||||
}
|
||||
|
||||
// TODO:xbzk: shall be dropped when Track method cover all bindless stuff
|
||||
static ConstBufferAddr last_valid_addr = ConstBufferAddr{
|
||||
.index = 0,
|
||||
.offset = 0,
|
||||
.shift_left = 0,
|
||||
.secondary_index = 0,
|
||||
.secondary_offset = 0,
|
||||
.secondary_shift_left = 0,
|
||||
.dynamic_offset = {},
|
||||
.count = 1,
|
||||
.has_secondary = false,
|
||||
};
|
||||
|
||||
TextureInst MakeInst(Environment& env, IR::Block* block, IR::Inst& inst) {
|
||||
ConstBufferAddr addr;
|
||||
ConstBufferAddr addr{};
|
||||
if (IsBindless(inst)) {
|
||||
const std::optional<ConstBufferAddr> track_addr{Track(inst.Arg(0), env)};
|
||||
|
||||
if (!track_addr) {
|
||||
//throw NotImplementedException("Failed to track bindless texture constant buffer");
|
||||
addr = last_valid_addr; // TODO:xbzk: shall be dropped when Track method cover all bindless stuff
|
||||
LOG_WARNING(Shader, "Failed to track bindless texture constant buffer");
|
||||
} else {
|
||||
addr = *track_addr;
|
||||
last_valid_addr = addr; // TODO:xbzk: shall be dropped when Track method cover all bindless stuff
|
||||
}
|
||||
} else {
|
||||
addr = ConstBufferAddr{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue