Blender V5.3
eevee_shadow_page_allocate.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
11
12#pragma once
13
15
16namespace eevee::shadow {
17
21
22[[compute, local_size(SHADOW_TILEMAP_LOD0_LEN)]]
24 [[resource_table]] TileMaps &tilemaps,
25 [[resource_table]] Statistics &stats,
26 [[global_invocation_id]] const uint3 global_id,
27 [[local_invocation_index]] const uint local_tile)
28{
29 ShadowTileMapData tilemap_data = tilemaps.tilemaps_buf[global_id.z];
30
31 uint tile_start = uint(tilemap_data.tiles_index);
32 for (int lod = 0; lod <= SHADOW_TILEMAP_LOD; lod++) {
33 uint lod_len = uint(SHADOW_TILEMAP_LOD0_LEN >> (lod * 2));
34 if (local_tile < lod_len) {
35 uint tile_index = tile_start + local_tile;
36
37 ShadowTileData tile = shadow_tile_unpack(allocator.tiles_buf[tile_index]);
38 if (tile.is_used && !tile.is_allocated) {
39 allocator.page_alloc(tile);
40 allocator.tiles_buf[tile_index] = shadow_tile_pack(tile);
41 }
42
43 if (tile.is_used) {
44 atomicAdd(stats.statistics_buf.page_used_count, 1);
45 }
46 if (tile.is_used && tile.do_update) {
47 atomicAdd(stats.statistics_buf.page_update_count, 1);
48 }
49 if (tile.is_allocated) {
50 atomicAdd(stats.statistics_buf.page_allocated_count, 1);
51 }
52 }
53 tile_start += lod_len;
54 }
55}
56
58
59} // namespace eevee::shadow
#define local_invocation_index
#define resource_table
#define global_invocation_id
#define compute
#define local_size(...)
int atomicAdd(int &, int) RET
const int tile_index
const ccl_global KernelWorkTile * tile
PipelineCompute page_allocate(allocate)
void allocate(PageAllocator &allocator, TileMaps &tilemaps, Statistics &stats, const uint3 global_id, const uint local_tile)