2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 13:44:56 +00:00

Fix Metal rendering; HI-DPI improvements

This commit is contained in:
2021-05-24 18:53:49 -04:00
parent 3616b42072
commit 32f9bafff1
7 changed files with 41 additions and 25 deletions

View File

@@ -242,6 +242,7 @@ public:
m_window->showWindow();
boo::SWindowRect rect = m_window->getWindowFrame();
m_windowCallback.m_lastRect = rect;
boo::IGraphicsDataFactory* gfxF = m_window->getMainContextDataFactory();
gfxF->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) {
m_renderTex = ctx.newRenderTexture(rect.size[0], rect.size[1], boo::TextureClampMode::ClampToEdge, 3, 3);
@@ -344,12 +345,14 @@ public:
m_window->waitForRetrace();
boo::SWindowRect& rect = m_windowCallback.m_lastRect;
boo::IGraphicsCommandQueue* gfxQ = m_window->getCommandQueue();
if (m_windowCallback.m_rectDirty) {
boo::SWindowRect& rect = m_windowCallback.m_lastRect;
gfxQ->resizeRenderTexture(m_renderTex, rect.size[0], rect.size[1]);
metaforce::CGraphics::SetViewportResolution({rect.size[0], rect.size[1]});
CGraphics::SetViewportResolution({rect.size[0], rect.size[1]});
m_windowCallback.m_rectDirty = false;
} else if (m_firstFrame) {
CGraphics::SetViewportResolution({rect.size[0], rect.size[1]});
}
if (m_windowCallback.m_fullscreenToggleRequested) {
@@ -358,13 +361,14 @@ public:
}
boo::IGraphicsDataFactory* gfxF = m_window->getMainContextDataFactory();
float scale = m_window->getVirtualPixelFactor();
if (!g_mainMP1) {
g_mainMP1.emplace(nullptr, nullptr, gfxF, gfxQ, m_renderTex.get());
g_mainMP1->Init(m_fileMgr, &m_cvarManager, m_window.get(), m_voiceEngine.get(), *m_amuseAllocWrapper);
if (!m_noShaderWarmup) {
g_mainMP1->WarmupShaders();
}
ImGuiEngine::Initialize(gfxF, m_window->getWindowFrame());
ImGuiEngine::Initialize(gfxF, m_window->getWindowFrame(), scale);
}
float dt = 1 / 60.f;
@@ -381,7 +385,7 @@ public:
}
m_prevFrameTime = now;
ImGuiEngine::Begin(realDt);
ImGuiEngine::Begin(realDt, scale);
if (g_mainMP1->Proc(dt)) {
m_running.store(false);
@@ -391,6 +395,8 @@ public:
{
OPTICK_EVENT("Draw");
gfxQ->setRenderTarget(m_renderTex);
gfxQ->setViewport(rect);
gfxQ->setScissor(rect);
if (g_Renderer != nullptr) {
g_Renderer->BeginScene();
}

View File

@@ -48,10 +48,13 @@ if(APPLE)
list(APPEND PLAT_SRCS startButton.cpp CGameOptionsTouchBarMac.mm)
endif()
set(RUNTIME_SOURCES_A
set(CAST_TO_SOURCES
MkCastTo.py
TCastTo.hpp TCastTo.cpp
TCastTo.hpp TCastTo.cpp)
set(RUNTIME_SOURCES_A
RetroTypes.hpp RetroTypes.cpp
${CAST_TO_SOURCES}
${MP1_SOURCES}
${AUDIO_SOURCES}
${AUTOMAPPER_SOURCES}
@@ -61,6 +64,7 @@ set(RUNTIME_SOURCES_A
${GRAPHICS_SOURCES})
set(RUNTIME_SOURCES_B
${CAST_TO_SOURCES}
${GUISYS_SOURCES}
${INPUT_SOURCES}
${PARTICLE_SOURCES}