Version: 2021.1
HLSL in Unity
include and include_with_pragmas directives in HLSL

Preprocessor directives in HLSL

Internally, shader compilation has multiple stages. The first stage is preprocessing, where a program called the preprocessor prepares the code for compilation. Preprocessor directives are instructions for the preprocessor.

This section of the manual contains information on Unity-specific ways of working with HLSL preprocessor directives, and HLSL preprocessor directives that are unique to Unity. It does not contain exhaustive documentation on all the preprocessor directives that HLSL supports, or general information on working with preprocessor directives in HLSL. For that information, see the HLSL documentation: Preprocessor directives (HLSL).

Page Description
include and include_with_pragmas directives in HLSL Working with #include and the Unity-specific #include_with_pragmas directives in HLSL in Unity.
pragma directives in HLSL Working with #pragma directives in HLSL in Unity.
Targeting shader models and GPU features in HLSL Using #pragma directives to indicate that your shaderA program that runs on the GPU. More info
See in Glossary
requires certain GPU features.
Targeting graphics APIs and platforms in HLSL Using #pragma directives to target specific graphics API and platforms.
Declaring and using shader keywords in HLSL Using #pragma directives to declare shader keywords and #if directives to indicate that code depends on the state of shader keywords.
HLSL in Unity
include and include_with_pragmas directives in HLSL
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961