Commit 27399aa6 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Add new registry setting to select shader backend.

parent 28e74af7
......@@ -1983,22 +1983,28 @@ static const struct fragment_pipeline *select_fragment_implementation(const stru
static const struct wined3d_shader_backend_ops *select_shader_backend(const struct wined3d_gl_info *gl_info)
{
BOOL glsl = wined3d_settings.use_glsl && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20);
if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT] && !wined3d_settings.use_glsl)
BOOL glsl = wined3d_settings.shader_backend == WINED3D_SHADER_BACKEND_AUTO
|| wined3d_settings.shader_backend == WINED3D_SHADER_BACKEND_GLSL;
BOOL arb = wined3d_settings.shader_backend == WINED3D_SHADER_BACKEND_AUTO
|| wined3d_settings.shader_backend == WINED3D_SHADER_BACKEND_ARB;
if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT] && !glsl)
{
ERR_(winediag)("Ignoring the UseGLSL registry key. "
ERR_(winediag)("Ignoring the shader backend registry key. "
"GLSL is the only shader backend available on core profile contexts. "
"You need to explicitly set GL version to use legacy contexts.\n");
glsl = TRUE;
}
glsl = glsl && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20);
if (glsl && gl_info->supported[ARB_VERTEX_SHADER] && gl_info->supported[ARB_FRAGMENT_SHADER])
return &glsl_shader_backend;
if (gl_info->supported[ARB_VERTEX_PROGRAM] && gl_info->supported[ARB_FRAGMENT_PROGRAM])
if (arb && gl_info->supported[ARB_VERTEX_PROGRAM] && gl_info->supported[ARB_FRAGMENT_PROGRAM])
return &arb_program_shader_backend;
if (glsl && (gl_info->supported[ARB_VERTEX_SHADER] || gl_info->supported[ARB_FRAGMENT_SHADER]))
return &glsl_shader_backend;
if (gl_info->supported[ARB_VERTEX_PROGRAM] || gl_info->supported[ARB_FRAGMENT_PROGRAM])
if (arb && (gl_info->supported[ARB_VERTEX_PROGRAM] || gl_info->supported[ARB_FRAGMENT_PROGRAM]))
return &arb_program_shader_backend;
return &none_shader_backend;
}
......
......@@ -74,7 +74,6 @@ struct wined3d_settings wined3d_settings =
{
TRUE, /* Multithreaded CS by default. */
MAKEDWORD_VERSION(4, 4), /* Default to OpenGL 4.4 */
TRUE, /* Use of GLSL enabled by default */
ORM_FBO, /* Use FBOs to do offscreen rendering */
PCI_VENDOR_NONE,/* PCI Vendor ID */
PCI_DEVICE_NONE,/* PCI Device ID */
......@@ -90,6 +89,7 @@ struct wined3d_settings wined3d_settings =
~0U, /* No PS shader model limit by default. */
~0u, /* No CS shader model limit by default. */
FALSE, /* 3D support enabled by default. */
WINED3D_SHADER_BACKEND_AUTO,
};
struct wined3d * CDECL wined3d_create(DWORD flags)
......@@ -218,14 +218,33 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
tmpvalue >> 16, tmpvalue & 0xffff);
wined3d_settings.max_gl_version = tmpvalue;
}
if ( !get_config_key( hkey, appkey, "UseGLSL", buffer, size) )
if (!get_config_key(hkey, appkey, "ShaderBackend", buffer, size))
{
if (!strcmp(buffer,"disabled"))
if (!strcasecmp(buffer, "glsl"))
{
ERR_(winediag)("The GLSL shader backend has been disabled. You get to keep all the pieces if it breaks.\n");
TRACE("Use of GL Shading Language disabled.\n");
wined3d_settings.use_glsl = FALSE;
ERR_(winediag)("Using the GLSL shader backend.\n");
wined3d_settings.shader_backend = WINED3D_SHADER_BACKEND_GLSL;
}
else if (!strcasecmp(buffer, "arb"))
{
ERR_(winediag)("Using the ARB shader backend.\n");
wined3d_settings.shader_backend = WINED3D_SHADER_BACKEND_ARB;
}
else if (!strcasecmp(buffer, "none"))
{
ERR_(winediag)("Disabling shader backends.\n");
wined3d_settings.shader_backend = WINED3D_SHADER_BACKEND_NONE;
}
}
else if (!get_config_key(hkey, appkey, "UseGLSL", buffer, size) && !strcmp(buffer, "disabled"))
{
wined3d_settings.shader_backend = WINED3D_SHADER_BACKEND_ARB;
}
if (wined3d_settings.shader_backend == WINED3D_SHADER_BACKEND_ARB
|| wined3d_settings.shader_backend == WINED3D_SHADER_BACKEND_NONE)
{
ERR_(winediag)("The GLSL shader backend has been disabled. You get to keep all the pieces if it breaks.\n");
TRACE("Use of GL Shading Language disabled.\n");
}
if (!get_config_key(hkey, appkey, "OffscreenRenderingMode", buffer, size)
&& !strcmp(buffer,"backbuffer"))
......
......@@ -375,13 +375,20 @@ static inline void wined3d_pause(void)
#define PCI_VENDOR_NONE 0xffff /* e.g. 0x8086 for Intel and 0x10de for Nvidia */
#define PCI_DEVICE_NONE 0xffff /* e.g. 0x14f for a Geforce6200 */
enum wined3d_shader_backend
{
WINED3D_SHADER_BACKEND_AUTO,
WINED3D_SHADER_BACKEND_GLSL,
WINED3D_SHADER_BACKEND_ARB,
WINED3D_SHADER_BACKEND_NONE,
};
/* NOTE: When adding fields to this structure, make sure to update the default
* values in wined3d_main.c as well. */
struct wined3d_settings
{
unsigned int cs_multithreaded;
DWORD max_gl_version;
BOOL use_glsl;
int offscreen_rendering_mode;
unsigned short pci_vendor_id;
unsigned short pci_device_id;
......@@ -398,6 +405,7 @@ struct wined3d_settings
unsigned int max_sm_ps;
unsigned int max_sm_cs;
BOOL no_3d;
enum wined3d_shader_backend shader_backend;
};
extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment