Commit 47e7352
authored
Refactor the
# Objective
- I strongly agree with the doc style suggested by @mate-h in #23110.
When I originally wrote the vignette docs, I just tried to match the
style of the initial chromatic aberration comments without thinking too
much about it. Now, I’ve updated them to be consistent with the current
lens distortion docs.
- I also made a few other minor changes to make the code cleaner.
## Solution
- Merged Samplers: Replaced `source_sampler` and
`chromatic_aberration_lut_sampler` with a single `common_sampler` (Both
samplers are configured identically).
- CPU-side Clamping: Moved mathematical bounds checks (e.g., clamp, max)
from WGSL shaders into `prepare_post_processing_uniforms`. I only clamp
values that would cause shader errors or result in unexpected behavior.
- Unified Thresholds: Standardized the “skip post-processing” check to >
1e-4 for both `ChromaticAberration` and `Vignette ` extraction, avoiding
unnecessary draw calls for negligible values.
- Cleanup: Removed redundant `DEFAULT_*` constants in favor of inline
literals in Default implementations.
## Testing
- `post-processing` example works properly.
---effect_stack post-processing module (#23928)1 parent 6e7b436 commit 47e7352
6 files changed
Lines changed: 46 additions & 94 deletions
File tree
- crates/bevy_post_process/src/effect_stack
Lines changed: 4 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | 23 | | |
31 | 24 | | |
32 | 25 | | |
| |||
79 | 72 | | |
80 | 73 | | |
81 | 74 | | |
82 | | - | |
83 | | - | |
| 75 | + | |
| 76 | + | |
84 | 77 | | |
85 | 78 | | |
86 | 79 | | |
| |||
97 | 90 | | |
98 | 91 | | |
99 | 92 | | |
100 | | - | |
101 | | - | |
| 93 | + | |
| 94 | + | |
102 | 95 | | |
103 | 96 | | |
104 | 97 | | |
| |||
112 | 105 | | |
113 | 106 | | |
114 | 107 | | |
115 | | - | |
116 | 108 | | |
117 | | - | |
118 | | - | |
119 | 109 | | |
120 | | - | |
121 | 110 | | |
122 | | - | |
123 | 111 | | |
124 | 112 | | |
Lines changed: 5 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | 22 | | |
25 | | - | |
| 23 | + | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
| |||
56 | 54 | | |
57 | 55 | | |
58 | 56 | | |
59 | | - | |
| 57 | + | |
60 | 58 | | |
61 | 59 | | |
62 | 60 | | |
| |||
65 | 63 | | |
66 | 64 | | |
67 | 65 | | |
68 | | - | |
| 66 | + | |
69 | 67 | | |
70 | 68 | | |
71 | 69 | | |
| |||
82 | 80 | | |
83 | 81 | | |
84 | 82 | | |
85 | | - | |
| 83 | + | |
86 | 84 | | |
87 | 85 | | |
88 | 86 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 83 | + | |
| 84 | + | |
88 | 85 | | |
89 | 86 | | |
90 | 87 | | |
| |||
176 | 173 | | |
177 | 174 | | |
178 | 175 | | |
179 | | - | |
| 176 | + | |
180 | 177 | | |
181 | 178 | | |
182 | 179 | | |
| |||
190 | 187 | | |
191 | 188 | | |
192 | 189 | | |
193 | | - | |
| 190 | + | |
194 | 191 | | |
195 | 192 | | |
196 | 193 | | |
197 | | - | |
198 | | - | |
199 | 194 | | |
200 | 195 | | |
201 | 196 | | |
| |||
208 | 203 | | |
209 | 204 | | |
210 | 205 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 206 | + | |
220 | 207 | | |
221 | 208 | | |
222 | 209 | | |
| |||
225 | 212 | | |
226 | 213 | | |
227 | 214 | | |
228 | | - | |
229 | | - | |
| 215 | + | |
230 | 216 | | |
231 | 217 | | |
232 | 218 | | |
| |||
335 | 321 | | |
336 | 322 | | |
337 | 323 | | |
338 | | - | |
| 324 | + | |
339 | 325 | | |
340 | | - | |
341 | 326 | | |
342 | 327 | | |
343 | 328 | | |
| |||
366 | 351 | | |
367 | 352 | | |
368 | 353 | | |
369 | | - | |
| 354 | + | |
370 | 355 | | |
371 | 356 | | |
372 | 357 | | |
| |||
398 | 383 | | |
399 | 384 | | |
400 | 385 | | |
401 | | - | |
| 386 | + | |
402 | 387 | | |
403 | 388 | | |
404 | 389 | | |
| |||
419 | 404 | | |
420 | 405 | | |
421 | 406 | | |
| 407 | + | |
422 | 408 | | |
423 | 409 | | |
424 | 410 | | |
| |||
444 | 430 | | |
445 | 431 | | |
446 | 432 | | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
451 | 437 | | |
452 | 438 | | |
453 | 439 | | |
| |||
466 | 452 | | |
467 | 453 | | |
468 | 454 | | |
469 | | - | |
470 | | - | |
| 455 | + | |
| 456 | + | |
471 | 457 | | |
472 | 458 | | |
473 | 459 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | 15 | | |
31 | 16 | | |
32 | 17 | | |
| |||
91 | 76 | | |
92 | 77 | | |
93 | 78 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
98 | 83 | | |
99 | | - | |
| 84 | + | |
100 | 85 | | |
101 | 86 | | |
102 | 87 | | |
| |||
112 | 97 | | |
113 | 98 | | |
114 | 99 | | |
115 | | - | |
116 | | - | |
| 100 | + | |
| 101 | + | |
117 | 102 | | |
118 | 103 | | |
119 | 104 | | |
120 | 105 | | |
121 | 106 | | |
122 | 107 | | |
123 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
124 | 113 | | |
125 | 114 | | |
126 | | - | |
127 | 115 | | |
128 | | - | |
129 | 116 | | |
130 | | - | |
131 | 117 | | |
132 | | - | |
133 | 118 | | |
134 | | - | |
135 | 119 | | |
136 | | - | |
137 | 120 | | |
138 | | - | |
139 | 121 | | |
140 | | - | |
141 | 122 | | |
142 | 123 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| |||
0 commit comments