Blender  V3.3
Typedefs | Enumerations | Functions
GPU_buffers.h File Reference
#include <stddef.h>
#include "BKE_attribute.h"
#include "BKE_pbvh.h"

Go to the source code of this file.

Typedefs

typedef struct PBVHGPUFormat PBVHGPUFormat
 
typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers
 

Enumerations

enum  { GPU_PBVH_BUFFERS_SHOW_MASK = (1 << 1) , GPU_PBVH_BUFFERS_SHOW_VCOL = (1 << 2) , GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS = (1 << 3) }
 

Functions

GPU_PBVH_BuffersGPU_pbvh_mesh_buffers_build (const struct MPoly *mpoly, const struct MLoop *mloop, const struct MLoopTri *looptri, const struct MVert *mvert, const int *face_indices, const int *sculpt_face_sets, int face_indices_len, const struct Mesh *mesh)
 
GPU_PBVH_BuffersGPU_pbvh_grid_buffers_build (int totgrid, unsigned int **grid_hidden, bool smooth)
 
GPU_PBVH_BuffersGPU_pbvh_bmesh_buffers_build (bool smooth_shading)
 
void GPU_pbvh_bmesh_buffers_update_free (GPU_PBVH_Buffers *buffers)
 
void GPU_pbvh_grid_buffers_update_free (GPU_PBVH_Buffers *buffers, const struct DMFlagMat *grid_flag_mats, const int *grid_indices)
 
void GPU_pbvh_mesh_buffers_update (PBVHGPUFormat *vbo_id, GPU_PBVH_Buffers *buffers, const struct MVert *mvert, const CustomData *vdata, const CustomData *ldata, const float *vmask, const int *sculpt_face_sets, const int face_sets_color_seed, const int face_sets_color_default, const int update_flags, const float(*vert_normals)[3])
 
bool GPU_pbvh_attribute_names_update (PBVHType pbvh_type, PBVHGPUFormat *vbo_id, const struct CustomData *vdata, const struct CustomData *ldata, bool active_attrs_only)
 
void GPU_pbvh_bmesh_buffers_update (PBVHGPUFormat *vbo_id, struct GPU_PBVH_Buffers *buffers, struct BMesh *bm, struct GSet *bm_faces, struct GSet *bm_unique_verts, struct GSet *bm_other_verts, const int update_flags)
 
void GPU_pbvh_grid_buffers_update (PBVHGPUFormat *vbo_id, GPU_PBVH_Buffers *buffers, struct SubdivCCG *subdiv_ccg, struct CCGElem **grids, const struct DMFlagMat *grid_flag_mats, int *grid_indices, int totgrid, const int *sculpt_face_sets, int face_sets_color_seed, int face_sets_color_default, const struct CCGKey *key, int update_flags)
 
void GPU_pbvh_buffers_update_flush (GPU_PBVH_Buffers *buffers)
 
void GPU_pbvh_buffers_free (GPU_PBVH_Buffers *buffers)
 
struct GPUBatchGPU_pbvh_buffers_batch_get (GPU_PBVH_Buffers *buffers, bool fast, bool wires)
 
short GPU_pbvh_buffers_material_index_get (GPU_PBVH_Buffers *buffers)
 
bool GPU_pbvh_buffers_has_overlays (GPU_PBVH_Buffers *buffers)
 
PBVHGPUFormatGPU_pbvh_make_format (void)
 
void GPU_pbvh_free_format (PBVHGPUFormat *vbo_id)
 

Typedef Documentation

◆ GPU_PBVH_Buffers

Buffers for drawing from PBVH grids.

Definition at line 1 of file GPU_buffers.h.

◆ PBVHGPUFormat

typedef struct PBVHGPUFormat PBVHGPUFormat

Definition at line 1 of file GPU_buffers.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Update mesh buffers without topology changes. Threaded.

Enumerator
GPU_PBVH_BUFFERS_SHOW_MASK 
GPU_PBVH_BUFFERS_SHOW_VCOL 
GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS 

Definition at line 81 of file GPU_buffers.h.

Function Documentation

◆ GPU_pbvh_attribute_names_update()

bool GPU_pbvh_attribute_names_update ( PBVHType  pbvh_type,
PBVHGPUFormat vbo_id,
const struct CustomData vdata,
const struct CustomData ldata,
bool  active_attrs_only 
)

Referenced by pbvh_check_draw_layout().

◆ GPU_pbvh_bmesh_buffers_build()

GPU_PBVH_Buffers* GPU_pbvh_bmesh_buffers_build ( bool  smooth_shading)

Threaded: do not call any functions that use OpenGL calls!

Definition at line 1169 of file gpu_buffers.c.

References MEM_callocN, GPU_PBVH_Buffers::show_overlay, GPU_PBVH_Buffers::smooth, and GPU_PBVH_Buffers::use_bmesh.

Referenced by pbvh_update_draw_buffer_cb().

◆ GPU_pbvh_bmesh_buffers_update()

void GPU_pbvh_bmesh_buffers_update ( PBVHGPUFormat vbo_id,
struct GPU_PBVH_Buffers buffers,
struct BMesh bm,
struct GSet bm_faces,
struct GSet bm_unique_verts,
struct GSet bm_other_verts,
const int  update_flags 
)

◆ GPU_pbvh_bmesh_buffers_update_free()

void GPU_pbvh_bmesh_buffers_update_free ( GPU_PBVH_Buffers buffers)

Free part of data for update. Not thread safe, must run in OpenGL main thread.

Definition at line 984 of file gpu_buffers.c.

References GPU_BATCH_DISCARD_SAFE, GPU_INDEXBUF_DISCARD_SAFE, GPU_PBVH_Buffers::index_buf, GPU_PBVH_Buffers::index_lines_buf, GPU_PBVH_Buffers::lines, GPU_PBVH_Buffers::smooth, and GPU_PBVH_Buffers::triangles.

Referenced by pbvh_update_draw_buffers().

◆ GPU_pbvh_buffers_batch_get()

struct GPUBatch* GPU_pbvh_buffers_batch_get ( GPU_PBVH_Buffers buffers,
bool  fast,
bool  wires 
)

◆ GPU_pbvh_buffers_free()

void GPU_pbvh_buffers_free ( GPU_PBVH_Buffers buffers)

Free buffers. Not thread safe, must run in OpenGL main thread.

Definition at line 1471 of file gpu_buffers.c.

References gpu_pbvh_buffers_clear(), and MEM_freeN.

Referenced by BKE_pbvh_free(), and pbvh_free_draw_buffers().

◆ GPU_pbvh_buffers_has_overlays()

bool GPU_pbvh_buffers_has_overlays ( GPU_PBVH_Buffers buffers)

Definition at line 1434 of file gpu_buffers.c.

References GPU_PBVH_Buffers::show_overlay.

Referenced by sculpt_draw_cb().

◆ GPU_pbvh_buffers_material_index_get()

short GPU_pbvh_buffers_material_index_get ( GPU_PBVH_Buffers buffers)

Definition at line 1439 of file gpu_buffers.c.

References GPU_PBVH_Buffers::material_index.

Referenced by sculpt_draw_cb().

◆ GPU_pbvh_buffers_update_flush()

void GPU_pbvh_buffers_update_flush ( GPU_PBVH_Buffers buffers)

Finish update. Not thread safe, must run in OpenGL main thread.

Definition at line 1457 of file gpu_buffers.c.

References GPU_PBVH_Buffers::clear_bmesh_on_flush, gpu_pbvh_buffers_clear(), GPU_vertbuf_get_data(), GPU_vertbuf_use(), and GPU_PBVH_Buffers::vert_buf.

Referenced by pbvh_update_draw_buffers().

◆ GPU_pbvh_free_format()

void GPU_pbvh_free_format ( PBVHGPUFormat vbo_id)

Definition at line 113 of file gpu_buffers.c.

References MEM_SAFE_FREE.

Referenced by BKE_pbvh_free().

◆ GPU_pbvh_grid_buffers_build()

GPU_PBVH_Buffers* GPU_pbvh_grid_buffers_build ( int  totgrid,
unsigned int **  grid_hidden,
bool  smooth 
)

Threaded: do not call any functions that use OpenGL calls!

Definition at line 884 of file gpu_buffers.c.

References GPU_PBVH_Buffers::grid_hidden, MEM_callocN, GPU_PBVH_Buffers::show_overlay, smooth(), GPU_PBVH_Buffers::smooth, and GPU_PBVH_Buffers::totgrid.

Referenced by pbvh_update_draw_buffer_cb().

◆ GPU_pbvh_grid_buffers_update()

void GPU_pbvh_grid_buffers_update ( PBVHGPUFormat vbo_id,
GPU_PBVH_Buffers buffers,
struct SubdivCCG subdiv_ccg,
struct CCGElem **  grids,
const struct DMFlagMat grid_flag_mats,
int *  grid_indices,
int  totgrid,
const int *  sculpt_face_sets,
int  face_sets_color_seed,
int  face_sets_color_default,
const struct CCGKey key,
int  update_flags 
)

◆ GPU_pbvh_grid_buffers_update_free()

void GPU_pbvh_grid_buffers_update_free ( GPU_PBVH_Buffers buffers,
const struct DMFlagMat grid_flag_mats,
const int *  grid_indices 
)

◆ GPU_pbvh_make_format()

PBVHGPUFormat* GPU_pbvh_make_format ( void  )

◆ GPU_pbvh_mesh_buffers_build()

GPU_PBVH_Buffers* GPU_pbvh_mesh_buffers_build ( const struct MPoly mpoly,
const struct MLoop mloop,
const struct MLoopTri looptri,
const struct MVert mvert,
const int *  face_indices,
const int *  sculpt_face_sets,
int  face_indices_len,
const struct Mesh mesh 
)

Build must be called once before using the other functions, used every time mesh topology changes.

Threaded: do not call any functions that use OpenGL calls!

Referenced by pbvh_update_draw_buffer_cb().

◆ GPU_pbvh_mesh_buffers_update()

void GPU_pbvh_mesh_buffers_update ( PBVHGPUFormat vbo_id,
GPU_PBVH_Buffers buffers,
const struct MVert mvert,
const CustomData vdata,
const CustomData ldata,
const float vmask,
const int *  sculpt_face_sets,
const int  face_sets_color_seed,
const int  face_sets_color_default,
const int  update_flags,
const float(*)  vert_normals[3] 
)

Creates a vertex buffer (coordinate, normal, color) and, if smooth shading, an element index buffer. Threaded: do not call any functions that use OpenGL calls!

Referenced by pbvh_update_draw_buffer_cb().