Blender
V4.3
source
blender
draw
intern
draw_command_shared.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2022 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
9
#ifndef GPU_SHADER
10
# include "
BLI_span.hh
"
11
# include "
GPU_shader_shared_utils.hh
"
12
13
namespace
blender::draw::command
{
14
15
#endif
16
17
/* -------------------------------------------------------------------- */
25
struct
DrawGroup
{
27
uint
next
;
28
36
uint
start
;
38
uint
len
;
40
uint
front_facing_len
;
41
43
int
vertex_len
;
44
int
vertex_first
;
45
/* Set to -1 if not an indexed draw. */
46
int
base_index
;
47
50
/* Counts visible and invisible instances. Create drawcalls when it reaches `DrawGroup::len`. */
51
uint
total_counter
;
52
/* Counts only visible instance (counting multi-view). Used to issue the drawcalls. */
53
uint
front_facing_counter
;
54
uint
back_facing_counter
;
55
56
/* CPU specific region of the struct. Should be kept constant after recording.
57
* Can be used by GPU but needs to be initialized by GPU before usage. */
58
#ifdef GPU_SHADER
59
uint
_cpu_reserved_1;
60
uint
_cpu_reserved_2;
61
62
uint
_cpu_reserved_3;
63
uint
_cpu_reserved_4;
64
uint
_cpu_reserved_5;
65
uint
_cpu_reserved_6;
66
67
#else
68
struct
{
69
/* Specific range of vertex to draw from the #gpu::Batch. */
70
uint32_t
vertex_first
;
71
/* Ugly packing to support expanded draws without inflating the struct.
72
* Makes vertex range restricted to smaller range for expanded draw. */
73
uint32_t
expand_prim_type
: 4;
74
uint32_t
expand_prim_len
: 3;
75
uint32_t
vertex_len
: 25;
76
78
gpu::Batch *
gpu_batch
;
79
# ifdef WITH_METAL_BACKEND
80
GPUShader
*gpu_shader;
81
# else
82
uint64_t
_cpu_pad0
;
83
# endif
84
}
desc
;
85
#endif
86
};
87
BLI_STATIC_ASSERT_ALIGN
(
DrawGroup
, 16)
88
89
94
struct
DrawPrototype
{
95
/* Reference to parent DrawGroup to get the gpu::Batch vertex / instance count. */
96
uint
group_id
;
97
/* Resource handle associated with this call. Also reference visibility. */
98
uint
resource_handle
;
99
/* Custom extra value to be used by the engines. */
100
uint
custom_id
;
101
/* Number of instances. */
102
uint
instance_len
;
103
};
104
BLI_STATIC_ASSERT_ALIGN
(
DrawPrototype
, 16)
105
106
108
#ifndef GPU_SHADER
109
};
// namespace blender::draw::command
110
#endif
BLI_STATIC_ASSERT_ALIGN
#define BLI_STATIC_ASSERT_ALIGN(st, align)
Definition
BLI_assert.h:90
BLI_span.hh
uint
unsigned int uint
Definition
BLI_sys_types.h:68
GPU_shader_shared_utils.hh
GPUShader
struct GPUShader GPUShader
Definition
blender/display_driver.h:21
blender::draw::command
Definition
draw_command.cc:22
uint32_t
unsigned int uint32_t
Definition
stdint.h:80
uint64_t
unsigned __int64 uint64_t
Definition
stdint.h:90
blender::draw::command::DrawGroup
Definition
draw_command_shared.hh:25
blender::draw::command::DrawGroup::vertex_first
int vertex_first
Definition
draw_command_shared.hh:44
blender::draw::command::DrawGroup::expand_prim_type
uint32_t expand_prim_type
Definition
draw_command_shared.hh:73
blender::draw::command::DrawGroup::back_facing_counter
uint back_facing_counter
Definition
draw_command_shared.hh:54
blender::draw::command::DrawGroup::vertex_first
uint32_t vertex_first
Definition
draw_command_shared.hh:70
blender::draw::command::DrawGroup::gpu_batch
gpu::Batch * gpu_batch
Definition
draw_command_shared.hh:78
blender::draw::command::DrawGroup::start
uint start
Definition
draw_command_shared.hh:36
blender::draw::command::DrawGroup::total_counter
uint total_counter
Definition
draw_command_shared.hh:51
blender::draw::command::DrawGroup::vertex_len
int vertex_len
Definition
draw_command_shared.hh:43
blender::draw::command::DrawGroup::front_facing_len
uint front_facing_len
Definition
draw_command_shared.hh:40
blender::draw::command::DrawGroup::base_index
int base_index
Definition
draw_command_shared.hh:46
blender::draw::command::DrawGroup::expand_prim_len
uint32_t expand_prim_len
Definition
draw_command_shared.hh:74
blender::draw::command::DrawGroup::len
uint len
Definition
draw_command_shared.hh:38
blender::draw::command::DrawGroup::vertex_len
uint32_t vertex_len
Definition
draw_command_shared.hh:75
blender::draw::command::DrawGroup::front_facing_counter
uint front_facing_counter
Definition
draw_command_shared.hh:53
blender::draw::command::DrawGroup::desc
struct blender::draw::command::DrawGroup::@274 desc
blender::draw::command::DrawGroup::next
uint next
Definition
draw_command_shared.hh:27
blender::draw::command::DrawGroup::_cpu_pad0
uint64_t _cpu_pad0
Definition
draw_command_shared.hh:82
blender::draw::command::DrawPrototype
Definition
draw_command_shared.hh:94
blender::draw::command::DrawPrototype::resource_handle
uint resource_handle
Definition
draw_command_shared.hh:98
blender::draw::command::DrawPrototype::custom_id
uint custom_id
Definition
draw_command_shared.hh:100
blender::draw::command::DrawPrototype::instance_len
uint instance_len
Definition
draw_command_shared.hh:102
blender::draw::command::DrawPrototype::group_id
uint group_id
Definition
draw_command_shared.hh:96
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0