Commit 9fe6f5f
UUM-69940 URP NRP RG uses more GPU bandwidth than URP non-RG NRP
JIRA: [UUM-69940](https://jira.unity3d.com/browse/UUM-69940)
## Changes:
It was determined that URP NRP RG uses more GPU bandwidth than URP non-RG NRP (see JIRA task for documentation + results), which is a bug.
This PR removes the gBuffer as a default global, which should reduce the bandwidth usage and is a step towards preventing the resource and texture properties to be out of sync, which is another bug. Considering that this is a breaking change for some users, we also add a sample to show how to re-enable the gBuffer if needed.
The main changes are that we use builder.UseTexture(gBuffer[i]) rather than builder.UseAllGlobalTextures(true) to reference the gBuffer in a pass. This means that we need to call material.SetTexture() in passes that use the gBuffer because it cannot be accessed from the globals anymore.
Some tests were modified as well to use the non-global gBuffer
## Sample:
The sample is a ScriptableRendererFeature that can be added to the rendering asset that will display the contents of the gBuffer and set the gBuffer components as globals after the pass using the builder.SetGlobalTextureAfterPass method. It aims to show (1) how to use the gBuffer as a non-global in a pass and (2) how to set the gBuffer as global (and which names are used internally by URP)1 parent 2930f0d commit 9fe6f5f
File tree
23 files changed
+698
-72
lines changed- Packages/com.unity.render-pipelines.universal
- Runtime
- 2D/Rendergraph
- Passes
- Samples~/URPRenderGraphSamples
- GbufferVisualization
- GlobalGbuffers
- Tests/SRPTests
- Packages/com.unity.testing.urp/Scripts/Runtime
- DrawRenderingLayers
- Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/060_Deferred
23 files changed
+698
-72
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
627 | | - | |
| 627 | + | |
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
626 | 635 | | |
627 | 636 | | |
628 | 637 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | 115 | | |
120 | 116 | | |
121 | 117 | | |
| |||
Lines changed: 0 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | 227 | | |
236 | 228 | | |
237 | 229 | | |
| |||
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
| |||
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
134 | | - | |
| 136 | + | |
135 | 137 | | |
136 | 138 | | |
137 | 139 | | |
| |||
152 | 154 | | |
153 | 155 | | |
154 | 156 | | |
| 157 | + | |
155 | 158 | | |
156 | 159 | | |
157 | 160 | | |
| |||
160 | 163 | | |
161 | 164 | | |
162 | 165 | | |
| 166 | + | |
163 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
164 | 171 | | |
165 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
166 | 176 | | |
167 | 177 | | |
168 | 178 | | |
| |||
174 | 184 | | |
175 | 185 | | |
176 | 186 | | |
| 187 | + | |
| 188 | + | |
177 | 189 | | |
178 | 190 | | |
179 | 191 | | |
| |||
Lines changed: 15 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
| |||
264 | 265 | | |
265 | 266 | | |
266 | 267 | | |
267 | | - | |
| 268 | + | |
268 | 269 | | |
269 | 270 | | |
270 | 271 | | |
| 272 | + | |
271 | 273 | | |
| 274 | + | |
272 | 275 | | |
273 | 276 | | |
274 | 277 | | |
| 278 | + | |
275 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
276 | 283 | | |
277 | | - | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
278 | 288 | | |
279 | 289 | | |
280 | 290 | | |
| |||
315 | 325 | | |
316 | 326 | | |
317 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
318 | 331 | | |
319 | 332 | | |
320 | 333 | | |
| |||
Lines changed: 0 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | 276 | | |
281 | 277 | | |
282 | 278 | | |
| |||
286 | 282 | | |
287 | 283 | | |
288 | 284 | | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | 285 | | |
310 | 286 | | |
Lines changed: 14 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
637 | 637 | | |
638 | 638 | | |
639 | 639 | | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | 640 | | |
647 | 641 | | |
648 | 642 | | |
| |||
856 | 850 | | |
857 | 851 | | |
858 | 852 | | |
859 | | - | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | 853 | | |
866 | 854 | | |
867 | 855 | | |
| |||
1885 | 1873 | | |
1886 | 1874 | | |
1887 | 1875 | | |
| 1876 | + | |
1888 | 1877 | | |
1889 | 1878 | | |
1890 | 1879 | | |
| |||
1896 | 1885 | | |
1897 | 1886 | | |
1898 | 1887 | | |
1899 | | - | |
| 1888 | + | |
1900 | 1889 | | |
1901 | 1890 | | |
1902 | 1891 | | |
| |||
1919 | 1908 | | |
1920 | 1909 | | |
1921 | 1910 | | |
| 1911 | + | |
| 1912 | + | |
1922 | 1913 | | |
1923 | 1914 | | |
1924 | 1915 | | |
| 1916 | + | |
1925 | 1917 | | |
| 1918 | + | |
| 1919 | + | |
1926 | 1920 | | |
1927 | | - | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
1928 | 1925 | | |
1929 | 1926 | | |
1930 | 1927 | | |
| |||
1963 | 1960 | | |
1964 | 1961 | | |
1965 | 1962 | | |
| 1963 | + | |
| 1964 | + | |
1966 | 1965 | | |
1967 | 1966 | | |
1968 | 1967 | | |
| |||
2177 | 2176 | | |
2178 | 2177 | | |
2179 | 2178 | | |
2180 | | - | |
| 2179 | + | |
2181 | 2180 | | |
2182 | 2181 | | |
2183 | 2182 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
0 commit comments