File mame-bgfx.patch of Package mame

diff -Pdpru mame-mame0253.orig/src/osd/modules/render/bgfx/shadermanager.cpp mame-mame0253/src/osd/modules/render/bgfx/shadermanager.cpp
--- mame-mame0253.orig/src/osd/modules/render/bgfx/shadermanager.cpp	2023-03-29 17:05:56.000000000 +0300
+++ mame-mame0253/src/osd/modules/render/bgfx/shadermanager.cpp	2023-04-02 13:17:15.588187724 +0300
@@ -85,7 +85,6 @@ std::string shader_manager::make_path_st
 	shader_path += PATH_SEPARATOR "shaders" PATH_SEPARATOR;
 	switch (bgfx::getRendererType())
 	{
-		case bgfx::RendererType::Noop:
 		case bgfx::RendererType::Direct3D9:
 			shader_path += "dx9";
 			break;
@@ -103,6 +102,7 @@ std::string shader_manager::make_path_st
 			shader_path += "metal";
 			break;
 
+		case bgfx::RendererType::Noop:
 		case bgfx::RendererType::OpenGL:
 			shader_path += "glsl";
 			break;
diff -Pdpru mame-mame0253.orig/src/osd/sdl/osdsdl.cpp mame-mame0253/src/osd/sdl/osdsdl.cpp
--- mame-mame0253.orig/src/osd/sdl/osdsdl.cpp	2023-03-29 17:05:56.000000000 +0300
+++ mame-mame0253/src/osd/sdl/osdsdl.cpp	2023-04-02 13:20:13.152600500 +0300
@@ -273,7 +273,12 @@ void sdl_osd_interface::init(running_mac
 
 	// bgfx does not work with wayland
 	if ((strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) && (strcmp(options().video(), "bgfx") == 0))
-		fatalerror("Error: BGFX video does not work with wayland videodriver. Please change either of the options.");
+	{
+		osd_printf_verbose("BGFX does not work with wayland, overriding SDL videodriver to '%s' ...\n", "x11");
+		SDL_QuitSubSystem(SDL_INIT_VIDEO);
+		osd_setenv(SDLENV_VIDEODRIVER, "x11", 1);
+		SDL_InitSubSystem(SDL_INIT_VIDEO);
+	}
 
 	osd_sdl_info();
 
openSUSE Build Service is sponsored by