Dynamic shadows: whitelist the 'opengl3' driver

This commit is contained in:
SmallJoker 2024-11-02 15:52:29 +01:00 committed by sfan5
parent 58dd42166d
commit 87ac32edea
2 changed files with 8 additions and 4 deletions

@ -351,7 +351,7 @@ local function check_requirements(name, requires)
-- be used, so we show settings for both. -- be used, so we show settings for both.
touchscreen = touch_support and (touch_controls == "auto" or core.is_yes(touch_controls)), touchscreen = touch_support and (touch_controls == "auto" or core.is_yes(touch_controls)),
keyboard_mouse = not touch_support or (touch_controls == "auto" or not core.is_yes(touch_controls)), keyboard_mouse = not touch_support or (touch_controls == "auto" or not core.is_yes(touch_controls)),
opengl = video_driver == "opengl", opengl = (video_driver == "opengl" or video_driver == "opengl3"),
gles = video_driver:sub(1, 5) == "ogles", gles = video_driver:sub(1, 5) == "ogles",
} }

@ -694,10 +694,14 @@ std::string ShadowRenderer::readShaderFile(const std::string &path)
ShadowRenderer *createShadowRenderer(IrrlichtDevice *device, Client *client) ShadowRenderer *createShadowRenderer(IrrlichtDevice *device, Client *client)
{ {
// disable if unsupported // disable if unsupported
if (g_settings->getBool("enable_dynamic_shadows") && if (g_settings->getBool("enable_dynamic_shadows")) {
device->getVideoDriver()->getDriverType() != video::EDT_OPENGL) { // See also checks in builtin/mainmenu/settings/dlg_settings.lua
const video::E_DRIVER_TYPE type = device->getVideoDriver()->getDriverType();
if (type != video::EDT_OPENGL && type != video::EDT_OPENGL3) {
warningstream << "Shadows: disabled dynamic shadows due to being unsupported" << std::endl;
g_settings->setBool("enable_dynamic_shadows", false); g_settings->setBool("enable_dynamic_shadows", false);
} }
}
if (g_settings->getBool("enable_dynamic_shadows")) { if (g_settings->getBool("enable_dynamic_shadows")) {
ShadowRenderer *shadow_renderer = new ShadowRenderer(device, client); ShadowRenderer *shadow_renderer = new ShadowRenderer(device, client);