Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/fast/Fast3dWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Fast3dWindow : public Ship::Window {

void Init() override;
void Close() override;
void RunGuiOnly() override;
void StartFrame() override;
void EndFrame() override;
bool IsFrameReady() override;
Expand Down
1 change: 1 addition & 0 deletions include/fast/interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ class Interpreter {
void GetDimensions(uint32_t* width, uint32_t* height, int32_t* posX, int32_t* posY);
GfxRenderingAPI* GetCurrentRenderingAPI();
void StartFrame();
void RunGuiOnly();
void Run(Gfx* commands, const std::unordered_map<Mtx*, MtxF>& mtx_replacements);
void EndFrame();
void HandleWindowEvents();
Expand Down
1 change: 1 addition & 0 deletions include/ship/window/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Window {

virtual void Init() = 0;
virtual void Close() = 0;
virtual void RunGuiOnly() = 0;
virtual void StartFrame() = 0;
virtual void EndFrame() = 0;
virtual bool IsFrameReady() = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/fast/Fast3dWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ void Fast3dWindow::Close() {
mWindowManagerApi->Close();
}

void Fast3dWindow::RunGuiOnly() {
mInterpreter->RunGuiOnly();
}

void Fast3dWindow::StartFrame() {
mInterpreter->StartFrame();
}
Expand Down
40 changes: 40 additions & 0 deletions src/fast/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4301,6 +4301,46 @@ void Interpreter::StartFrame() {

GfxExecStack g_exec_stack = {};

void Interpreter::RunGuiOnly() {
SpReset();

mGetPixelDepthPending.clear();
mGetPixelDepthCached.clear();

mRapi->UpdateFramebufferParameters(0, mGfxCurrentWindowDimensions.width, mGfxCurrentWindowDimensions.height, 1,
false, true, true, !mRendersToFb);
mRapi->StartFrame();
mRapi->StartDrawToFramebuffer(mRendersToFb ? mGameFb : 0, (float)mCurDimensions.height / mNativeDimensions.height);
mRapi->ClearFramebuffer(false, true);
mRdp->viewport_or_scissor_changed = true;
mRenderingState.viewport = {};
mRenderingState.scissor = {};

Flush();
mGfxFrameBuffer = 0;

if (mRendersToFb) {
mRapi->StartDrawToFramebuffer(0, 1);
mRapi->ClearFramebuffer(true, true);
if (mMsaaLevel > 1) {
if (!ViewportMatchesRendererResolution()) {
mRapi->ResolveMSAAColorBuffer(mGameFbMsaaResolved, mGameFb);
mGfxFrameBuffer = (uintptr_t)mRapi->GetFramebufferTextureId(mGameFbMsaaResolved);
} else {
mRapi->ResolveMSAAColorBuffer(0, mGameFb);
}
} else {
mGfxFrameBuffer = (uintptr_t)mRapi->GetFramebufferTextureId(mGameFb);
}
} else if (mFbActive) {
// Failsafe reset to main framebuffer to prevent softlocking the renderer
mFbActive = 0;
mRapi->StartDrawToFramebuffer(0, 1);

assert(0 && "active framebuffer was never reset back to original");
}
}

void Interpreter::Run(Gfx* commands, const std::unordered_map<Mtx*, MtxF>& mtx_replacements) {
SpReset();

Expand Down
Loading