[PATCH] WineD3D: Enable blue =3D 1.0 fixup for D3DFMT_V8U8=0A=

Stefan Doesinger stefan at codeweavers.com
Thu Nov 20 15:23:19 CST 2008


=0A=
The dx7 sdk demos need this=0A=
---=0A=
 dlls/wined3d/arb_program_shader.c |   15 +++++++--------=0A=
 dlls/wined3d/utils.c              |   29 +++++++++--------------------=0A=
 2 files changed, 16 insertions(+), 28 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/arb_program_shader.c =
b/dlls/wined3d/arb_program_shader.c=0A=
index 3a52453..e8a6e96 100644=0A=
--- a/dlls/wined3d/arb_program_shader.c=0A=
+++ b/dlls/wined3d/arb_program_shader.c=0A=
@@ -601,14 +601,13 @@ static void gen_color_correction(SHADER_BUFFER =
*buffer, const char *reg, const c=0A=
         case WINED3DFMT_V8U8:=0A=
         case WINED3DFMT_V16U16:=0A=
             if(GL_SUPPORT(NV_TEXTURE_SHADER) && fmt =3D=3D =
WINED3DFMT_V8U8) {=0A=
-                if(0) {=0A=
-                    /* The 3rd channel returns 1.0 in d3d, but 0.0 in =
gl. Fix this while we're at it :-)=0A=
-                     * disabled until an application that needs it is =
found because it causes unneeded=0A=
-                     * shader recompilation in some game=0A=
-                     */=0A=
-                    if(strlen(writemask) >=3D 4) {=0A=
-                        shader_addline(buffer, "MOV %s.%c, %s;\n", reg, =
writemask[3], one);=0A=
-                    }=0A=
+                /* The 3rd channel returns 1.0 in d3d, but 0.0 in gl. =
Fix this while we're at it :-)=0A=
+                 * The dx7 sdk BumpEarth demo needs it because it uses =
BUMPENVMAPLUMINANCE with V8U8.=0A=
+                 * With the luminance(b) value =3D 1.0, =
BUMPENVMAPLUMINANCE =3D=3D BUMPENVMAP, but if b is=0A=
+                 * 0.0(without this fixup), the rendering breaks.=0A=
+                 */=0A=
+                if(strlen(writemask) >=3D 4) {=0A=
+                    shader_addline(buffer, "MOV %s.%c, %s;\n", reg, =
writemask[3], one);=0A=
                 }=0A=
             } else {=0A=
                 /* Correct the sign, but leave the blue as it is - it =
was loaded correctly already=0A=
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c=0A=
index b49072f..f027404 100644=0A=
--- a/dlls/wined3d/utils.c=0A=
+++ b/dlls/wined3d/utils.c=0A=
@@ -365,28 +365,17 @@ BOOL initPixelFormats(WineD3D_GL_Info *gl_info)=0A=
 =0A=
     /* V8U8 is supported natively by GL_ATI_envmap_bumpmap and =
GL_NV_texture_shader.=0A=
      * V16U16 is only supported by GL_NV_texture_shader. The formats =
need fixup if=0A=
-     * their extensions are not available.=0A=
+     * their extensions are not available. GL_ATI_envmap_bumpmap is not =
used because=0A=
+     * the only driver that implements it(fglrx) has a buggy =
implementation.=0A=
      *=0A=
-     * In theory, V8U8 and V16U16 need a fixup of the undefined blue =
channel. OpenGL=0A=
-     * returns 0.0 when sampling from it, DirectX 1.0. This is disabled =
until we find=0A=
-     * an application that needs this because it causes performance =
problems due to=0A=
-     * shader recompiling in some games.=0A=
+     * V8U8 and V16U16 need a fixup of the undefined blue channel. =
OpenGL=0A=
+     * returns 0.0 when sampling from it, DirectX 1.0. So we always =
have in-shader=0A=
+     * conversion for this format.=0A=
      */=0A=
-    if(!GL_SUPPORT(NV_TEXTURE_SHADER2)) {=0A=
-        /* signed -> unsigned fixup */=0A=
-        dst =3D getFmtIdx(WINED3DFMT_V8U8);=0A=
-        gl_info->gl_formats[dst].conversion_group =3D WINED3DFMT_V8U8;=0A=
-        dst =3D getFmtIdx(WINED3DFMT_V16U16);=0A=
-        gl_info->gl_formats[dst].conversion_group =3D WINED3DFMT_V8U8;=0A=
-    } else {=0A=
-        /* Blue =3D 1.0 fixup, disabled for now */=0A=
-        if(0) {=0A=
-            dst =3D getFmtIdx(WINED3DFMT_V8U8);=0A=
-            gl_info->gl_formats[dst].conversion_group =3D =
WINED3DFMT_V8U8;=0A=
-            dst =3D getFmtIdx(WINED3DFMT_V16U16);=0A=
-            gl_info->gl_formats[dst].conversion_group =3D =
WINED3DFMT_V8U8;=0A=
-        }=0A=
-    }=0A=
+    dst =3D getFmtIdx(WINED3DFMT_V8U8);=0A=
+    gl_info->gl_formats[dst].conversion_group =3D WINED3DFMT_V8U8;=0A=
+    dst =3D getFmtIdx(WINED3DFMT_V16U16);=0A=
+    gl_info->gl_formats[dst].conversion_group =3D WINED3DFMT_V8U8;=0A=
 =0A=
     if(!GL_SUPPORT(NV_TEXTURE_SHADER)) {=0A=
         /* If GL_NV_texture_shader is not supported, those formats are =
converted, incompatibly=0A=
-- =0A=
1.5.6.4=0A=
=0A=

------=_NextPart_000_001C_01C94E6E.1CA479C0--




More information about the wine-patches mailing list