Overriding shader use?

Started by
20 comments, last by ChopperDave 17 years, 11 months ago
Your vertex structure still contains w. This would make your shader get the wrong data (though it shouldn't prevent it from executing).
Advertisement
True. And even if I used XYRHW, the pixel shader still should have executed. Just out of curiosity, if I drop the 'w' from my vertex struct, should I still have the position in my shader be a float4? Or should it be a float3?

I've got the feeling that the pass isn't even being executed, but the call returns S_OK.

Any other ideas?
Quote:Original post by ChopperDave
Just out of curiosity, if I drop the 'w' from my vertex struct, should I still have the position in my shader be a float4? Or should it be a float3?
I forget what the spec dictates, but it'll take a default value - either 0.0 or 1.0. Bottom line is probably best to match them up unless you really can't for some reason [smile]

Quote:Original post by ChopperDave
I've got the feeling that the pass isn't even being executed, but the call returns S_OK.
What do the debug runtimes say? Failed shader linkage can often silently fail - but you'll get 1000's of debug statements indicating the problem.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Try using "ValidateTechnique" to check if the technique is okay.

BTW, I've just looked at your pixel shader, and I'd be surprised if it compiles under ps_2_0. That's limited to 64 arithmetic instructions, and you seem to have more than that.
Yeah I do validate it, and it comes out OK. It does compile under 2.0 if it's optimized; if not, then you're right it has too many instructions.

I'm gonna see what the debug spews out, if anything.
Here is what my debug output looks like:

'DOF2.exe': Loaded 'C:\Documents and Settings\guy\Desktop\DOF\Debug\DOF2.exe', Symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\d3d9.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\d3d8thk.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\katrack.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\entapi.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\psapi.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\netapi32.dll', No symbols loaded.'DOF2.exe': Unloaded 'C:\WINDOWS\system32\entapi.dll''DOF2.exe': Unloaded 'C:\WINDOWS\system32\netapi32.dll''DOF2.exe': Unloaded 'C:\WINDOWS\system32\psapi.dll''DOF2.exe': Loaded 'C:\WINDOWS\system32\wtsapi32.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\winsta.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\netapi32.dll', No symbols loaded.'DOF2.exe': Unloaded 'C:\WINDOWS\system32\wtsapi32.dll''DOF2.exe': Unloaded 'C:\WINDOWS\system32\winsta.dll''DOF2.exe': Unloaded 'C:\WINDOWS\system32\netapi32.dll'The thread 'Win32 Thread' (0x1be8) has exited with code 0 (0x0).'DOF2.exe': Loaded 'C:\WINDOWS\system32\msctf.dll', No symbols loaded.'DOF2.exe': Loaded 'C:\WINDOWS\system32\d3dref9.dll', No symbols loaded.The program '[7216] DOF2.exe: Native' has exited with code 0 (0x0).


I don't see anything that stands out with regards to the shaders. Is there anything that you noticed?
umm.... did you activate Direct3D debug runtime? You can do that in your control panel in the DirectX options in the Direct3D tab.
I assume you don´t have them enabled just because you should at least get some status messages from it even when everything is going fine.
Also pull the debug output level to the max.
With debug runtime you should get more information, and hopefully some useful that is.
Yeah, I'll have to get back to you on that. Apparently the computer I was using required an administrator to be able to change the control panel settings, so the debug wasn't enabled.

If you guys want I can post my code in it's entirety. But hopefully that won't be necessary.
OK. Igot some debugging info:
Direct3D9: :DoneExclusiveMode'Direct3D REF Device 1': Attached to debug monitor.'Direct3D REF-owned HAL (HWVP) Device 1': Attached to debug monitor.D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[0] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[1] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[2] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[3] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[4] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[5] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[6] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[7] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[8] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[9] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[10] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[11] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[12] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[13] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[14] is incorrect.  Expected 0x100, Returned 0x0D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[15] is incorrect.  Expected 0x100, Returned 0x0Direct3D9: (WARN) :Vertexbuffer created with POOL_DEFAULT but WRITEONLY not set. Performance penalty could be severe.Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 13Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 14Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 25Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 15Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 16Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 17Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 18Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 19Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 20Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 21Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 29Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 30Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 13Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 14Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 25Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 15Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 16Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 17Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 18Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 19Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 20Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 21Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 29Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 30Direct3D9: (WARN) :Ignoring redundant SetRenderState 7Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 13Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 14Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 25Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 15Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 19Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 20Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 21Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 29Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 30Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 13Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 14Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 25Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 15Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 19Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 20Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 21Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 29Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 30Direct3D9: (WARN) :Ignoring redundant SetRenderState - 7Direct3D9: (WARN) :Vertex shader function usage (D3DDECLUSAGE_TEXCOORD, 0) does not have corresponding usage in the current vertex declarationDirect3D9: (INFO) :The vertex declaration is (Stream, Offset, Type, Method, Usage, UsageIndex):Direct3D9: (INFO) :0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0Direct3D9: (INFO) :0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0Direct3D9: (WARN) :Vertex shader function usage (D3DDECLUSAGE_TEXCOORD, 0) does not have corresponding usage in the current vertex declarationDirect3D9: (INFO) :The vertex declaration is (Stream, Offset, Type, Method, Usage, UsageIndex):Direct3D9: (INFO) :0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0Direct3D9: (INFO) :0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0Direct3D9: (WARN) :Vertex shader function usage (D3DDECLUSAGE_TEXCOORD, 0) does not have corresponding usage in the current vertex declarationDirect3D9: (INFO) :The vertex declaration is (Stream, Offset, Type, Method, Usage, UsageIndex):Direct3D9: (INFO) :0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0Direct3D9: (INFO) :0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0Direct3D9: (WARN) :Vertex shader function usage (D3DDECLUSAGE_TEXCOORD, 0) does not have corresponding usage in the current vertex declarationDirect3D9: (INFO) :The vertex declaration is (Stream, Offset, Type, Method, Usage, UsageIndex):Direct3D9: (INFO) :0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0Direct3D9: (INFO) :0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0'Direct3D REF Device 1': Loaded vertex shader 'ppvs''Direct3D REF Device 1': Loaded vertex shader 'srvs''Direct3D REF Device 1': Loaded pixel shader 'ppps''Direct3D REF Device 1': Loaded pixel shader 'srps'Direct3D9: (WARN) :Ignoring redundant SetRenderState 7Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 13Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 14Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 25Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 15Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 19Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 20Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 21Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 29Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 30The program '[1224] DOF2.exe: Native' has exited with code 0 (0x0).The program '[1224] DOF2.exe: Direct3D REF Device 1' has exited with code 0 (0x0).The program '[1224] DOF2.exe: Direct3D REF-owned HAL (HWVP) Device 1' has exited with code 0 (0x0).


So apparently there's a problem with my FVF for the vertex and the samplers I'm using for the pixel shader. Based on that debug do you see anything wrong with my setup?
I believe it's just the FVF. Seems strange, though. If I read the messages correctly, D3D claims you're supplying position and normal instead of position and texture coords.

This topic is closed to new replies.

Advertisement