Blender
V5.3
source
blender
draw
intern
shaders
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
15
namespace
draw
{
16
17
struct
ViewLayerAttributes
{
18
[[
uniform
(
DRW_LAYER_ATTR_UBO_SLOT
)]]
const
LayerAttribute
(
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
DRW_LAYER_ATTR_UBO_SLOT
#define DRW_LAYER_ATTR_UBO_SLOT
Definition
draw_defines.hh:18
draw_shader_shared.hh
gpu_shader_compat.hh
uniform
#define uniform(slot)
Definition
gpu_shader_cxx_attribute.hh:117
draw
Definition
select_lib.bsl.hh:10
hash
#define hash
Definition
noise_c.cc:156
LayerAttribute
Definition
draw_shader_shared.hh:644
LayerAttribute::data
float4 data
Definition
draw_shader_shared.hh:645
LayerAttribute::hash_code
uint hash_code
Definition
draw_shader_shared.hh:646
LayerAttribute::buffer_length
uint buffer_length
Definition
draw_shader_shared.hh:647
draw::ViewLayerAttributes
Definition
draw_viewlayer.bsl.hh:17
draw::ViewLayerAttributes::get
float4 get(const uint attr_hash) const
Definition
draw_viewlayer.bsl.hh:21
draw::ViewLayerAttributes::drw_layer_attrs
const LayerAttribute(& drw_layer_attrs)[DRW_RESOURCE_CHUNK_LEN]
Definition
draw_viewlayer.bsl.hh:18
float4
Definition
sky_math.h:224
Generated on
for Blender by
doxygen
1.18.0