Skip to content

Follow-ups: SRP batcher for world and VOBs (#558 review) #563

Backlog

Description

@BoroBongo

Follow-ups from the review of #558 (SRP batcher for the world and VOBs). The PR fixed the focus-highlight tint, the shared-material writes and the docs; these were left for later.

  • EditMode guard for SRP batcher compatibility. One property outside UnityPerMaterial (as _FocusBrightness was) silently draws ~1900 VOBs and the world chunks one by one, and nobody notices until someone profiles. Add a text-parsing test over Assets/Gothic-Core/Shaders/*.shader: for every shader with a CBUFFER_START(UnityPerMaterial), every non-texture Properties entry is inside the buffer, and the buffer body is the same in every pass. Don't use ShaderUtil.GetSRPBatcherCompatibilityCode (internal, reflection breaks across Unity versions).

  • A VOB whose world light comes back empty keeps its old _VobLightTint. It's harmless today (the materials are new per VOB), but becomes stale if VOB materials are ever reused.

  • Not SRP batcher compatible yet: Barrier, GothicUI, Thunder and Bink. They are cheap today; check whether any of them gets many draws.

  • Measure on Quest (P5). SetPass and frame time at one fixed spot (Khorinis market / Old Camp), before and after.

  • Decision for later: if VOB materials are ever shared (GPU Resident Drawer, static batching), the tint and the light indices need another home.

  • To check separately: render queue of the focused Lit/World copy. I noticed this by accident while testing the review fixes, so it may be a non-issue. DynamicMaterialService maps Lit/World to Constants.ShaderTypeDefault, which gives the focused copy renderQueue 0 (Background) instead of the shader's 2000 (Geometry). In the test the highlighted barrel looked fine. Check whether 0 is intended or whether it should be -1 (the shader's own queue), and whether the draw order of focused objects is affected. This behavior predates perf: the world and its VOBs are SRP batched again (SetPass 3100 -> 190 with shadows) #558; perf: the world and its VOBs are SRP batched again (SetPass 3100 -> 190 with shadows) #558 didn't change it.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions