[PATCH] WineD3D: optimize the projected bump map handling=0A=

Stefan Doesinger stefan at codeweavers.com
Wed Aug 27 14:39:29 CDT 2008


=0A=
As suggested by Winspool, use TXP and multiply the displacement instead =
of manually dividing the static=0A=
coordinate=0A=
---=0A=
 dlls/wined3d/arb_program_shader.c |   17 +++++++----------=0A=
 1 files changed, 7 insertions(+), 10 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/arb_program_shader.c =
b/dlls/wined3d/arb_program_shader.c=0A=
index 335e54b..ca65e3e 100644=0A=
--- a/dlls/wined3d/arb_program_shader.c=0A=
+++ b/dlls/wined3d/arb_program_shader.c=0A=
@@ -2790,25 +2790,22 @@ static GLuint gen_arbfp_ffp_shader(struct =
ffp_settings *settings, IWineD3DStateB=0A=
             shader_addline(&buffer, "DP3 ret.g, arg1, tex%u;\n", stage =
- 1);=0A=
 =0A=
             /* with projective textures, texbem only divides the static =
texture coord, not the displacement,=0A=
-             * so we can't let the GL handle this.=0A=
+             * so multiply the displacement with the dividing parameter =
before passing it to TXP=0A=
              */=0A=
             if (settings->op[stage].projected !=3D proj_none) {=0A=
-                /* Note: Currently always divide by .a because the =
vertex pipeline moves the correct value=0A=
-                 * into the 4th component=0A=
-                 */=0A=
                 if(settings->op[stage].projected =3D=3D proj_count4) {=0A=
-                    shader_addline(&buffer, "RCP arg1.a, =
fragment.texcoord[%u].a;\n", stage);=0A=
+                    shader_addline(&buffer, "MOV ret.a, =
fragment.texcoord[%u].a;\n", stage);=0A=
+                    shader_addline(&buffer, "MUL ret.rgb, ret, =
fragment.texcoord[%u].a, fragment.texcoord[%u];\n", stage, stage);=0A=
                 } else {=0A=
-                    shader_addline(&buffer, "RCP arg1.a, =
fragment.texcoord[%u].b;\n", stage);=0A=
+                    shader_addline(&buffer, "MOV ret.a, =
fragment.texcoord[%u].b;\n", stage);=0A=
+                    shader_addline(&buffer, "MAD ret.rgb, ret, =
fragment.texcoord[%u].b, fragment.texcoord[%u];\n", stage, stage);=0A=
                 }=0A=
-                shader_addline(&buffer, "MUL arg1.rg, =
fragment.texcoord[%u], arg1.a;\n", stage);=0A=
-                shader_addline(&buffer, "ADD ret, ret, arg1;\n");=0A=
             } else {=0A=
                 shader_addline(&buffer, "ADD ret, ret, =
fragment.texcoord[%u];\n", stage);=0A=
             }=0A=
 =0A=
-            shader_addline(&buffer, "TEX%s tex%u, ret, texture[%u], =
%s;\n",=0A=
-                            sat, stage, stage, textype);=0A=
+            shader_addline(&buffer, "%s%s tex%u, ret, texture[%u], =
%s;\n",=0A=
+                           instr, sat, stage, stage, textype);=0A=
             if(settings->op[stage - 1].cop =3D=3D =
WINED3DTOP_BUMPENVMAPLUMINANCE) {=0A=
                 shader_addline(&buffer, "MAD_SAT ret.r, tex%u.b, =
luminance%u.r, luminance%u.g;\n",=0A=
                                stage - 1, stage - 1, stage - 1);=0A=
-- =0A=
1.5.6.4=0A=
=0A=

------=_NextPart_000_002D_01C909E1.7CCC5FB0--




More information about the wine-patches mailing list