how to get each pass's input from .fx file

Started by
1 comment, last by jimzy 18 years, 8 months ago
I want to get each pass's input from .fx file,then call IDirect3DDevice9::CreateVertexDeclaration . example: This is a HLSL function: "float4 vs(float3 Pos : POSITION, float3 Size : PSIZE)" how can i know this function's input data type ,then create a vertex declaration? i want to use ID3DXBaseEffect::GetParameter but the SDK says this method " Gets the handle of a top-level parameter or a structure member parameter ".
public Literal getLiteral(int index). Get the member at a given index. Parameters::index - The index of the required member. . Returns:: The member at the given index.getResource. public Resource getResource(int index)
Advertisement
I'm sure it is possible by getting the vertex shader (by name) from the FX-file and then using GetParameter(). But I'm more worried about why you want to do this. Are you aware you don't have to exactly match the input format of a vertex shader?

I.e. if you have normals in you vertex declaration and the vertex shader doesn't use them it is not a problem -- they are just ignored. Similar, if your vertex shader uses texture coordinates but your vertex declaration doesn't have them, no texture will be mapped but the rest of the shader will work.

Greetz,

Illco
^_^,^_^,^_^,
I sorry !,i want to say this:
I say this in chinese and others translate it in English.

"I can't expressly explain the reason in English why I want to do that ."
I can understand it well,but can not write it.
I asked others but they did not reply me and i want solve this problem quickly.
i have tried ,and find that i can not get the the vertex input information (type and semantic) .i not very sure.
I posted question here ,because i can get reply and quick reply , useful reply, i know gamedev.net is a big site .
over.

Thanks a lot!
public Literal getLiteral(int index). Get the member at a given index. Parameters::index - The index of the required member. . Returns:: The member at the given index.getResource. public Resource getResource(int index)

This topic is closed to new replies.

Advertisement