Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/mod/hwdetect/hwdetect.js
Show First 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | function RunDetection(settings) | ||||
var disable_shadowpcf = undefined; | var disable_shadowpcf = undefined; | ||||
var disable_allwater = undefined; | var disable_allwater = undefined; | ||||
var disable_fancywater = undefined; | var disable_fancywater = undefined; | ||||
var enable_glsl = undefined; | var enable_glsl = undefined; | ||||
var enable_postproc = undefined; | var enable_postproc = undefined; | ||||
var enable_smoothlos = undefined; | var enable_smoothlos = undefined; | ||||
var override_renderpath = undefined; | var override_renderpath = undefined; | ||||
var max_uniforms = 512; | |||||
// TODO: add some mechanism for setting config values | // TODO: add some mechanism for setting config values | ||||
// (overriding default.cfg, but overridden by local.cfg) | // (overriding default.cfg, but overridden by local.cfg) | ||||
// Extract all the settings we might use from the argument: | // Extract all the settings we might use from the argument: | ||||
// (This is less error-prone than referring to "settings.foo" directly | // (This is less error-prone than referring to "settings.foo" directly | ||||
// since typos in the matching code will be caught as references to | // since typos in the matching code will be caught as references to | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | if (GL_RENDERER.match(/^(Software Rasterizer|.*(llvm|soft)pipe.*|Mesa X11|Apple Software Renderer|GDI Generic)$/)) | ||||
enable_smoothlos = false; | enable_smoothlos = false; | ||||
// s3tc on software renderers halves fps and makes textures weird | // s3tc on software renderers halves fps and makes textures weird | ||||
disable_s3tc = true; | disable_s3tc = true; | ||||
disable_shadows = true; | disable_shadows = true; | ||||
disable_shadowpcf = true; | disable_shadowpcf = true; | ||||
disable_allwater = true; | disable_allwater = true; | ||||
} | } | ||||
if (settings.GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB) | |||||
max_uniforms = settings.GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB; | |||||
// NVIDIA 260.19.* UNIX drivers cause random crashes soon after startup. | // NVIDIA 260.19.* UNIX drivers cause random crashes soon after startup. | ||||
// https://www.wildfiregames.com/forum/index.php?showtopic=13668 | // https://www.wildfiregames.com/forum/index.php?showtopic=13668 | ||||
// Fixed in 260.19.21: | // Fixed in 260.19.21: | ||||
// "Fixed a race condition in OpenGL that could cause crashes with multithreaded applications." | // "Fixed a race condition in OpenGL that could cause crashes with multithreaded applications." | ||||
if (os_unix && GL_VERSION.match(/NVIDIA 260\.19\.(0[0-9]|1[0-9]|20)$/)) | if (os_unix && GL_VERSION.match(/NVIDIA 260\.19\.(0[0-9]|1[0-9]|20)$/)) | ||||
{ | { | ||||
dialog_warnings.push("You are using 260.19.* series NVIDIA drivers, which may crash the game. Please upgrade to 260.19.21 or later."); | dialog_warnings.push("You are using 260.19.* series NVIDIA drivers, which may crash the game. Please upgrade to 260.19.21 or later."); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | return { | ||||
"disable_shadows": disable_shadows, | "disable_shadows": disable_shadows, | ||||
"disable_shadowpcf": disable_shadowpcf, | "disable_shadowpcf": disable_shadowpcf, | ||||
"disable_allwater": disable_allwater, | "disable_allwater": disable_allwater, | ||||
"disable_fancywater": disable_fancywater, | "disable_fancywater": disable_fancywater, | ||||
"enable_glsl": enable_glsl, | "enable_glsl": enable_glsl, | ||||
"enable_postproc": enable_postproc, | "enable_postproc": enable_postproc, | ||||
"enable_smoothlos": enable_smoothlos, | "enable_smoothlos": enable_smoothlos, | ||||
"override_renderpath": override_renderpath, | "override_renderpath": override_renderpath, | ||||
"max_uniforms": max_uniforms, | |||||
}; | }; | ||||
} | } | ||||
global.RunHardwareDetection = function(settings) | global.RunHardwareDetection = function(settings) | ||||
{ | { | ||||
//print(JSON.stringify(settings, null, 1)+"\n"); | //print(JSON.stringify(settings, null, 1)+"\n"); | ||||
var output = RunDetection(settings); | var output = RunDetection(settings); | ||||
Show All 13 Lines | if (output.disable_audio !== undefined) | ||||
Engine.SetDisableAudio(output.disable_audio); | Engine.SetDisableAudio(output.disable_audio); | ||||
if (output.disable_shadows !== undefined) | if (output.disable_shadows !== undefined) | ||||
Engine.ConfigDB_CreateValue("hwdetect", "shadows", (!output.disable_shadows).toString()); | Engine.ConfigDB_CreateValue("hwdetect", "shadows", (!output.disable_shadows).toString()); | ||||
if (output.disable_shadowpcf !== undefined) | if (output.disable_shadowpcf !== undefined) | ||||
Engine.ConfigDB_CreateValue("hwdetect", "shadowpcf", (!output.disable_shadowpcf).toString()); | Engine.ConfigDB_CreateValue("hwdetect", "shadowpcf", (!output.disable_shadowpcf).toString()); | ||||
// Regular uniforms won't take up more than 256 floats, still leaving at least 16-instancing. | |||||
var max_matrix_uniform = (output.max_uniforms - 256) / 16; | |||||
if (Engine.ConfigDB_GetValue("user", "gpuskinning")) | |||||
max_matrix_uniform = Math.max(max_matrix_uniform - 64, 0); | |||||
max_matrix_uniform = Math.min(64, max_matrix_uniform); | |||||
Engine.ConfigDB_CreateValue("hwdetect", "max_matrix_uniform", max_matrix_uniform.toString()); | |||||
if (output.disable_allwater !== undefined) | if (output.disable_allwater !== undefined) | ||||
{ | { | ||||
Engine.ConfigDB_CreateValue("hwdetect", "watereffects", (!output.disable_allwater).toString()); | Engine.ConfigDB_CreateValue("hwdetect", "watereffects", (!output.disable_allwater).toString()); | ||||
Engine.ConfigDB_CreateValue("hwdetect", "waterfancyeffects", (!output.disable_allwater).toString()); | Engine.ConfigDB_CreateValue("hwdetect", "waterfancyeffects", (!output.disable_allwater).toString()); | ||||
Engine.ConfigDB_CreateValue("hwdetect", "waterrealdepth", (!output.disable_allwater).toString()); | Engine.ConfigDB_CreateValue("hwdetect", "waterrealdepth", (!output.disable_allwater).toString()); | ||||
Engine.ConfigDB_CreateValue("hwdetect", "watershadows", (!output.disable_allwater).toString()); | Engine.ConfigDB_CreateValue("hwdetect", "watershadows", (!output.disable_allwater).toString()); | ||||
Engine.ConfigDB_CreateValue("hwdetect", "waterrefraction", (!output.disable_allwater).toString()); | Engine.ConfigDB_CreateValue("hwdetect", "waterrefraction", (!output.disable_allwater).toString()); | ||||
Engine.ConfigDB_CreateValue("hwdetect", "waterreflection", (!output.disable_allwater).toString()); | Engine.ConfigDB_CreateValue("hwdetect", "waterreflection", (!output.disable_allwater).toString()); | ||||
Show All 21 Lines |
Wildfire Games · Phabricator