A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.unity3d.com/Manual/sprite/mask/../../writing-shader-include-shader-program.html below:

Manual: Duplicate HLSL in multiple programs

Add an HLSL shader program

Duplicate HLSL in multiple programs

To include HLSL code in other HLSLPROGRAM sections, you can use the HLSLINCLUDE directive.

Example
Shader "Examples/ExampleShader"
{
    SubShader
    {

        HLSLINCLUDE
            // HLSL code that you want to share goes here
        ENDHLSL

        Pass
        {                
              Name "ExampleFirstPassName"
              Tags { "LightMode" = "ExampleLightModeTagValue" }

              // ShaderLab commands to set the render state go here

              HLSLPROGRAM
                // This HLSL shader program automatically includes the contents of the HLSLINCLUDE block above
                // HLSL shader code goes here
              ENDHLSL
        }

        Pass
        {                
              Name "ExampleSecondPassName"
              Tags { "LightMode" = "ExampleLightModeTagValue" }

              // ShaderLab commands to set the render state go here

              HLSLPROGRAM
                // This HLSL shader program automatically includes the contents of the HLSLINCLUDE block above
                // HLSL shader code goes here
              ENDHLSL
        }

    }
}
Additional resources

Add an HLSL shader program


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4