Shader graph bug: undeclared identifier 'UNITY_DISPLAY_ORIENTATION_PRETRANSFORM'

Shader graph is broken somehow (I spent entire day). I tried on 2021 and 2022 latest versions (From hub and manual download). Built-in shaders and vulkan api on android.

[197870-compiled-shader-graphs-new-shader-graph.zip|197870] (RMB>Save As)

Even blank shader graph is giving this error:

undeclared identifier 'UNITY_DISPLAY_ORIENTATION_PRETRANSFORM'
Compiling Subshader: 0, Pass: BuiltIn Forward, Vertex program with DIRECTIONAL LIGHTPROBE_SH _ADDITIONAL_LIGHTS_VERTEX
Platform defines: SHADER_API_MOBILE UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_ENABLE_REFLECTION_BUFFERS UNITY_HARDWARE_TIER2 UNITY_LIGHTMAP_RGBM_ENCODING UNITY_NO_CUBEMAP_ARRAY UNITY_NO_RGBM UNITY_NO_SCREENSPACE_SHADOWS UNITY_PASS_FORWARDBASE UNITY_PBS_USE_BRDF2 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION
Disabled keywords: DIRLIGHTMAP_COMBINED DYNAMICLIGHTMAP_ON FOG_EXP FOG_EXP2 FOG_LINEAR INSTANCING_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING SHADER_API_GLES30 SHADOWS_SCREEN SHADOWS_SHADOWMASK UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_PBS_USE_BRDF1 UNITY_PBS_USE_BRDF3 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_VIRTUAL_TEXTURING VERTEXLIGHT_ON _ADDITIONAL_LIGHTS _ADDITIONAL_LIGHT_SHADOWS _ADDITIONAL_OFF _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN _SCREEN_SPACE_OCCLUSION _SHADOWS_SOFT

I stumbled across this myself. Not a fix, but the error goes away if you uncheck “Apply display rotation during rendering” in the Vulkan section of Player Settings. Apparently this is needed for correctly displaying rotations in landscape mode, see the documentation.

In the Unity 2023.1.0a21 release notes they mention a fix

Android: Fixed an incorrect value of Android/Vulkan specific shader constant UNITY_DISPLAY_ORIENTATION_PRETRANSFORM when “Apply display rotation during rendering” was enabled. (UUM-5654)

Unfortunately I’m not able to find an issue tracker entry for UUM-5654. I suspect they’ll backport the fix to their LTS versions.

I am getting this error on 2021.3.10 :frowning:

Edit: I am using shadergraph with Built-in Render Pipeline

switching to unity 2022.3.7 from 2021 fixed this issues for me, seems like 2021 bug