So reading through this article, I wanted to double check on the following blurb:
Note: It may not seem obvious, but any calculation on the texture coordinates counts as a dependent texture read. For example, packing multiple sets of texture coordinates into a single varying parameter and using a swizzle command to extract the coordinates still causes a dependent texture read.
So that means that instead of having a single float4 texcoord like this:
```csharp
*struct v2f {
float4 vertex : SV_POSITION;
float4 texcoord : TEXCOORD0;
};
v2f vert (appdata_t v) {
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f,o);
V_CW_TransformPoint(v.vertex);
o.vertex = UnityObjectToClipPos(vert);
o.texcoord.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
o.texcoord.zw = TRANSFORM_TEX(v.texcoord, _Tex2);
return o;
}
fixed4 frag (v2f i) : SV_Target {
fixed4 mainTex = tex2D(_MainTex, i.texcoord.xy);
fixed4 tex2 = tex2D(_Tex2, i.texcoord.zw);
return mainTex * tex2;
}*
* *I should break out the float4 texcoord into 2 separate values like this:* *csharp
*struct v2f {
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
float2 texcoord2 : TEXCOORD1;
};
v2f vert (appdata_t v) {
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f,o);
V_CW_TransformPoint(v.vertex);
o.vertex = UnityObjectToClipPos(vert);
o.texcoord= TRANSFORM_TEX(v.texcoord, _MainTex);
o.texcoord2 = TRANSFORM_TEX(v.texcoord, _Tex2);
return o;
}
fixed4 frag (v2f i) : SV_Target {
fixed4 mainTex = tex2D(_MainTex, i.texcoord);
fixed4 tex2 = tex2D(_Tex2, i.texcoord2);
return mainTex * tex2;
}*
```
Am I understanding that right?