From 06feafe9efcdc7a90c5c670e897cccb15c753879 Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Sat, 8 Apr 2017 20:06:12 +0200 Subject: [PATCH 1/3] Add missing include --- src/eventthread.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/eventthread.cpp b/src/eventthread.cpp index 42dab49..08b6c29 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include From 1478e1e0f9154eb82b708ed1e68f269fa422857a Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Sun, 23 Apr 2017 12:28:34 +0200 Subject: [PATCH 2/3] Config: Add "maxTextureSize" entry to artificially limit texture sizes --- mkxp.conf.sample | 11 +++++++++++ src/config.cpp | 1 + src/config.h | 1 + src/glstate.cpp | 6 +++++- src/glstate.h | 4 +++- src/sharedstate.cpp | 1 + 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/mkxp.conf.sample b/mkxp.conf.sample index b88f216..0062451 100644 --- a/mkxp.conf.sample +++ b/mkxp.conf.sample @@ -124,6 +124,17 @@ # subImageFix=false +# Limit the maximum size (width, height) of +# most textures mkxp will create (exceptions are +# rendering backbuffers and similar). +# If set to 0, the hardware maximum is used. +# This is useful for recording traces that can +# be played back on machines with lower specs. +# (default: 0) +# +# maxTextureSize=0 + + # Set the base path of the game to '/path/to/game' # (default: executable directory) # diff --git a/src/config.cpp b/src/config.cpp index a58ddab..0fab180 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -166,6 +166,7 @@ void Config::read(int argc, char *argv[]) PO_DESC(syncToRefreshrate, bool, false) \ PO_DESC(solidFonts, bool, false) \ PO_DESC(subImageFix, bool, false) \ + PO_DESC(maxTextureSize, int, 0) \ PO_DESC(gameFolder, std::string, ".") \ PO_DESC(anyAltToggleFS, bool, false) \ PO_DESC(enableReset, bool, true) \ diff --git a/src/config.h b/src/config.h index d82698d..f6dc2c4 100644 --- a/src/config.h +++ b/src/config.h @@ -49,6 +49,7 @@ struct Config bool solidFonts; bool subImageFix; + int maxTextureSize; std::string gameFolder; bool anyAltToggleFS; diff --git a/src/glstate.cpp b/src/glstate.cpp index 73aec31..ff88de7 100644 --- a/src/glstate.cpp +++ b/src/glstate.cpp @@ -23,6 +23,7 @@ #include "shader.h" #include "etc.h" #include "gl-fun.h" +#include "config.h" #include @@ -111,7 +112,7 @@ GLState::Caps::Caps() gl.GetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize); } -GLState::GLState() +GLState::GLState(const Config &conf) { gl.Disable(GL_DEPTH_TEST); @@ -121,4 +122,7 @@ GLState::GLState() scissorTest.init(false); scissorBox.init(IntRect(0, 0, 640, 480)); program.init(0); + + if (conf.maxTextureSize > 0) + caps.maxTexSize = conf.maxTextureSize; } diff --git a/src/glstate.h b/src/glstate.h index 63b0bcb..02830e6 100644 --- a/src/glstate.h +++ b/src/glstate.h @@ -27,6 +27,8 @@ #include #include +struct Config; + template struct GLProperty { @@ -130,7 +132,7 @@ public: } caps; - GLState(); + GLState(const Config &conf); }; #endif // GLSTATE_H diff --git a/src/sharedstate.cpp b/src/sharedstate.cpp index 9872af7..0778da9 100644 --- a/src/sharedstate.cpp +++ b/src/sharedstate.cpp @@ -109,6 +109,7 @@ struct SharedStatePrivate graphics(threadData), input(*threadData), audio(*threadData), + _glState(threadData->config), fontState(threadData->config), stampCounter(0) { From 006f701fecf405f8d0b0743c346c047a4c74be4e Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Sun, 23 Apr 2017 14:32:11 +0200 Subject: [PATCH 3/3] Config: Add "enableBlitting" entry to toggle GL_EXT_framebuffer_blit --- mkxp.conf.sample | 9 +++++++++ src/config.cpp | 1 + src/config.h | 1 + src/main.cpp | 3 +++ 4 files changed, 14 insertions(+) diff --git a/mkxp.conf.sample b/mkxp.conf.sample index 0062451..500dcc6 100644 --- a/mkxp.conf.sample +++ b/mkxp.conf.sample @@ -124,6 +124,15 @@ # subImageFix=false +# Enable framebuffer blitting if the driver is +# capable of it. Some drivers carry buggy +# implementations of this functionality, so +# disabling it can be used as a workaround +# (default: enabled) +# +# enableBlitting=true + + # Limit the maximum size (width, height) of # most textures mkxp will create (exceptions are # rendering backbuffers and similar). diff --git a/src/config.cpp b/src/config.cpp index 0fab180..33d8160 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -166,6 +166,7 @@ void Config::read(int argc, char *argv[]) PO_DESC(syncToRefreshrate, bool, false) \ PO_DESC(solidFonts, bool, false) \ PO_DESC(subImageFix, bool, false) \ + PO_DESC(enableBlitting, bool, true) \ PO_DESC(maxTextureSize, int, 0) \ PO_DESC(gameFolder, std::string, ".") \ PO_DESC(anyAltToggleFS, bool, false) \ diff --git a/src/config.h b/src/config.h index f6dc2c4..d2d4650 100644 --- a/src/config.h +++ b/src/config.h @@ -49,6 +49,7 @@ struct Config bool solidFonts; bool subImageFix; + bool enableBlitting; int maxTextureSize; std::string gameFolder; diff --git a/src/main.cpp b/src/main.cpp index a87ae48..1a3fc4e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -102,6 +102,9 @@ int rgssThreadFun(void *userdata) return 0; } + if (!conf.enableBlitting) + gl.BlitFramebuffer = 0; + gl.ClearColor(0, 0, 0, 1); gl.Clear(GL_COLOR_BUFFER_BIT); SDL_GL_SwapWindow(win);