Ivan Gyurdiev wrote:
Hi, I'm attaching test, which demonstrates incorrect behavior of
SetFVF and SetVertexDeclaration.
Windows converts one to the other and backwards (at least partially),
and we do not such thing - this breaks at least 2 demos (dx9_hlsl_*)
I'm posting it here, because:
- I don't have Windows, and I need someone to try it on machine with
pixel shader support (preferably 3.0, will need to enable pshaders and
GLSL registry key). The whole first part of the test checks decl to
fvf conversions, and they're almost all set to 0 in order to pass on
H. Verbeet and V. Margolen's setups [ which have no pshaders ]. MSDN
has a whole page on how to convert to an fvf, and the values there are
definitely *not* 0, so that's why I'm suspicious.
- Secondly, I am leaving for NYC in 2 days to look for a place to
live, so I have limited time to clean up the test (ok/trace usage and
the like), and I have no time to implement the fix. I am hoping
someone else can finish it, because afterwards I go to Denver for a
month, where I will have limited computing capabilities. Then I start
a full time job back at NYC, so I'll be pretty busy. Anyway, I'm sure
Jave has shaders under control and will be done with sm 2, 3, 4, 5..
10 by the end of the summer whether I help or not :)
Hi,
I've attached a patch which seems to fix the first set of failures. This
sets FVF values(from converted declarations) which were not set before.
I'm still getting a lot of 0 results myself. Pretty sure I have
everything enabled.
Comments?
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e635352..7116d2f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4480,6 +4480,66 @@ static HRESULT WINAPI IWineD3DDeviceImpl
}
if (NULL != pDecl) {
+ DWORD fvf = 0;
+ D3DVERTEXELEMENT9 * declaration = ((IWineD3DVertexDeclarationImpl
*)pDecl)->pDeclaration9;
+ if(D3DDECLTYPE_FLOAT3 == declaration->Type &&
+ D3DDECLUSAGE_POSITION == declaration->Usage &&
+ 0 == declaration->UsageIndex) {
+ fvf = D3DFVF_XYZ;
+ } else if(D3DDECLTYPE_FLOAT4 == declaration->Type &&
+ D3DDECLUSAGE_POSITIONT == declaration->Usage &&
+ 0 == declaration->UsageIndex) {
+ fvf = D3DFVF_XYZRHW;
+ } else if(D3DDECLTYPE_FLOAT1 == declaration->Type &&
+ D3DDECLUSAGE_BLENDWEIGHT == declaration->Usage &&
+ 0 == declaration->UsageIndex) {
+ fvf = 0/*D3DFVF_XYZB1*/;
+ } else if(D3DDECLTYPE_FLOAT2 == declaration->Type &&
+ D3DDECLUSAGE_BLENDWEIGHT == declaration->Usage &&
+ 0 == declaration->UsageIndex) {
+ fvf = 0/*D3DFVF_XYZB2*/;
+ } else if(D3DDECLTYPE_FLOAT3 == declaration->Type &&
+ D3DDECLUSAGE_BLENDWEIGHT == declaration->Usage &&
+ 0 == declaration->UsageIndex) {
+ fvf = 0/*D3DFVF_XYZB3*/;
+ } else if(D3DDECLTYPE_FLOAT4 == declaration->Type &&
+ D3DDECLUSAGE_BLENDWEIGHT == declaration->Usage &&
+ 0 == declaration->UsageIndex) {
+ fvf = 0/*D3DFVF_XYZB4*/;
+ } else if(D3DDECLTYPE_UBYTE4 == declaration->Type &&
+ D3DDECLUSAGE_BLENDINDICES == declaration->Usage &&
+ 0 == declaration->UsageIndex) {
+ fvf = 0/*D3DFVF_XYZB5*/;
+ } else if(D3DDECLTYPE_FLOAT3 == declaration->Type &&
+ D3DDECLUSAGE_NORMAL == declaration->Usage &&
+ 0 == declaration->UsageIndex) {
+ fvf = 0/*D3DFVF_NORMAL*/;
+ } else if(D3DDECLTYPE_FLOAT1 == declaration->Type &&
+ D3DDECLUSAGE_PSIZE == declaration->Usage &&
+ 0 == declaration->UsageIndex) {
+ fvf = 0/*D3DFVF_PSIZE*/;
+ } else if(D3DDECLTYPE_D3DCOLOR == declaration->Type &&
+ D3DDECLUSAGE_COLOR == declaration->Usage &&
+ 0 == declaration->UsageIndex) {
+ fvf = 0/*D3DFVF_DIFFUSE*/;
+ } else if(D3DDECLTYPE_D3DCOLOR == declaration->Type &&
+ D3DDECLUSAGE_COLOR == declaration->Usage &&
+ 1 == declaration->UsageIndex) {
+ fvf = 0/*D3DFVF_SPECULAR*/;
+ } else if(D3DDECLTYPE_FLOAT1 == declaration->Type &&
+ D3DDECLUSAGE_TEXCOORD == declaration->Usage) {
+ fvf = 0/*D3DFVF_TEXCOORDSIZE1(declaration->UsageIndex)*/;
+ } else if(D3DDECLTYPE_FLOAT2 == declaration->Type &&
+ D3DDECLUSAGE_TEXCOORD == declaration->Usage) {
+ fvf = 0/*D3DFVF_TEXCOORDSIZE2(declaration->UsageIndex)*/;
+ } else if(D3DDECLTYPE_FLOAT3 == declaration->Type &&
+ D3DDECLUSAGE_TEXCOORD == declaration->Usage) {
+ fvf = 0/*D3DFVF_TEXCOORDSIZE3(declaration->UsageIndex)*/;
+ } else if(D3DDECLTYPE_FLOAT4 == declaration->Type &&
+ D3DDECLUSAGE_TEXCOORD == declaration->Usage) {
+ fvf = 0/*D3DFVF_TEXCOORDSIZE4(declaration->UsageIndex)*/;
+ }
+ IWineD3DDeviceImpl_SetFVF(iface, fvf);
IWineD3DVertexDeclaration_AddRef(pDecl);
}
if (NULL != oldDecl) {