variable 'o' used without having been completely initialized Compiling Vertex program

Posted rexzhao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了variable 'o' used without having been completely initialized Compiling Vertex program相关的知识,希望对你有一定的参考价值。

 

variable ‘o‘ used without having been completely initialized Compiling Vertex program

 

 

v2f vert (appdata_base v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
float3 V = WorldSpaceViewDir(v.vertex);
V = mul(unity_WorldToObject, float4(V,1));
o.NdotV.x = saturate(dot(v.normal, normalize(V)));
return o;
}

使用宏初始化  v2f 即可 UNITY_INITIALIZE_OUTPUT

修改为

v2f vert (appdata_base v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f,o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
float3 V = WorldSpaceViewDir(v.vertex);
V = mul(unity_WorldToObject, float4(V,1));
o.NdotV.x = saturate(dot(v.normal, normalize(V)));
return o;
}

以上是关于variable 'o' used without having been completely initialized Compiling Vertex program的主要内容,如果未能解决你的问题,请参考以下文章

Can't connect to X11 window server using ':1.0' as the value of the DISPLAY variable.(示例

C++问题 错误如下Time Check Failure #3 - The variable 'C' is being used without being initialized

What's the difference between using “let” and “var” to declare a variable in JavaScript?

ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N O)

error C4996: 'fopen': This function or variable may be unsafe.

warning C4996: 'sprintf': This function or variable may be unsafe.