[Resend] wined3d: Move _shader_program_dump_decl_usage() into baseshader.c

Jason Green jave27 at gmail.com
Tue May 9 20:01:40 CDT 2006


This re-aligned patch applies to the main git tree after Ivan's 1/5
(make register counting pass the same) and 2/5 (merge register
counting pass) patches.  Must be applied before the rest of his, or
there may be offset errors.

On 4/28/06, Jason Green <jave27 at gmail.com> wrote:
> This time with patch.
>
> ---------- Forwarded message ----------
> From: Jason Green <jave27 at gmail.com>
> Date: Apr 28, 2006 10:20 AM
> Subject: wined3d: Move _shader_program_dump_decl_usage() into baseshader.c
> To: wine patch <wine-patches at winehq.org>
>
>
> Both pixel and vertex shaders use an identical function to display
> debug traces of the D3DSIO_DCL opcode.  This consolidates them into a
> single function in the new baseshader.c file.  Also, they were passing
> a reference to their interface previously which never not used, so
> that has been removed.
>
> This requires Ivan's initial baseshader.c patch as a minimum, and
> should be a no-op.
>
>
>
-------------- next part --------------
diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c
index 1691151..19c4be5 100644
--- a/dlls/wined3d/baseshader.c
+++ b/dlls/wined3d/baseshader.c
@@ -159,4 +159,79 @@ void shader_get_registers_used(
     }
 }
 
+void shader_program_dump_decl_usage(
+    DWORD decl, 
+    DWORD param) {
+
+    DWORD regtype = shader_get_regtype(param);
+    TRACE("dcl_");
+
+    if (regtype == D3DSPR_SAMPLER) {
+        DWORD ttype = decl & D3DSP_TEXTURETYPE_MASK;
+
+        switch (ttype) {
+            case D3DSTT_2D: TRACE("2d "); break;
+            case D3DSTT_CUBE: TRACE("cube "); break;
+            case D3DSTT_VOLUME: TRACE("volume "); break;
+            default: TRACE("unknown_ttype(%08lx) ", ttype); 
+       }
+
+    } else { 
+
+        DWORD usage = decl & D3DSP_DCL_USAGE_MASK;
+        DWORD idx = (decl & D3DSP_DCL_USAGEINDEX_MASK) >> D3DSP_DCL_USAGEINDEX_SHIFT;
+
+        switch(usage) {
+        case D3DDECLUSAGE_POSITION:
+            TRACE("%s%ld ", "position", idx);
+            break;
+        case D3DDECLUSAGE_BLENDINDICES:
+            TRACE("%s ", "blend");
+            break;
+        case D3DDECLUSAGE_BLENDWEIGHT:
+            TRACE("%s ", "weight");
+            break;
+        case D3DDECLUSAGE_NORMAL:
+            TRACE("%s%ld ", "normal", idx);
+            break;
+        case D3DDECLUSAGE_PSIZE:
+            TRACE("%s ", "psize");
+            break;
+        case D3DDECLUSAGE_COLOR:
+            if(idx == 0)  {
+                TRACE("%s ", "color");
+            } else {
+                TRACE("%s%ld ", "specular", (idx - 1));
+            }
+            break;
+        case D3DDECLUSAGE_TEXCOORD:
+            TRACE("%s%ld ", "texture", idx);
+            break;
+        case D3DDECLUSAGE_TANGENT:
+            TRACE("%s ", "tangent");
+            break;
+        case D3DDECLUSAGE_BINORMAL:
+            TRACE("%s ", "binormal");
+            break;
+        case D3DDECLUSAGE_TESSFACTOR:
+            TRACE("%s ", "tessfactor");
+            break;
+        case D3DDECLUSAGE_POSITIONT:
+            TRACE("%s%ld ", "positionT", idx);
+            break;
+        case D3DDECLUSAGE_FOG:
+            TRACE("%s ", "fog");
+            break;
+        case D3DDECLUSAGE_DEPTH:
+            TRACE("%s ", "depth");
+            break;
+        case D3DDECLUSAGE_SAMPLE:
+            TRACE("%s ", "sample");
+            break;
+        default:
+            FIXME("Unrecognised dcl %08lx", usage);
+        }
+    }
+}
+
 /* TODO: Move other shared code here */
diff --git a/dlls/wined3d/pixelshader.c b/dlls/wined3d/pixelshader.c
index 23d3ab4..32a75ac 100644
--- a/dlls/wined3d/pixelshader.c
+++ b/dlls/wined3d/pixelshader.c
@@ -1602,80 +1602,6 @@ inline static void pshader_program_dump_
     }
 }
 
-inline static void pshader_program_dump_decl_usage(
-    IWineD3DPixelShaderImpl *This, DWORD decl, DWORD param) {
-
-    DWORD regtype = shader_get_regtype(param);
-    TRACE("dcl_");
-
-    if (regtype == D3DSPR_SAMPLER) {
-        DWORD ttype = decl & D3DSP_TEXTURETYPE_MASK;
-
-        switch (ttype) {
-            case D3DSTT_2D: TRACE("2d "); break;
-            case D3DSTT_CUBE: TRACE("cube "); break;
-            case D3DSTT_VOLUME: TRACE("volume "); break;
-            default: TRACE("unknown_ttype(%08lx) ", ttype); 
-       }
-
-    } else { 
-
-        DWORD usage = decl & D3DSP_DCL_USAGE_MASK;
-        DWORD idx = (decl & D3DSP_DCL_USAGEINDEX_MASK) >> D3DSP_DCL_USAGEINDEX_SHIFT;
-
-        switch(usage) {
-        case D3DDECLUSAGE_POSITION:
-            TRACE("%s%ld ", "position", idx);
-            break;
-        case D3DDECLUSAGE_BLENDINDICES:
-            TRACE("%s ", "blend");
-            break;
-        case D3DDECLUSAGE_BLENDWEIGHT:
-            TRACE("%s ", "weight");
-            break;
-        case D3DDECLUSAGE_NORMAL:
-            TRACE("%s%ld ", "normal", idx);
-            break;
-        case D3DDECLUSAGE_PSIZE:
-            TRACE("%s ", "psize");
-            break;
-        case D3DDECLUSAGE_COLOR:
-            if(idx == 0)  {
-                TRACE("%s ", "color");
-            } else {
-                TRACE("%s%ld ", "specular", (idx - 1));
-            }
-            break;
-        case D3DDECLUSAGE_TEXCOORD:
-            TRACE("%s%ld ", "texture", idx);
-            break;
-        case D3DDECLUSAGE_TANGENT:
-            TRACE("%s ", "tangent");
-            break;
-        case D3DDECLUSAGE_BINORMAL:
-            TRACE("%s ", "binormal");
-            break;
-        case D3DDECLUSAGE_TESSFACTOR:
-            TRACE("%s ", "tessfactor");
-            break;
-        case D3DDECLUSAGE_POSITIONT:
-            TRACE("%s%ld ", "positionT", idx);
-            break;
-        case D3DDECLUSAGE_FOG:
-            TRACE("%s ", "fog");
-            break;
-        case D3DDECLUSAGE_DEPTH:
-            TRACE("%s ", "depth");
-            break;
-        case D3DDECLUSAGE_SAMPLE:
-            TRACE("%s ", "sample");
-            break;
-        default:
-            FIXME("Unrecognised dcl %08lx", usage);
-        }
-    }
-}
-
 HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *iface, CONST DWORD *pFunction) {
     IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
     const DWORD* pToken = pFunction;
@@ -1720,7 +1646,7 @@ HRESULT WINAPI IWineD3DPixelShaderImpl_S
 
             } else {
                 if (curOpcode->opcode == D3DSIO_DCL) {
-                    pshader_program_dump_decl_usage(This, *pToken, *(pToken + 1));
+                    shader_program_dump_decl_usage(*pToken, *(pToken + 1));
                     ++pToken;
                     ++len;
                     pshader_program_dump_ps_param(*pToken, 0);
diff --git a/dlls/wined3d/vertexshader.c b/dlls/wined3d/vertexshader.c
index 45e809e..823f6e8 100644
--- a/dlls/wined3d/vertexshader.c
+++ b/dlls/wined3d/vertexshader.c
@@ -640,80 +640,6 @@ inline static void vshader_program_dump_
   }
 }
 
-inline static void vshader_program_dump_decl_usage(
-    IWineD3DVertexShaderImpl *This, DWORD decl, DWORD param) {
-    DWORD regtype = shader_get_regtype(param);
-
-    TRACE("dcl_");
-
-    if (regtype == D3DSPR_SAMPLER) {
-        DWORD ttype = decl & D3DSP_TEXTURETYPE_MASK;
-
-        switch (ttype) {
-            case D3DSTT_2D: TRACE("2d "); break;
-            case D3DSTT_CUBE: TRACE("cube "); break;
-            case D3DSTT_VOLUME: TRACE("volume "); break;
-            default: TRACE("unknown_ttype(%08lx) ", ttype);
-       }
-
-    } else {
-
-        DWORD usage = decl & D3DSP_DCL_USAGE_MASK;
-        DWORD idx = (decl & D3DSP_DCL_USAGEINDEX_MASK) >> D3DSP_DCL_USAGEINDEX_SHIFT;
-
-        switch(usage) {
-        case D3DDECLUSAGE_POSITION:
-            TRACE("%s%ld ", "position", idx);
-            break;
-        case D3DDECLUSAGE_BLENDINDICES:
-            TRACE("%s ", "blend");
-            break;
-        case D3DDECLUSAGE_BLENDWEIGHT:
-            TRACE("%s ", "weight");
-            break;
-        case D3DDECLUSAGE_NORMAL:
-            TRACE("%s%ld ", "normal", idx);
-            break;
-        case D3DDECLUSAGE_PSIZE:
-            TRACE("%s ", "psize");
-            break;
-        case D3DDECLUSAGE_COLOR:
-            if(idx == 0)  {
-                TRACE("%s ", "color");
-            } else {
-                TRACE("%s ", "specular");
-            }
-            break;
-        case D3DDECLUSAGE_TEXCOORD:
-            TRACE("%s%ld ", "texture", idx);
-            break;
-        case D3DDECLUSAGE_TANGENT:
-            TRACE("%s ", "tangent");
-            break;
-        case D3DDECLUSAGE_BINORMAL:
-            TRACE("%s ", "binormal");
-            break;
-        case D3DDECLUSAGE_TESSFACTOR:
-            TRACE("%s ", "tessfactor");
-            break;
-        case D3DDECLUSAGE_POSITIONT:
-            TRACE("%s%ld ", "positionT", idx);
-            break;
-        case D3DDECLUSAGE_FOG:
-            TRACE("%s ", "fog");
-            break;
-        case D3DDECLUSAGE_DEPTH:
-            TRACE("%s ", "depth");
-            break;
-        case D3DDECLUSAGE_SAMPLE:
-            TRACE("%s ", "sample");
-            break;
-        default:
-            FIXME("Unrecognised dcl %08lx", usage);
-        }
-    }
-}
-
 inline static BOOL vshader_is_version_token(DWORD token) {
   return 0xFFFE0000 == (token & 0xFFFE0000);
 }
@@ -1811,7 +1737,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_
                     DWORD param = *(pToken + 1);
 
                     parse_decl_usage(This, usage, param & D3DSP_REGNUM_MASK);
-                    vshader_program_dump_decl_usage(This, usage, param);
+                    shader_program_dump_decl_usage(usage, param);
                     vshader_program_dump_vs_param(param, 0);
                     pToken += 2;
                     len += 2;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 60c7430..9693c60 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1264,6 +1264,10 @@ extern void shader_get_registers_used(
     DWORD* tempsUsed,
     DWORD* texUsed);
 
+extern void shader_program_dump_decl_usage(
+    DWORD dcl,
+    DWORD param);
+
 inline static int shader_get_regtype(const DWORD param) {
     return (((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT) |
             ((param & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2));


More information about the wine-patches mailing list