   hlsl questions
1) Is the semantic syntax POSITION the same as POSITION0?2) Lets say I have my shader files like this: B.fx : uniform extern float4x4 WVP_Matrix;...A.fx :#include "B.fx"struct outputvs{   float4 pos : POSITION0;};outputvs MainVS( float3 pos : POSITION0 ){   outputvs o;   o.pos = mul( float4(pos,1.f), WVP_Matrix );   return o;}technique tech{...}and in my C++ application I do something like : DWORD ShaderFlags = D3DXSHADER_SKIPOPTIMIZATION | D3DXSHADER_DEBUG;ID3DXBuffer *errors = 0;D3DXCreateEffectFromFile( d3ddev, L"Shader Files/A.fx", NULL, NULL, ShaderFlags, NULL, &_Effect, &errors );if( errors )   MessageBox( 0, (wchar_t*)(errors->GetBufferPointer()), 0, 0 );hWVP_Matrix = _Effect->GetParameterByName( 0, "WVP_Matrix" );Why doesn't that work? How come I can't declare WVP_Matrix in another file?I'm assuming that since I'm including B.fx in A.fx, D3DXCreateEffectFromFile would create both effects? If not, do I have to explicitly call D3DXCreateEffectFromFile with L"Shader Files/B.fx" as the param?3)How do I use multiple streams and how would I associate them to a particular input param?For example, I saw something like this struct vertex{   float4 position : POSITION;  //stream 0   float3 normal : NORMAL; //stream 0   float2 uv0 : TEXCOORD0; //stream 0};struct VS_IN{   vertex v;   float2 uv1 : TEXCOORD1;};VS_OUT main( VS_IN input ){...}...Do I do something like this when I'm rendering?void render(){/////stream 0d3ddev->SetStreamSource( 0, _Mesh.VertexBuffer, 0, sizeof(Vertex_D3D9) );d3ddev->SetIndices( _Mesh.IndexBuffer );d3ddev->SetVertexDeclaration( VertexDecl_0 );//VertexDecl_0 has elements: D3DDECLUSAGE_POSITION, D3DDECLUSAGE_NORMAL, D3DDECLUSAGE_TEXCOORD/////stream 1not exactly sure what to do here...}4) Someone mentioned fxc for compiling fx files. How do I use it?   
  2) It works, I'm doing it, too. Maybe here is your problem:L"Shader Files/A.fx"try to change your include to#include <Shader Files/B.fx>as well.   ;  1) Yes.2) I don't see any reason why that shouldn't work. If you use #include, it should be like you just copied and pasted everything from that file. Is GetParameterByName returning NULL?3) When using multiple streams, the vertex declaration you set has to include all vertex elements from all vertex streams. So the usage and usage index you specify for any element has to be unique across all streams being bound. Then in your shader you just use the appropriate semantics, as if they were all coming from the same stream.4) If you run fxc /?, it will give you a list of command line switches. You can also see that here. There's some more guidelines here.For you probably the only thing you'd want to do is pre-compile your effects to a file, which you do with the /P switch. You can then pass that file to D3DXCreateEffectFromFile, and it will just load the binary effect data without needing to compile it (making your load times quicker).;  First, how come there is a huge amount of space when I post my code? Any way to change that?Back to topic : Thanks, MJP.Apparently #2 was caused by some sort of spacing issue, but its fixed now.#3 : So I would have thisD3DVERTEXELEMENT9 decl[] = { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},    {0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 },   {0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},   {1, 32, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1},   D3DDECL_END()};but what do I do with SetSourceStream() and SetIndices()?#4 :I'll look into that. Thanks.   ;  You use SetStreamSource to bind a vertex buffer to stream index. So your would bind your first vertex buffer with the position, texcoord0, and normal to stream 0, and then bind your other vertex buffer with texcoord1 to stream 1. You can only have one index buffer bound, so if you do a DrawIndexedPrimitives call the indices will be used for vertices from all streams. You can also use SetStreamSourceFreq to apply a frequency multiply to the indices for a specific stream (this is how instancing is done).   