blob: 9fbbe23f0ce7168e20f094187d8a623d06a7c521 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2022 Blender Foundation. */
/** \file
* \ingroup draw
*/
#ifndef GPU_SHADER
# include "BLI_span.hh"
# include "GPU_shader_shared_utils.h"
namespace blender::draw::command {
struct RecordingState;
#endif
/* -------------------------------------------------------------------- */
/** \name Multi Draw
* \{ */
/**
* A DrawGroup allow to split the command stream into batch-able chunks of commands with
* the same render state.
*/
struct DrawGroup {
/** Index of next #DrawGroup from the same header. */
uint next;
/** Index of the first instances after sorting. */
uint start;
/** Total number of instances (including inverted facing). Needed to issue the draw call. */
uint len;
/** Number of non inverted scaling instances in this Group. */
uint front_facing_len;
/** #GPUBatch values to be copied to #DrawCommand after sorting (if not overridden). */
int vertex_len;
int vertex_first;
int base_index;
/** Atomic counters used during command sorting. */
uint total_counter;
#ifndef GPU_SHADER
/* NOTE: Union just to make sure the struct has always the same size on all platform. */
union {
struct {
/** For debug printing only. */
uint front_proto_len;
uint back_proto_len;
/** Needed to create the correct draw call. */
GPUBatch *gpu_batch;
};
struct {
#endif
uint front_facing_counter;
uint back_facing_counter;
uint _pad0, _pad1;
#ifndef GPU_SHADER
};
};
#endif
};
BLI_STATIC_ASSERT_ALIGN(DrawGroup, 16)
/**
* Representation of a future draw call inside a DrawGroup. This #DrawPrototype is then
* converted into #DrawCommand on GPU after visibility and compaction. Multiple
* #DrawPrototype might get merged into the same final #DrawCommand.
*/
struct DrawPrototype {
/* Reference to parent DrawGroup to get the GPUBatch vertex / instance count. */
uint group_id;
/* Resource handle associated with this call. Also reference visibility. */
uint resource_handle;
/* Number of instances. */
uint instance_len;
uint _pad0;
};
BLI_STATIC_ASSERT_ALIGN(DrawPrototype, 16)
/** \} */
#ifndef GPU_SHADER
}; // namespace blender::draw::command
#endif
|