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.
This commit is contained in:
Stefan Dösinger 2009-04-14 20:06:15 +02:00 committed by Alexandre Julliard
parent dbfe7b7b68
commit 7b7f027221
2 changed files with 35 additions and 0 deletions

View File

@ -4002,10 +4002,39 @@ static const struct driver_version_information driver_version_table[] = {
/* TODO: Add information about legacy ATI hardware, Intel and other cards */ /* 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) { static void fixup_extensions(WineD3D_GL_Info *gl_info) {
unsigned int i; unsigned int i;
BOOL apple = implementation_is_apple(gl_info); 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) { if(apple) {
/* MacOS advertises more GLSL vertex shader uniforms than supported by the hardware, and if more are /* 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 * used it falls back to software. While the compiler can detect if the shader uses all declared

View File

@ -3963,4 +3963,10 @@ typedef struct _WineD3D_GL_Info {
} WineD3D_GL_Info; } WineD3D_GL_Info;
#undef USE_GL_FUNC #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 */ #endif /* __WINE_WINED3D_GL */