Question by
sgthale · Mar 09, 2018 at 07:12 PM ·
shadersvertexfragmenttexturecoord
Reducing number of TEXCOORD# channels in a shader for performance.
I've noticed that my vertex to frag object can sometimes use several TEXCOORD# channels for passing data:
struct v2f{
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
float2 screenPos: TEXCOORD1;
}
Would it be of any benefit if I condensed the data into the leftover float4 spots to reduce the number of TEXCOORD and still pass all of my stuff to the frag? Does Unity already do this under the hood? Example:
struct v2f{
float4 vertex : SV_POSITION;
float4 uv_and_screenPos : TEXCOORD0;
}
Comment
Your answer
Follow this Question
Related Questions
Shaders - Avoiding Branches. Can 'true / false' be instanced as '1 / 0'? 1 Answer
How to change the alpha value in the vertex color using a shader ? 1 Answer
HD render pipeline: Getting a standard shader to work 0 Answers
Inside of a shader how can I convert a world direction relevant to a vertex's local position 1 Answer
Issues with HDRP shader graphs. 0 Answers