Cg snippets
Cg program snippets are written between CGPROGRAM and ENDCG.
At the start of the snippet compilation directives can be given as #pragma statements. Directives indicating which shader functions to compile:
- #pragma vertex name - compile function name as the vertex shader. 정점셰이더로 기능 컴파일
- #pragma fragment name - compile function name as the fragment shader. 조각셰이더로 기능 컴파일
- #pragma geometry name - compile function name as DX10 geometry shader. Having this option automatically turns on #pragma target 4.0, described below.
- #pragma hull name - compile function name as DX11 hull shader. Having this option automatically turns on #pragma target 5.0, described below.
- #pragma domain name - compile function name as DX11 domain shader. Having this option automatically turns on #pragma target 5.0, described below.
Other compilation directives:
- #pragma target name - which shader target to compile to. See Shader targets below for details.
- #pragma only_renderers space separated names - compile shader only for given renderers. By default shaders are compiled for all renderers. See Renderers below for details.
- #pragma exclude_renderers space separated names - do not compile shader for given renderers. By default shaders are compiled for all renderers. See Renderers below for details.
- #pragma multi_compile …_ - for working with multiple shader variants.
- #pragma enable_d3d11_debug_symbols - generate debug information for shaders compiled for DirectX 11, this will allow you to debug shaders via Visual Studio 2012 (or higher) Graphics debugger.
Each snippet must contain at least a vertex program and a fragment program. Thus #pragma vertex and #pragma fragment directives are required.
Compilation directives that don’t do anything starting with Unity 5.0 and can be safely removed: #pragma glsl
, #pragma glsl_no_auto_normalization
, #pragma profileoption
, #pragma fragmentoption
.
'게임개발 > Shader' 카테고리의 다른 글
Unlit Shader (0) | 2015.10.13 |
---|---|
Surface Shader compile directives (0) | 2015.10.04 |
Surface Shader (0) | 2015.10.04 |
Surface Shader 수학함수 (0) | 2015.10.04 |
Surface Shader 기하함수 및 Texture 함수 (0) | 2015.10.04 |