Skill: Validate a Unity URP Render Graph Renderer Feature
Purpose
Review a Unity 6+ URP Render Graph ScriptableRendererFeature and its associated pass implementation for correctness issues related to material binding, resource wiring, render graph texture creation, static render function structure, global resource exposure, and API/version usage.
When to Use
Use this skill when:
- reviewing AI-generated Unity URP Render Graph renderer feature code
- validating a custom
ScriptableRendererFeature before integrating it
- checking for common Render Graph resource wiring and pass setup mistakes
- diagnosing suspicious but plausible Render Graph pass implementations
- reviewing whether a custom raster/blit/copy pass uses the most appropriate Render Graph helper APIs
Inputs
The skill should expect:
- Unity version
- URP version
- Render Graph renderer feature code to review
ScriptableRendererFeature
- associated pass code
- or both
- Intended behavior
- Expected inputs/outputs, if known
- Optional constraints
- project conventions
- required pass type
- known resources
- required material/shader properties
Output Format
The skill must return results in the following structure:
1. Validation Summary
A short overall assessment of the implementation.
2. Confirmed Issues
Concrete issues directly supported by the provided code.
3. Likely Issues / Risky Assumptions
Potential issues that depend on missing context or incomplete information.
4. Recommended Fixes
Minimal targeted fixes for each issue.
5. Corrected Snippets
Small corrected code snippets where useful.
6. Missing Information
Any information needed to validate the code with higher confidence.
Validation Checklist
1. Material Binding
Check that:
- materials are declared clearly
- serialized materials are exposed correctly when needed
- materials are passed into the pass correctly
- null handling exists where required
- declared materials are actually used
- all required material inputs are bound before execution
- the primary input texture is explicitly bound when the shader expects one
- auxiliary textures and parameter textures are also bound explicitly
- texture/property binding matches the shader’s expected property names
Flag as an issue when:
- a material is declared or passed but not actually used
- only secondary textures or parameters are bound while the main input texture is omitted
- the pass binds a mask/noise/auxiliary texture but fails to bind the primary color/input texture
- required shader properties are assumed to exist without being set
- property names are inconsistent or ambiguous
- the code relies on implicit main texture binding when explicit binding is required by the pass pattern
Prefer patterns where:
- the material is created or assigned clearly
- the primary source texture is bound explicitly
- all auxiliary textures are bound explicitly
- property names are consistent and intentional
- null or missing-resource cases are handled or reported
2. Texture Resource Wiring
Check that:
- sampled/read textures, write targets, and auxiliary textures are clearly distinguished
- textures used with
UseTexture(...) are appropriate for read access
- textures used with
SetRenderAttachment(...) are appropriate as write targets
- source, destination, and auxiliary resources are not confused
- all expected textures are explicitly wired
- texture property names are explicit and consistent when materials are involved
- the implementation does not invent texture availability
- multi-texture resource usage is handled explicitly rather than implicitly
Flag as an issue when:
- a texture intended as an input/read resource is instead used as a write target without justification
- a destination/write target is confused with a sampled input
- auxiliary textures are used without being clearly sourced or wired
- a required texture resource is missing from the pass setup
- read/write resource roles are ambiguous or inconsistent
3. Execution Structure / Static Render Function
Check that:
- the render function is declared as
static
- the execution structure matches the target pass type and API style
- pass data is wired correctly into execution
- resources are accessed in the correct stage
- execution logic is consistent with the intended render pass behavior
- every
PassData field used by the render function is explicitly assigned during pass setup for the current recording
- the implementation does not rely on default values or previously assigned
PassData state
- resource handles stored in
PassData are assigned fresh for the current frame/pass recording and are not left dangling from prior usage
Flag as an issue when:
- the render function is not
static
- the implementation uses an instance method where the API pattern expects a static render function
- pass data or required resources are accessed through instance state instead of the pass data/context provided to the static function
- execution flow does not match the expected render graph or pass execution pattern
- a
PassData field is read in the render function but is not clearly assigned during pass setup
- only some
PassData fields are reassigned while others may retain stale values from previous pooled usage
- a resource handle stored in
PassData may survive from a previous frame or pass due to incomplete reassignment
- the implementation risks using a dangling or stale handle because pass data is not fully initialized each time it is recorded
Prefer:
- explicitly assigning every
PassData field used by the pass during each RecordRenderGraph(...) call
- treating
PassData as transient per-recording data, not persistent state
- avoiding partial initialization of pooled pass data objects
4. Render Graph Descriptor Validation
Check that:
- the implementation does not create a new
TextureDesc by default when an appropriate graph-derived descriptor can be used directly
- when a texture should match the active render target, the descriptor is sourced from the relevant render graph resource first, such as:
resourceData.activeColorTexture.GetDescriptor(renderGraph)
- or another appropriate existing graph-backed resource
- only the fields that actually need to differ are modified after sourcing the descriptor
- descriptor fields such as name, depth bits, format, and MSAA are intentionally preserved or intentionally overridden
- any manual reconstruction of descriptor data is justified by a specific requirement
Flag as an issue when:
- the code creates a fresh
TextureDesc without first attempting to reuse a graph-derived descriptor
- width and height are manually copied into a new descriptor structure by default
cameraTargetDescriptor is used as the primary source when a render-graph-derived descriptor is available and more accurate
- important properties such as MSAA, graphics format, or compatibility with the active render target are dropped accidentally
- descriptor reconstruction is used as a convenience shortcut rather than a necessary divergence from the source resource
Preferred rule:
- Do not create a new
TextureDesc unless a graph-derived descriptor cannot be used directly or the texture must intentionally diverge from the source resource.
Preferred pattern:
- get the descriptor from the relevant render graph resource
- modify only the fields that must change
- create the texture from that derived descriptor whenever possible
Examples:
Preferred
RenderTextureDescriptor desc = resourceData.activeColorTexture.GetDescriptor(renderGraph);
desc.depthBufferBits = 0;
desc.name = "New name";
// other desired paramters
passData.targetTexture = renderGraph.CreateTexture(desc);
5. Manual Copy Pass Simplification
Check that:
- simple texture copy operations are not implemented as full custom raster passes when a built-in Render Graph helper is sufficient
- passes that only read one texture and write it unchanged to another target are simplified where appropriate
- the implementation prefers the most appropriate built-in helper for the target API/platform context
AddCopyPass(...) is not recommended by default if a more compatible AddBlitPass(...) overload should be preferred in the current environment
Flag as an issue when:
- a raster pass exists only to copy one texture into another
- the pass uses no material and no custom processing
- the render function only performs a simple blit/copy equivalent
- the implementation uses a full custom raster pass where a built-in copy/blit helper would express the same behavior more directly
Prefer:
- the appropriate
AddBlitPass(...) overload for straightforward copy-like operations when that is the recommended and more compatible path
AddCopyPass(...) only when it is explicitly appropriate and supported for the target API/platform context
- a custom raster pass only when the copy requires additional logic or non-trivial behavior
6. Manual Blit Pass Simplification
Check that:
- straightforward fullscreen material blits are not implemented as custom raster passes when
renderGraph.AddBlitPass(...) would express the same behavior more directly
- custom raster passes are only used for blits when additional logic or non-trivial behavior is actually required
- simple source-to-destination material blits use the most direct render graph helper available
Flag as an issue when:
- a raster pass reads one source texture and writes one destination texture
- the pass uses a material but no additional custom pass logic
- the render function only performs a simple fullscreen blit
renderGraph.AddBlitPass(...) would provide an equivalent result more clearly
Prefer:
renderGraph.AddBlitPass(...) for straightforward fullscreen material blits
- a custom raster pass only when extra logic, multiple operations, conditional behavior, or special setup is actually required
7. Global Resource Exposure
Check that:
- textures and buffers are not exposed globally unless explicitly requested or clearly required by a downstream consumer
- when global exposure is required in a render graph pass, the implementation uses the appropriate render graph publication mechanism
- direct command buffer global state mutation is not used as a substitute for render graph resource publication
- global exposure is not extending resource lifetime unnecessarily or reducing aliasing opportunities without justification
Flag as an issue when:
SetGlobalTextureAfterPass is used without a clear consumer
context.cmd.SetGlobalTexture(...) is used inside a render graph pass where render graph resource publication is the appropriate mechanism
- global exposure is used as a convenience shortcut instead of explicit pass-to-pass wiring
- hidden coupling is introduced unnecessarily
- a globally exposed texture may be kept alive longer than necessary due to downstream
UseGlobalTexture(...) or UseAllGlobalTextures() usage, increasing memory pressure or reducing aliasing opportunities
Prefer:
- no global exposure by default
- explicit resource wiring where possible
builder.SetGlobalTextureAfterPass(...) only when global publication is truly required in render graph
- resource lifetimes that remain as local and short-lived as possible
8. Renderer Feature Input Declaration
Check that:
- the
ScriptableRendererFeature and its associated pass declare required pipeline inputs using ConfigureInput(...) when needed
- the requested input flags match the feature’s intended behavior and visible resource usage
- the pass does not rely on pipeline-provided inputs without declaring them when required by the target API pattern
- unnecessary input requests are not declared by default, especially when they may introduce extra copies, intermediate resources, or avoidable pipeline work
Flag as an issue when:
- the feature’s pass uses or is clearly intended to use a pipeline-provided input but does not declare it with
ConfigureInput(...)
ConfigureInput(...) requests inputs that the feature/pass does not appear to use
- the declared input flags do not match the intended effect behavior
- the effect description, code, and declared inputs imply conflicting requirements
- unnecessary declared inputs may force extra copies, extra pass work, or other avoidable performance costs
Classification guidance:
- mark as a confirmed issue when the code clearly shows a required input is used but not declared
- mark as a likely issue when the intended effect implies a required input but the visible code does not fully prove shader/resource usage
- treat unnecessary input declarations as higher severity when they are likely to introduce additional copies or other measurable runtime cost
Guardrails
The skill must:
- avoid inventing unsupported APIs
- distinguish confirmed issues from likely issues
- prefer minimal targeted fixes over broad rewrites
- explain why each issue matters
- flag hidden coupling and unnecessary global state
- state when the provided code is insufficient for full certainty
Non-Goals
- guarantee runtime correctness
- rewrite the entire renderer feature unless necessary
- validate unrelated gameplay logic
- validate shader internals unless directly relevant to pass wiring or binding
Evaluation Criteria
A successful validation should:
- catch real wiring and API issues
- identify suspicious but plausible mistakes
- provide actionable fixes
- avoid false certainty
- improve trust in generated render pass code
Notes for Future Expansion
As new recurring issues are discovered, extend this checklist with additional rules such as:
- pass ordering / injection point validation
- resource lifetime and cleanup checks
- read/write hazard detection
- unnecessary copies or allocations
- camera depth/color dependency validation
- multi-pass dependency validation
- override material correctness
- pass configuration
1---
2name: validate-urp-render-graph-renderer-feature
3description: Use when the user wants to review or validate a Unity 6+ URP ScriptableRendererFeature that uses the Render Graph API. Checks for correctness issues - resource wiring, material binding, execution structure, descriptor usage, global resource exposure, and Render Graph best practices.
4metadata:
5 source: https://skillmd.com/skills/gabrielmoreira/validate-urp-render-graph-renderer-feature
6---
7
8# Skill: Validate a Unity URP Render Graph Renderer Feature
9
10## Purpose
11Review a Unity 6+ URP Render Graph `ScriptableRendererFeature` and its associated pass implementation for correctness issues related to material binding, resource wiring, render graph texture creation, static render function structure, global resource exposure, and API/version usage.
12
13## When to Use
14Use this skill when:
15- reviewing AI-generated Unity URP Render Graph renderer feature code
16- validating a custom `ScriptableRendererFeature` before integrating it
17- checking for common Render Graph resource wiring and pass setup mistakes
18- diagnosing suspicious but plausible Render Graph pass implementations
19- reviewing whether a custom raster/blit/copy pass uses the most appropriate Render Graph helper APIs
20
21## Inputs
22The skill should expect:
23- **Unity version**
24- **URP version**
25- **Render Graph renderer feature code to review**
26 - `ScriptableRendererFeature`
27 - associated pass code
28 - or both
29- **Intended behavior**
30- **Expected inputs/outputs**, if known
31- **Optional constraints**
32 - project conventions
33 - required pass type
34 - known resources
35 - required material/shader properties
36
37## Output Format
38The skill must return results in the following structure:
39
40### 1. Validation Summary
41A short overall assessment of the implementation.
42
43### 2. Confirmed Issues
44Concrete issues directly supported by the provided code.
45
46### 3. Likely Issues / Risky Assumptions
47Potential issues that depend on missing context or incomplete information.
48
49### 4. Recommended Fixes
50Minimal targeted fixes for each issue.
51
52### 5. Corrected Snippets
53Small corrected code snippets where useful.
54
55### 6. Missing Information
56Any information needed to validate the code with higher confidence.
57
58## Validation Checklist
59
60### 1. Material Binding
61Check that:
62- materials are declared clearly
63- serialized materials are exposed correctly when needed
64- materials are passed into the pass correctly
65- null handling exists where required
66- declared materials are actually used
67- **all required material inputs are bound before execution**
68- **the primary input texture is explicitly bound when the shader expects one**
69- auxiliary textures and parameter textures are also bound explicitly
70- texture/property binding matches the shader’s expected property names
71
72Flag as an issue when:
73- a material is declared or passed but not actually used
74- only secondary textures or parameters are bound while the main input texture is omitted
75- the pass binds a mask/noise/auxiliary texture but fails to bind the primary color/input texture
76- required shader properties are assumed to exist without being set
77- property names are inconsistent or ambiguous
78- the code relies on implicit main texture binding when explicit binding is required by the pass pattern
79
80Prefer patterns where:
811. the material is created or assigned clearly
822. the primary source texture is bound explicitly
833. all auxiliary textures are bound explicitly
844. property names are consistent and intentional
855. null or missing-resource cases are handled or reported
86
87### 2. Texture Resource Wiring
88Check that:
89- sampled/read textures, write targets, and auxiliary textures are clearly distinguished
90- textures used with `UseTexture(...)` are appropriate for read access
91- textures used with `SetRenderAttachment(...)` are appropriate as write targets
92- source, destination, and auxiliary resources are not confused
93- all expected textures are explicitly wired
94- texture property names are explicit and consistent when materials are involved
95- the implementation does not invent texture availability
96- multi-texture resource usage is handled explicitly rather than implicitly
97
98Flag as an issue when:
99- a texture intended as an input/read resource is instead used as a write target without justification
100- a destination/write target is confused with a sampled input
101- auxiliary textures are used without being clearly sourced or wired
102- a required texture resource is missing from the pass setup
103- read/write resource roles are ambiguous or inconsistent
104
105### 3. Execution Structure / Static Render Function
106Check that:
107- the render function is declared as `static`
108- the execution structure matches the target pass type and API style
109- pass data is wired correctly into execution
110- resources are accessed in the correct stage
111- execution logic is consistent with the intended render pass behavior
112- every `PassData` field used by the render function is explicitly assigned during pass setup for the current recording
113- the implementation does not rely on default values or previously assigned `PassData` state
114- resource handles stored in `PassData` are assigned fresh for the current frame/pass recording and are not left dangling from prior usage
115
116Flag as an issue when:
117- the render function is not `static`
118- the implementation uses an instance method where the API pattern expects a static render function
119- pass data or required resources are accessed through instance state instead of the pass data/context provided to the static function
120- execution flow does not match the expected render graph or pass execution pattern
121- a `PassData` field is read in the render function but is not clearly assigned during pass setup
122- only some `PassData` fields are reassigned while others may retain stale values from previous pooled usage
123- a resource handle stored in `PassData` may survive from a previous frame or pass due to incomplete reassignment
124- the implementation risks using a dangling or stale handle because pass data is not fully initialized each time it is recorded
125
126Prefer:
127- explicitly assigning every `PassData` field used by the pass during each `RecordRenderGraph(...)` call
128- treating `PassData` as transient per-recording data, not persistent state
129- avoiding partial initialization of pooled pass data objects
130
131### 4. Render Graph Descriptor Validation
132Check that:
133- the implementation does **not** create a new `TextureDesc` by default when an appropriate graph-derived descriptor can be used directly
134- when a texture should match the active render target, the descriptor is sourced from the relevant render graph resource first, such as:
135 - `resourceData.activeColorTexture.GetDescriptor(renderGraph)`
136 - or another appropriate existing graph-backed resource
137- only the fields that actually need to differ are modified after sourcing the descriptor
138- descriptor fields such as name, depth bits, format, and MSAA are intentionally preserved or intentionally overridden
139- any manual reconstruction of descriptor data is justified by a specific requirement
140
141Flag as an issue when:
142- the code creates a fresh `TextureDesc` without first attempting to reuse a graph-derived descriptor
143- width and height are manually copied into a new descriptor structure by default
144- `cameraTargetDescriptor` is used as the primary source when a render-graph-derived descriptor is available and more accurate
145- important properties such as MSAA, graphics format, or compatibility with the active render target are dropped accidentally
146- descriptor reconstruction is used as a convenience shortcut rather than a necessary divergence from the source resource
147
148Preferred rule:
149- **Do not create a new `TextureDesc` unless a graph-derived descriptor cannot be used directly or the texture must intentionally diverge from the source resource.**
150
151Preferred pattern:
1521. get the descriptor from the relevant render graph resource
1532. modify only the fields that must change
1543. create the texture from that derived descriptor whenever possible
155
156Examples:
157
158#### Preferred
159```csharp
160RenderTextureDescriptor desc = resourceData.activeColorTexture.GetDescriptor(renderGraph);
161desc.depthBufferBits = 0;
162desc.name = "New name";
163// other desired paramters
164passData.targetTexture = renderGraph.CreateTexture(desc);
165```
166
167### 5. Manual Copy Pass Simplification
168Check that:
169- simple texture copy operations are not implemented as full custom raster passes when a built-in Render Graph helper is sufficient
170- passes that only read one texture and write it unchanged to another target are simplified where appropriate
171- the implementation prefers the most appropriate built-in helper for the target API/platform context
172- `AddCopyPass(...)` is not recommended by default if a more compatible `AddBlitPass(...)` overload should be preferred in the current environment
173
174Flag as an issue when:
175- a raster pass exists only to copy one texture into another
176- the pass uses no material and no custom processing
177- the render function only performs a simple blit/copy equivalent
178- the implementation uses a full custom raster pass where a built-in copy/blit helper would express the same behavior more directly
179
180Prefer:
181- the appropriate `AddBlitPass(...)` overload for straightforward copy-like operations when that is the recommended and more compatible path
182- `AddCopyPass(...)` only when it is explicitly appropriate and supported for the target API/platform context
183- a custom raster pass only when the copy requires additional logic or non-trivial behavior
184
185### 6. Manual Blit Pass Simplification
186Check that:
187- straightforward fullscreen material blits are not implemented as custom raster passes when `renderGraph.AddBlitPass(...)` would express the same behavior more directly
188- custom raster passes are only used for blits when additional logic or non-trivial behavior is actually required
189- simple source-to-destination material blits use the most direct render graph helper available
190
191Flag as an issue when:
192- a raster pass reads one source texture and writes one destination texture
193- the pass uses a material but no additional custom pass logic
194- the render function only performs a simple fullscreen blit
195- `renderGraph.AddBlitPass(...)` would provide an equivalent result more clearly
196
197Prefer:
198- `renderGraph.AddBlitPass(...)` for straightforward fullscreen material blits
199- a custom raster pass only when extra logic, multiple operations, conditional behavior, or special setup is actually required
200
201### 7. Global Resource Exposure
202Check that:
203- textures and buffers are not exposed globally unless explicitly requested or clearly required by a downstream consumer
204- when global exposure is required in a render graph pass, the implementation uses the appropriate render graph publication mechanism
205- direct command buffer global state mutation is not used as a substitute for render graph resource publication
206- global exposure is not extending resource lifetime unnecessarily or reducing aliasing opportunities without justification
207
208Flag as an issue when:
209- `SetGlobalTextureAfterPass` is used without a clear consumer
210- `context.cmd.SetGlobalTexture(...)` is used inside a render graph pass where render graph resource publication is the appropriate mechanism
211- global exposure is used as a convenience shortcut instead of explicit pass-to-pass wiring
212- hidden coupling is introduced unnecessarily
213- a globally exposed texture may be kept alive longer than necessary due to downstream `UseGlobalTexture(...)` or `UseAllGlobalTextures()` usage, increasing memory pressure or reducing aliasing opportunities
214
215Prefer:
216- no global exposure by default
217- explicit resource wiring where possible
218- `builder.SetGlobalTextureAfterPass(...)` only when global publication is truly required in render graph
219- resource lifetimes that remain as local and short-lived as possible
220
221### 8. Renderer Feature Input Declaration
222Check that:
223- the `ScriptableRendererFeature` and its associated pass declare required pipeline inputs using `ConfigureInput(...)` when needed
224- the requested input flags match the feature’s intended behavior and visible resource usage
225- the pass does not rely on pipeline-provided inputs without declaring them when required by the target API pattern
226- unnecessary input requests are not declared by default, especially when they may introduce extra copies, intermediate resources, or avoidable pipeline work
227
228Flag as an issue when:
229- the feature’s pass uses or is clearly intended to use a pipeline-provided input but does not declare it with `ConfigureInput(...)`
230- `ConfigureInput(...)` requests inputs that the feature/pass does not appear to use
231- the declared input flags do not match the intended effect behavior
232- the effect description, code, and declared inputs imply conflicting requirements
233- unnecessary declared inputs may force extra copies, extra pass work, or other avoidable performance costs
234
235Classification guidance:
236- mark as a **confirmed issue** when the code clearly shows a required input is used but not declared
237- mark as a **likely issue** when the intended effect implies a required input but the visible code does not fully prove shader/resource usage
238- treat unnecessary input declarations as higher severity when they are likely to introduce additional copies or other measurable runtime cost
239
240## Guardrails
241The skill must:
242- avoid inventing unsupported APIs
243- distinguish **confirmed** issues from **likely** issues
244- prefer minimal targeted fixes over broad rewrites
245- explain why each issue matters
246- flag hidden coupling and unnecessary global state
247- state when the provided code is insufficient for full certainty
248
249## Non-Goals
250- guarantee runtime correctness
251- rewrite the entire renderer feature unless necessary
252- validate unrelated gameplay logic
253- validate shader internals unless directly relevant to pass wiring or binding
254
255## Evaluation Criteria
256A successful validation should:
257- catch real wiring and API issues
258- identify suspicious but plausible mistakes
259- provide actionable fixes
260- avoid false certainty
261- improve trust in generated render pass code
262
263## Notes for Future Expansion
264As new recurring issues are discovered, extend this checklist with additional rules such as:
265- pass ordering / injection point validation
266- resource lifetime and cleanup checks
267- read/write hazard detection
268- unnecessary copies or allocations
269- camera depth/color dependency validation
270- multi-pass dependency validation
271- override material correctness
272- pass configuration