D3D10_INPUT_ELEMENT_DESC InputElementDesc[] =
{
{"MYPOS", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{"MYTEX", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 },
};
HLSL:
struct VS_INPUT
{
float4 Pos : MYPOS;
float2 Tex : MYTEX;
};
struct VS_OUTPUT
{
float4 Pos : SV_POSITION;
float4 Tex : NEWTEXCOORD;
};
VS_OUTPUT VS( VS_INPUT input )
{
VS_OUTPUT output = (VS_OUTPUT)0;
output.Pos = mul( input.Pos, World );
output.Pos = mul( output.Pos, View );
output.Pos = mul( output.Pos, Projection );
output.Tex = input.Tex;
return output;
}
float4 PS( VS_OUTPUT input) : SV_Target
{
return txDiffuse.Sample( samLinear, input.Tex );
}
Directx10 Shader Semantic
Is there a need to follow the Semantic in directx10 shader model? Example POSITION, TEXCOORD, NORMAL0, etc.
I was wondering since in directx10, the creation of the InputLayout actually specifies the semantics to bind the input data to, there wouldn't be a need to follow thoes Semantics.
Example is it perfectly alright to do this:
I am just curious as to is there a need to follow the standard semantic that was used (POSITON0, TEXCOORD etc)?
You can use whatever semantic names you like. Your example should be mostly fine.
The only restriction is that the required system-interpreted semantics are present (ie SV_Position for VS/GS output, SV_Target for PS output)
The only restriction is that the required system-interpreted semantics are present (ie SV_Position for VS/GS output, SV_Target for PS output)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement