본문 바로가기
유니티 엔진

UNITY_INITIALIZE_OUTPUT( )

by 대마왕J 2015. 1. 25.

UNITY_INITIALIZE_OUTPUT(type,name)  함수

 

 

HLSLSupport.cginc 에 정의되어 있는 함수.

  1. #if defined(UNITY_COMPILER_HLSL)
  2. #define UNITY_INITIALIZE_OUTPUT(type,name) name = (type)0;
  3. #else
  4. #define UNITY_INITIALIZE_OUTPUT(type,name)
  5. #endif

 

HLSL 컴파일러가 왔을때에야 작동하는 함수.

So, it does nothing unless the HLSL compiler is compiling.
In that case it sets its value to a typecasted zero. That way the compiler won't complain about uninitialized output values.

 

... 별 일 안하잖아...

 

 

 

example

 

 

void vert (inout appdata_full v, out Input o)
  {
   #if defined(SHADER_API_D3D11) || defined(SHADER_API_D3D11_9X)
   UNITY_INITIALIZE_OUTPUT(Input,o);
   #endif

}

반응형

댓글