Blender V5.3
GPU_vertex_format.hh File Reference
#include "BLI_assert.hh"
#include "BLI_compiler_compat.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_string_ref.hh"
#include "BLI_sys_types.hh"
#include "GPU_format.hh"

Go to the source code of this file.

Classes

struct  blender::gpu::AttrType< T >
struct  blender::GPUVertAttr
struct  blender::GPUVertAttr::Type
struct  blender::GPUVertFormat
struct  blender::gpu::GenericVertexFormat< T >
struct  blender::gpu::GenericVertexFormat< int8_t >
struct  blender::gpu::GenericVertexFormat< uint8_t >
struct  blender::gpu::GenericVertexFormat< bool >

Namespaces

namespace  blender
 BMesh Iterators.
namespace  blender::gpu

Macros

#define DECLARE(a, b, c, blender_enum, d, e, f, g, h)
#define GPU_VERTEX_FORMAT_EXPAND(impl)
#define DECLARE(a, b, c, blender_enum, d, e, f, g, h)
#define GPU_VERTEX_DEPRECATED_FORMAT_EXPAND(impl)
#define GPU_VERTEX_FORMAT_EXPAND_TYPED(impl)
#define ATTR_TYPE_MAPPING(_type, b, c, blender_enum, d, e, f, g, h)
#define GPU_VERTEX_FORMAT_ADD_ATTR(attr)
#define _ATTR_EXPAND1(a)
#define _ATTR_EXPAND2(a, b)
#define _ATTR_EXPAND3(a, b, c)
#define _ATTR_EXPAND4(a, b, c, d)
#define _ATTR_EXPAND5(a, b, c, d, e)
#define _ATTR_EXPAND6(a, b, c, d, e, f)
#define _ATTR_EXPAND7(a, b, c, d, e, f, g)
#define _ATTR_EXPAND8(a, b, c, d, e, f, g, h)
#define _ATTR_EXPAND9(a, b, c, d, e, f, g, h, i)
#define _ATTR_EXPAND10(a, b, c, d, e, f, g, h, i, j)
#define _ATTR_EXPAND11(a, b, c, d, e, f, g, h, i, j, k)
#define _ATTR_EXPAND12(a, b, c, d, e, f, g, h, i, j, k, l)
#define _ATTR_EXPAND13(a, b, c, d, e, f, g, h, i, j, k, l, m)
#define _ATTR_EXPAND14(a, b, c, d, e, f, g, h, i, j, k, l, m, n)
#define _ATTR_EXPAND15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
#define _ATTR_EXPAND16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
#define GPU_VERTEX_FORMAT_ADD_ATTR_EXPAND(...)
#define GPU_VERTEX_FORMAT_FUNC(_VertT, ...)

Enumerations

enum class  blender::gpu::VertAttrType : uint8_t { blender::gpu::Invalid = 0 }
enum  blender::GPUVertCompType {
  blender::GPU_COMP_I8 = 0 , blender::GPU_COMP_U8 , blender::GPU_COMP_I16 , blender::GPU_COMP_U16 ,
  blender::GPU_COMP_I32 , blender::GPU_COMP_U32 , blender::GPU_COMP_F32 , blender::GPU_COMP_I10 ,
  blender::GPU_COMP_MAX
}
enum  blender::GPUVertFetchMode { blender::GPU_FETCH_FLOAT = 0 , blender::GPU_FETCH_INT , blender::GPU_FETCH_INT_TO_FLOAT_UNIT }

Functions

constexpr DataFormat blender::gpu::to_data_format (VertAttrType format)
 blender::BLI_STATIC_ASSERT (GPU_VERT_ATTR_NAMES_BUF_LEN<=256, "We use uchar as index inside the name buffer " "so GPU_VERT_ATTR_NAMES_BUF_LEN needs to be " "smaller than GPUVertFormat->name_offset and " "GPUVertAttr->names maximum value")
void blender::GPU_vertformat_clear (GPUVertFormat *)
void blender::GPU_vertformat_copy (GPUVertFormat *dest, const GPUVertFormat &src)
void blender::GPU_vertformat_from_shader (GPUVertFormat *format, const gpu::Shader *shader)
uint blender::GPU_vertformat_attr_add (GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
uint blender::GPU_vertformat_attr_add_legacy (GPUVertFormat *, StringRef name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
void blender::GPU_vertformat_alias_add (GPUVertFormat *, StringRef alias)
GPUVertFormat blender::GPU_vertformat_from_attribute (StringRef name, gpu::VertAttrType type)
void blender::GPU_vertformat_multiload_enable (GPUVertFormat *format, int load_count)
void blender::GPU_vertformat_deinterleave (GPUVertFormat *format)
int blender::GPU_vertformat_attr_id_get (const GPUVertFormat *, StringRef name)
BLI_INLINE const char * blender::GPU_vertformat_attr_name_get (const GPUVertFormat *format, const GPUVertAttr *attr, uint n_idx)
void blender::GPU_vertformat_attr_rename (GPUVertFormat *format, int attr, const char *new_name)
void blender::GPU_vertformat_safe_attr_name (StringRef attr_name, char *r_safe_name, uint max_len)

Variables

static constexpr int blender::GPU_VERT_ATTR_MAX_LEN = 16
static constexpr int blender::GPU_VERT_ATTR_MAX_NAMES = 6
static constexpr int blender::GPU_VERT_ATTR_NAMES_BUF_LEN = 256
static constexpr int blender::GPU_VERT_FORMAT_MAX_NAMES = 63
static constexpr int blender::GPU_MAX_SAFE_ATTR_NAME = 12

Detailed Description

GPU vertex format

Definition in file GPU_vertex_format.hh.

Macro Definition Documentation

◆ _ATTR_EXPAND1

#define _ATTR_EXPAND1 ( a)
Value:
#define GPU_VERTEX_FORMAT_ADD_ATTR(attr)

Definition at line 248 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND10

#define _ATTR_EXPAND10 ( a,
b,
c,
d,
e,
f,
g,
h,
i,
j )
Value:
_ATTR_EXPAND9(a, b, c, d, e, f, g, h, i) \
GPU_VERTEX_FORMAT_ADD_ATTR(j)
#define _ATTR_EXPAND9(a, b, c, d, e, f, g, h, i)

Definition at line 273 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND11

#define _ATTR_EXPAND11 ( a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k )
Value:
_ATTR_EXPAND10(a, b, c, d, e, f, g, h, i, j) \
GPU_VERTEX_FORMAT_ADD_ATTR(k)
#define _ATTR_EXPAND10(a, b, c, d, e, f, g, h, i, j)

Definition at line 276 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND12

#define _ATTR_EXPAND12 ( a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l )
Value:
_ATTR_EXPAND11(a, b, c, d, e, f, g, h, i, j, k) \
GPU_VERTEX_FORMAT_ADD_ATTR(l)
#define _ATTR_EXPAND11(a, b, c, d, e, f, g, h, i, j, k)

Definition at line 279 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND13

#define _ATTR_EXPAND13 ( a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m )
Value:
_ATTR_EXPAND12(a, b, c, d, e, f, g, h, i, j, k, l) \
GPU_VERTEX_FORMAT_ADD_ATTR(m)
#define _ATTR_EXPAND12(a, b, c, d, e, f, g, h, i, j, k, l)

Definition at line 282 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND14

#define _ATTR_EXPAND14 ( a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n )
Value:
_ATTR_EXPAND13(a, b, c, d, e, f, g, h, i, j, k, l, m) \
GPU_VERTEX_FORMAT_ADD_ATTR(n)
#define _ATTR_EXPAND13(a, b, c, d, e, f, g, h, i, j, k, l, m)

Definition at line 285 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND15

#define _ATTR_EXPAND15 ( a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o )
Value:
_ATTR_EXPAND14(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \
GPU_VERTEX_FORMAT_ADD_ATTR(o)
#define _ATTR_EXPAND14(a, b, c, d, e, f, g, h, i, j, k, l, m, n)

Definition at line 288 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND16

#define _ATTR_EXPAND16 ( a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p )
Value:
_ATTR_EXPAND15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) \
GPU_VERTEX_FORMAT_ADD_ATTR(p)
#define _ATTR_EXPAND15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)

Definition at line 291 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND2

#define _ATTR_EXPAND2 ( a,
b )
Value:
GPU_VERTEX_FORMAT_ADD_ATTR(b)
#define _ATTR_EXPAND1(a)

Definition at line 249 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND3

#define _ATTR_EXPAND3 ( a,
b,
c )
Value:
GPU_VERTEX_FORMAT_ADD_ATTR(c)
#define _ATTR_EXPAND2(a, b)

Definition at line 252 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND4

#define _ATTR_EXPAND4 ( a,
b,
c,
d )
Value:
_ATTR_EXPAND3(a, b, c) \
GPU_VERTEX_FORMAT_ADD_ATTR(d)
#define _ATTR_EXPAND3(a, b, c)

Definition at line 255 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND5

#define _ATTR_EXPAND5 ( a,
b,
c,
d,
e )
Value:
_ATTR_EXPAND4(a, b, c, d) \
GPU_VERTEX_FORMAT_ADD_ATTR(e)
#define _ATTR_EXPAND4(a, b, c, d)

Definition at line 258 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND6

#define _ATTR_EXPAND6 ( a,
b,
c,
d,
e,
f )
Value:
_ATTR_EXPAND5(a, b, c, d, e) \
GPU_VERTEX_FORMAT_ADD_ATTR(f)
#define _ATTR_EXPAND5(a, b, c, d, e)

Definition at line 261 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND7

#define _ATTR_EXPAND7 ( a,
b,
c,
d,
e,
f,
g )
Value:
_ATTR_EXPAND6(a, b, c, d, e, f) \
GPU_VERTEX_FORMAT_ADD_ATTR(g)
#define _ATTR_EXPAND6(a, b, c, d, e, f)

Definition at line 264 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND8

#define _ATTR_EXPAND8 ( a,
b,
c,
d,
e,
f,
g,
h )
Value:
_ATTR_EXPAND7(a, b, c, d, e, f, g) \
GPU_VERTEX_FORMAT_ADD_ATTR(h)
#define _ATTR_EXPAND7(a, b, c, d, e, f, g)

Definition at line 267 of file GPU_vertex_format.hh.

◆ _ATTR_EXPAND9

#define _ATTR_EXPAND9 ( a,
b,
c,
d,
e,
f,
g,
h,
i )
Value:
_ATTR_EXPAND8(a, b, c, d, e, f, g, h) \
GPU_VERTEX_FORMAT_ADD_ATTR(i)
#define _ATTR_EXPAND8(a, b, c, d, e, f, g, h)

Definition at line 270 of file GPU_vertex_format.hh.

◆ ATTR_TYPE_MAPPING

#define ATTR_TYPE_MAPPING ( _type,
b,
c,
blender_enum,
d,
e,
f,
g,
h )
Value:
template<> struct AttrType<_type> { \
static constexpr VertAttrType type = VertAttrType::blender_enum; \
};

Definition at line 143 of file GPU_vertex_format.hh.

◆ DECLARE [1/2]

#define DECLARE ( a,
b,
c,
blender_enum,
d,
e,
f,
g,
h )
Value:
blender_enum##_DEPRECATED = int(DataFormat::blender_enum),

Definition at line 28 of file GPU_vertex_format.hh.

◆ DECLARE [2/2]

#define DECLARE ( a,
b,
c,
blender_enum,
d,
e,
f,
g,
h )
Value:
blender_enum = int(DataFormat::blender_enum),

Definition at line 28 of file GPU_vertex_format.hh.

◆ GPU_VERTEX_DEPRECATED_FORMAT_EXPAND

#define GPU_VERTEX_DEPRECATED_FORMAT_EXPAND ( impl)
Value:
SNORM_8_(impl) \
SNORM_8_8_(impl) \
SNORM_8_8_8_(impl) \
SNORM_16_(impl) \
SNORM_16_16_16_(impl) \
UNORM_8_(impl) \
UNORM_8_8_(impl) \
UNORM_8_8_8_(impl) \
UNORM_16_(impl) \
UNORM_16_16_16_(impl) \
SINT_8_(impl) \
SINT_8_8_(impl) \
SINT_8_8_8_(impl) \
SINT_16_(impl) \
SINT_16_16_16_(impl) \
UINT_8_(impl) \
UINT_8_8_(impl) \
UINT_8_8_8_(impl) \
UINT_16_(impl) \
UINT_16_16_16_(impl)
#define SNORM_8_(impl)
Definition GPU_format.hh:24

Definition at line 82 of file GPU_vertex_format.hh.

Referenced by blender::gpu::gpu_vertex_format_to_metal().

◆ GPU_VERTEX_FORMAT_ADD_ATTR

#define GPU_VERTEX_FORMAT_ADD_ATTR ( attr)
Value:
format.attribute_add(#attr, gpu::AttrType<decltype(attr)>::type, offsetof(VertT, attr)); \
BLI_STATIC_ASSERT(offsetof(VertT, attr) < 255, #attr " has offset greater than 255") \
BLI_STATIC_ASSERT(offsetof(VertT, attr) % 4 == 0, #attr " is not aligned to 4 bytes")
#define offsetof(t, d)

Definition at line 243 of file GPU_vertex_format.hh.

◆ GPU_VERTEX_FORMAT_ADD_ATTR_EXPAND

#define GPU_VERTEX_FORMAT_ADD_ATTR_EXPAND ( ...)
Value:
VA_NARGS_CALL_OVERLOAD(_ATTR_EXPAND, __VA_ARGS__)
#define VA_NARGS_CALL_OVERLOAD(name,...)

Definition at line 296 of file GPU_vertex_format.hh.

◆ GPU_VERTEX_FORMAT_EXPAND

#define GPU_VERTEX_FORMAT_EXPAND ( impl)

Definition at line 30 of file GPU_vertex_format.hh.

Referenced by blender::gpu::gpu_vertex_format_to_metal().

◆ GPU_VERTEX_FORMAT_EXPAND_TYPED

#define GPU_VERTEX_FORMAT_EXPAND_TYPED ( impl)
Value:
\
SINT_16_16_(impl) \
SINT_16_16_16_16_(impl) \
\
SINT_32_(impl) \
SINT_32_32_(impl) \
SINT_32_32_32_(impl) \
SINT_32_32_32_32_(impl) \
\
UINT_8_8_8_8_(impl) \
\
UINT_16_16_(impl) \
UINT_16_16_16_16_(impl) \
\
UINT_32_(impl) \
UINT_32_32_(impl) \
UINT_32_32_32_(impl) \
UINT_32_32_32_32_(impl) \
\
SFLOAT_32_(impl) \
SFLOAT_32_32_(impl) \
SFLOAT_32_32_32_(impl) \
SFLOAT_32_32_32_32_(impl) \
\
\
#define SINT_8_8_8_8_(impl)
Definition GPU_format.hh:47

Definition at line 110 of file GPU_vertex_format.hh.

◆ GPU_VERTEX_FORMAT_FUNC

#define GPU_VERTEX_FORMAT_FUNC ( _VertT,
... )
Value:
static GPUVertFormat &format() \
{ \
using VertT = _VertT; \
static GPUVertFormat format = {}; \
if (format.attr_len == 0) { \
GPU_VERTEX_FORMAT_ADD_ATTR_EXPAND(__VA_ARGS__) \
format.stride = sizeof(VertT); \
BLI_STATIC_ASSERT(sizeof(VertT) < 1024, "Vertex format is too big") \
format.packed = true; \
BLI_STATIC_ASSERT_ALIGN(VertT, 4) \
} \
return format; \
}
std::string format(const std::string &fmt, Args &&...args)
Definition diagnostic.hh:43

Definition at line 298 of file GPU_vertex_format.hh.

Referenced by blender::draw::test_draw_curves_interpolate_attributes(), blender::draw::test_draw_curves_interpolate_position(), blender::draw::test_draw_curves_lib(), and blender::draw::test_draw_curves_topology().