book/13-reference-cheatsheet.md

13. Reference (cheat sheet)

A page to quickly find SRP/URP/RenderGraph/HLSL core symbols by “signature + definition location + reference (xref)” based on Unity 6.3 (6000.3) / URP 17.3.0

13. Reference (cheat sheet): Class/Function/Keyword/Variable

This page is a reference for “quickly finding things when you get confused while studying.”
In particular, HLSL items do not provide “concepts” but return value/signature/definition location/representative reference (xref).

13.0 Accurate Reference (Generated, URP 17.3.0)

13.1 C# (SRP/URP) core types

13.2 URP Frame Data (frequently used, RenderGraph path)

These are the data types accessed by ContextContainer frameData in the RenderGraph path.

Official documentation:

13.3 HLSL(URP) core functions: signature/return value/definition location

The table below is the “Learning Core” extracted from the URP 17.3.0 generated index.

For the full list, search @@TOK_15_20e1594e@@. Symbol Returns Params(요약) Defined-in related
TransformObjectToHClip float4 float3 positionOS <CORE>/ShaderLibrary/SpaceTransforms.hlsl:108 08
GetVertexPositionInputs VertexPositionInputs float3 positionOS <URP>/ShaderLibrary/ShaderVariablesFunctions.hlsl:8 21
GetVertexNormalInputs VertexNormalInputs float3 normalOS, float4 tangentOS <URP>/ShaderLibrary/ShaderVariablesFunctions.hlsl:22 21
GetMainLight Light (overloads) <URP>/ShaderLibrary/RealtimeLights.hlsl 07
GetAdditionalLight Light uint i, float3 positionWS <URP>/ShaderLibrary/RealtimeLights.hlsl 07
GetAdditionalLightsCount int (none) <URP>/ShaderLibrary/RealtimeLights.hlsl:271 07
UniversalFragmentPBR half4 InputData, SurfaceData <URP>/ShaderLibrary/Lighting.hlsl:282 22
InitializeStandardLitSurfaceData void float2 uv, out SurfaceData <URP>/Shaders/LitInput.hlsl:252 22
InitializeInputData void Varyings, normalTS, out InputData <URP>/Shaders/LitForwardPass.hlsl:72 22

representative xref(정의 + 아이처): @@TOK_34_8394c928@@

13.4 HLSL(URP) core structure: FIELD/정의 ויציק

Search the entire list from @@TOK_35_11a7626e@@.

Structure Fields(개수) Defined-in related
Light 5 <URP>/ShaderLibrary/RealtimeLights.hlsl:12 07
InputData 23 <URP>/ShaderLibrary/Input.hlsl:43 21
SurfaceData 10 <URP>/ShaderLibrary/SurfaceData.hlsl:5 21
VertexPositionInputs 4 <URP>/ShaderLibrary/Core.hlsl:259 21
VertexNormalInputs 3 <URP>/ShaderLibrary/Core.hlsl:267 21
## 13.5 Forward+(Cluster) Related Symbol Type Defined-in Key Points
--- --- --- ---
_CLUSTER_LIGHT_LOOP shader keyword <URP>/ShaderLibrary/ForwardPlusKeyword.deprecated.hlsl:20 etc variant branch (Forward+)
USE_CLUSTER_LIGHT_LOOP macro(0/1) <URP>/ShaderLibrary/Core.hlsl:14 / :16 include inner loop switch
LIGHT_LOOP_BEGIN/END macros <URP>/ShaderLibrary/RealtimeLights.hlsl:28 / :36 Forward/Forward+ loop unification

The most common pitfall is that GetAdditionalLightsCount() in Forward+ can be 0.
Detailed debugging routine: 07

13.6 ShaderLab Pass tags/LightMode (9 types as of URP 17.3.0 Lit)

LightMode Purpose (Summary)
UniversalForward Forward color
UniversalGBuffer Deferred GBuffer
ShadowCaster shadow
DepthOnly Depth
DepthNormals Depth+Normal
Meta Baking
MotionVectors velocity
XRMotionVectors XR velocity(+stencil)
Universal2D 2D Renderer

Total ticket/consumption stage of the contract: @@TOK_18_b865c9ce@@

13.7 Commonly seen calls (concepts) in RenderGraph “Builder”

The exact signature may be different for different versions of URP, but conceptually you see the following call over and over again:

  • Add pass: renderGraph.AddRasterRenderPass<T>(...)
  • Texture creation: renderGraph.CreateTexture(desc)
  • Import external RTHandle: renderGraph.ImportTexture(rtHandle)
  • Read declaration: builder.UseTexture(handle, AccessFlags.Read)
  • Color target setting: builder.SetRenderAttachment(handle, index, AccessFlags.Write)
  • Execution function settings: builder.SetRenderFunc((data, ctx) => { ... })

Related: 04. RenderGraph

13.8 Frequently seen calls (concepts) in ComputeGraphContext (Compute Pass)

In the Compute pass, ComputeGraphContext is passed, usually repeating the following pattern.

  • Add pass: renderGraph.AddComputePass<T>(...)
  • UAV texture creation: desc.enableRandomWrite = true
  • Texture read/write declaration: builder.UseTexture(handle, AccessFlags.Read/Write)
  • Binding: cmd.SetComputeTextureParam(...), cmd.SetComputeBufferParam(...)
  • Run: cmd.DispatchCompute(...)

Related: 17. RenderGraph Compute/UAV

13.9 ShaderLab tag/key (representative)

  • Tags { "RenderPipeline"="UniversalPipeline" } — Declare shader for URP
  • Tags { "LightMode"="UniversalForward" } — Declaration of pass usage selected by URP
  • Queue / RenderType — Render queue/render type (opaque/transparent) classification

Related: 09. URP 호환 셰이더 작성