Fwd: wined3d: Move _shader_program_dump_decl_usage() into
baseshader.c
Jason Green
jave27 at gmail.com
Fri Apr 28 09:22:13 CDT 2006
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 fe69949..e3db343 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 bdad583..66cac26 100644
--- a/dlls/wined3d/vertexshader.c
+++ b/dlls/wined3d/vertexshader.c
@@ -711,80 +711,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);
}
@@ -1877,7 +1803,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_
} else {
if (curOpcode->opcode == D3DSIO_DCL) {
- vshader_program_dump_decl_usage(This, *pToken, *(pToken + 1));
+ shader_program_dump_decl_usage(*pToken, *(pToken + 1));
parse_decl_usage(This, *pToken, *(pToken + 1) & D3DSP_REGNUM_MASK);
++pToken;
++len;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index c5a1e80..529a7b4 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1222,6 +1222,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