Skip to content

fix: keep URP 17.5 LitInput out of the DCL_Toon ForwardLit pass#95

Open
eordano wants to merge 1 commit into
mainfrom
fix/unity-6000.5-shader-compat
Open

fix: keep URP 17.5 LitInput out of the DCL_Toon ForwardLit pass#95
eordano wants to merge 1 commit into
mainfrom
fix/unity-6000.5-shader-compat

Conversation

@eordano

@eordano eordano commented Jul 20, 2026

Copy link
Copy Markdown
Member

Unity 6000.5's URP added #include "LitInput.hlsl" to LitForwardPass.hlsl, which pulls ShaderLibrary/SurfaceInput.hlsl into the one DCL translation unit that includes URP's real LitForwardPass (DCL_Toon ForwardLit) — colliding with DCL_ToonInput.hlsl (_BaseMap, Alpha, UnityPerMaterial members) and rendering avatars magenta.

Fix (+16 lines, one file): pre-claim URP's UNIVERSAL_LIT_INPUT_INCLUDED guard so the new self-include no-ops (the same guard-reuse pattern this repo already uses in Scene/URP/LitInput.hlsl), and inline the parameterless IsSurfaceTypeTransparent() that 6000.5's LitForwardPass calls — under the real file's own guard, since Shaders/Utils/SurfaceType.hlsl does not exist in 6000.4's URP. With _Surface defined 0.0f it returns false, matching the 6000.4 behavior exactly.

Cross-version verification (both zero errors, zero shader errors):

Safe to merge ahead of the upgrade PR; #9392 currently pins this branch and will repoint to main after merge.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

🔗 Merge Alignment Reminder

If this PR targets main, please make sure the corresponding changes in unity-explorer are also ready to merge.

Both repos should be merged in coordination to avoid breaking changes. Do not merge one without the other being ready.

@eordano

eordano commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

Expanded during player-build verification

The initial commit only handled the editor-visible DCL_Toon ForwardLit collision. Running actual player builds of unity-explorer (which compile the DOTS-instancing *_INSTANCING_ON shader variants that editor compiles skip) surfaced the rest — now all fixed on this branch (head de4cce8):

  • DCL_Toon.shader — pre-claim URP's UNITY_LIT_INPUT_INCLUDED guard; inline IsSurfaceTypeTransparent() (6000.4's URP has no SurfaceType.hlsl, so it's version-agnostic).
  • DCL_ToonOutline/DCL_ToonHighlightunity_ObjectToWorldGetObjectToWorldMatrix() (not declared in DOTS variants), and added the missing UNITY_VERTEX_INPUT_INSTANCE_ID member + UNITY_TRANSFER_INSTANCE_ID so the fragment stage's UNITY_SETUP_INSTANCE_ID resolves.
  • Scene/URP Lit/Unlit inputs — legacy UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO (removed in 6000.5) → UNITY_ACCESS_DOTS_INSTANCED_PROP (17 sites).
  • Avatar_CelShading_DepthNormalsPass — direct unity_ObjectToWorldGetObjectToWorldMatrix().

Cross-version player-build verified

  • 6000.5.4f1 — full IL2CPP player build of unity-explorer#9392: 0 shader errors, avatars render correctly in-world.
  • 6000.4.0f1 — player build of current dev + this branch: 0 shader errors (every API used — GetObjectToWorldMatrix, UNITY_ACCESS_DOTS_INSTANCED_PROP, the instance-id macros — exists in 6000.4).

Safe to merge ahead of the 6000.5 upgrade.

🤖 Generated with Claude Code

@eordano

eordano commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

6000.4 clean-pass player build now confirmed: SUCCEEDED, 0 shader / 0 script errors, .app produced (the 4 counted errors are the benign pulse.transport no-meta-file warnings, identical on 6000.5). Local player-build verification is complete and green on both editors with both dependency PRs pinned. Only remaining unverified target is Windows/DirectX.

- DCL_Toon ForwardLit: claim UNIVERSAL_LIT_INPUT_INCLUDED, inline
  IsSurfaceTypeTransparent (6000.4 URP has no SurfaceType.hlsl).
- Toon outline/highlight and CelShading depth-normals: GetObjectToWorldMatrix
  instead of unity_ObjectToWorld; carry the instance id into the toon
  outline fragment stage.
- Scene URP Lit/Unlit input: UNITY_ACCESS_DOTS_INSTANCED_PROP replaces the
  removed _FROM_MACRO accessor.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@eordano
eordano force-pushed the fix/unity-6000.5-shader-compat branch from de4cce8 to 5261933 Compare July 20, 2026 19:23
@eordano

eordano commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

Windows/DirectX verified. Full 6000.5.4f1 StandaloneWindows64 player build on the Windows rig succeeded — 0 shader errors, 0 CS errors across 132k log lines, Explorer.exe produced. The DCL_Toon ForwardLit, DCL/Scene, and all DOTS-instancing variants compiled clean on d3d11. This closes the last platform gap: the upgrade's shader fixes now verified on both macOS/Metal and Windows/DirectX, across both 6000.4 and 6000.5 editors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant