From 9964d7e5ace3fe7f6aff6b9cd6939cd9eec14943 Mon Sep 17 00:00:00 2001 From: Tobias Jakobi Date: Sat, 18 Apr 2009 13:04:58 +0200 Subject: [wined3d] add ps_np2fixup_t struct to ps_compiled_shader --- dlls/wined3d/wined3d_private.h | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 3d911de..00c7082 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2464,8 +2464,26 @@ GLuint find_gl_vshader(IWineD3DVertexShaderImpl *shader, const struct vs_compile /***************************************************************************** * IDirect3DPixelShader implementation structure */ + +/* Using additional shader constants (uniforms in GLSL / program environment + * or local parameters in ARB) is costly: + * ARB only knows float4 parameters and GLSL compiler are not really smart + * when it comes to efficiently pack float2 uniforms, so no space is wasted + * (in fact most compilers map a float2 to a full float4 uniform). + * + * For NP2 texcoord fixup we only need 2 floats (width and height) for each + * 2D texture used in the shader. We therefore pack fixup info for 2 textures + * into a single shader constant (uniform / program parameter). */ +struct ps_np2fixup_t { + unsigned char idx[MAX_FRAGMENT_SAMPLERS]; /* indices to the real constant */ + GLfloat* const_cache; /* constant cache for fast reloading (without readback) */ + WORD swz; /* bitfield used to determine if we have to swizzle the constant */ + WORD num_consts; +}; + struct ps_compiled_shader { struct ps_compile_args args; + struct ps_np2fixup_t np2fixup; /* info for NP2 texcoord fixup (used both for GLSL and ARB) */ GLuint prgId; }; -- 1.6.0.6