Stefan Dösinger : wined3d: Add a more formal framework for driver quirks.
Alexandre Julliard
julliard at winehq.org
Mon Apr 20 11:33:09 CDT 2009
Module: wine
Branch: master
Commit: 7b7f0272219c97da68e8dd54adb0e225ff36e7f9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7b7f0272219c97da68e8dd54adb0e225ff36e7f9
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Tue Apr 14 20:06:15 2009 +0200
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(+), 0 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 3b46965..260d579 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 cc76035..2cf4e3f 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 */
More information about the wine-cvs
mailing list