Blender V5.3
eevee_debug.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
11#include "draw_view.bsl.hh"
12#include "eevee_debug_shared.hh"
13#include "eevee_defines.hh"
15#include "eevee_hiz.bsl.hh"
21#include "eevee_shadow.bsl.hh"
28
29namespace eevee {
30
34
35[[vertex]] void debug_fullscreen_vert([[vertex_id]] const int vert_id,
36 [[position]] float4 &out_position,
37 [[out]] DebugVertOut &v_out)
38{
39 fullscreen_vertex(vert_id, out_position, v_out.screen_uv);
40}
41
42#define default_depth -1.0f
43
47
48 void eval_directional(LightRenderData & /*res*/, uint l_idx, LightData light)
49 {
50 if (light.tilemap_index == debug_tilemap_index) {
51 light_index = l_idx;
52 }
53 }
54 void eval_local(LightRenderData & /*res*/, uint l_idx, LightData light)
55 {
56 if (light.tilemap_index == debug_tilemap_index) {
57 light_index = l_idx;
58 }
59 }
60};
61
62template void light::foreach<SearchDebugLightCtx, LightRenderData>(const LightRenderData &,
63 SearchDebugLightCtx &,
64 LightRenderData &);
65
69
70 [[storage(5, read)]] ShadowTileMapData (&tilemaps_buf)[];
71 [[storage(6, read)]] uint (&tiles_buf)[];
74
75 ShadowSamplingTile shadow_tile_data_get(usampler2D tilemaps_tx, ShadowCoordinates coord) const
76 {
77 return shadow_tile_load(tilemaps_tx, coord.tilemap_tile, coord.tilemap_index);
78 }
79
81 {
82 float r = random::interleaved_gradient(float2(v), 0.0f, 0.0f);
83 return hue_gradient(r);
84 }
85
87 {
88 return debug_random_color(int2(v, 0));
89 }
90
91 void debug_tile_print([[maybe_unused]] ShadowTileData tile,
92 [[maybe_unused]] int4 tile_coord) const
93 {
94 /* This `printf` injection is based on string literal detection. Comment it out unless needed.
95 */
96 /* NOTE: using `#if 0` here causes a crash on exit for debug builds, stick to C++ comments. */
97 // printf("Tile (%u, %u) in Tilemap %u: page(%u, %u, %u), cache_index %u",
98 // tile_coord.x, tile_coord.y, tile_coord.z, tile.page.x, tile.page.y, tile.page.z,
99 // tile.cache_index);
100 }
101
102 float3 debug_tile_state_color(ShadowTileData tile) const
103 {
104 if (tile.do_update && tile.is_used) {
105 /* Updated. */
106 return float3(0.5f, 1, 0);
107 }
108 if (tile.is_used) {
109 /* Used but was cached. */
110 return float3(0, 1, 0);
111 }
112 float3 col = float3(0);
113 if (tile.is_cached) {
114 col += float3(0.2f, 0, 0.5f);
115 if (tile.do_update) {
116 col += float3(0.8f, 0, 0);
117 }
118 }
119 return col;
120 }
121
122 float3 debug_tile_lod(eLightType type, ShadowSamplingTile tile) const
123 {
124 if (!tile.is_valid) {
125 return float3(1, 0, 0);
126 }
127 /* Uses data from another LOD. */
128 return neon_gradient(float(tile.lod) / float((type == LIGHT_SUN) ?
129 SHADOW_TILEMAP_MAX_CLIPMAP_LOD :
130 SHADOW_TILEMAP_LOD));
131 }
132
134 {
135 if (is_sun_light(light.type)) {
138 }
139
141 int face_id = shadow_punctual_face_index_get(lP);
143 return shadow_punctual_coordinates(light, lP, face_id);
144 }
145
146 ShadowSamplingTile debug_tile_get(float3 P, LightData light) const
147 {
150 }
151
152 LightData debug_light_get()
153 {
154 SearchDebugLightCtx ctx = {
155 .debug_tilemap_index = this->debug_tilemap_index,
156 .light_index = 0,
157 };
158
160
161 return light_data.light_buf[ctx.light_index];
162 }
163};
164
169
176
178 const ShadowDebug &srt, float3 /*P*/, LightData light, int2 texel, bool do_debug_sample_tile)
179{
181 constexpr int debug_tile_size_px = 4;
182
183 int2 px = texel / debug_tile_size_px;
184 int tilemap = px.x / SHADOW_TILEMAP_RES;
185 int tilemap_index = light.tilemap_index + tilemap;
186 if ((px.y < SHADOW_TILEMAP_RES) && (tilemap_index <= light.tilemap_max_get())) {
187 if (do_debug_sample_tile) {
188 /* Debug values in the tilemap_tx. */
189 uint2 tilemap_texel = shadow_tile_coord_in_atlas(uint2(px), tilemap_index);
190 ShadowSamplingTile tile = shadow_sampling_tile_unpack(
191 texelFetch(srt.shadow_data.shadow_tilemaps_tx, int2(tilemap_texel), 0).x);
192 /* Leave 1 px border between tile-maps. */
193 if (!any(equal(texel % (SHADOW_TILEMAP_RES * debug_tile_size_px), int2(0)))) {
194 return {.valid = true,
195 .color_add = float4(srt.debug_tile_lod(light.type, tile), 0.0f),
196 .color_mul = float4(0.0f),
197 .depth = 1.0f};
198 }
199 }
200 else {
201 /* Debug actual values in the tile-map buffer. */
202 ShadowTileMapData tilemap = srt.tilemaps_buf[tilemap_index];
204 uint2(px + SHADOW_TILEMAP_RES) % SHADOW_TILEMAP_RES, tilemap.tiles_index, 0);
205 ShadowTileData tile = shadow_tile_unpack(srt.tiles_buf[tile_index]);
206 /* Leave 1 px border between tile-maps. */
207 if (!any(equal(texel % (SHADOW_TILEMAP_RES * debug_tile_size_px), int2(0)))) {
208 return {.valid = true,
209 .color_add = float4(srt.debug_tile_state_color(tile), 0.0f),
210 .color_mul = float4(0.0f),
211 .depth = 1.0f};
212 }
213 }
214 }
215 return {false, float4(0.0f), float4(1.0f), 1.0f};
216}
217
219{
220 ShadowSamplingTile tile_samp = srt.debug_tile_get(P, light);
222 ShadowTileMapData tilemap = srt.tilemaps_buf[coord.tilemap_index];
224 uint2(coord.tilemap_tile >> tile_samp.lod), tilemap.tiles_index, int(tile_samp.lod));
225 ShadowTileData tile = shadow_tile_unpack(srt.tiles_buf[tile_index]);
226 return {.valid = true,
227 .color_add = float4(srt.debug_tile_state_color(tile), 0) * 0.5f,
228 .color_mul = float4(0.5f),
229 .depth = default_depth};
230}
231
233{
234 const ShadowRenderData &srd = srt.shadow_data;
235
237 float depth = srd.read_depth(coord);
238 return {.valid = true,
239 .color_add = float4((depth == -1.0f) ? float3(1.0f, 0.0f, 0.0f) : float3(1.0f / depth),
240 0.0f) *
241 0.5f,
242 .color_mul = float4(0.5f),
243 .depth = default_depth};
244}
245
248 float cost;
249
250 float atomic_cost(const ShadowDebug &srt, LightData light)
251 {
252 const ShadowRenderData &srd = srt.shadow_data;
253
255 uint u_cost = floatBitsToUint(srd.read_depth(coord));
256 return float(u_cost - floatBitsToUint(FLT_MAX));
257 }
258
259 void eval_directional(ShadowDebug &srt, uint /*l_idx*/, LightData light)
260 {
261 cost += atomic_cost(srt, light);
262 }
263
264 void eval_local(ShadowDebug &srt, uint /*l_idx*/, LightData light)
265 {
266 cost += atomic_cost(srt, light);
267 }
268};
269
270template void light::foreach<AtomicCostCtx, ShadowDebug>(const LightRenderData &,
271 AtomicCostCtx &,
272 ShadowDebug &);
273
275{
276 AtomicCostCtx ctx = {.P = P, .cost = 0.0f};
277
278 light::foreach(srt.light_data, ctx, srt);
279
280 ctx.cost /= 60.0f;
281 return {.valid = true,
282 .color_add = float4(heatmap_gradient(ctx.cost), 0.0f),
283 .color_mul = float4(0.0f),
284 .depth = default_depth};
285}
286
288{
289 ShadowSamplingTile tile = srt.debug_tile_get(P, light);
290 return {.valid = true,
291 .color_add = float4(srt.debug_random_color(int2(tile.page.xy)), 0) * 0.5f,
292 .color_mul = float4(0.5f),
293 .depth = default_depth};
294}
295
297{
299 return {.valid = true,
300 .color_add = float4(srt.debug_random_color(int2(coord.tilemap_index)), 0) * 0.5f,
301 .color_mul = float4(0.5f),
302 .depth = default_depth};
303}
304
305[[fragment]]
307 [[resource_table]] const draw::View &views,
308 [[frag_coord]] const float4 frag_co,
309 [[frag_depth(greater)]] float &frag_depth,
310 [[resource_table]] const HiZ &hiz,
311 [[in]] const DebugVertOut v_out,
312 [[out]] DualBlendFragOut &frag_out)
313{
314 /* Default to no output. */
315 frag_out.color_add = float4(0.0f);
316 frag_out.color_mul = float4(1.0f);
317
318 const ViewMatrices view = views.get(0);
319
320 float depth = texelFetch(hiz.hiz_tx, int2(frag_co.xy), 0).r;
321 float3 P = view.point_screen_to_world(float3(v_out.screen_uv, depth));
322
323 const LightData light = srt.debug_light_get();
324
325 const eDebugMode mode = eDebugMode(srt.debug_mode);
326 bool do_debug_sample_tile = mode != DEBUG_SHADOW_TILEMAPS;
327
328 ShadowDebugOutput result;
329 result.valid = false;
330 if (mode != DEBUG_SHADOW_ATOMIC_COST) {
331 result = debug_tilemaps(srt, P, light, int2(frag_co.xy), do_debug_sample_tile);
332 }
333
334 if (!result.valid && depth != 1.0f) {
335 switch (mode) {
336 case DEBUG_SHADOW_TILEMAPS:
337 result = debug_tile_state(srt, P, light);
338 break;
339 case DEBUG_SHADOW_VALUES:
340 result = debug_atlas_values(srt, P, light);
341 break;
342 case DEBUG_SHADOW_TILE_RANDOM_COLOR:
343 result = debug_random_tile_color(srt, P, light);
344 break;
345 case DEBUG_SHADOW_TILEMAP_RANDOM_COLOR:
346 result = debug_random_tilemap_color(srt, P, light);
347 break;
348 case DEBUG_SHADOW_ATOMIC_COST:
349 result = debug_atomic_cost(srt, P, light);
350 break;
351 default:
352 break;
353 }
354 }
355
356 frag_out.color_add = result.color_add;
357 frag_out.color_mul = result.color_mul;
358 /* Make it pass the depth test by default. */
359 frag_depth = result.depth == default_depth ? 1.0f - depth + 1e-6f : result.depth;
360}
361
362} // namespace eevee
363
366 eevee::ShadowRenderConstants{.shadow_random = false});
367
369
373
374struct FragOut {
376};
377
385
387 [[resource_table]] const draw::View &views,
388 [[vertex_id]] const int vert_id,
389 [[position]] float4 &out_position,
390 [[point_size]] float &out_point_size,
391 [[out]] VertOut &v_out)
392{
393 int3 grid_resolution = textureSize(srt.debug_data_tx, 0);
394 int3 grid_sample;
395 int sample_id = 0;
396 if (srt.debug_mode == DEBUG_IRRADIANCE_CACHE_VALIDITY) {
397 /* Points. */
398 sample_id = vert_id;
399 }
400 else if (srt.debug_mode == DEBUG_IRRADIANCE_CACHE_VIRTUAL_OFFSET) {
401 /* Lines. */
402 sample_id = vert_id / 2;
403 }
404
405 grid_sample.x = (sample_id % grid_resolution.x);
406 grid_sample.y = (sample_id / grid_resolution.x) % grid_resolution.y;
407 grid_sample.z = (sample_id / (grid_resolution.x * grid_resolution.y));
408
410 srt.grid_mat, grid_resolution, grid_sample);
411
412 float4 debug_data = texelFetch(srt.debug_data_tx, grid_sample, 0);
413 if (srt.debug_mode == DEBUG_IRRADIANCE_CACHE_VALIDITY) {
414 v_out.interp_color = float4(1.0f - debug_data.r, debug_data.r, 0.0f, 0.0f);
415 out_point_size = 3.0f;
416 if (debug_data.r > srt.debug_value) {
417 /* Only render points that are below threshold. */
418 out_position = float4(0.0f);
419 out_point_size = 0.0f;
420 return;
421 }
422 }
423 else if (srt.debug_mode == DEBUG_IRRADIANCE_CACHE_VIRTUAL_OFFSET) {
424 if (is_zero(debug_data.xyz)) {
425 /* Only render points that have offset. */
426 out_position = float4(0.0f);
427 out_point_size = 0.0f;
428 return;
429 }
430
431 if ((vert_id & 1) == 1) {
432 P += debug_data.xyz;
433 v_out.interp_color = float4(1.0f, 0.0f, 0.0f, 0.0f);
434 }
435 else {
436 v_out.interp_color = float4(0.0f, 0.0f, 1.0f, 0.0f);
437 }
438 }
439
440 const ViewMatrices view = views.get(0);
441
442 out_position = view.point_world_to_homogenous(P);
443 out_position.z -= 2.5e-5f;
444 out_point_size = 3.0f;
445}
446
447[[fragment]]
448void frag_main([[in]] const VertOut &v_out, [[out]] FragOut &frag_out)
449{
450 frag_out.out_color = v_out.interp_color;
451}
452
453} // namespace eevee::debug::irradiance_grid
454
457
459
460struct VertOut {
463};
464
465struct FragOut {
467};
468
469struct Resources {
470 [[storage(0, read)]] const Surfel (&surfels_buf)[];
471
474};
475
478 [[resource_table]] const draw::View &views,
479 [[vertex_id]] const int vert_id,
480 [[instance_id]] const int inst_id,
481 [[position]] float4 &out_position,
482 [[out]] VertOut &v_out)
483{
484 v_out.surfel_index = inst_id;
485 Surfel surfel = srt.surfels_buf[v_out.surfel_index];
486
487#if 0 /* Debug surfel lists. TODO allow in release build with a dedicated shader. */
488 if (vert_id == 0 && surfel.next > -1) {
489 Surfel surfel_next = surfels_buf[surfel.next];
490 float4 line_color = (surfel.prev == -1) ? float4(1.0f, 1.0f, 0.0f, 1.0f) :
491 (surfel_next.next == -1) ? float4(0.0f, 1.0f, 1.0f, 1.0f) :
492 float4(0.0f, 1.0f, 0.0f, 1.0f);
493 /* WORKAROUND: Avoid compilation error because this gets parsed before dead code removal. */
494 drw_ debug_line(surfel_next.position, surfel.position, line_color);
495 }
496#endif
497
498 float3 lP;
499
500 switch (vert_id) {
501 case 0:
502 lP = float3(-1, 1, 0);
503 break;
504 case 1:
505 lP = float3(-1, -1, 0);
506 break;
507 case 2:
508 lP = float3(1, 1, 0);
509 break;
510 case 3:
511 lP = float3(1, -1, 0);
512 break;
513 }
514
515 float3x3 TBN = from_up_axis(surfel.normal);
516
517 float4x4 model_matrix = float4x4(float4(TBN[0] * srt.debug_surfel_radius, 0),
518 float4(TBN[1] * srt.debug_surfel_radius, 0),
519 float4(TBN[2] * srt.debug_surfel_radius, 0),
520 float4(surfel.position, 1));
521
522 v_out.P = (model_matrix * float4(lP, 1)).xyz;
523
524 const ViewMatrices view = views.get(0);
525
526 out_position = reverse_z::transform(view.point_world_to_homogenous(v_out.P));
527 out_position.z += 2.5e-5f;
528}
529
531{
532 float r = random::interleaved_gradient(float2(v, 0), 0.0f, 0.0f);
533 return hue_gradient(r);
534}
535
536[[fragment]]
538 [[front_facing]] const bool front_face,
539 [[in]] const VertOut &v_out,
540 [[out]] FragOut &frag_out)
541{
542 Surfel surfel = srt.surfels_buf[v_out.surfel_index];
543
544 float4 radiance_vis = float4(0.0f);
545 radiance_vis += front_face ? surfel.radiance_direct.front : surfel.radiance_direct.back;
546 radiance_vis += front_face ? surfel.radiance_indirect[1].front :
547 surfel.radiance_indirect[1].back;
548
549 switch (eDebugMode(srt.debug_mode)) {
550 default:
551 case DEBUG_IRRADIANCE_CACHE_SURFELS_NORMAL:
552 frag_out.out_color = float4(pow(surfel.normal * 0.5f + 0.5f, float3(2.2f)), 0.0f);
553 break;
554 case DEBUG_IRRADIANCE_CACHE_SURFELS_CLUSTER:
555 frag_out.out_color = float4(pow(debug_random_color(surfel.cluster_id), float3(2.2f)), 0.0f);
556 break;
557 case DEBUG_IRRADIANCE_CACHE_SURFELS_IRRADIANCE:
558 frag_out.out_color = float4(radiance_vis.rgb, 0.0f);
559 break;
560 case DEBUG_IRRADIANCE_CACHE_SURFELS_VISIBILITY:
561 frag_out.out_color = float4(radiance_vis.aaa, 0.0f);
562 break;
563 }
564
565 /* Display surfels as circles. */
566 if (distance(v_out.P, surfel.position) > srt.debug_surfel_radius) {
568 return;
569 }
570}
571
572} // namespace eevee::debug::surfels
573
576
578
579struct Resources {
581};
582
583[[fragment]]
585 [[resource_table]] const draw::View &views,
586 [[resource_table]] const ::gbuffer::Reader &reader,
587 [[frag_coord]] const float4 frag_co,
588 [[out]] DualBlendFragOut &frag_out)
589{
590 int2 texel = int2(frag_co.xy);
591
592 const ::gbuffer::Layers gbuf = reader.read_layers(texel);
593
594 if (gbuf.has_no_closure()) {
596 return;
597 }
598
599 const ViewMatrices view = views.get(0);
600
601 float shade = saturate(view.normal_world_to_view(gbuf.surface_N()).z);
602
603 ::gbuffer::Header header = reader.read_header(texel);
604 uint4 closure_types = (uint4(header.raw()) >> uint4(0u, 4u, 8u, 12u)) & 15u;
605 float storage_cost = reduce_add(float4(not(equal(closure_types, uint4(0u)))));
606
607 float eval_cost = 0.0f;
608 for (uchar i = 0; i < GBUFFER_LAYER_MAX; i++) {
609 switch (gbuf.layer[i].type) {
612 case CLOSURE_BSDF_MICROFACET_GGX_REFLECTION_ID:
614 eval_cost += 1.0f;
615 break;
618 eval_cost += 2.0f;
619 break;
620 case CLOSURE_NONE_ID:
621 break;
622 }
623 }
624
625 switch (eDebugMode(srt.debug_mode)) {
626 default:
627 case DEBUG_GBUFFER_STORAGE:
628 frag_out.color_add = shade * float4(green_to_red_gradient(storage_cost / 4.0f), 0.0f);
629 break;
630 case DEBUG_GBUFFER_EVALUATION:
631 frag_out.color_add = shade * float4(green_to_red_gradient(eval_cost / 4.0f), 0.0f);
632 break;
633 }
634
635 frag_out.color_mul = float4(0.0f);
636}
637
638} // namespace eevee::debug::gbuffer
639
642
644
649[[fragment]]
651 [[frag_coord]] const float4 frag_co,
652 [[out]] DualBlendFragOut &frag_out)
653{
654 int2 texel = int2(frag_co.xy);
655
656 float depth0 = texelFetch(hiz.hiz_tx, texel, 0).r;
657
658 float4 color = float4(0.1f, 0.1f, 1.0f, 1.0f);
659 for (int i = 1; i < HIZ_MIP_COUNT; i++) {
660 int2 lvl_texel = texel / int2(uint2(1) << uint(i));
661 lvl_texel = min(lvl_texel, textureSize(hiz.hiz_tx, i) - 1);
662 if (texelFetch(hiz.hiz_tx, lvl_texel, i).r < depth0) {
663 color = float4(1.0f, 0.1f, 0.1f, 1.0f);
664 break;
665 }
666 }
667 frag_out.color_add = float4(color.rgb, 0.0f) * 0.2f;
668 frag_out.color_mul = color;
669}
670
671} // namespace eevee::debug::hiz
672
PipelineGraphic eevee_debug_gbuffer(eevee::debug_fullscreen_vert, eevee::debug::gbuffer::frag_main)
PipelineGraphic eevee_shadow_debug(eevee::debug_fullscreen_vert, eevee::debug_shadow_frag, eevee::ShadowRenderConstants{.shadow_random=false})
PipelineGraphic eevee_debug_surfels(eevee::debug::surfels::vert_main, eevee::debug::surfels::frag_main)
PipelineGraphic eevee_debug_irradiance_grid(eevee::debug::irradiance_grid::vert_main, eevee::debug::irradiance_grid::frag_main)
PipelineGraphic eevee_hiz_debug(eevee::debug_fullscreen_vert, eevee::debug::hiz::frag_main)
#define default_depth
float3 light_world_to_local_point(LightData light, float3 point)
float3 light_world_to_local_direction(LightData light, float3 L)
int shadow_tile_offset(uint2 tile, int tiles_index, int lod)
ShadowCoordinates shadow_punctual_coordinates(LightData light, float3 lP, int face_id)
int shadow_punctual_face_index_get(float3 lL)
ShadowCoordinates shadow_directional_coordinates(LightData light, float3 lP)
uint2 shadow_tile_coord_in_atlas(uint2 tile, int tilemap_index)
ShadowSamplingTile shadow_tile_load(usampler2D tilemaps_tx, uint2 tile_co, int tilemap_index)
float3 shadow_punctual_local_position_to_face_local(int face_id, float3 lL)
#define FLT_MAX
#define instance_id
#define point_size
#define storage(slot, qualifiers)
#define position
#define front_facing
#define index(i)
#define flat
#define frag_coord
#define smooth
#define push_constant
#define resource_table
#define sampler(slot)
#define frag_depth(mode)
#define fragment
#define vertex_id
#define clip_control
#define vertex
#define frag_color(slot)
void gpu_discard_fragment()
bool any(VecOp< bool, D >) RET
#define pow
float distance(float, float) RET
VecBase< uint, D > floatBitsToUint(VecOp< float, D >) RET
VecBase< bool, D > equal(VecOp< T, D >, VecOp< T, D >) RET
TEX_TEMPLATE DataVec texelFetch(T, IntCoord, int) RET
SamplerBase< float, 3 > sampler3D
TEX_TEMPLATE SizeVec textureSize(T, int) RET
SamplerBase< uint, 2 > usampler2D
unsigned int uchar
float3 hue_gradient(float t)
float3 heatmap_gradient(float t)
float3 green_to_red_gradient(float t)
float3 neon_gradient(float t)
void fullscreen_vertex(int vertex_id, float4 &out_position)
bool is_zero(float3x3 a)
float3x3 from_up_axis(float3 up)
float reduce_add(float2 a)
const int tile_index
const ccl_global KernelWorkTile * tile
@ CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID
@ CLOSURE_BSDF_DIFFUSE_ID
@ CLOSURE_BSSRDF_BURLEY_ID
@ CLOSURE_NONE_ID
@ CLOSURE_BSDF_THIN_GLASS_TRANSMISSION_ID
@ CLOSURE_BSDF_TRANSLUCENT_ID
@ LIGHT_SUN
MatBase< float, 4, 4 > float4x4
void frag_main(Resources &srt, const draw::View &views, const ::gbuffer::Reader &reader, const float4 frag_co, DualBlendFragOut &frag_out)
void frag_main(const HiZ &hiz, const float4 frag_co, DualBlendFragOut &frag_out)
void frag_main(const VertOut &v_out, FragOut &frag_out)
void vert_main(const Resources &srt, const draw::View &views, const int vert_id, float4 &out_position, float &out_point_size, VertOut &v_out)
float3 debug_random_color(int v)
void vert_main(const Resources &srt, const draw::View &views, const int vert_id, const int inst_id, float4 &out_position, VertOut &v_out)
void frag_main(const Resources &srt, const bool front_face, const VertOut &v_out, FragOut &frag_out)
void foreach(const LightRenderData &srt, CallbackT &cb, ResourceT &res)
float3 grid_sample_position(float4x4 grid_local_to_world_mat, int3 grid_res, int3 cell_coord)
void debug_shadow_frag(ShadowDebug &srt, const draw::View &views, const float4 frag_co, float &frag_depth, const HiZ &hiz, const DebugVertOut v_out, DualBlendFragOut &frag_out)
ShadowDebugOutput debug_random_tilemap_color(const ShadowDebug &srt, float3 P, LightData light)
ShadowDebugOutput debug_tilemaps(const ShadowDebug &srt, float3, LightData light, int2 texel, bool do_debug_sample_tile)
ShadowDebugOutput debug_atlas_values(const ShadowDebug &srt, float3 P, LightData light)
ShadowDebugOutput debug_tile_state(const ShadowDebug &srt, float3 P, LightData light)
void debug_fullscreen_vert(const int vert_id, float4 &out_position, DebugVertOut &v_out)
ShadowDebugOutput debug_atomic_cost(ShadowDebug &srt, float3 P, LightData)
ShadowDebugOutput debug_random_tile_color(const ShadowDebug &srt, float3 P, LightData light)
float interleaved_gradient(float2 pixel, float seed, float offset)
float4 transform(float4 hs_position)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
#define saturate(a)
Definition smaa.cc:319
#define min(a, b)
Definition sort.cc:38
float4 point_world_to_homogenous(float3 P) const
float3 point_screen_to_world(float3 ssP) const
float atomic_cost(const ShadowDebug &srt, LightData light)
void eval_local(ShadowDebug &srt, uint, LightData light)
void eval_directional(ShadowDebug &srt, uint, LightData light)
const LightData(& light_buf)[]
void eval_local(LightRenderData &, uint l_idx, LightData light)
void eval_directional(LightRenderData &, uint l_idx, LightData light)
ShadowTileMapData(& tilemaps_buf)[]
ShadowSamplingTile shadow_tile_data_get(usampler2D tilemaps_tx, ShadowCoordinates coord) const
LightRenderData light_data
ShadowCoordinates debug_coord_get(float3 P, LightData light) const
float3 debug_random_color(int v) const
LightData debug_light_get()
float3 debug_tile_lod(eLightType type, ShadowSamplingTile tile) const
ShadowSamplingTile debug_tile_get(float3 P, LightData light) const
ShadowRenderData shadow_data
void debug_tile_print(ShadowTileData tile, int4 tile_coord) const
float3 debug_random_color(int2 v) const
float3 debug_tile_state_color(ShadowTileData tile) const
float read_depth(ShadowCoordinates coord) const
float z
Definition sky_math.h:225