So, I was arguing with a friend of mine about passing Vertex data, like Position and Normal, as float3 and not float4. My point of view is that it will save you memory and since the HLSL intrinsic functions are always inlined the performance hit "cannot" be noticeable.
Ok, so you guys have a better understanding of what I'm talking about here is some code.
float4 HPos vertexshader(float3 lPos : POSITION) : SV_POSITION
{
return mul( float4(lPos, 1.0f), WorldViewProjTransform);
}
On the other hand he is saying that it would be a lot better to pass in the float4 so you don't have to call the constructor for "every single" vertex that is pumped through the pipeline, like in the following example:
float4 HPos vertexshader(float4 lPos : POSITION) : SV_POSITION
{
return mul(lPos, WorldViewProjTransform) ;
}
I'm not saying that his idea is totally wrong, I just think it's not worth copying all that data when we know the fourth component will always be 1.0f.
Just looking for some unbiased opinions....
Ok, so you guys have a better understanding of what I'm talking about here is some code.
float4 HPos vertexshader(float3 lPos : POSITION) : SV_POSITION
{
return mul( float4(lPos, 1.0f), WorldViewProjTransform);
}
On the other hand he is saying that it would be a lot better to pass in the float4 so you don't have to call the constructor for "every single" vertex that is pumped through the pipeline, like in the following example:
float4 HPos vertexshader(float4 lPos : POSITION) : SV_POSITION
{
return mul(lPos, WorldViewProjTransform) ;
}
I'm not saying that his idea is totally wrong, I just think it's not worth copying all that data when we know the fourth component will always be 1.0f.
Just looking for some unbiased opinions....
Intel i7 3930k
8GB Mushkin LP @ 2133 mhz
GTX 680
Asus Rampage IV Extreme
Corsair 650w
8GB Mushkin LP @ 2133 mhz
GTX 680
Asus Rampage IV Extreme
Corsair 650w