From 39877a2ad2365c5ff28ab20d8aa428241d4d8217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Tue, 14 Apr 2009 20:33:15 +0200 Subject: [PATCH] wined3d: Reserve additional GLSL constants on some drivers. Some drivers apparently need private constants, or don't have an efficient immval packing. For example, MacOS seems to need 1 float for each different relative addressing offset. fglrx has the same issue, although it is more efficient in general Previously this worked on most drivers because the 16 + 4 reserved int and bool constants kept the problem hidden. Now that we are more aggressive with uniforms we have to keep free room for some drivers. --- dlls/wined3d/directx.c | 18 +++++++++++++++++- dlls/wined3d/wined3d_gl.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index e7a74d476d5..50443e2dbcd 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -4041,6 +4041,16 @@ static void quirk_arb_constants(WineD3D_GL_Info *gl_info) { gl_info->ps_glsl_constantsF = gl_info->ps_arb_constantsF; } +static void quirk_apple_glsl_constants(WineD3D_GL_Info *gl_info) { + quirk_arb_constants(gl_info); + /* MacOS needs uniforms for relative addressing offsets. This can accumulate to quite a few uniforms. + * Beyond that the general uniform isn't optimal, so reserve a number of uniforms. 12 vec4's should + * allow 48 different offsets or other helper immediate values + */ + TRACE_(d3d_caps)("Reserving 12 GLSL constants for compiler private use\n"); + gl_info->reserved_glsl_constants = max(gl_info->reserved_glsl_constants, 12); +} + static void quirk_ati_dx9(WineD3D_GL_Info *gl_info) { quirk_arb_constants(gl_info); @@ -4059,6 +4069,12 @@ static void quirk_ati_dx9(WineD3D_GL_Info *gl_info) { TRACE("GL_ARB_texture_non_power_of_two advertised on R500 or earlier card, removing\n"); gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] = FALSE; gl_info->supported[WINE_NORMALIZED_TEXRECT] = TRUE; + + /* fglrx has the same structural issues as the one described in quirk_apple_glsl_constants, although + * it is generally more efficient. Reserve just 8 constants + */ + TRACE_(d3d_caps)("Reserving 8 GLSL constants for compiler private use\n"); + gl_info->reserved_glsl_constants = max(gl_info->reserved_glsl_constants, 8); } static void quirk_no_np2(WineD3D_GL_Info *gl_info) { @@ -4116,7 +4132,7 @@ struct driver_quirk quirk_table[] = { */ { match_apple, - quirk_arb_constants, + quirk_apple_glsl_constants, "Apple GLSL uniform override" }, { diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 2cf4e3f8e0b..763ed69cc95 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -3951,6 +3951,7 @@ typedef struct _WineD3D_GL_Info { BOOL arb_vs_offset_limit; BOOL set_texcoord_w; + DWORD reserved_glsl_constants; BOOL supported[OPENGL_SUPPORTED_EXT_END + 1];