Blender V5.3
GPU_shader_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
8
9#pragma once
10
12
13#ifndef GPU_SHADER
15#endif
16
17/* NOTE: float3 has differing stride and alignment rules across different GPU back-ends. If 12 byte
18 * stride and alignment is essential, use `packed_float3` to avoid data read issues. This is
19 * required in the common use-case where a float3 and an int/float are paired together for optimal
20 * data transfer. */
21
34
35static constexpr int MAX_SOCKET_PARAMETERS = 4;
36static constexpr int MAX_SOCKET_INSTANCE = 32;
37
38/* Node Socket shader parameters. Must match the shader layout of "gpu_shader_2D_node_socket". */
48
49/* Per link data. */
70
71/* Destination tile size handled by one workgroup of the mipmap compute shader. */
72static constexpr int MIPMAP_UPDATE_TILE_SIZE = 8;
73
74/* Chunk size for partial mipmap updates. */
75static constexpr int MIPMAP_UPDATE_CHUNK_SIZE = 256;
76
77/* Coordinate of a mipmap chunk for partial mipmap updates. */
81
82/* Data common to all links. */
89
99
104
110
111static constexpr int MAX_CALLS = 16;
112
116
117static constexpr int GPU_SEQ_STRIP_DRAW_DATA_LEN = 256;
118
139
140/* Glyph for text rendering. */
143 float4 glyph_color; /* Cannot be name `color` because of metal macros. */
146 uint flags;
147};
148
149/* VSE per-strip data for timeline rendering. */
151 /* Horizontal strip positions (1.0 is one frame). */
152 /* Left and right strip sides. */
155 /* Start and end of actual content (only relevant for strips that have holdout regions). */
159 /* Vertical strip positions (1.0 is one channel). */
160 float bottom;
161 float top;
162 float strip_content_top; /* Content coordinate, i.e. below title bar if there is one. */
163 uint flags; /* GPUSeqFlags bitmask. */
164 /* Strip colors, each is uchar4 packed with equivalent of packUnorm4x8. */
170 float _pad0;
171 float _pad1;
172};
173#ifndef GPU_SHADER
175 "SeqStripDrawData UBO must not exceed minspec UBO size (16384)")
176#endif
177
178/* VSE per-thumbnail data for timeline rendering. */
179struct [[host_shared]] SeqStripThumbData {
180 /* Strip rectangle positions. */
181 float left;
182 float right;
183 float bottom;
184 float top;
185 /* Thumbnail rectangle positions. */
186 float x1;
187 float y1;
188 float x2;
189 float y2;
190 /* Thumbnail UVs. */
191 float u1;
192 float v1;
193 float u2;
194 float v2;
195 float4 tint_color;
196};
197#ifndef GPU_SHADER
198BLI_STATIC_ASSERT(sizeof(SeqStripThumbData) * GPU_SEQ_STRIP_DRAW_DATA_LEN <= 16384,
199 "SeqStripThumbData UBO must not exceed minspec UBO size (16384)")
200#endif
201
202/* VSE global data for timeline rendering. */
203struct [[host_shared]] SeqContextDrawData {
204 float round_radius;
205 float pixelsize;
206 uint col_back;
207 float _pad0;
208};
209
210/* VSE scope point rasterizer data. */
212 uint col_r;
213 uint col_g;
214 uint col_b;
215 uint col_a;
216};
217
223
253
256 uint data[16];
257};
258
270
271#ifdef GPU_SHADER
272TestOutput test_output(TestOutputRawData expect, TestOutputRawData result, bool status, uint type)
273{
274 TestOutput test;
275 test.expect = expect;
276 test.result = result;
278 test.type = type;
279 return test;
280}
281#endif
@ TEST_TYPE_IVEC2
@ TEST_TYPE_UINT
@ TEST_TYPE_INT
@ TEST_TYPE_IVEC4
@ TEST_TYPE_MAT2X2
@ TEST_TYPE_VEC2
@ TEST_TYPE_FLOAT
@ TEST_TYPE_VEC3
@ TEST_TYPE_BOOL
@ TEST_TYPE_IVEC3
@ TEST_TYPE_UVEC3
@ TEST_TYPE_MAT3X3
@ TEST_TYPE_UVEC2
@ TEST_TYPE_MAT4X4
@ TEST_TYPE_MAT2X3
@ TEST_TYPE_MAT4X3
@ TEST_TYPE_MAT3X2
@ TEST_TYPE_MAT4X2
@ TEST_TYPE_UVEC4
@ TEST_TYPE_MAT2X4
@ TEST_TYPE_VEC4
@ TEST_TYPE_MAT3X4
static constexpr int MIPMAP_UPDATE_CHUNK_SIZE
GPUKeyframeShapes
@ GPU_KEYFRAME_SHAPE_INNER_DOT
@ GPU_KEYFRAME_SHAPE_CIRCLE
@ GPU_KEYFRAME_SHAPE_SQUARE
@ GPU_KEYFRAME_SHAPE_CLIPPED_HORIZONTAL
@ GPU_KEYFRAME_SHAPE_ARROW_END_MIXED
@ GPU_KEYFRAME_SHAPE_DIAMOND
@ GPU_KEYFRAME_SHAPE_ARROW_END_MAX
@ GPU_KEYFRAME_SHAPE_ARROW_END_MIN
@ GPU_KEYFRAME_SHAPE_CLIPPED_VERTICAL
@ TEST_STATUS_NONE
@ TEST_STATUS_PASSED
@ TEST_STATUS_FAILED
static constexpr int MIPMAP_UPDATE_TILE_SIZE
static constexpr int GPU_SEQ_STRIP_DRAW_DATA_LEN
@ GPU_SEQ_FLAG_HIGHLIGHT
@ GPU_SEQ_FLAG_BACKGROUND
@ GPU_SEQ_FLAG_SINGLE_IMAGE
@ GPU_SEQ_FLAG_LOCKED
@ GPU_SEQ_FLAG_MISSING_CONTENT
@ GPU_SEQ_FLAG_SELECTED
@ GPU_SEQ_FLAG_CLAMPED
@ GPU_SEQ_FLAG_ANY_HANDLE
@ GPU_SEQ_FLAG_BORDER
@ GPU_SEQ_FLAG_THUMBNAILS_BACKGROUND
@ GPU_SEQ_FLAG_COLOR_BAND
@ GPU_SEQ_FLAG_TRANSITION
@ GPU_SEQ_FLAG_SELECTED_LH
@ GPU_SEQ_FLAG_SELECTED_RH
@ GPU_SEQ_FLAG_OVERLAP
@ GPU_SEQ_FLAG_ACTIVE
@ GPU_SEQ_FLAG_MISSING_TITLE
static constexpr int MAX_CALLS
#define host_shared
int32_t bool32_t
#define BLI_STATIC_ASSERT(a, msg)
#define MAX_SOCKET_PARAMETERS
Definition drawnode.cc:1893
#define MAX_SOCKET_INSTANCE
Definition drawnode.cc:1894
VecBase< int32_t, 4 > int4
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
float4 calls_data[MAX_CALLS *3]
struct TestOutputRawData result
struct TestOutputRawData expect