From bf9cc30aacf84798422b2ba2862a889d2128f403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Mon, 24 Sep 2007 16:16:31 +0200 Subject: [PATCH] wined3d: Put V8U8 back into the UNKNOWN format group. --- dlls/wined3d/arb_program_shader.c | 7 ++++++- dlls/wined3d/utils.c | 33 ++++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 4d404d6c106..3ceffe70696 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -598,10 +598,15 @@ static void shader_arb_color_correction(SHADER_OPCODE_ARG* arg) { case WINED3DFMT_V16U16: if(GL_SUPPORT(NV_TEXTURE_SHADER) || (GL_SUPPORT(ATI_ENVMAP_BUMPMAP) && fmt == WINED3DFMT_V8U8)) { - /* The 3rd channel returns 1.0 in d3d, but 0.0 in gl. Fix this while we're at it :-) */ +#if 0 + /* The 3rd channel returns 1.0 in d3d, but 0.0 in gl. Fix this while we're at it :-) + * disabled until an application that needs it is found because it causes unneeded + * shader recompilation in some game + */ if(strlen(writemask) >= 4) { shader_addline(arg->buffer, "MOV %s.%c, one.z;\n", reg, writemask[3]); } +#endif } else { /* Correct the sign, but leave the blue as it is - it was loaded correctly already * ARB shaders are a bit picky wrt writemasks and swizzles. If we're free to scale diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 4765ae5ee60..bd1d7d385af 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -230,18 +230,33 @@ BOOL initPixelFormats(WineD3D_GL_Info *gl_info) gl_info->gl_formats[dst].conversion_group= WINED3DFMT_UNKNOWN; } - /* V8U8 and V16U16 are always tidied up in the pixel shader - blue is set to 1.0. - * They can't be switched with other formats, but they can be switched with each other, - * except if GL_ATI_envmap_bumpmap is supported. In this case, V8U8 uses the gl native format, - * but V16U16 is converted. + /* V8U8 is supported natively by GL_ATI_envmap_bumpmap and GL_NV_texture_shader. + * V16U16 is only supported by GL_NV_texture_shader. The formats need fixup if + * their extensions are not available. + * + * In theory, V8U8 and V16U16 need a fixup of the undefined blue channel. OpenGL + * returns 0.0 when sampling from it, DirectX 1.0. This is disabled until we find + * an application that needs this because it causes performance problems due to + * shader recompiling in some games. */ - dst = getFmtIdx(WINED3DFMT_V8U8); - gl_info->gl_formats[dst].conversion_group = WINED3DFMT_V8U8; - dst = getFmtIdx(WINED3DFMT_V16U16); - if(!GL_SUPPORT(ATI_ENVMAP_BUMPMAP)) { + if(!GL_SUPPORT(ATI_ENVMAP_BUMPMAP) && !GL_SUPPORT(NV_TEXTURE_SHADER2)) { + /* signed -> unsigned fixup */ + dst = getFmtIdx(WINED3DFMT_V8U8); gl_info->gl_formats[dst].conversion_group = WINED3DFMT_V8U8; - } else { + dst = getFmtIdx(WINED3DFMT_V16U16); + gl_info->gl_formats[dst].conversion_group = WINED3DFMT_V8U8; + } else if(GL_SUPPORT(ATI_ENVMAP_BUMPMAP)) { + /* signed -> unsigned fixup */ + dst = getFmtIdx(WINED3DFMT_V16U16); gl_info->gl_formats[dst].conversion_group = WINED3DFMT_V16U16; + } else { + /* Blue = 1.0 fixup, disabled for now */ +#if 0 + dst = getFmtIdx(WINED3DFMT_V8U8); + gl_info->gl_formats[dst].conversion_group = WINED3DFMT_V8U8; + dst = getFmtIdx(WINED3DFMT_V16U16); + gl_info->gl_formats[dst].conversion_group = WINED3DFMT_V8U8; +#endif } if(!GL_SUPPORT(NV_TEXTURE_SHADER)) {