# BuiltinShaderDefine

> Defines set by editor when compiling shaders, based on the target platform and GraphicsTier.

## Definition

* **Type:** Enum
* **Namespace:** [UnityEngine.Rendering](/engine/6000.7/script-reference/unityengine/rendering.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public enum BuiltinShaderDefine
```

## Remarks

These defines reflect the availability of platform-specific features (such as [BuiltinShaderDefine.UNITY\_ASTC\_NORMALMAP\_ENCODING](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-astc-normalmap-encoding.md)) and current graphics APIs (such as [BuiltinShaderDefine.SHADER\_API\_DESKTOP](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/shader-api-desktop.md)).

The `BuiltinShaderDefine`s of a given variant are made available for [scriptable shader stripping](/engine/6000.7/manual/materials-and-shaders/shaders/shader-troubleshooting/shader-reducing/shader-variants/shader-variant-stripping.md) via [PlatformKeywordSet](/engine/6000.7/script-reference/unityengine/rendering/platformkeywordset.md).

Additional Resources: [GraphicsSettings.HasShaderDefine](/engine/6000.7/script-reference/unityengine/rendering/graphicssettings/hasshaderdefine.md).

## Examples

```csharp
using UnityEditor;
using UnityEditor.Rendering;
using UnityEngine;
using UnityEngine.Rendering;

// Adds a new Editor menu item called Example. Select Example > PrintLightModeTagExample
// from the Editor menu to print all shader defines Unity adds when compiling a shader
// for the current build target and the Vulkan API.
public class PrintBuiltInDefines
{
    public const ShaderCompilerPlatform kTargetPlatform = ShaderCompilerPlatform.Vulkan;

    [MenuItem("Example/Print built-in defines")]
    public static void Print()
    {
        // Get current build target
        BuildTarget currentBuildTarget = EditorUserBuildSettings.activeBuildTarget;

        // Collect defines from the build target and platform
        BuiltinShaderDefine[] defines = ShaderUtil.GetShaderPlatformKeywordsForBuildTarget(kTargetPlatform, currentBuildTarget);

        // Print the defines
        string definesAsString = string.Join(' ', defines);
        string message = $"Built-in defines for compiler platform {kTargetPlatform} and active build target ({currentBuildTarget}): {definesAsString}";
        Debug.Log(message);
    }
}
```

## Fields

| Value                                                                                                                                                                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [SHADER\_API\_DESKTOP](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/shader-api-desktop.md)                                                             | SHADER\_API\_DESKTOP is set when compiling shader for "desktop" platforms.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [SHADER\_API\_GLES30](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/shader-api-gles30.md)                                                               | SHADER\_API\_ES30 is set when the Graphics API is OpenGL ES 3 and the minimum supported OpenGL ES 3 version is OpenGL ES 3.0.                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [SHADER\_API\_GLES31](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/shader-api-gles31.md)                                                               | SHADER\_API\_ES31 is set when the Graphics API is OpenGL ES 3 and the minimum supported OpenGL ES 3 version is OpenGL ES 3.1.                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [SHADER\_API\_GLES32](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/shader-api-gles32.md)                                                               | SHADER\_API\_ES32 is set when the Graphics API is OpenGL ES 3 and the minimum supported OpenGL ES 3 version is OpenGL ES 3.2.                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [SHADER\_API\_MOBILE](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/shader-api-mobile.md)                                                               | SHADER\_API\_MOBILE is set when compiling shader for mobile platforms.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [UNITY\_ASTC\_NORMALMAP\_ENCODING](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-astc-normalmap-encoding.md)                                      | Unity enables UNITY\_ASTC\_NORMALMAP\_ENCODING when DXT5nm-style normal maps are used on Android, iOS or tvOS.                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [UNITY\_COLORSPACE\_GAMMA](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-colorspace-gamma.md)                                                     | UNITY\_COLORSPACE\_GAMMA is set when compiling shaders for Gamma Color Space.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [UNITY\_ENABLE\_DETAIL\_NORMALMAP](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-enable-detail-normalmap.md)                                      | UNITY\_ENABLE\_DETAIL\_NORMALMAP is set if Detail Normal Map should be sampled if assigned.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [UNITY\_ENABLE\_NATIVE\_SHADOW\_LOOKUPS](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-enable-native-shadow-lookups.md)                           | UNITY\_ENABLE\_NATIVE\_SHADOW\_LOOKUPS enables use of built-in shadow comparison samplers on OpenGL ES 2.0.                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [UNITY\_ENABLE\_REFLECTION\_BUFFERS](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-enable-reflection-buffers.md)                                  | UNITY\_ENABLE\_REFLECTION\_BUFFERS is set when deferred shading renders reflection probes in deferred mode. With this option set reflections are rendered into a per-pixel buffer. This is similar to the way lights are rendered into a per-pixel buffer. UNITY\_ENABLE\_REFLECTION\_BUFFERS is on by default when using deferred shading, but you can turn it off by setting “No support” for the Deferred Reflections shader option in Graphics Settings. When the setting is off, reflection probes are rendered per-object, similar to the way forward rendering works. |
| [UNITY\_FRAMEBUFFER\_FETCH\_AVAILABLE](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-framebuffer-fetch-available.md)                              | UNITY\_FRAMEBUFFER\_FETCH\_AVAILABLE is set when compiling shaders for platforms where framebuffer fetch is potentially available.                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [UNITY\_HARDWARE\_TIER1](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-hardware-tier1.md)                                                         | UNITY\_HARDWARE\_TIER1 is set when compiling shaders for [GraphicsTier.Tier1](/engine/6000.7/script-reference/unityengine/rendering/graphicstier/tier1.md).                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [UNITY\_HARDWARE\_TIER2](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-hardware-tier2.md)                                                         | UNITY\_HARDWARE\_TIER2 is set when compiling shaders for [GraphicsTier.Tier2](/engine/6000.7/script-reference/unityengine/rendering/graphicstier/tier2.md).                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [UNITY\_HARDWARE\_TIER3](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-hardware-tier3.md)                                                         | UNITY\_HARDWARE\_TIER3 is set when compiling shaders for [GraphicsTier.Tier3](/engine/6000.7/script-reference/unityengine/rendering/graphicstier/tier3.md).                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [UNITY\_LIGHT\_PROBE\_PROXY\_VOLUME](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-light-probe-proxy-volume.md)                                   | UNITY\_LIGHT\_PROBE\_PROXY\_VOLUME is set when **Light Probe Proxy Volume** feature is supported by the current graphics API and is enabled in the [Graphics Tier settings](/engine/6000.7/manual/unity-editor/editor-settings-reference/comp-manager-group/class-graphics-settings.md). You can only set a Graphics Tier in the Built-in Render Pipeline.                                                                                                                                                                                                                   |
| [UNITY\_LIGHTMAP\_DLDR\_ENCODING](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-lightmap-dldr-encoding.md)                                        | UNITY\_LIGHTMAP\_DLDR\_ENCODING is set when lightmap textures are using double LDR encoding to store the values in the texture.                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [UNITY\_LIGHTMAP\_FULL\_HDR](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-lightmap-full-hdr.md)                                                  | UNITY\_LIGHTMAP\_FULL\_HDR is set when lightmap textures are not using any encoding to store the values in the texture.                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [UNITY\_LIGHTMAP\_RGBM\_ENCODING](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-lightmap-rgbm-encoding.md)                                        | UNITY\_LIGHTMAP\_RGBM\_ENCODING is set when lightmap textures are using RGBM encoding to store the values in the texture.                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [UNITY\_METAL\_SHADOWS\_USE\_POINT\_FILTERING](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-metal-shadows-use-point-filtering.md)                | UNITY\_METAL\_SHADOWS\_USE\_POINT\_FILTERING is set if shadow sampler should use point filtering on iOS Metal.                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [UNITY\_NEEDS\_RENDERPASS\_FBFETCH\_FALLBACK](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-needs-renderpass-fbfetch-fallback.md)                 | UNITY\_NEEDS\_RENDERPASS\_FBFETCH\_FALLBACK is set when we need to generate a fallback for RenderPass due to the possibility of not having framebuffer fetch                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [UNITY\_NO\_DXT5nm](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-no-dxt5nm.md)                                                                   | UNITY\_NO\_DXT5nm is set when compiling shader for platform that do not support DXT5NM, meaning that normal maps will be encoded in RGB instead.                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [UNITY\_NO\_RGBM](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-no-rgbm.md)                                                                       | UNITY\_NO\_RGBM is set when compiling shader for platform that do not support RGBM, so dLDR will be used instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [UNITY\_NO\_SCREENSPACE\_SHADOWS](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-no-screenspace-shadows.md)                                        | UNITY\_NO\_SCREENSPACE\_SHADOWS is set when screenspace cascaded shadow maps are disabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [UNITY\_PBS\_USE\_BRDF1](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-pbs-use-brdf1.md)                                                          | UNITY\_PBS\_USE\_BRDF1 is set if Standard Shader BRDF1 should be used.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [UNITY\_PBS\_USE\_BRDF2](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-pbs-use-brdf2.md)                                                          | UNITY\_PBS\_USE\_BRDF2 is set if Standard Shader BRDF2 should be used.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [UNITY\_PBS\_USE\_BRDF3](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-pbs-use-brdf3.md)                                                          | UNITY\_PBS\_USE\_BRDF3 is set if Standard Shader BRDF3 should be used.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [UNITY\_PLATFORM\_SUPPORTS\_DEPTH\_FETCH](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-platform-supports-depth-fetch.md)                         | UNITY\_PLATFORM\_SUPPORTS\_DEPTH\_FETCH is set if RenderPass can use its depth attachment as input.                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [UNITY\_PLATFORM\_SUPPORTS\_WAVE\_32](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-platform-supports-wave-32.md)                                 | Unity sets UNITY\_PLATFORM\_SUPPORTS\_WAVE\_32 when the target platform is known to support wave-level shader operations with a wave size of 32.                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [UNITY\_PLATFORM\_SUPPORTS\_WAVE\_64](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-platform-supports-wave-64.md)                                 | Unity sets UNITY\_PLATFORM\_SUPPORTS\_WAVE\_64 when the target platform is known to support wave-level shader operations with a wave size of 64.                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [UNITY\_PRETRANSFORM\_TO\_DISPLAY\_ORIENTATION](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-pretransform-to-display-orientation.md)             | Unity enables UNITY\_PRETRANSFORM\_TO\_DISPLAY\_ORIENTATION when Vulkan pre-transform is enabled and supported on the target build platform.                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [UNITY\_SPECCUBE\_BLENDING](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-speccube-blending.md)                                                   | UNITY\_SPECCUBE\_BLENDING is set if Reflection Probes Blending is enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [UNITY\_SPECCUBE\_BOX\_PROJECTION](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-speccube-box-projection.md)                                      | UNITY\_SPECCUBE\_BLENDING is set if Reflection Probes Box Projection is enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [UNITY\_UNIFIED\_SHADER\_PRECISION\_MODEL](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-unified-shader-precision-model.md)                       | Unity sets UNITY\_UNIFIED\_SHADER\_PRECISION\_MODEL if, in Player Settings, you set **Shader Precision Model** to Unified.                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [UNITY\_USE\_DITHER\_MASK\_FOR\_ALPHABLENDED\_SHADOWS](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-use-dither-mask-for-alphablended-shadows.md) | UNITY\_USE\_DITHER\_MASK\_FOR\_ALPHABLENDED\_SHADOWS is set when Semitransparent Shadows are enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [UNITY\_VIRTUAL\_TEXTURING](/engine/6000.7/script-reference/unityengine/rendering/builtinshaderdefine/unity-virtual-texturing.md)                                                   | Is virtual texturing enabled and supported on this platform.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
