Disable shaders GUI on unsupported drivers

* address [#7563](https://github.com/minetest/minetest/issues/7563)
* Disable shaders GUI on unsupported drivers
  [#2060](https://github.com/minetest/minetest/issues/2060)
* Disable shaders if unavailable
* also backported "shaders disabled by default"
   continue of commit 21b1462b58
This commit is contained in:
mckaygerhard 2023-01-05 09:29:24 -04:00
parent b920208550
commit be06a8ad6b
2 changed files with 18 additions and 4 deletions

View File

@ -204,8 +204,22 @@ local function formspec(tabview, name, tabdata)
"checkbox[4.25,3.6;cb_autosave_screensize;" .. fgettext("Autosave screen size") .. ";"
.. dump(core.settings:get_bool("autosave_screensize")) .. "]" ..
"box[8,0;3.75,4.5;#999999]" ..
"box[8,0;3.75,4.5;#999999]"
local video_driver = core.settings:get("video_driver")
local shaders_supported = video_driver == "opengl"
local shaders_enabled = false
if shaders_supported then
shaders_enabled = core.settings:get_bool("enable_shaders")
tab_string = tab_string ..
"checkbox[8.25,0;cb_shaders;" .. fgettext("Shaders") .. ";"
.. dump(core.settings:get_bool("enable_shaders")) .. "]"
.. tostring(shaders_enabled) .. "]"
else
core.settings:set_bool("enable_shaders", false)
tab_string = tab_string ..
"label[8.38,0.2;" .. core.colorize("#888888",
fgettext("Shaders (unavailable)")) .. "]"
end
if PLATFORM == "Android" then
tab_string = tab_string ..
@ -229,7 +243,7 @@ local function formspec(tabview, name, tabdata)
((tonumber(core.settings:get("touchscreen_threshold")) / 10) + 1) .. "]"
end
if core.settings:get_bool("enable_shaders") then
if shaders_enabled then
tab_string = tab_string ..
"checkbox[8.25,0.5;cb_bumpmapping;" .. fgettext("Bump Mapping") .. ";"
.. dump(core.settings:get_bool("enable_bumpmapping")) .. "]" ..

View File

@ -390,7 +390,7 @@ undersampling (Undersampling) enum 0 0,2,3,4
# Shaders allow advanced visual effects and may increase performance on some video cards.
# This only works with the OpenGL video backend.
enable_shaders (Shaders) bool true
enable_shaders (Shaders) bool false
# Path to shader directory. If no path is defined, default location will be used.
shader_path (Shader path) path