Skip to content

Commit

Permalink
port: allow user to disable framebuffer use
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsfdsfgs committed Oct 16, 2023
1 parent dbebe7e commit 1eb1e96
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion port/fast3d/gfx_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,9 @@ static void gfx_opengl_init(void) {
// maybe replace this with sysFatalError, though the GLSL compiler will cause that later anyway
}

if (!gfx_opengl_supports_framebuffers()) {
if (!gfx_framebuffers_enabled) {
sysLogPrintf(LOG_WARNING, "GL: framebuffer effects disabled by user");
} else if (!gfx_opengl_supports_framebuffers()) {
sysLogPrintf(LOG_WARNING, "GL: GL_ARB_framebuffer_object unsupported, framebuffer effects disabled");
gfx_framebuffers_enabled = false;
}
Expand Down
5 changes: 5 additions & 0 deletions port/fast3d/gfx_pc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2688,6 +2688,11 @@ extern "C" void gfx_init(struct GfxWindowManagerAPI* wapi, struct GfxRenderingAP
game_framebuffer = gfx_rapi->create_framebuffer();
game_framebuffer_msaa_resolved = gfx_rapi->create_framebuffer();

if (gfx_msaa_level > 1 && !gfx_framebuffers_enabled) {
sysLogPrintf(LOG_WARNING, "F3D: MSAA set to %d, but framebuffers are not available; disabling", gfx_msaa_level);
gfx_msaa_level = 1;
}

for (int i = 0; i < 16; i++) {
segmentPointers[i] = 0;
}
Expand Down
2 changes: 2 additions & 0 deletions port/src/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ s32 videoInit(void)
const s32 h = configGetInt("Video.DefaultHeight", 480);
const bool fs = configGetInt("Video.DefaultFullscreen", false);

gfx_framebuffers_enabled = (bool)configGetIntClamped("Video.FramebufferEffects", 1, 0, 1);

gfx_msaa_level = configGetInt("Video.MSAA", 0);
if (gfx_msaa_level < 1 || gfx_msaa_level > 16) {
gfx_msaa_level = 1;
Expand Down

0 comments on commit 1eb1e96

Please sign in to comment.