Blender V4.5
draw_subdiv_shader_shared.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 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
18 /* Offsets in the buffers data where the source and destination data start. */
21
22 /* Parameters for the DRWPatchMap. */
27
28 /* Coarse topology information. */
31
32 /* Refined topology information. */
34
35 /* The sculpt mask data layer may be null. */
37
38 /* Masks for the extra coarse face data. */
44
45 /* Number of elements to process in the compute shader (can be the coarse quad count, or the
46 * final vertex count, depending on which compute pass we do). This is used to early out in case
47 * of out of bond accesses as compute dispatch are of fixed size. */
49
52 int _pad3;
53 int _pad4;
54};
56
61
62/* Duplicate of #PosNorLoop from the mesh extract CPU code.
63 * We do not use a float3 for the position as it will be padded to a float4 which is incompatible
64 * with the format. */
65struct PosNorLoop {
66 float x, y, z;
67 float nx, ny, nz;
68 float flag;
69};
70
71/* Mirror of #UVStretchAngle in the C++ code, but using floats until proper data compression
72 * is implemented for all subdivision data. */
74 float angle;
75 float uv_angle0;
76 float uv_angle1;
77};
78
79struct LoopNormal {
80 float nx, ny, nz;
81 float flag;
82};
83
85 float x;
86 float y;
87 float z;
88};
89
90/* Structure for #CompressedPatchCoord. */
95
96/* Patch evaluation - F-dots. */
97/* float3 is padded to float4, but the format used for face-dots does not have any padding. */
98struct FDotVert {
99 float x, y, z;
100};
101
102/* Same here, do not use float3. */
103struct FDotNor {
104 float x, y, z;
105 float flag;
106};
107
108/* This structure is a carbon copy of OpenSubDiv's #PatchTable::PatchHandle. */
114
115/* This structure is a carbon copy of OpenSubDiv's #PatchCoord. */
120 float u;
121 float v;
122};
123
124/* This structure is a carbon copy of OpenSubDiv's #PatchCoord.QuadNode.
125 * Each child is a bit-field. */
126struct QuadNode {
128};
129
130/* When not using OSD we need to defined the structs as they subdiv_info still refer to them. */
131#if !defined(USE_GPU_SHADER_CREATE_INFO) || \
132 (!defined(OSD_PATCH_BASIS_GLSL) && !defined(OSD_PATCH_BASIS_METAL))
133/* This structure is a carbon copy of OpenSubDiv's #Osd::PatchParam. */
138};
139
140/* This structure is a carbon copy of OpenSubDiv's #Osd::PatchArray. */
149
150/* This structure is a carbon copy of OpenSubDiv's #Osd::PatchCoord. */
155 float s;
156 float t;
157};
158
159#endif
#define BLI_STATIC_ASSERT_ALIGN(st, align)
Definition BLI_assert.h:86
unsigned int uint
int32_t bool32_t
VecBase< uint32_t, 4 > uint4