开发者

How to get the right type of texture coordinate input in vertex shader in DX9

Here are two version of HLSL vertex shader input

开发者_如何学运维struct VS_INPUTS_0 { float3 Pos : POSITION; float2 Tex0 : TEXCOORD0; }

struct VS_INPUTS_1 { float3 Pos : POSITION; float3 Tex0 : TEXCOORD0; }

The only difference is the float2 and float3 of Tex0. Is there a DX9 API to get the right type of Tex0 to indicate whether the type of Tex0 is float2 or float3?


For DX9, not as far as I know, as DX9 automatically patches your shaders. That is, if your pixel shader expects float2 and your vertex shader provides float3, it will still work. With DirectX10/11, you can use shader reflection to query the compiled shader and figure out what it expects.

Question is: What do you mean with "right type"? That totally depends on your pixel shader, the vertex shader alone is not enough to decide.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜