[PATCH] WineD3D: Make the MAC ARBvp implementation happy about =

Stefan Doesinger stefan at codeweavers.com
Thu Jul 17 15:58:23 CDT 2008


ARL=0A=
=0A=
A comment in the code explains what the patch does. This makes=0A=
the ARL generation a completely separate part in this function.=0A=
Unfortunately we can't make it a different function in the shader=0A=
instruction table because the difference between MOV and ARL is=0A=
decided with the dest register.=0A=
---=0A=
 dlls/wined3d/arb_program_shader.c |   21 ++++++++++++++++++---=0A=
 1 files changed, 18 insertions(+), 3 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/arb_program_shader.c =
b/dlls/wined3d/arb_program_shader.c=0A=
index 22a8b55..2de05bf 100644=0A=
--- a/dlls/wined3d/arb_program_shader.c=0A=
+++ b/dlls/wined3d/arb_program_shader.c=0A=
@@ -1718,15 +1718,30 @@ void vshader_hw_map2gl(SHADER_OPCODE_ARG* arg) {=0A=
     unsigned int i;=0A=
 =0A=
     if ((curOpcode->opcode =3D=3D WINED3DSIO_MOV && dst_regtype =3D=3D =
WINED3DSPR_ADDR) || curOpcode->opcode =3D=3D WINED3DSIO_MOVA) {=0A=
+        memset(tmpLine, 0, sizeof(tmpLine));=0A=
         if(shader->rel_offset) {=0A=
-            memset(tmpLine, 0, sizeof(tmpLine));=0A=
             vshader_program_add_param(arg, src[0], TRUE, tmpLine);=0A=
             shader_addline(buffer, "ADD TMP.x, %s, helper_const.z;\n", =
tmpLine);=0A=
             shader_addline(buffer, "ARL A0.x, TMP.x;\n");=0A=
-            return;=0A=
         } else {=0A=
-            strcpy(tmpLine, "ARL");=0A=
+            /* Apple's ARB_vertex_program implementation does not =
accept an ARL source argument=0A=
+             * with more than one component. Thus replicate the first =
source argument over all=0A=
+             * 4 components. For example, .xyzw -> .x (or better: =
.xxxx), .zwxy -> .z, etc)=0A=
+             */=0A=
+            DWORD parm =3D src[0] & ~(WINED3DVS_SWIZZLE_MASK);=0A=
+                   if((src[0] & WINED3DVS_X_W) =3D=3D WINED3DVS_X_W) {=0A=
+                parm |=3D WINED3DVS_X_W | WINED3DVS_Y_W | WINED3DVS_Z_W =
| WINED3DVS_W_W;=0A=
+            } else if((src[0] & WINED3DVS_X_Z) =3D=3D WINED3DVS_X_Z) {=0A=
+                parm |=3D WINED3DVS_X_Z | WINED3DVS_Y_Z | WINED3DVS_Z_Z =
| WINED3DVS_W_Z;=0A=
+            } else if((src[0] & WINED3DVS_X_Y) =3D=3D WINED3DVS_X_Y) {=0A=
+                parm |=3D WINED3DVS_X_Y | WINED3DVS_Y_Y | WINED3DVS_Z_Y =
| WINED3DVS_W_Y;=0A=
+            } else if((src[0] & WINED3DVS_X_X) =3D=3D WINED3DVS_X_X) {=0A=
+                parm |=3D WINED3DVS_X_X | WINED3DVS_Y_X | WINED3DVS_Z_X =
| WINED3DVS_W_X;=0A=
+            }=0A=
+            vshader_program_add_param(arg, parm, TRUE, tmpLine);=0A=
+            shader_addline(buffer, "ARL A0.x, %s;\n", tmpLine);=0A=
         }=0A=
+        return;=0A=
     } else=0A=
         strcpy(tmpLine, curOpcode->glname);=0A=
 =0A=
-- =0A=
1.5.4.5=0A=
=0A=

------=_NextPart_000_0001_01C8ECB5.AF5E2EC0--




More information about the wine-patches mailing list