mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-05 06:21:19 +12:00
add auto option for buffer cache mode
This commit is contained in:
parent
bc6fb816da
commit
d912837c9c
5 changed files with 38 additions and 11 deletions
|
@ -227,7 +227,7 @@ bool GameProfile::Load(uint64_t title_id)
|
||||||
|
|
||||||
gameProfile_loadEnumOption(iniParser, "accurateShaderMul", m_accurateShaderMul);
|
gameProfile_loadEnumOption(iniParser, "accurateShaderMul", m_accurateShaderMul);
|
||||||
gameProfile_loadBooleanOption2(iniParser, "fastMath", m_fastMath);
|
gameProfile_loadBooleanOption2(iniParser, "fastMath", m_fastMath);
|
||||||
gameProfile_loadEnumOption(iniParser, "bufferCacheMode", m_bufferCacheMode);
|
gameProfile_loadEnumOption(iniParser, "bufferCacheMode2", m_bufferCacheMode);
|
||||||
gameProfile_loadEnumOption(iniParser, "positionInvariance2", m_positionInvariance);
|
gameProfile_loadEnumOption(iniParser, "positionInvariance2", m_positionInvariance);
|
||||||
|
|
||||||
// legacy support
|
// legacy support
|
||||||
|
@ -295,25 +295,23 @@ void GameProfile::Save(uint64_t title_id)
|
||||||
|
|
||||||
#define WRITE_OPTIONAL_ENTRY(__NAME) if (m_##__NAME) fs->writeLine(fmt::format("{} = {}", #__NAME, m_##__NAME.value()).c_str());
|
#define WRITE_OPTIONAL_ENTRY(__NAME) if (m_##__NAME) fs->writeLine(fmt::format("{} = {}", #__NAME, m_##__NAME.value()).c_str());
|
||||||
#define WRITE_ENTRY(__NAME) fs->writeLine(fmt::format("{} = {}", #__NAME, m_##__NAME).c_str());
|
#define WRITE_ENTRY(__NAME) fs->writeLine(fmt::format("{} = {}", #__NAME, m_##__NAME).c_str());
|
||||||
|
#define WRITE_ENTRY_NUMBERED(__NAME, __NUM) fs->writeLine(fmt::format("{} = {}", #__NAME #__NUM, m_##__NAME).c_str());
|
||||||
|
|
||||||
fs->writeLine("[General]");
|
fs->writeLine("[General]");
|
||||||
WRITE_OPTIONAL_ENTRY(loadSharedLibraries);
|
WRITE_OPTIONAL_ENTRY(loadSharedLibraries);
|
||||||
WRITE_ENTRY(startWithPadView);
|
WRITE_ENTRY(startWithPadView);
|
||||||
|
|
||||||
fs->writeLine("");
|
fs->writeLine("");
|
||||||
|
|
||||||
|
|
||||||
fs->writeLine("[CPU]");
|
fs->writeLine("[CPU]");
|
||||||
WRITE_OPTIONAL_ENTRY(cpuMode);
|
WRITE_OPTIONAL_ENTRY(cpuMode);
|
||||||
WRITE_ENTRY(threadQuantum);
|
WRITE_ENTRY(threadQuantum);
|
||||||
|
|
||||||
fs->writeLine("");
|
fs->writeLine("");
|
||||||
|
|
||||||
fs->writeLine("[Graphics]");
|
fs->writeLine("[Graphics]");
|
||||||
WRITE_ENTRY(accurateShaderMul);
|
WRITE_ENTRY(accurateShaderMul);
|
||||||
WRITE_ENTRY(fastMath);
|
WRITE_ENTRY(fastMath);
|
||||||
WRITE_ENTRY(bufferCacheMode);
|
WRITE_ENTRY_NUMBERED(bufferCacheMode, 2);
|
||||||
WRITE_ENTRY(positionInvariance);
|
WRITE_ENTRY_NUMBERED(positionInvariance, 2);
|
||||||
WRITE_OPTIONAL_ENTRY(precompiledShaders);
|
WRITE_OPTIONAL_ENTRY(precompiledShaders);
|
||||||
WRITE_OPTIONAL_ENTRY(graphics_api);
|
WRITE_OPTIONAL_ENTRY(graphics_api);
|
||||||
fs->writeLine("");
|
fs->writeLine("");
|
||||||
|
@ -344,7 +342,7 @@ void GameProfile::ResetOptional()
|
||||||
// graphic settings
|
// graphic settings
|
||||||
m_accurateShaderMul = AccurateShaderMulOption::True;
|
m_accurateShaderMul = AccurateShaderMulOption::True;
|
||||||
m_fastMath = true;
|
m_fastMath = true;
|
||||||
m_bufferCacheMode = BufferCacheMode::DevicePrivate;
|
m_bufferCacheMode = BufferCacheMode::Auto;
|
||||||
m_positionInvariance = PositionInvariance::Auto;
|
m_positionInvariance = PositionInvariance::Auto;
|
||||||
// cpu settings
|
// cpu settings
|
||||||
m_threadQuantum = kThreadQuantumDefault;
|
m_threadQuantum = kThreadQuantumDefault;
|
||||||
|
@ -367,7 +365,7 @@ void GameProfile::Reset()
|
||||||
// graphic settings
|
// graphic settings
|
||||||
m_accurateShaderMul = AccurateShaderMulOption::True;
|
m_accurateShaderMul = AccurateShaderMulOption::True;
|
||||||
m_fastMath = true;
|
m_fastMath = true;
|
||||||
m_bufferCacheMode = BufferCacheMode::DevicePrivate;
|
m_bufferCacheMode = BufferCacheMode::Auto;
|
||||||
m_positionInvariance = PositionInvariance::Auto;
|
m_positionInvariance = PositionInvariance::Auto;
|
||||||
m_precompiledShaders = PrecompiledShaderOption::Auto;
|
m_precompiledShaders = PrecompiledShaderOption::Auto;
|
||||||
// cpu settings
|
// cpu settings
|
||||||
|
|
|
@ -58,7 +58,7 @@ private:
|
||||||
std::optional<GraphicAPI> m_graphics_api{};
|
std::optional<GraphicAPI> m_graphics_api{};
|
||||||
AccurateShaderMulOption m_accurateShaderMul = AccurateShaderMulOption::True;
|
AccurateShaderMulOption m_accurateShaderMul = AccurateShaderMulOption::True;
|
||||||
bool m_fastMath = true;
|
bool m_fastMath = true;
|
||||||
BufferCacheMode m_bufferCacheMode = BufferCacheMode::DevicePrivate;
|
BufferCacheMode m_bufferCacheMode = BufferCacheMode::Auto;
|
||||||
PositionInvariance m_positionInvariance = PositionInvariance::Auto;
|
PositionInvariance m_positionInvariance = PositionInvariance::Auto;
|
||||||
std::optional<PrecompiledShaderOption> m_precompiledShaders{};
|
std::optional<PrecompiledShaderOption> m_precompiledShaders{};
|
||||||
// cpu settings
|
// cpu settings
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
#include "Cafe/HW/Latte/Renderer/Metal/MetalMemoryManager.h"
|
#include "Cafe/HW/Latte/Renderer/Metal/MetalMemoryManager.h"
|
||||||
#include "Cafe/HW/Latte/Renderer/Metal/MetalVoidVertexPipeline.h"
|
#include "Cafe/HW/Latte/Renderer/Metal/MetalVoidVertexPipeline.h"
|
||||||
|
|
||||||
|
#include "CafeSystem.h"
|
||||||
#include "Cemu/Logging/CemuLogging.h"
|
#include "Cemu/Logging/CemuLogging.h"
|
||||||
#include "Common/precompiled.h"
|
#include "Common/precompiled.h"
|
||||||
#include "HW/MMU/MMU.h"
|
#include "HW/MMU/MMU.h"
|
||||||
|
#include "config/CemuConfig.h"
|
||||||
|
|
||||||
MetalMemoryManager::~MetalMemoryManager()
|
MetalMemoryManager::~MetalMemoryManager()
|
||||||
{
|
{
|
||||||
|
@ -36,6 +38,31 @@ void MetalMemoryManager::InitBufferCache(size_t size)
|
||||||
|
|
||||||
m_bufferCacheMode = g_current_game_profile->GetBufferCacheMode();
|
m_bufferCacheMode = g_current_game_profile->GetBufferCacheMode();
|
||||||
|
|
||||||
|
if (m_bufferCacheMode == BufferCacheMode::Auto)
|
||||||
|
{
|
||||||
|
// TODO: do this for all unified memory systems?
|
||||||
|
if (m_mtlr->IsAppleGPU())
|
||||||
|
{
|
||||||
|
switch (CafeSystem::GetForegroundTitleId())
|
||||||
|
{
|
||||||
|
// The Legend of Zelda: Wind Waker HD
|
||||||
|
case 0x0005000010143600: // EUR
|
||||||
|
case 0x0005000010143500: // USA
|
||||||
|
case 0x0005000010143400: // JPN
|
||||||
|
// TODO: use host instead?
|
||||||
|
m_bufferCacheMode = BufferCacheMode::DeviceShared;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_bufferCacheMode = BufferCacheMode::DevicePrivate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_bufferCacheMode = BufferCacheMode::DevicePrivate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// First, try to import the host memory as a buffer
|
// First, try to import the host memory as a buffer
|
||||||
if (m_bufferCacheMode == BufferCacheMode::Host)
|
if (m_bufferCacheMode == BufferCacheMode::Host)
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,9 +76,9 @@ MetalRenderer::MetalRenderer()
|
||||||
case 0x00050000101C9300: // JPN
|
case 0x00050000101C9300: // JPN
|
||||||
// Ninja Gaiden 3: Razor's Edge
|
// Ninja Gaiden 3: Razor's Edge
|
||||||
case 0x0005000010110B00: // EUR
|
case 0x0005000010110B00: // EUR
|
||||||
|
case 0x0005000010139B00: // EUR (TODO: check)
|
||||||
case 0x0005000010110A00: // USA
|
case 0x0005000010110A00: // USA
|
||||||
case 0x0005000010110900: // JPN
|
case 0x0005000010110900: // JPN
|
||||||
case 0x0005000010139B00: // EUR (TODO: check)
|
|
||||||
// Bayonetta 2
|
// Bayonetta 2
|
||||||
case 0x0005000010172700: // EUR
|
case 0x0005000010172700: // EUR
|
||||||
case 0x0005000010172600: // USA
|
case 0x0005000010172600: // USA
|
||||||
|
|
|
@ -126,11 +126,12 @@ ENABLE_ENUM_ITERATORS(AccurateShaderMulOption, AccurateShaderMulOption::False, A
|
||||||
|
|
||||||
enum class BufferCacheMode
|
enum class BufferCacheMode
|
||||||
{
|
{
|
||||||
|
Auto,
|
||||||
DevicePrivate,
|
DevicePrivate,
|
||||||
DeviceShared,
|
DeviceShared,
|
||||||
Host,
|
Host,
|
||||||
};
|
};
|
||||||
ENABLE_ENUM_ITERATORS(BufferCacheMode, BufferCacheMode::DevicePrivate, BufferCacheMode::Host);
|
ENABLE_ENUM_ITERATORS(BufferCacheMode, BufferCacheMode::Auto, BufferCacheMode::Host);
|
||||||
|
|
||||||
enum class PositionInvariance
|
enum class PositionInvariance
|
||||||
{
|
{
|
||||||
|
@ -244,6 +245,7 @@ struct fmt::formatter<BufferCacheMode> : formatter<string_view> {
|
||||||
string_view name;
|
string_view name;
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
case BufferCacheMode::Auto: name = "auto"; break;
|
||||||
case BufferCacheMode::DevicePrivate: name = "device private"; break;
|
case BufferCacheMode::DevicePrivate: name = "device private"; break;
|
||||||
case BufferCacheMode::DeviceShared: name = "device shared"; break;
|
case BufferCacheMode::DeviceShared: name = "device shared"; break;
|
||||||
case BufferCacheMode::Host: name = "host"; break;
|
case BufferCacheMode::Host: name = "host"; break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue