In most of the programs I have seen that make use of vertex position data in the Pixel Shader, there is a tendency to process it as a float4 vector. This restriction does not appear to be present fin the other shaders. In the program that I am currently writing, for instance, float2's are inputted into the VS and float3's into the GS with no problem. But when I try to input this data into the PS, it rejects all forms except for float4. Are other vector types not allowed into the PS? If so, why?
Asked
Active
Viewed 193 times
1 Answers
1
In a pixel shader, the SV_Position
is a system-generated value which must be a float4
. When you use the SV_Position
semantic in a vertex shader, it's basically just an alias for the old POSITION
semantic and comes from the Input Assembler in whatever format the Input Layout specifies. The binding between a vertex and geometry shader has to agree, but can be whatever value.
In other words, it has a special meaning for a pixel shader because it's the pixel position as computed by the rasterizer stage.

Chuck Walbourn
- 38,259
- 2
- 58
- 81