From 7b7f0272219c97da68e8dd54adb0e225ff36e7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 14 Apr 2009 20:06:15 +0200 Subject: [PATCH] wined3d: Add a more formal framework for driver quirks. This allows better defining of driver desc fixups without adding extra if lines for each card. For starters, there's a fixup for the advertised GLSL constants in ATI cards. fglrx advertises 512 GLSL uniforms instead of the supported 1024(means 128 instead of 256 vec4's). This bug was confirmed by ATI. --- dlls/wined3d/directx.c | 29 +++++++++++++++++++++++++++++ dlls/wined3d/wined3d_gl.h | 6 ++++++ 2 files changed, 35 insertions(+) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 3b46965d58c..260d5798e24 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -4002,10 +4002,39 @@ static const struct driver_version_information driver_version_table[] = { /* TODO: Add information about legacy ATI hardware, Intel and other cards */ }; +static BOOL match_ati_r300_to_500(WineD3D_GL_Info *gl_info) { + if(gl_info->gl_vendor != VENDOR_ATI) return FALSE; + if(gl_info->gl_card == CARD_ATI_RADEON_9500) return TRUE; + if(gl_info->gl_card == CARD_ATI_RADEON_X700) return TRUE; + if(gl_info->gl_card == CARD_ATI_RADEON_X1600) return TRUE; + return FALSE; +} + +static void quirk_arb_constants(WineD3D_GL_Info *gl_info) { + TRACE_(d3d_caps)("Using ARB vs constant limit(=%u) for GLSL\n", gl_info->vs_arb_constantsF); + gl_info->vs_glsl_constantsF = gl_info->vs_arb_constantsF; + TRACE_(d3d_caps)("Using ARB ps constant limit(=%u) for GLSL\n", gl_info->ps_arb_constantsF); + gl_info->ps_glsl_constantsF = gl_info->ps_arb_constantsF; +} + +struct driver_quirk quirk_table[] = { + { + match_ati_r300_to_500, + quirk_arb_constants, + "ATI GLSL constant quirk" + } +}; + static void fixup_extensions(WineD3D_GL_Info *gl_info) { unsigned int i; BOOL apple = implementation_is_apple(gl_info); + for(i = 0; i < (sizeof(quirk_table) / sizeof(*quirk_table)); i++) { + if(!quirk_table[i].match(gl_info)) continue; + TRACE_(d3d_caps)("Applying driver quirk \"%s\"\n", quirk_table[i].description); + quirk_table[i].apply(gl_info); + } + if(apple) { /* MacOS advertises more GLSL vertex shader uniforms than supported by the hardware, and if more are * used it falls back to software. While the compiler can detect if the shader uses all declared diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index cc760351af8..2cf4e3f8e0b 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -3963,4 +3963,10 @@ typedef struct _WineD3D_GL_Info { } WineD3D_GL_Info; #undef USE_GL_FUNC +struct driver_quirk { + BOOL (*match)(WineD3D_GL_Info *gl_info); + void (*apply)(WineD3D_GL_Info *gl_info); + const char *description; +}; + #endif /* __WINE_WINED3D_GL */