- Home /
Do TEXCOORDS need to be in sequence?
do the texcoord values in the vert to frag struct need to be in sequence? for example can i have a struct like this
struct v2f {
float2 UV: TEXCOORD0; float3 Color: TEXCOORD5;
}
or do they have to be ordered 012345. im asking because i have a shader with multiple compile setups that need different values in the vert to frag struct.
Answer by helarts · Dec 05, 2015 at 01:21 AM
I didn't notice any particular issue with fancy orders on DX9, DX11 and OpenGL, but I feel better with a serie of #ifdef like so:
float2 uv : TEXCOORD0;
#if defined (FEATURE_A) || defined (FEATURE_B)
float4 color : TEXCOORD1;
float3 fancyThing : TEXCOORD2;
#else
float3 fancyThing : TEXCOORD1;
#endif
Edit: This is how it is done in builtin shaders, so I guess it is the way to go.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Shaders problems after moving to URP 0 Answers
How to access another sprite's texture from a 2D shader 0 Answers
How to do 2D graphics like this ? 1 Answer