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

Go to the source code of this file.

Classes

struct  blender::gpu::AttrType< T >
struct  GPUVertAttr
struct  GPUVertAttr::Type
struct  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
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  GPUVertCompType {
  GPU_COMP_I8 = 0 , GPU_COMP_U8 , GPU_COMP_I16 , GPU_COMP_U16 ,
  GPU_COMP_I32 , GPU_COMP_U32 , GPU_COMP_F32 , GPU_COMP_I10 ,
  GPU_COMP_MAX
}
enum  GPUVertFetchMode { GPU_FETCH_FLOAT = 0 , GPU_FETCH_INT , GPU_FETCH_INT_TO_FLOAT_UNIT }

Functions

constexpr DataFormat blender::gpu::to_data_format (VertAttrType format)
 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 GPU_vertformat_clear (GPUVertFormat *)
void GPU_vertformat_copy (GPUVertFormat *dest, const GPUVertFormat &src)
void GPU_vertformat_from_shader (GPUVertFormat *format, const blender::gpu::Shader *shader)
uint GPU_vertformat_attr_add (GPUVertFormat *format, blender::StringRef name, blender::gpu::VertAttrType type)
uint GPU_vertformat_attr_add_legacy (GPUVertFormat *, blender::StringRef name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
void GPU_vertformat_alias_add (GPUVertFormat *, blender::StringRef alias)
GPUVertFormat GPU_vertformat_from_attribute (blender::StringRef name, blender::gpu::VertAttrType type)
void GPU_vertformat_multiload_enable (GPUVertFormat *format, int load_count)
void GPU_vertformat_deinterleave (GPUVertFormat *format)
int GPU_vertformat_attr_id_get (const GPUVertFormat *, blender::StringRef name)
BLI_INLINE const char * GPU_vertformat_attr_name_get (const GPUVertFormat *format, const GPUVertAttr *attr, uint n_idx)
void GPU_vertformat_attr_rename (GPUVertFormat *format, int attr, const char *new_name)
void GPU_vertformat_safe_attr_name (blender::StringRef attr_name, char *r_safe_name, uint max_len)

Variables

static constexpr int GPU_VERT_ATTR_MAX_LEN = 16
static constexpr int GPU_VERT_ATTR_MAX_NAMES = 6
static constexpr int GPU_VERT_ATTR_NAMES_BUF_LEN = 256
static constexpr int GPU_VERT_FORMAT_MAX_NAMES = 63
static constexpr int 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 244 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)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
i
Definition text_draw.cc:230

Definition at line 269 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 272 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)
ATTR_WARN_UNUSED_RESULT const BMLoop * l

Definition at line 275 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 278 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 281 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 284 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 287 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 245 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 248 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 251 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 254 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 257 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 260 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 263 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 266 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 138 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 26 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 26 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 77 of file GPU_vertex_format.hh.

◆ GPU_VERTEX_FORMAT_ADD_ATTR

#define GPU_VERTEX_FORMAT_ADD_ATTR ( attr)
Value:
format.attribute_add( \
#attr, blender::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)
format

Definition at line 238 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 292 of file GPU_vertex_format.hh.

◆ GPU_VERTEX_FORMAT_EXPAND

#define GPU_VERTEX_FORMAT_EXPAND ( impl)

Definition at line 28 of file GPU_vertex_format.hh.

◆ 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) \
\
/* UFLOAT_11_11_10_(impl) Available on Metal (and maybe VK) but not on GL. */ \
/* UFLOAT_9_9_9_EXP_5_(impl) Available on Metal (and maybe VK) but not on GL. */
#define SINT_8_8_8_8_(impl)
Definition GPU_format.hh:47

Definition at line 105 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; \
}

Definition at line 294 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().

Enumeration Type Documentation

◆ GPUVertCompType

Enumerator
GPU_COMP_I8 
GPU_COMP_U8 
GPU_COMP_I16 
GPU_COMP_U16 
GPU_COMP_I32 
GPU_COMP_U32 
GPU_COMP_F32 
GPU_COMP_I10 
GPU_COMP_MAX 

Definition at line 163 of file GPU_vertex_format.hh.

◆ GPUVertFetchMode

Enumerator
GPU_FETCH_FLOAT 
GPU_FETCH_INT 
GPU_FETCH_INT_TO_FLOAT_UNIT 

Definition at line 179 of file GPU_vertex_format.hh.

Function Documentation

◆ BLI_STATIC_ASSERT()

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"  )

◆ GPU_vertformat_alias_add()

◆ GPU_vertformat_attr_add()

uint GPU_vertformat_attr_add ( GPUVertFormat * format,
blender::StringRef name,
blender::gpu::VertAttrType type )

Definition at line 388 of file gpu_vertex_format.cc.

References name, and GPUVertAttr::type.

Referenced by acf_generic_channel_backdrop(), acf_generic_dataexpand_backdrop(), ANIM_channel_draw(), ANIM_channel_draw_widgets(), ANIM_draw_action_framerange(), ANIM_draw_cfra(), ANIM_draw_framerange(), ANIM_draw_previewrange(), ANIM_draw_scene_strip_range(), annotation_draw_eraser(), annotation_draw_stabilizer(), annotation_draw_stroke_2d(), annotation_draw_stroke_3d(), annotation_draw_stroke_buffer(), annotation_draw_stroke_point(), arrow_draw_geom(), batch_screen_edges_get(), brush_drawcursor(), button2d_draw_intern(), button2d_geom_draw_backdrop(), cage2d_draw_box_corners(), cage2d_draw_box_interaction(), cage2d_draw_circle_wire(), cage2d_draw_rect_corner_handles(), cage2d_draw_rect_edge_handles(), cage2d_draw_rect_rotate_handle(), cage2d_draw_rect_wire(), cage3d_draw_box_corners(), cage3d_draw_box_interaction(), cage3d_draw_circle_handles(), cage3d_draw_circle_wire(), channel_list_draw_keys(), circle_draw_rgb(), clip_draw_dopesheet_channels(), clip_draw_dopesheet_main(), clip_draw_graph(), console_textview_draw_cursor(), blender::opensubdiv::GPUVertexBuffer::Create(), cursor_box_draw(), blender::draw::curve_create_attribute(), blender::draw::curve_create_curves_pos(), blender::draw::curve_create_edit_curves_nor(), blender::draw::curve_create_edit_data_and_handles(), blender::ed::curves::curve_draw_stroke_3d(), curve_draw_stroke_3d(), dial_geom_draw(), dial_ghostarc_draw(), dial_ghostarc_draw_helpline(), dial_ghostarc_draw_incremental_angle(), BlenderDisplayDriver::draw(), draw_anti_tria(), draw_azone_arrow(), draw_background(), draw_background(), draw_channel_strips(), blender::ed::greasepencil::image_render::draw_circles(), draw_columnheader_background(), draw_columnheader_columns(), blender::ed::greasepencil::draw_control_points(), draw_current_frame(), blender::ed::vse::draw_cursor_2d(), draw_disk_shaded(), draw_display_buffer(), draw_distortion(), draw_dividers(), blender::ed::greasepencil::image_render::draw_dot(), blender::ed::greasepencil::image_render::draw_dots(), draw_fcurve(), draw_fcurve_handles(), draw_fcurve_modifier_controls_envelope(), draw_fcurve_samples(), draw_fcurve_vertices(), blender::ed::greasepencil::image_render::draw_grease_pencil_stroke(), draw_image_cache(), draw_image_sample_line(), draw_image_uv_custom_region(), draw_line_bounds(), draw_line_loop(), draw_line_pairs(), blender::ed::greasepencil::image_render::draw_lines(), draw_marker_areas(), draw_marker_line(), draw_markers_background(), draw_movieclip_cache(), draw_movieclip_muted(), draw_nla_main_data(), blender::ed::space_node::draw_nodespace_back_pix(), draw_normalization_borders(), blender::ed::vse::draw_overlap_frame_indicator(), draw_overshoot_triangle(), draw_parallel_lines(), draw_plane_marker_ex(), draw_plane_marker_image(), blender::ed::greasepencil::image_render::draw_polyline(), draw_render_info(), blender::ed::vse::draw_seq_timeline_channels(), draw_single_handle(), draw_spline_points(), blender::ed::spreadsheet::draw_spreadsheet_in_region(), draw_stabilization_border(), blender::draw::draw_subdiv_cache_update_extra_coarse_face_data(), draw_suggestion_list(), draw_text_decoration(), draw_text_main(), draw_textscroll(), blender::ed::vse::draw_timeline_sfra_efra(), draw_track_path(), draw_tracking_tracks(), draw_view_axis(), blender::ed::transform::drawConstraint(), blender::ed::transform::drawEdgeSlide(), drawFlyPixel(), blender::ed::transform::drawLine(), blender::ed::transform::drawPropCircle(), blender::ed::transform::drawPropRange(), drawrenderborder(), blender::ed::transform::drawSnapping(), blender::render::hydra::DrawTexture::DrawTexture(), blender::ed::transform::drawVertSlide(), drawviewborder(), drawWalkPixel(), blender::draw::drw_volume_selection_surface_cb(), blender::draw::drw_volume_wireframe_cb(), blender::gpu::Context::dummy_vbo_get(), blender::ed::sculpt_paint::dyntopo::dyntopo_detail_size_edit_draw(), ED_image_draw_cursor(), ED_image_draw_info(), ED_imbuf_sample_draw(), ED_mask_draw_frames(), ED_region_cache_draw_background(), ED_region_cache_draw_cached_segments(), ED_region_do_draw(), ED_region_draw_mouse_line_cb(), ED_region_grid_draw(), ED_region_image_metadata_draw(), ED_region_image_render_region_draw(), ED_region_info_draw_multiline(), ED_time_scrub_channel_search_draw(), ED_view3d_cursor_snap_draw_util(), EDBM_preselect_edgering_draw(), EDBM_preselect_elem_draw(), blender::draw::edit_points_vert_format_get(), blender::draw::edituv_data_format(), blender::draw::CurvesEvalCache::ensure_attribute(), blender::draw::extract_edituv_stretch_angle(), blender::draw::extract_face_dots_edituv_data(), blender::draw::extract_face_dots_uv(), blender::draw::extract_normals(), blender::draw::extract_sculpt_data_subdiv(), blender::draw::extract_skin_roots(), blender::draw::extract_tan_init_common(), file_draw_preview(), blender::gpu::MTLContext::get_dummy_texture(), blender::draw::get_edit_data_format(), blender::draw::get_edituv_stretch_angle_format_subdiv(), blender::draw::get_normals_format(), blender::draw::get_origindex_format(), blender::draw::get_sculpt_data_format(), gizmo_axis_draw(), gizmo_cage2d_draw_intern(), gizmo_cage3d_draw_intern(), gizmo_primitive_draw_geom(), gizmo_ruler_draw(), GPU_batch_tris_from_poly_2d_encoded(), GPU_batch_unit_cube(), GPU_batch_wire_from_poly_2d_encoded(), gpu_viewport_batch_format(), GPU_viewport_stereo_composite(), blender::ed::sculpt_paint::image::ops::paint::gradient_draw_line(), graph_draw_driver_debug(), graph_draw_ghost_curves(), graph_main_region_draw(), blender::draw::grease_pencil_color_format(), blender::draw::grease_pencil_stroke_format(), imm_draw_box_checker_2d_ex(), immDrawPixelsTexSetupAttributes(), blender::draw::init_empty_dummy_batch(), knife_draw_line(), knifetool_draw(), knifetool_draw_angle(), knifetool_draw_visible_distances(), blender::draw::lattice_batch_cache_create_overlay_batches(), blender::draw::lattice_batch_cache_get_pos(), mask_draw_curve_type(), blender::draw::mesh_extract_uv_format_init(), blender::ed::sculpt_paint::min_distance_edit::min_distance_edit_draw(), move_geom_draw(), nla_action_draw_keyframes(), nla_actionclip_draw_markers(), nla_draw_strip(), nla_draw_use_dashed_outlines(), blender::ed::space_node::node_draw_collapsed(), blender::ed::space_node::node_draw_preview_background(), blender::ed::space_node::node_draw_zones_and_frames(), blender::ed::space_node::nodelink_batch_init(), blender::ed::outliner::outliner_back(), blender::ed::outliner::outliner_draw_hierarchy_lines(), blender::ed::outliner::outliner_draw_separator(), blender::ed::outliner::outliner_draw_struct_marks(), blender::ed::sculpt_paint::paint_cursor_setup_2D_drawing(), blender::ed::sculpt_paint::paint_cursor_setup_3D_drawing(), blender::ed::sculpt_paint::paint_draw_cursor_overlay(), blender::ed::sculpt_paint::paint_draw_curve_cursor(), blender::ed::sculpt_paint::paint_draw_line_cursor(), blender::ed::sculpt_paint::paint_draw_smooth_cursor(), blender::ed::sculpt_paint::paint_draw_tex_overlay(), blender::draw::particle_batch_cache_ensure_pos(), blender::draw::particle_batch_cache_ensure_pos_and_seg(), playanim_toscreen_ex(), blender::draw::pointcloud_extract_attribute(), blender::draw::pointcloud_extract_position_and_radius(), preset_2d_format(), preset_3d_format(), blender::ed::vse::preview_draw_texture_simple(), blender::ed::vse::preview_draw_texture_to_linear(), pygpu_shader_format_calc(), radial_control_paint_cursor(), radial_control_paint_tex(), rounded_corners(), blender::ed::vse::SeqQuadsBatch::SeqQuadsBatch(), blender::ed::vse::sequencer_draw_borders_overlay(), blender::ed::vse::sequencer_draw_scopes(), blender::ed::vse::sequencer_preview_draw_overlays(), blender::ed::vse::sequencer_retiming_keys_draw(), stitch_draw(), blender::ed::vse::strip_draw_image_origin_and_outline(), blender::gpu::tests::test_buffer_texture(), blender::gpu::tests::test_immediate_one_plane(), blender::gpu::tests::test_immediate_two_planes(), blender::gpu::tests::test_shader_compute_vbo(), blender::gpu::tests::test_storage_buffer_copy_from_vertex_buffer(), blender::ed::vse::text_edit_draw(), textview_draw_sel(), textview_draw_string(), timeline_draw_cache(), blender::ed::transform::transform_draw_cursor_draw(), ui_draw_but_COLORBAND(), ui_draw_but_CURVE(), ui_draw_but_CURVEPROFILE(), ui_draw_but_HISTOGRAM(), ui_draw_but_HSVCIRCLE(), ui_draw_but_HSVCUBE(), ui_draw_but_TAB_outline(), ui_draw_but_TRACKPREVIEW(), ui_draw_but_UNITVEC(), ui_draw_but_VECTORSCOPE(), ui_draw_but_WAVEFORM(), ui_draw_button_sections_alignment_separator(), ui_draw_gradient(), ui_draw_pie_center(), ui_draw_popover_back_impl(), ui_draw_rounded_corners_inverted(), ui_draw_separator(), UI_draw_text_underline(), ui_hsv_cursor(), UI_panel_category_draw_all(), ui_tooltip_region_draw_cb(), UI_view2d_dot_grid_draw(), UI_view2d_multi_grid_draw(), blender::ed::vse::update_gpu_scopes(), v3d_cursor_plane_draw_grid(), blender::gpu::tests::vertex_buffer_fetch_mode(), vflag_format(), vicon_colorset_draw(), vicon_gplayer_color_draw(), vicon_keytype_draw_wrapper(), blender::ed::object::voxel_size_edit_draw(), waveform_draw_one(), waveform_draw_rgb(), widget_draw_extra_mask(), widget_draw_text(), widget_progress_type_ring(), widget_swatch(), wm_gesture_draw_circle(), wm_gesture_draw_cross(), wm_gesture_draw_lasso(), wm_gesture_draw_line(), wm_gesture_draw_line_active_side(), wm_gesture_draw_polyline(), wm_gesture_draw_rect(), wm_gizmo_geometryinfo_draw(), wm_software_cursor_draw_bitmap(), wm_software_cursor_draw_crosshair(), wm_stereo3d_draw_sidebyside(), wm_stereo3d_draw_topbottom(), wm_xr_controller_aim_draw(), wm_xr_controller_model_batch_create(), and wm_xr_raycast_draw().

◆ GPU_vertformat_attr_add_legacy()

uint GPU_vertformat_attr_add_legacy ( GPUVertFormat * format,
blender::StringRef name,
GPUVertCompType comp_type,
uint comp_len,
GPUVertFetchMode fetch_mode )

◆ GPU_vertformat_attr_id_get()

int GPU_vertformat_attr_id_get ( const GPUVertFormat * format,
blender::StringRef name )

◆ GPU_vertformat_attr_name_get()

◆ GPU_vertformat_attr_rename()

void GPU_vertformat_attr_rename ( GPUVertFormat * format,
int attr,
const char * new_name )
Warning
Can only rename using a string with same character count.
This removes all other aliases of this attribute.

Definition at line 480 of file gpu_vertex_format.cc.

References attr_id, BLI_assert, GPU_vertformat_attr_name_get(), i, and GPUVertAttr::name_len.

◆ GPU_vertformat_clear()

◆ GPU_vertformat_copy()

void GPU_vertformat_copy ( GPUVertFormat * dest,
const GPUVertFormat & src )

Definition at line 347 of file gpu_vertex_format.cc.

Referenced by blender::gpu::VertBuf::init().

◆ GPU_vertformat_deinterleave()

void GPU_vertformat_deinterleave ( GPUVertFormat * format)

Make attribute layout non-interleaved. Warning! This does not change data layout! Use direct buffer access to fill the data. This is for advanced usage.

De-interleaved data means all attribute data for each attribute is stored continuously like this: 000011112222 instead of: 012012012012

Note
This is per attribute de-interleaving, NOT per component.

Definition at line 537 of file gpu_vertex_format.cc.

Referenced by blender::draw::extract_tan_init_common(), blender::draw::init_vbo_for_attribute(), and blender::draw::mesh_extract_uv_format_init().

◆ GPU_vertformat_from_attribute()

GPUVertFormat GPU_vertformat_from_attribute ( blender::StringRef name,
blender::gpu::VertAttrType type )

Return a vertex format from a single attribute description. The attribute ID is ensured to be 0.

Definition at line 428 of file gpu_vertex_format.cc.

References name, and GPUVertAttr::type.

Referenced by blender::draw::build_poly_other_map_vbo(), blender::draw::create_edit_points_data(), blender::draw::create_edit_points_position(), blender::draw::create_edit_points_position_vbo(), blender::draw::create_edit_points_selection(), blender::draw::create_vbo(), blender::draw::DRW_vertbuf_create_wiredata(), blender::draw::extract_attr_viewer(), blender::draw::extract_edge_factor(), blender::draw::extract_edge_factor_subdiv(), blender::draw::extract_edituv_stretch_angle_subdiv(), blender::draw::extract_edituv_stretch_area(), blender::draw::extract_edituv_stretch_area_subdiv(), blender::draw::extract_face_dot_normals(), blender::draw::extract_lines_loose_geom_subdiv(), blender::draw::extract_mesh_analysis(), blender::draw::extract_normals_subdiv(), blender::draw::extract_orco(), blender::draw::extract_positions(), blender::draw::extract_positions_subdiv(), blender::draw::extract_vert_normals(), blender::draw::extract_weights(), blender::draw::extract_weights_subdiv(), blender::draw::pbvh::face_set_format(), blender::draw::get_coarse_tan_format(), blender::draw::get_fdots_nor_format_subdiv(), blender::draw::get_fdots_pos_format(), blender::draw::get_paint_overlay_flag_format(), blender::draw::grease_pencil_edit_batch_ensure(), blender::draw::grease_pencil_weight_batch_ensure(), blender::draw::pbvh::mask_format(), blender::draw::pbvh::normal_format(), and blender::draw::pbvh::position_format().

◆ GPU_vertformat_from_shader()

◆ GPU_vertformat_multiload_enable()

void GPU_vertformat_multiload_enable ( GPUVertFormat * format,
int load_count )

Makes vertex attribute from the next vertices to be accessible in the vertex shader. For an attribute named "attr" you can access the next nth vertex using "attr{number}". Use this function after specifying all the attributes in the format.

NOTE: This does NOT work when using indexed rendering. NOTE: Only works for first attribute name. (this limitation can be changed if needed)

WARNING: this function creates a lot of aliases/attributes, make sure to keep the attribute name short to avoid overflowing the name-buffer.

Definition at line 436 of file gpu_vertex_format.cc.

References BLI_assert, copy_attr_name(), GPU_VERT_ATTR_MAX_LEN, GPU_VERT_ATTR_NAMES_BUF_LEN, GPU_VERT_FORMAT_MAX_NAMES, GPU_vertformat_attr_name_get(), i, GPUVertAttr::name_len, GPUVertAttr::names, GPUVertAttr::offset, SNPRINTF, and VertexFormat_pack().

◆ GPU_vertformat_safe_attr_name()

Variable Documentation

◆ GPU_MAX_SAFE_ATTR_NAME

◆ GPU_VERT_ATTR_MAX_LEN

◆ GPU_VERT_ATTR_MAX_NAMES

int GPU_VERT_ATTR_MAX_NAMES = 6
staticconstexpr

Definition at line 157 of file GPU_vertex_format.hh.

Referenced by GPU_vertformat_alias_add().

◆ GPU_VERT_ATTR_NAMES_BUF_LEN

int GPU_VERT_ATTR_NAMES_BUF_LEN = 256
staticconstexpr

◆ GPU_VERT_FORMAT_MAX_NAMES

int GPU_VERT_FORMAT_MAX_NAMES = 63
staticconstexpr