FunKey-OS/FunKey/package/mednafen/0001-disable-opengl.patch

483 lines
18 KiB
Diff

Disable OpenGL support.
Signed-off-by: "Michel Stempin" <michel.stempin@wanadoo.fr>
---
po/POTFILES.in | 2
src/drivers/Makefile.in | 12 +---
src/drivers/main.cpp | 2
src/drivers/video.cpp | 208 ++++-------------------------------------------------------------------
4 files changed, 17 insertions(+), 207 deletions(-)
diff -Naur a/po/POTFILES.in b/po/POTFILES.in
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -59,8 +59,6 @@
src/drivers/help.cpp
src/drivers/debugger.cpp
src/drivers/video-state.cpp
-src/drivers/opengl.cpp
-src/drivers/shader.cpp
src/drivers/hq2x.cpp
src/drivers/netplay.cpp
src/drivers/scalebit.c
diff -Naur a/src/drivers/Makefile.in b/src/drivers/Makefile.in
--- a/src/drivers/Makefile.in
+++ b/src/drivers/Makefile.in
@@ -124,7 +124,7 @@
am__libmdfnsdl_a_SOURCES_DIST = main.cpp input.cpp args.cpp help.cpp \
ers.cpp sound.cpp netplay.cpp input-config.cpp console.cpp \
cheat.cpp fps.cpp video-state.cpp remote.cpp rmdui.cpp \
- opengl.cpp shader.cpp overlay.cpp video.cpp nongl.cpp nnx.cpp \
+ overlay.cpp video.cpp nongl.cpp nnx.cpp \
thread_win32.cpp thread_sdl.cpp hqxx-common.cpp hq2x.cpp \
hq3x.cpp hq4x.cpp scale2x.c scale3x.c scalebit.c 2xSaI.cpp \
Joystick.cpp Joystick_SDL.cpp Joystick_Linux.cpp \
@@ -148,8 +148,8 @@
args.$(OBJEXT) help.$(OBJEXT) ers.$(OBJEXT) sound.$(OBJEXT) \
netplay.$(OBJEXT) input-config.$(OBJEXT) console.$(OBJEXT) \
cheat.$(OBJEXT) fps.$(OBJEXT) video-state.$(OBJEXT) \
- remote.$(OBJEXT) rmdui.$(OBJEXT) opengl.$(OBJEXT) \
- shader.$(OBJEXT) overlay.$(OBJEXT) video.$(OBJEXT) \
+ remote.$(OBJEXT) rmdui.$(OBJEXT) \
+ overlay.$(OBJEXT) video.$(OBJEXT) \
nongl.$(OBJEXT) nnx.$(OBJEXT) $(am__objects_1) \
$(am__objects_2) $(am__objects_3) Joystick.$(OBJEXT) \
Joystick_SDL.$(OBJEXT) $(am__objects_4) $(am__objects_5) \
@@ -405,8 +405,8 @@
noinst_LIBRARIES = libmdfnsdl.a
libmdfnsdl_a_SOURCES = main.cpp input.cpp args.cpp help.cpp ers.cpp \
sound.cpp netplay.cpp input-config.cpp console.cpp cheat.cpp \
- fps.cpp video-state.cpp remote.cpp rmdui.cpp opengl.cpp \
- shader.cpp overlay.cpp video.cpp nongl.cpp nnx.cpp \
+ fps.cpp video-state.cpp remote.cpp rmdui.cpp \
+ overlay.cpp video.cpp nongl.cpp nnx.cpp \
$(am__append_1) $(am__append_2) $(am__append_3) Joystick.cpp \
Joystick_SDL.cpp $(am__append_4) $(am__append_5) \
$(am__append_6)
@@ -485,7 +485,6 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netplay.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nnx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nongl.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opengl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/overlay.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prompt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote.Po@am__quote@
@@ -493,7 +492,6 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scale2x.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scale3x.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scalebit.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shader.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread_sdl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread_win32.Po@am__quote@
diff -Naur a/src/drivers/main.cpp b/src/drivers/main.cpp
--- a/src/drivers/main.cpp
+++ b/src/drivers/main.cpp
@@ -42,8 +42,6 @@
#include "input.h"
#include "Joystick.h"
#include "video.h"
-#include "opengl.h"
-#include "shader.h"
#include "sound.h"
#include "netplay.h"
#include "cheat.h"
diff -Naur a/src/drivers/video.cpp b/src/drivers/video.cpp
--- a/src/drivers/video.cpp
+++ b/src/drivers/video.cpp
@@ -25,8 +25,6 @@
#include <trio/trio.h>
#include "video.h"
-#include "opengl.h"
-#include "shader.h"
#include "nongl.h"
#include "overlay.h"
@@ -147,7 +145,7 @@
static const MDFNSetting GlobalVideoSettings[] =
{
- { "video.driver", MDFNSF_NOFLAGS, gettext_noop("Video output method/driver."), NULL, MDFNST_ENUM, "opengl", NULL, NULL, NULL, NULL, VDriver_List },
+ { "video.driver", MDFNSF_NOFLAGS, gettext_noop("Video output method/driver."), NULL, MDFNST_ENUM, "sdl", NULL, NULL, NULL, NULL, VDriver_List },
{ "video.fs", MDFNSF_NOFLAGS, gettext_noop("Enable fullscreen mode."), NULL, MDFNST_BOOL, "0", },
{ "video.glvsync", MDFNSF_NOFLAGS, gettext_noop("Attempt to synchronize OpenGL page flips to vertical retrace period."),
@@ -216,37 +214,6 @@
{ NULL, 0 },
};
-static const MDFNSetting_EnumList Shader_List[] =
-{
- { "none", SHADER_NONE, gettext_noop("None/Disabled") },
- { "autoip", SHADER_AUTOIP, gettext_noop("Auto Interpolation"), gettext_noop("Will automatically interpolate on each axis if the corresponding effective scaling factor is not an integer.") },
- { "autoipsharper", SHADER_AUTOIPSHARPER, gettext_noop("Sharper Auto Interpolation"), gettext_noop("Same as \"autoip\", but when interpolation is done, it is done in a manner that will reduce blurriness if possible.") },
- { "scale2x", SHADER_SCALE2X, "Scale2x" },
- { "sabr", SHADER_SABR, "SABR v3.0", gettext_noop("GPU-intensive.") },
- { "ipsharper", SHADER_IPSHARPER, gettext_noop("Sharper bilinear interpolation.") },
- { "ipxnoty", SHADER_IPXNOTY, gettext_noop("Linear interpolation on X axis only.") },
- { "ipynotx", SHADER_IPYNOTX, gettext_noop("Linear interpolation on Y axis only.") },
- { "ipxnotysharper", SHADER_IPXNOTYSHARPER, gettext_noop("Sharper version of \"ipxnoty\".") },
- { "ipynotxsharper", SHADER_IPYNOTXSHARPER, gettext_noop("Sharper version of \"ipynotx\".") },
-
- { "goat", SHADER_GOAT, gettext_noop("Simple approximation of a color TV CRT look."), gettext_noop("Intended for fullscreen modes with a vertical resolution of around 1000 to 1500 pixels. Doesn't simulate halation and electron beam energy distribution nuances.") },
-
- { NULL, 0 },
-};
-
-static const MDFNSetting_EnumList GoatPat_List[] =
-{
- { "goatron", ShaderParams::GOAT_MASKPAT_GOATRON, gettext_noop("Goatron"), gettext_noop("Brightest.") },
- { "goattron", ShaderParams::GOAT_MASKPAT_GOATRON },
- { "goatronprime", ShaderParams::GOAT_MASKPAT_GOATRONPRIME },
- { "goattronprime", ShaderParams::GOAT_MASKPAT_GOATRONPRIME },
-
- { "borg", ShaderParams::GOAT_MASKPAT_BORG, gettext_noop("Borg"), gettext_noop("Darkest.") },
- { "slenderman", ShaderParams::GOAT_MASKPAT_SLENDERMAN, gettext_noop("Slenderman"), gettext_noop("Spookiest?") },
-
- { NULL, 0 },
-};
-
void Video_MakeSettings(std::vector <MDFNSetting> &settings)
{
static const char *CSD_xres = gettext_noop("Full-screen horizontal resolution.");
@@ -270,9 +237,6 @@
static const char *CSD_special = gettext_noop("Enable specified special video scaler.");
static const char *CSDE_special = gettext_noop("The destination rectangle is NOT altered by this setting, so if you have xscale and yscale set to \"2\", and try to use a 3x scaling filter like hq3x, the image is not going to look that great. The nearest-neighbor scalers are intended for use with bilinear interpolation enabled, at high resolutions(such as 1280x1024; nn2x(or nny2x) + bilinear interpolation + fullscreen stretching at this resolution looks quite nice).");
- static const char *CSD_shader = gettext_noop("Enable specified OpenGL shader.");
- static const char *CSDE_shader = gettext_noop("Obviously, this will only work with the OpenGL \"video.driver\" setting, and only on cards and OpenGL implementations that support shaders, otherwise you will get a black screen, or Mednafen may display an error message when starting up. When a shader is enabled, the \"<system>.videoip\" setting is ignored.");
-
for(unsigned int i = 0; i < MDFNSystems.size() + 1; i++)
{
int nominal_width;
@@ -339,27 +303,6 @@
BuildSystemSetting(&setting, sysname, "special", CSD_special, CSDE_special, MDFNST_ENUM, "none", NULL, NULL, NULL, NULL, Special_List);
settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader", CSD_shader, CSDE_shader, MDFNST_ENUM, "none", NULL, NULL, NULL, NULL, Shader_List);
- settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader.goat.hdiv", gettext_noop("Constant RGB horizontal divergence."), nullptr, MDFNST_FLOAT, "0.50", "-2.00", "2.00");
- settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader.goat.vdiv", gettext_noop("Constant RGB vertical divergence."), nullptr, MDFNST_FLOAT, "0.50", "-2.00", "2.00");
- settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader.goat.pat", gettext_noop("Mask pattern."), nullptr, MDFNST_ENUM, "goatron", NULL, NULL, NULL, NULL, GoatPat_List);
- settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader.goat.tp", gettext_noop("Transparency of otherwise-opaque mask areas."), nullptr, MDFNST_FLOAT, "0.50", "0.00", "1.00");
- settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader.goat.fprog", gettext_noop("Force interlaced video to be treated as progressive."), gettext_noop("When disabled, the default, the \"video.deinterlacer\" setting is effectively ignored with respect to what appears on the screen. When enabled, it may be prudent to disable the scanlines effect controlled by the *.goat.slen setting, or else the scanline effect may look objectionable."), MDFNST_BOOL, "0");
- settings.push_back(setting);
-
- BuildSystemSetting(&setting, sysname, "shader.goat.slen", gettext_noop("Enable scanlines effect."), nullptr, MDFNST_BOOL, "1");
- settings.push_back(setting);
}
for(unsigned i = 0; i < sizeof(GlobalVideoSettings) / sizeof(GlobalVideoSettings[0]); i++)
@@ -377,15 +320,13 @@
int stretch;
int special;
int scanlines;
- ShaderType shader;
- ShaderParams shader_params;
} CommonVS;
static CommonVS _video;
static int _fullscreen;
static bool osd_alpha_blend;
-static unsigned int vdriver = VDRIVER_OPENGL;
+static unsigned int vdriver = VDRIVER_SOFTSDL;
static struct ScalerDefinition
{
@@ -417,8 +358,6 @@
static MDFNGI *VideoGI;
-static bool sdlhaveogl = false;
-
static int best_xres = 0, best_yres = 0;
static int cur_xres, cur_yres, cur_flags;
@@ -426,7 +365,6 @@
static ScalerDefinition *CurrentScaler = NULL;
static SDL_Surface *screen = NULL;
-static OpenGL_Blitter *ogl_blitter = NULL;
static SDL_Surface *IconSurface=NULL;
static MDFN_Rect screen_dest_rect;
@@ -456,12 +394,6 @@
static void ClearBackBuffer(void)
{
//printf("WOO: %u\n", Time::MonoMS());
- if(ogl_blitter)
- {
- ogl_blitter->ClearBackBuffer();
- }
- else
- {
// Don't use SDL_FillRect() on hardware surfaces, it's borked(causes a long wait) with DirectX.
// ...on second thought, memset() is likely borked on PPC with hardware surface memory due to use of "dcbz" on uncachable memory. :(
//
@@ -480,7 +412,6 @@
{
SDL_FillRect(screen, NULL, 0);
}
- }
}
void Video_Kill(void)
@@ -505,12 +436,6 @@
HelpSurface = NULL;
}
- if(ogl_blitter)
- {
- delete ogl_blitter;
- ogl_blitter = NULL;
- }
-
if(vdriver == VDRIVER_OVERLAY)
OV_Kill();
@@ -778,7 +703,6 @@
const std::string special_string = MDFN_GetSettingS(snp + std::string("special"));
const unsigned special_id = MDFN_GetSettingUI(snp + std::string("special"));
- const std::string goat_pat_string = MDFN_GetSettingS(snp + "shader.goat.pat");
_fullscreen = MDFN_GetSettingB("video.fs");
_video.xres = MDFN_GetSettingUI(snp + "xres");
@@ -793,14 +717,6 @@
_video.special = special_id;
- _video.shader = (ShaderType)MDFN_GetSettingI(snp + "shader");
- _video.shader_params.goat_hdiv = MDFN_GetSettingF(snp + "shader.goat.hdiv");
- _video.shader_params.goat_vdiv = MDFN_GetSettingF(snp + "shader.goat.vdiv");
- _video.shader_params.goat_pat = MDFN_GetSettingI(snp + "shader.goat.pat");
- _video.shader_params.goat_tp = MDFN_GetSettingF(snp + "shader.goat.tp");
- _video.shader_params.goat_slen = MDFN_GetSettingB(snp + "shader.goat.slen");
- _video.shader_params.goat_fprog = MDFN_GetSettingB(snp + "shader.goat.fprog");
-
CurrentScaler = nullptr;
for(auto& scaler : Scalers)
if(_video.special == scaler.id)
@@ -830,42 +746,7 @@
vdriver = MDFN_GetSettingI("video.driver");
- if(vdriver == VDRIVER_OPENGL)
- {
- if(!sdlhaveogl)
- {
- // SDL_GL_LoadLibrary returns 0 on success, -1 on failure
- if(SDL_GL_LoadLibrary(NULL) == 0)
- sdlhaveogl = true;
- else
- sdlhaveogl = false;
- }
-
- if(!sdlhaveogl)
- {
- MDFN_PrintError(_("Could not load OpenGL library, disabling OpenGL usage!"));
- vdriver = VDRIVER_SOFTSDL;
- }
- }
-
- if(vdriver == VDRIVER_OPENGL)
- {
- flags |= SDL_OPENGL;
-
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1 );
-
- #if SDL_VERSION_ATLEAST(1, 2, 10)
- SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, MDFN_GetSettingB("video.glvsync"));
- #endif
- }
- else if(vdriver == VDRIVER_SOFTSDL)
- {
-
- }
- else if(vdriver == VDRIVER_OVERLAY)
- {
-
- }
+ vdriver = VDRIVER_SOFTSDL;
exs = _fullscreen ? _video.xscalefs : _video.xscale;
eys = _fullscreen ? _video.yscalefs : _video.yscale;
@@ -935,18 +816,6 @@
//MDFN_printf(_("OpenGL: %s\n"), (cur_flags & SDL_OPENGL) ? _("Yes") : _("No"));
- if(cur_flags & SDL_OPENGL)
- {
- MDFN_AutoIndent aindps;
- char sp[128] = { 0 };
-
- if(_video.shader == SHADER_GOAT)
- trio_snprintf(sp, sizeof(sp), " (pat=%s, hdiv=%f, vdiv=%f, tp=%f, slen=%d, fprog=%d)",
- goat_pat_string.c_str(), _video.shader_params.goat_hdiv, _video.shader_params.goat_vdiv, _video.shader_params.goat_tp, _video.shader_params.goat_slen, _video.shader_params.goat_fprog);
-
- MDFN_printf(_("Shader: %s%s\n"), MDFN_GetSettingS(snp + "shader").c_str(), sp);
- }
-
MDFN_printf(_("Fullscreen: %s\n"), _fullscreen ? _("Yes") : _("No"));
MDFN_printf(_("Special Scaler: %s\n"), (special_id == NTVB_NONE) ? _("None") : special_string.c_str());
@@ -973,28 +842,13 @@
int rs, gs, bs, as;
- if(cur_flags & SDL_OPENGL)
- {
- try
- {
- ogl_blitter = new OpenGL_Blitter(_video.scanlines, _video.shader, _video.shader_params, screen->w, screen->h, &rs, &gs, &bs, &as);
- }
- catch(std::exception &e)
- {
- Video_Kill();
- throw;
- }
- }
- else
- {
- rs = screen->format->Rshift;
- gs = screen->format->Gshift;
- bs = screen->format->Bshift;
+ rs = screen->format->Rshift;
+ gs = screen->format->Gshift;
+ bs = screen->format->Bshift;
- as = 0;
- while(as == rs || as == gs || as == bs) // Find unused 8-bits to use as our alpha channel
+ as = 0;
+ while(as == rs || as == gs || as == bs) // Find unused 8-bits to use as our alpha channel
as += 8;
- }
//printf("%d %d %d %d\n", rs, gs, bs, as);
@@ -1075,13 +929,7 @@
{
ClearBackBuffer();
- if(cur_flags & SDL_OPENGL)
- {
- SDL_GL_SwapBuffers();
- //ogl_blitter->HardSync();
- }
- else
- SDL_Flip(screen);
+ SDL_Flip(screen);
}
MarkNeedBBClear();
@@ -1108,15 +956,10 @@
void BlitRaw(MDFN_Surface *src, const MDFN_Rect *src_rect, const MDFN_Rect *dest_rect, int source_alpha)
{
- if(ogl_blitter)
- ogl_blitter->BlitRaw(src, src_rect, dest_rect, (source_alpha != 0) && osd_alpha_blend);
- else
- {
SDL_to_MDFN_Surface_Wrapper m_surface(screen);
//MDFN_SrcAlphaBlitSurface(src, src_rect, &m_surface, dest_rect);
MDFN_StretchBlitSurface(src, *src_rect, &m_surface, *dest_rect, (source_alpha > 0) && osd_alpha_blend);
- }
bool cond1 = (dest_rect->x < screen_dest_rect.x || (dest_rect->x + dest_rect->w) > (screen_dest_rect.x + screen_dest_rect.w));
bool cond2 = (dest_rect->y < screen_dest_rect.y || (dest_rect->y + dest_rect->h) > (screen_dest_rect.y + screen_dest_rect.h));
@@ -1287,10 +1130,6 @@
}
#endif
- if(ogl_blitter)
- ogl_blitter->Blit(&bah_surface, &boohoo_rect, &dest_rect, &eff_src_rect, InterlaceField, evideoip, CurGame->rotated);
- else
- {
if(OverlayOK)
{
SDL_Rect tr;
@@ -1308,14 +1147,9 @@
MDFN_StretchBlitSurface(&bah_surface, boohoo_rect, &m_surface, dest_rect, false, _video.scanlines, &eff_src_rect, CurGame->rotated, InterlaceField);
}
- }
}
else // No special scaler:
{
- if(ogl_blitter)
- ogl_blitter->Blit(eff_source_surface, &eff_src_rect, &dest_rect, &eff_src_rect, InterlaceField, evideoip, CurGame->rotated);
- else
- {
if(OverlayOK)
{
SDL_Rect tr;
@@ -1333,7 +1167,6 @@
MDFN_StretchBlitSurface(eff_source_surface, eff_src_rect, &m_surface, dest_rect, false, _video.scanlines, &eff_src_rect, CurGame->rotated, InterlaceField);
}
- }
}
}
@@ -1512,10 +1345,6 @@
ib.reset(new MDFN_Surface(NULL, sr.w, sr.h, sr.w, MDFN_PixelFormat(MDFN_COLORSPACE_RGB, real_rs, real_gs, real_bs, real_as)));
- if(ogl_blitter)
- ogl_blitter->ReadPixels(ib.get(), &sr);
- else
- {
if(SDL_MUSTLOCK(screen))
SDL_LockSurface(screen);
@@ -1529,7 +1358,6 @@
if(SDL_MUSTLOCK(screen))
SDL_UnlockSurface(screen);
- }
tr.x = tr.y = 0;
@@ -1629,25 +1457,13 @@
// but that gets awfully complicated and prone to bugs when dealing with double/triple-buffered video...).
//
// std::max so we don't position it offscreen if the user has selected xscalefs or yscalefs values that are too large.
- if(!(cur_flags & SDL_OPENGL))
- {
- fps_offsx = std::max<int32>(screen_dest_rect.x, 0);
- fps_offsy = std::max<int32>(screen_dest_rect.y, 0);
- }
+ fps_offsx = std::max<int32>(screen_dest_rect.x, 0);
+ fps_offsy = std::max<int32>(screen_dest_rect.y, 0);
FPS_DrawToScreen(screen, real_rs, real_gs, real_bs, real_as, fps_offsx, fps_offsy);
}
- if(!(cur_flags & SDL_OPENGL))
- {
- if(!OverlayOK)
+ if(!OverlayOK)
SDL_Flip(screen);
- }
- else
- {
- PumpWrap();
- SDL_GL_SwapBuffers();
- //ogl_blitter->HardSync();
- }
}
void Video_PtoV(const int in_x, const int in_y, int32 *out_x, int32 *out_y)