Blender V5.3
gpu_shader_index_load.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
8
15
16struct IndexLoad {
17 [[storage(GPU_SSBO_INDEX_BUF_SLOT, read), frequency(GEOMETRY)]] const uint (&gpu_index_buf)[];
18
22
26 uint load(uint element_index) const
27 {
29 return element_index;
30 }
31
32 uint raw_index = gpu_index_buf[gpu_index_16bit ? element_index >> 1u : element_index];
33
34 if (gpu_index_16bit) {
35 raw_index = ((element_index & 1u) == 0u) ? (raw_index & 0xFFFFu) : (raw_index >> 16u);
36 }
37
38 return raw_index + uint(gpu_index_base_index);
39 }
40};
#define GPU_SSBO_INDEX_BUF_SLOT
#define storage(slot, qualifiers)
#define push_constant
#define frequency(freq)
const uint(& gpu_index_buf)[]
const bool gpu_index_no_buffer
uint load(uint element_index) const