diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 2df18cd6b89..31ee94add8b 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -4989,6 +4989,7 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh if (gl_info->supported[ARB_VERTEX_PROGRAM]) { DWORD vs_consts; + UINT vs_version; /* 96 is the minimum allowed value of MAX_PROGRAM_ENV_PARAMETERS_ARB * for vertex programs. If the native limit is less than that it's @@ -5001,20 +5002,21 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh if (gl_info->supported[NV_VERTEX_PROGRAM3]) { - caps->vs_version = 3; + vs_version = 3; TRACE("Hardware vertex shader version 3.0 enabled (NV_VERTEX_PROGRAM3)\n"); } else if (vs_consts >= 256) { /* Shader Model 2.0 requires at least 256 vertex shader constants */ - caps->vs_version = 2; + vs_version = 2; TRACE("Hardware vertex shader version 2.0 enabled (ARB_PROGRAM)\n"); } else { - caps->vs_version = 1; + vs_version = 1; TRACE("Hardware vertex shader version 1.1 enabled (ARB_PROGRAM)\n"); } + caps->vs_version = min(wined3d_settings.max_sm_vs, vs_version); caps->vs_uniform_count = vs_consts; } else @@ -5028,6 +5030,7 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh if (gl_info->supported[ARB_FRAGMENT_PROGRAM]) { DWORD ps_consts; + UINT ps_version; /* Similar as above for vertex programs, but the minimum for fragment * programs is 24. */ @@ -5038,20 +5041,21 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh if (gl_info->supported[NV_FRAGMENT_PROGRAM2]) { - caps->ps_version = 3; + ps_version = 3; TRACE("Hardware pixel shader version 3.0 enabled (NV_FRAGMENT_PROGRAM2)\n"); } else if (ps_consts >= 32) { /* Shader Model 2.0 requires at least 32 pixel shader constants */ - caps->ps_version = 2; + ps_version = 2; TRACE("Hardware pixel shader version 2.0 enabled (ARB_PROGRAM)\n"); } else { - caps->ps_version = 1; + ps_version = 1; TRACE("Hardware pixel shader version 1.4 enabled (ARB_PROGRAM)\n"); } + caps->ps_version = min(wined3d_settings.max_sm_ps, ps_version); caps->ps_uniform_count = ps_consts; caps->ps_1x_max_value = 8.0f; } diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index d5d1025d700..b70a44f2e01 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -2267,8 +2267,6 @@ static const struct wined3d_shader_backend_ops *select_shader_backend(const stru { BOOL glsl = wined3d_settings.glslRequested && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20); - if (wined3d_settings.vs_mode == VS_NONE && wined3d_settings.ps_mode == PS_NONE) - return &none_shader_backend; if (glsl && gl_info->supported[ARB_FRAGMENT_SHADER]) return &glsl_shader_backend; if (glsl && gl_info->supported[ARB_VERTEX_SHADER]) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 9b000b6b869..16b8a83cfea 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -6184,9 +6184,9 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s shader_model = 2; TRACE("Shader model %u.\n", shader_model); - caps->vs_version = shader_model; - caps->gs_version = shader_model; - caps->ps_version = shader_model; + caps->vs_version = min(wined3d_settings.max_sm_vs, shader_model); + caps->gs_version = min(wined3d_settings.max_sm_gs, shader_model); + caps->ps_version = min(wined3d_settings.max_sm_ps, shader_model); caps->vs_uniform_count = gl_info->limits.glsl_vs_float_constants; caps->ps_uniform_count = gl_info->limits.glsl_ps_float_constants; diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index 2247e9c17ce..f49e5bcdd00 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -72,8 +72,6 @@ static CRITICAL_SECTION wined3d_wndproc_cs = {&wined3d_wndproc_cs_debug, -1, 0, * where appropriate. */ struct wined3d_settings wined3d_settings = { - VS_HW, /* Hardware by default */ - PS_HW, /* Hardware by default */ TRUE, /* Use of GLSL enabled by default */ ORM_FBO, /* Use FBOs to do offscreen rendering */ RTL_READTEX, /* Default render target locking method */ @@ -84,6 +82,9 @@ struct wined3d_settings wined3d_settings = TRUE, /* Multisampling enabled by default. */ FALSE, /* No strict draw ordering. */ TRUE, /* Don't try to render onscreen by default. */ + ~0U, /* No VS shader model limit by default. */ + ~0U, /* No GS shader model limit by default. */ + ~0U, /* No PS shader model limit by default. */ }; /* Do not call while under the GL lock. */ @@ -196,27 +197,6 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) if (hkey || appkey) { - if ( !get_config_key( hkey, appkey, "VertexShaderMode", buffer, size) ) - { - if (!strcmp(buffer,"none")) - { - TRACE("Disable vertex shaders\n"); - wined3d_settings.vs_mode = VS_NONE; - } - } - if ( !get_config_key( hkey, appkey, "PixelShaderMode", buffer, size) ) - { - if (!strcmp(buffer,"enabled")) - { - TRACE("Allow pixel shaders\n"); - wined3d_settings.ps_mode = PS_HW; - } - if (!strcmp(buffer,"disabled")) - { - TRACE("Disable pixel shaders\n"); - wined3d_settings.ps_mode = PS_NONE; - } - } if ( !get_config_key( hkey, appkey, "UseGLSL", buffer, size) ) { if (!strcmp(buffer,"disabled")) @@ -323,13 +303,13 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) TRACE("Not always rendering backbuffers offscreen.\n"); wined3d_settings.always_offscreen = FALSE; } + if (!get_config_key_dword(hkey, appkey, "MaxShaderModelVS", &wined3d_settings.max_sm_vs)) + TRACE("Limiting VS shader model to %u.\n", wined3d_settings.max_sm_vs); + if (!get_config_key_dword(hkey, appkey, "MaxShaderModelGS", &wined3d_settings.max_sm_gs)) + TRACE("Limiting GS shader model to %u.\n", wined3d_settings.max_sm_gs); + if (!get_config_key_dword(hkey, appkey, "MaxShaderModelPS", &wined3d_settings.max_sm_ps)) + TRACE("Limiting PS shader model to %u.\n", wined3d_settings.max_sm_ps); } - if (wined3d_settings.vs_mode == VS_HW) - TRACE("Allow HW vertex shaders\n"); - if (wined3d_settings.ps_mode == PS_NONE) - TRACE("Disable pixel shaders\n"); - if (wined3d_settings.glslRequested) - TRACE("If supported by your system, GL Shading Language will be used\n"); if (appkey) RegCloseKey( appkey ); if (hkey) RegCloseKey( hkey ); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index af24e69d75c..819cb824005 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -237,18 +237,6 @@ static inline float float_24_to_32(DWORD in) } } -/** - * Settings - */ -#define VS_NONE 0 -#define VS_HW 1 - -#define PS_NONE 0 -#define PS_HW 1 - -#define VBO_NONE 0 -#define VBO_HW 1 - #define ORM_BACKBUFFER 0 #define ORM_FBO 1 @@ -262,9 +250,6 @@ static inline float float_24_to_32(DWORD in) * values in wined3d_main.c as well. */ struct wined3d_settings { - /* vertex and pixel shader modes */ - int vs_mode; - int ps_mode; /* Ideally, we don't want the user to have to request GLSL. If the * hardware supports GLSL, we should use it. However, until it's fully * implemented, we'll leave it as a registry setting for developers. */ @@ -279,6 +264,9 @@ struct wined3d_settings int allow_multisampling; BOOL strict_draw_ordering; BOOL always_offscreen; + unsigned int max_sm_vs; + unsigned int max_sm_gs; + unsigned int max_sm_ps; }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN;