Blender V5.3
draw_viewlayer.bsl.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2018-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "gpu_shader_compat.hh"
12
13#include "draw_shader_shared.hh"
14
15namespace draw {
16
19 &drw_layer_attrs)[DRW_RESOURCE_CHUNK_LEN];
20
21 float4 get(const uint attr_hash) const
22 {
23 /* The first record of the buffer stores the length. */
24 uint left = 0, right = drw_layer_attrs[0].buffer_length;
25
26 while (left < right) {
27 uint mid = (left + right) / 2;
28 uint hash = drw_layer_attrs[mid].hash_code;
29
30 if (hash < attr_hash) {
31 left = mid + 1;
32 }
33 else if (hash > attr_hash) {
34 right = mid;
35 }
36 else {
37 return drw_layer_attrs[mid].data;
38 }
39 }
40 return float4(0);
41 }
42};
43
44} // namespace draw
#define DRW_LAYER_ATTR_UBO_SLOT
#define uniform(slot)
#define hash
Definition noise_c.cc:156
float4 get(const uint attr_hash) const
const LayerAttribute(& drw_layer_attrs)[DRW_RESOURCE_CHUNK_LEN]