Blender V2.61 - r43446
|
#include <limits.h>
#include <stddef.h>
#include <string.h>
#include "GL/glew.h"
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BLI_threads.h"
#include "DNA_meshdata_types.h"
#include "BKE_DerivedMesh.h"
#include "DNA_userdef_types.h"
#include "GPU_buffers.h"
Go to the source code of this file.
Classes | |
struct | GPUBufferPool |
struct | GPUVertPointLink |
struct | GPUBufferTypeSettings |
struct | VertexBufferFormat |
struct | GPU_Buffers |
Defines | |
#define | MAX_GPU_ATTRIB_DATA 32 |
#define | MAX_MATERIALS 16384 |
#define | MAX_FREE_GPU_BUFFERS 8 |
Typedefs | |
typedef struct GPUBufferPool | GPUBufferPool |
typedef struct GPUVertPointLink | GPUVertPointLink |
typedef void(* | GPUBufferCopyFunc )(DerivedMesh *dm, float *varray, int *index, int *mat_orig_to_new, void *user_data) |
Enumerations | |
enum | GPUBufferState { GPU_BUFFER_VERTEX_STATE = 1, GPU_BUFFER_NORMAL_STATE = 2, GPU_BUFFER_TEXCOORD_STATE = 4, GPU_BUFFER_COLOR_STATE = 8, GPU_BUFFER_ELEMENT_STATE = 16 } |
enum | GPUBufferType { GPU_BUFFER_VERTEX = 0, GPU_BUFFER_NORMAL, GPU_BUFFER_COLOR, GPU_BUFFER_UV, GPU_BUFFER_EDGE, GPU_BUFFER_UVEDGE } |
Functions | |
static GPUBufferPool * | gpu_buffer_pool_new (void) |
static void | gpu_buffer_pool_remove_index (GPUBufferPool *pool, int index) |
static void | gpu_buffer_pool_delete_last (GPUBufferPool *pool) |
static void | gpu_buffer_pool_free (GPUBufferPool *pool) |
static GPUBufferPool * | gpu_get_global_buffer_pool (void) |
void | GPU_global_buffer_pool_free (void) |
GPUBuffer * | GPU_buffer_alloc (int size) |
void | GPU_buffer_free (GPUBuffer *buffer) |
static void | gpu_drawobject_add_vert_point (GPUDrawObject *gdo, int vert_index, int point_index) |
static void | gpu_drawobject_add_triangle (GPUDrawObject *gdo, int base_point_index, int face_index, int v1, int v2, int v3) |
static void | gpu_drawobject_init_vert_points (GPUDrawObject *gdo, MFace *f, int totface) |
GPUDrawObject * | GPU_drawobject_new (DerivedMesh *dm) |
void | GPU_drawobject_free (DerivedMesh *dm) |
static GPUBuffer * | gpu_buffer_setup (DerivedMesh *dm, GPUDrawObject *object, int vector_size, int size, GLenum target, void *user, GPUBufferCopyFunc copy_f) |
static void | GPU_buffer_copy_vertex (DerivedMesh *dm, float *varray, int *index, int *mat_orig_to_new, void *UNUSED(user)) |
static void | GPU_buffer_copy_normal (DerivedMesh *dm, float *varray, int *index, int *mat_orig_to_new, void *UNUSED(user)) |
static void | GPU_buffer_copy_uv (DerivedMesh *dm, float *varray, int *index, int *mat_orig_to_new, void *UNUSED(user)) |
static void | GPU_buffer_copy_color3 (DerivedMesh *dm, float *varray_, int *index, int *mat_orig_to_new, void *user) |
static void | copy_mcol_uc3 (unsigned char *v, unsigned char *col) |
static void | GPU_buffer_copy_mcol (DerivedMesh *dm, float *varray_, int *index, int *mat_orig_to_new, void *user) |
static void | GPU_buffer_copy_edge (DerivedMesh *dm, float *varray_, int *UNUSED(index), int *UNUSED(mat_orig_to_new), void *UNUSED(user)) |
static void | GPU_buffer_copy_uvedge (DerivedMesh *dm, float *varray, int *UNUSED(index), int *UNUSED(mat_orig_to_new), void *UNUSED(user)) |
static MCol * | gpu_buffer_color_type (DerivedMesh *dm) |
static GPUBuffer ** | gpu_drawobject_buffer_from_type (GPUDrawObject *gdo, GPUBufferType type) |
static int | gpu_buffer_size_from_type (DerivedMesh *dm, GPUBufferType type) |
static GPUBuffer * | gpu_buffer_setup_type (DerivedMesh *dm, GPUBufferType type) |
static GPUBuffer * | gpu_buffer_setup_common (DerivedMesh *dm, GPUBufferType type) |
void | GPU_vertex_setup (DerivedMesh *dm) |
void | GPU_normal_setup (DerivedMesh *dm) |
void | GPU_uv_setup (DerivedMesh *dm) |
void | GPU_color_setup (DerivedMesh *dm) |
void | GPU_edge_setup (DerivedMesh *dm) |
void | GPU_uvedge_setup (DerivedMesh *dm) |
static int | GPU_typesize (int type) |
int | GPU_attrib_element_size (GPUAttrib data[], int numdata) |
void | GPU_interleaved_attrib_setup (GPUBuffer *buffer, GPUAttrib data[], int numdata) |
void | GPU_buffer_unbind (void) |
void | GPU_color3_upload (DerivedMesh *dm, unsigned char *data) |
void | GPU_color4_upload (DerivedMesh *UNUSED(dm), unsigned char *UNUSED(data)) |
void | GPU_color_switch (int mode) |
int | GPU_buffer_legacy (DerivedMesh *dm) |
void * | GPU_buffer_lock (GPUBuffer *buffer) |
void * | GPU_buffer_lock_stream (GPUBuffer *buffer) |
void | GPU_buffer_unlock (GPUBuffer *buffer) |
void | GPU_buffer_draw_elements (GPUBuffer *elements, unsigned int mode, int start, int count) |
void | GPU_update_mesh_buffers (GPU_Buffers *buffers, MVert *mvert, int *vert_indices, int totvert) |
GPU_Buffers * | GPU_build_mesh_buffers (GHash *map, MVert *mvert, MFace *mface, int *face_indices, int totface, int *vert_indices, int tot_uniq_verts, int totvert) |
void | GPU_update_grid_buffers (GPU_Buffers *buffers, DMGridData **grids, int *grid_indices, int totgrid, int gridsize, int smooth) |
GPU_Buffers * | GPU_build_grid_buffers (DMGridData **UNUSED(grids), int *UNUSED(grid_indices), int totgrid, int gridsize) |
void | GPU_draw_buffers (GPU_Buffers *buffers) |
void | GPU_free_buffers (GPU_Buffers *buffers) |
Variables | |
static int | useVBOs = -1 |
static GPUBufferState | GLStates = 0 |
static GPUAttrib | attribData [MAX_GPU_ATTRIB_DATA] = { { -1, 0, 0 } } |
static GPUBufferPool * | gpu_buffer_pool = NULL |
const GPUBufferTypeSettings | gpu_buffer_type_settings [] |
Definition in file gpu_buffers.c.
#define MAX_FREE_GPU_BUFFERS 8 |
Definition at line 90 of file gpu_buffers.c.
Referenced by GPU_buffer_free(), and gpu_buffer_pool_new().
#define MAX_GPU_ATTRIB_DATA 32 |
Definition at line 62 of file gpu_buffers.c.
Referenced by GPU_buffer_unbind(), and GPU_interleaved_attrib_setup().
#define MAX_MATERIALS 16384 |
Definition at line 65 of file gpu_buffers.c.
Referenced by gpu_buffer_setup(), gpu_drawobject_init_vert_points(), and GPU_drawobject_new().
typedef void(* GPUBufferCopyFunc)(DerivedMesh *dm, float *varray, int *index, int *mat_orig_to_new, void *user_data) |
Definition at line 467 of file gpu_buffers.c.
typedef struct GPUBufferPool GPUBufferPool |
typedef struct GPUVertPointLink GPUVertPointLink |
enum GPUBufferState |
GPU_BUFFER_VERTEX_STATE | |
GPU_BUFFER_NORMAL_STATE | |
GPU_BUFFER_TEXCOORD_STATE | |
GPU_BUFFER_COLOR_STATE | |
GPU_BUFFER_ELEMENT_STATE |
Definition at line 54 of file gpu_buffers.c.
enum GPUBufferType |
GPU_BUFFER_VERTEX | |
GPU_BUFFER_NORMAL | |
GPU_BUFFER_COLOR | |
GPU_BUFFER_UV | |
GPU_BUFFER_EDGE | |
GPU_BUFFER_UVEDGE |
Definition at line 833 of file gpu_buffers.c.
static void copy_mcol_uc3 | ( | unsigned char * | v, |
unsigned char * | col | ||
) | [static] |
Definition at line 728 of file gpu_buffers.c.
Referenced by GPU_buffer_copy_mcol().
int GPU_attrib_element_size | ( | GPUAttrib | data[], |
int | numdata | ||
) |
Definition at line 1074 of file gpu_buffers.c.
References elementsize(), GPU_typesize(), i, and GPUAttrib::size.
Referenced by cdDM_drawMappedFacesGLSL(), and GPU_interleaved_attrib_setup().
GPUBuffer* GPU_buffer_alloc | ( | int | size | ) |
Definition at line 185 of file gpu_buffers.c.
References GPUBufferPool::buffers, gpu_buffer_pool_delete_last(), gpu_buffer_pool_remove_index(), gpu_get_global_buffer_pool(), i, GPUBuffer::id, MEM_callocN(), MEM_mallocN(), NULL, GPUBuffer::pointer, GPUBuffer::size, size(), GPUBufferPool::totbuf, and useVBOs.
Referenced by cdDM_drawMappedFacesGLSL(), and gpu_buffer_setup().
static MCol* gpu_buffer_color_type | ( | DerivedMesh * | dm | ) | [static] |
Definition at line 813 of file gpu_buffers.c.
References CD_ID_MCOL, CD_MCOL, CD_WEIGHT_MCOL, GPUDrawObject::colType, DM_get_face_data_layer(), and DerivedMesh::drawObject.
Referenced by gpu_buffer_setup_type().
static void GPU_buffer_copy_color3 | ( | DerivedMesh * | dm, |
float * | varray_, | ||
int * | index, | ||
int * | mat_orig_to_new, | ||
void * | user | ||
) | [static] |
Definition at line 701 of file gpu_buffers.c.
References copy_v3_v3_char(), DerivedMesh::getFaceArray, DerivedMesh::getNumFaces, i, MFace::mat_nr, and MFace::v4.
Referenced by GPU_color3_upload().
static void GPU_buffer_copy_edge | ( | DerivedMesh * | dm, |
float * | varray_, | ||
int * | UNUSEDindex, | ||
int * | UNUSEDmat_orig_to_new, | ||
void * | UNUSEDuser | ||
) | [static] |
Definition at line 763 of file gpu_buffers.c.
References DerivedMesh::drawObject, DerivedMesh::getEdgeArray, DerivedMesh::getNumEdges, i, GPUVertPointLink::point_index, MEdge::v1, MEdge::v2, and GPUDrawObject::vert_points.
static void GPU_buffer_copy_mcol | ( | DerivedMesh * | dm, |
float * | varray_, | ||
int * | index, | ||
int * | mat_orig_to_new, | ||
void * | user | ||
) | [static] |
Definition at line 736 of file gpu_buffers.c.
References copy_mcol_uc3(), DerivedMesh::getFaceArray, DerivedMesh::getNumFaces, i, MFace::mat_nr, and MFace::v4.
static void GPU_buffer_copy_normal | ( | DerivedMesh * | dm, |
float * | varray, | ||
int * | index, | ||
int * | mat_orig_to_new, | ||
void * | UNUSEDuser | ||
) | [static] |
Definition at line 607 of file gpu_buffers.c.
References CD_NORMAL, MVert::co, copy_v3_v3(), MFace::flag, DerivedMesh::getFaceArray, DerivedMesh::getFaceDataArray, DerivedMesh::getNumFaces, DerivedMesh::getVertArray, i, MFace::mat_nr, ME_SMOOTH, MVert::no, normal_quad_v3(), normal_short_to_float_v3(), normal_tri_v3(), MFace::v1, MFace::v2, MFace::v3, and MFace::v4.
static void GPU_buffer_copy_uv | ( | DerivedMesh * | dm, |
float * | varray, | ||
int * | index, | ||
int * | mat_orig_to_new, | ||
void * | UNUSEDuser | ||
) | [static] |
Definition at line 668 of file gpu_buffers.c.
References CD_MTFACE, copy_v2_v2(), DM_get_face_data_layer(), DerivedMesh::getFaceArray, DerivedMesh::getNumFaces, i, MFace::mat_nr, and MFace::v4.
static void GPU_buffer_copy_uvedge | ( | DerivedMesh * | dm, |
float * | varray, | ||
int * | UNUSEDindex, | ||
int * | UNUSEDmat_orig_to_new, | ||
void * | UNUSEDuser | ||
) | [static] |
Definition at line 778 of file gpu_buffers.c.
References CD_MTFACE, copy_v2_v2(), DM_get_face_data_layer(), DerivedMesh::getFace, i, DerivedMesh::numFaceData, MTFace::uv, and MFace::v4.
static void GPU_buffer_copy_vertex | ( | DerivedMesh * | dm, |
float * | varray, | ||
int * | index, | ||
int * | mat_orig_to_new, | ||
void * | UNUSEDuser | ||
) | [static] |
Definition at line 569 of file gpu_buffers.c.
References MVert::co, co, copy_v3_v3(), DerivedMesh::drawObject, DerivedMesh::getFaceArray, DerivedMesh::getNumFaces, DerivedMesh::getVertArray, i, MFace::mat_nr, GPUVertPointLink::point_index, GPUDrawObject::tot_triangle_point, GPUDrawObject::totvert, MFace::v1, MFace::v2, MFace::v3, MFace::v4, and GPUDrawObject::vert_points.
void GPU_buffer_draw_elements | ( | GPUBuffer * | elements, |
unsigned int | mode, | ||
int | start, | ||
int | count | ||
) |
Definition at line 1261 of file gpu_buffers.c.
References GPUBuffer::pointer, and useVBOs.
Referenced by cdDM_drawEdges(), and cdDM_drawLooseEdges().
void GPU_buffer_free | ( | GPUBuffer * | buffer | ) |
Definition at line 262 of file gpu_buffers.c.
References BLI_thread_is_main(), GPUBufferPool::buffers, gpu_buffer_pool_delete_last(), gpu_get_global_buffer_pool(), i, MAX_FREE_GPU_BUFFERS, GPUBufferPool::maxsize, MEM_reallocN(), and GPUBufferPool::totbuf.
Referenced by cdDM_drawMappedFacesGLSL(), gpu_buffer_setup(), GPU_color3_upload(), and GPU_drawobject_free().
int GPU_buffer_legacy | ( | DerivedMesh * | dm | ) |
Definition at line 1201 of file gpu_buffers.c.
References DerivedMesh::drawObject, UserDef::gameflags, GPU_drawobject_new(), GPUDrawObject::legacy, rna_array::test, U, and USER_DISABLE_VBO.
Referenced by cdDM_drawEdges(), cdDM_drawFacesColored(), cdDM_drawFacesSolid(), cdDM_drawFacesTex_common(), cdDM_drawLooseEdges(), cdDM_drawMappedFaces(), cdDM_drawMappedFacesGLSL(), cdDM_drawUVEdges(), cdDM_drawVerts(), and draw_mesh_textured_old().
void* GPU_buffer_lock | ( | GPUBuffer * | buffer | ) |
Definition at line 1212 of file gpu_buffers.c.
References GPUBuffer::id, GPUBuffer::pointer, and useVBOs.
void* GPU_buffer_lock_stream | ( | GPUBuffer * | buffer | ) |
Definition at line 1229 of file gpu_buffers.c.
References GPUBuffer::id, GPUBuffer::pointer, GPUBuffer::size, and useVBOs.
Referenced by cdDM_drawMappedFacesGLSL().
static void gpu_buffer_pool_delete_last | ( | GPUBufferPool * | pool | ) | [static] |
Definition at line 130 of file gpu_buffers.c.
References GPUBufferPool::buffers, GPUBuffer::id, MEM_freeN(), NULL, GPUBuffer::pointer, GPUBufferPool::totbuf, and useVBOs.
Referenced by GPU_buffer_alloc(), GPU_buffer_free(), gpu_buffer_pool_free(), and gpu_buffer_setup().
static void gpu_buffer_pool_free | ( | GPUBufferPool * | pool | ) | [static] |
Definition at line 155 of file gpu_buffers.c.
References GPUBufferPool::buffers, gpu_buffer_pool_delete_last(), MEM_freeN(), and GPUBufferPool::totbuf.
Referenced by GPU_global_buffer_pool_free().
static GPUBufferPool* gpu_buffer_pool_new | ( | void | ) | [static] |
Definition at line 93 of file gpu_buffers.c.
References GPUBufferPool::buffers, MAX_FREE_GPU_BUFFERS, GPUBufferPool::maxsize, MEM_callocN(), and useVBOs.
Referenced by gpu_get_global_buffer_pool().
static void gpu_buffer_pool_remove_index | ( | GPUBufferPool * | pool, |
int | index | ||
) | [static] |
Definition at line 111 of file gpu_buffers.c.
References GPUBufferPool::buffers, i, NULL, and GPUBufferPool::totbuf.
Referenced by GPU_buffer_alloc().
static GPUBuffer* gpu_buffer_setup | ( | DerivedMesh * | dm, |
GPUDrawObject * | object, | ||
int | vector_size, | ||
int | size, | ||
GLenum | target, | ||
void * | user, | ||
GPUBufferCopyFunc | copy_f | ||
) | [static] |
Definition at line 470 of file gpu_buffers.c.
References DerivedMesh::drawObject, GPU_buffer_alloc(), GPU_buffer_free(), gpu_buffer_pool_delete_last(), gpu_get_global_buffer_pool(), i, GPUBuffer::id, GPUDrawObject::legacy, MAX_MATERIALS, MEM_freeN(), MEM_mallocN(), NULL, GPUBuffer::pointer, GPUBuffer::size, GPUBufferPool::totbuf, GPUDrawObject::totmaterial, and useVBOs.
Referenced by gpu_buffer_setup_type(), and GPU_color3_upload().
static GPUBuffer* gpu_buffer_setup_common | ( | DerivedMesh * | dm, |
GPUBufferType | type | ||
) | [static] |
Definition at line 932 of file gpu_buffers.c.
References DerivedMesh::drawObject, gpu_buffer_setup_type(), gpu_drawobject_buffer_from_type(), and GPU_drawobject_new().
Referenced by GPU_color_setup(), GPU_edge_setup(), GPU_normal_setup(), GPU_uv_setup(), GPU_uvedge_setup(), and GPU_vertex_setup().
static GPUBuffer* gpu_buffer_setup_type | ( | DerivedMesh * | dm, |
GPUBufferType | type | ||
) | [static] |
Definition at line 905 of file gpu_buffers.c.
References CD_MTFACE, GPUBufferTypeSettings::copy, DM_get_face_data_layer(), DerivedMesh::drawObject, GPUBufferTypeSettings::gl_buffer_type, GPU_BUFFER_COLOR, gpu_buffer_color_type(), gpu_buffer_setup(), gpu_buffer_size_from_type(), GPU_BUFFER_UV, NULL, and GPUBufferTypeSettings::vector_size.
Referenced by gpu_buffer_setup_common().
static int gpu_buffer_size_from_type | ( | DerivedMesh * | dm, |
GPUBufferType | type | ||
) | [static] |
Definition at line 879 of file gpu_buffers.c.
References DerivedMesh::drawObject, GPU_BUFFER_COLOR, GPU_BUFFER_EDGE, GPU_BUFFER_NORMAL, GPU_BUFFER_UV, GPU_BUFFER_UVEDGE, GPU_BUFFER_VERTEX, GPUDrawObject::tot_loose_point, GPUDrawObject::tot_triangle_point, and GPUDrawObject::totedge.
Referenced by gpu_buffer_setup_type().
void GPU_buffer_unbind | ( | void | ) |
Definition at line 1126 of file gpu_buffers.c.
References GLStates, GPU_BUFFER_COLOR_STATE, GPU_BUFFER_ELEMENT_STATE, GPU_BUFFER_NORMAL_STATE, GPU_BUFFER_TEXCOORD_STATE, GPU_BUFFER_VERTEX_STATE, i, MAX_GPU_ATTRIB_DATA, and useVBOs.
Referenced by cdDM_drawEdges(), cdDM_drawFacesColored(), cdDM_drawFacesSolid(), cdDM_drawFacesTex_common(), cdDM_drawLooseEdges(), cdDM_drawMappedFaces(), cdDM_drawMappedFacesGLSL(), cdDM_drawUVEdges(), and cdDM_drawVerts().
void GPU_buffer_unlock | ( | GPUBuffer * | buffer | ) |
Definition at line 1248 of file gpu_buffers.c.
References useVBOs.
Referenced by cdDM_drawMappedFacesGLSL().
GPU_Buffers* GPU_build_grid_buffers | ( | DMGridData ** | UNUSEDgrids, |
int * | UNUSEDgrid_indices, | ||
int | totgrid, | ||
int | gridsize | ||
) |
Definition at line 1469 of file gpu_buffers.c.
References UserDef::gameflags, i, GPU_Buffers::index_buf, GPU_Buffers::index_type, MEM_callocN(), NULL, GPU_Buffers::tot_quad, U, USER_DISABLE_VBO, and GPU_Buffers::vert_buf.
GPU_Buffers* GPU_build_mesh_buffers | ( | GHash * | map, |
MVert * | mvert, | ||
MFace * | mface, | ||
int * | face_indices, | ||
int | totface, | ||
int * | vert_indices, | ||
int | tot_uniq_verts, | ||
int | totvert | ||
) |
Definition at line 1335 of file gpu_buffers.c.
References BLI_ghash_lookup(), GPU_Buffers::face_indices, UserDef::gameflags, GET_INT_FROM_POINTER, GPU_update_mesh_buffers(), i, GPU_Buffers::index_buf, GPU_Buffers::index_type, MEM_callocN(), GPU_Buffers::mface, NULL, SET_INT_IN_POINTER, GPU_Buffers::tot_tri, GPU_Buffers::totface, U, USER_DISABLE_VBO, MFace::v1, MFace::v2, MFace::v3, MFace::v4, and GPU_Buffers::vert_buf.
Referenced by build_mesh_leaf_node().
void GPU_color3_upload | ( | DerivedMesh * | dm, |
unsigned char * | data | ||
) |
Definition at line 1162 of file gpu_buffers.c.
References GPUDrawObject::colors, DerivedMesh::drawObject, GPU_buffer_copy_color3(), GPU_buffer_free(), gpu_buffer_setup(), GPU_drawobject_new(), and GPUDrawObject::tot_triangle_point.
Referenced by cdDM_drawFacesTex_common().
void GPU_color4_upload | ( | DerivedMesh * | UNUSEDdm, |
unsigned char * | UNUSEDdata | ||
) |
Definition at line 1175 of file gpu_buffers.c.
void GPU_color_setup | ( | DerivedMesh * | dm | ) |
Definition at line 997 of file gpu_buffers.c.
References GPUDrawObject::colors, DerivedMesh::drawObject, GLStates, GPU_BUFFER_COLOR, GPU_BUFFER_COLOR_STATE, gpu_buffer_setup_common(), GPUBuffer::id, GPUBuffer::pointer, and useVBOs.
Referenced by cdDM_drawFacesColored(), cdDM_drawFacesTex_common(), and cdDM_drawMappedFaces().
void GPU_color_switch | ( | int | mode | ) |
Definition at line 1185 of file gpu_buffers.c.
References GLStates, and GPU_BUFFER_COLOR_STATE.
Referenced by cdDM_drawFacesTex_common().
void GPU_draw_buffers | ( | GPU_Buffers * | buffers | ) |
Definition at line 1559 of file gpu_buffers.c.
References DMGridData::co, MVert::co, co, GPU_Buffers::face_indices, GPU_Buffers::grid_indices, GPU_Buffers::grids, GPU_Buffers::gridsize, i, GPU_Buffers::index_buf, GPU_Buffers::index_type, GPU_Buffers::mface, GPU_Buffers::mvert, MVert::no, DMGridData::no, GPU_Buffers::tot_quad, GPU_Buffers::tot_tri, GPU_Buffers::totface, GPU_Buffers::totgrid, MFace::v1, MFace::v2, MFace::v3, MFace::v4, and GPU_Buffers::vert_buf.
Referenced by BLI_pbvh_node_draw().
static void gpu_drawobject_add_triangle | ( | GPUDrawObject * | gdo, |
int | base_point_index, | ||
int | face_index, | ||
int | v1, | ||
int | v2, | ||
int | v3 | ||
) | [static] |
Definition at line 330 of file gpu_buffers.c.
References gpu_drawobject_add_vert_point(), i, and GPUDrawObject::triangle_to_mface.
Referenced by gpu_drawobject_init_vert_points().
static void gpu_drawobject_add_vert_point | ( | GPUDrawObject * | gdo, |
int | vert_index, | ||
int | point_index | ||
) | [static] |
Definition at line 309 of file gpu_buffers.c.
References GPUVertPointLink::next, GPUVertPointLink::point_index, GPUDrawObject::vert_points, GPUDrawObject::vert_points_mem, and GPUDrawObject::vert_points_usage.
Referenced by gpu_drawobject_add_triangle().
static GPUBuffer** gpu_drawobject_buffer_from_type | ( | GPUDrawObject * | gdo, |
GPUBufferType | type | ||
) | [static] |
Definition at line 858 of file gpu_buffers.c.
References GPUDrawObject::colors, GPUDrawObject::edges, GPU_BUFFER_COLOR, GPU_BUFFER_EDGE, GPU_BUFFER_NORMAL, GPU_BUFFER_UV, GPU_BUFFER_UVEDGE, GPU_BUFFER_VERTEX, GPUDrawObject::normals, NULL, GPUDrawObject::points, GPUDrawObject::uv, and GPUDrawObject::uvedges.
Referenced by gpu_buffer_setup_common().
void GPU_drawobject_free | ( | DerivedMesh * | dm | ) |
Definition at line 445 of file gpu_buffers.c.
References GPUDrawObject::colors, DerivedMesh::drawObject, GPUDrawObject::edges, GPU_buffer_free(), GPUDrawObject::materials, MEM_freeN(), GPUDrawObject::normals, NULL, GPUDrawObject::points, GPUDrawObject::triangle_to_mface, GPUDrawObject::uv, GPUDrawObject::uvedges, GPUDrawObject::vert_points, and GPUDrawObject::vert_points_mem.
Referenced by DM_release(), sculpt_flush_update(), and sculpt_undo_restore().
static void gpu_drawobject_init_vert_points | ( | GPUDrawObject * | gdo, |
MFace * | f, | ||
int | totface | ||
) | [static] |
Definition at line 343 of file gpu_buffers.c.
References gpu_drawobject_add_triangle(), i, MFace::mat_nr, GPUBufferMaterial::mat_nr, GPUDrawObject::materials, MAX_MATERIALS, MEM_callocN(), GPUVertPointLink::point_index, GPUBufferMaterial::start, GPUDrawObject::tot_loose_point, GPUDrawObject::tot_triangle_point, GPUDrawObject::totmaterial, GPUBufferMaterial::totpoint, GPUDrawObject::totvert, MFace::v1, MFace::v2, MFace::v3, MFace::v4, GPUDrawObject::vert_points, GPUDrawObject::vert_points_mem, and GPUDrawObject::vert_points_usage.
Referenced by GPU_drawobject_new().
GPUDrawObject* GPU_drawobject_new | ( | DerivedMesh * | dm | ) |
Definition at line 391 of file gpu_buffers.c.
References DerivedMesh::getFaceArray, DerivedMesh::getNumEdges, DerivedMesh::getNumFaces, DerivedMesh::getNumVerts, gpu_drawobject_init_vert_points(), i, GPUBufferMaterial::mat_nr, GPUDrawObject::materials, MAX_MATERIALS, MEM_callocN(), MEM_mallocN(), GPUBufferMaterial::start, GPUDrawObject::tot_triangle_point, GPUDrawObject::totedge, GPUDrawObject::totmaterial, GPUBufferMaterial::totpoint, GPUDrawObject::totvert, and GPUDrawObject::triangle_to_mface.
Referenced by GPU_buffer_legacy(), gpu_buffer_setup_common(), and GPU_color3_upload().
void GPU_edge_setup | ( | DerivedMesh * | dm | ) |
Definition at line 1014 of file gpu_buffers.c.
References DerivedMesh::drawObject, GPUDrawObject::edges, GLStates, GPU_BUFFER_EDGE, GPU_BUFFER_ELEMENT_STATE, gpu_buffer_setup_common(), GPU_BUFFER_VERTEX, GPU_BUFFER_VERTEX_STATE, GPUBuffer::id, GPUBuffer::pointer, GPUDrawObject::points, and useVBOs.
Referenced by cdDM_drawEdges(), and cdDM_drawLooseEdges().
void GPU_free_buffers | ( | GPU_Buffers * | buffers | ) |
Definition at line 1631 of file gpu_buffers.c.
References GPU_Buffers::index_buf, MEM_freeN(), and GPU_Buffers::vert_buf.
Referenced by BLI_pbvh_free().
static GPUBufferPool* gpu_get_global_buffer_pool | ( | void | ) | [static] |
Definition at line 168 of file gpu_buffers.c.
References gpu_buffer_pool, and gpu_buffer_pool_new().
Referenced by GPU_buffer_alloc(), GPU_buffer_free(), and gpu_buffer_setup().
void GPU_global_buffer_pool_free | ( | void | ) |
Definition at line 177 of file gpu_buffers.c.
References gpu_buffer_pool_free(), and NULL.
Referenced by WM_exit_ext().
Definition at line 1086 of file gpu_buffers.c.
References elementsize(), GPU_attrib_element_size(), GPU_typesize(), i, GPUBuffer::id, GPUAttrib::index, MAX_GPU_ATTRIB_DATA, GPUBuffer::pointer, GPUAttrib::size, size(), GPUAttrib::type, and useVBOs.
Referenced by cdDM_drawMappedFacesGLSL().
void GPU_normal_setup | ( | DerivedMesh * | dm | ) |
Definition at line 963 of file gpu_buffers.c.
References DerivedMesh::drawObject, GLStates, GPU_BUFFER_NORMAL, GPU_BUFFER_NORMAL_STATE, gpu_buffer_setup_common(), GPUBuffer::id, GPUDrawObject::normals, GPUBuffer::pointer, and useVBOs.
Referenced by cdDM_drawFacesSolid(), cdDM_drawFacesTex_common(), cdDM_drawMappedFaces(), and cdDM_drawMappedFacesGLSL().
static int GPU_typesize | ( | int | type | ) | [static] |
Definition at line 1056 of file gpu_buffers.c.
Referenced by GPU_attrib_element_size(), and GPU_interleaved_attrib_setup().
void GPU_update_grid_buffers | ( | GPU_Buffers * | buffers, |
DMGridData ** | grids, | ||
int * | grid_indices, | ||
int | totgrid, | ||
int | gridsize, | ||
int | smooth | ||
) |
Definition at line 1415 of file gpu_buffers.c.
References co, GPU_Buffers::grid_indices, GPU_Buffers::grids, GPU_Buffers::gridsize, i, normal_quad_v3(), NULL, GPU_Buffers::totgrid, and GPU_Buffers::vert_buf.
Referenced by pbvh_update_draw_buffers().
void GPU_update_mesh_buffers | ( | GPU_Buffers * | buffers, |
MVert * | mvert, | ||
int * | vert_indices, | ||
int | totvert | ||
) |
Definition at line 1299 of file gpu_buffers.c.
References MVert::co, VertexBufferFormat::co, copy_v3_v3(), i, GPU_Buffers::mvert, MVert::no, VertexBufferFormat::no, NULL, and GPU_Buffers::vert_buf.
Referenced by GPU_build_mesh_buffers(), and pbvh_update_draw_buffers().
void GPU_uv_setup | ( | DerivedMesh * | dm | ) |
Definition at line 980 of file gpu_buffers.c.
References DerivedMesh::drawObject, GLStates, gpu_buffer_setup_common(), GPU_BUFFER_TEXCOORD_STATE, GPU_BUFFER_UV, GPUBuffer::id, GPUBuffer::pointer, useVBOs, and GPUDrawObject::uv.
Referenced by cdDM_drawFacesTex_common().
void GPU_uvedge_setup | ( | DerivedMesh * | dm | ) |
Definition at line 1039 of file gpu_buffers.c.
References DerivedMesh::drawObject, GLStates, gpu_buffer_setup_common(), GPU_BUFFER_UVEDGE, GPU_BUFFER_VERTEX_STATE, GPUBuffer::id, GPUBuffer::pointer, useVBOs, and GPUDrawObject::uvedges.
Referenced by cdDM_drawUVEdges().
void GPU_vertex_setup | ( | DerivedMesh * | dm | ) |
Definition at line 946 of file gpu_buffers.c.
References DerivedMesh::drawObject, GLStates, gpu_buffer_setup_common(), GPU_BUFFER_VERTEX, GPU_BUFFER_VERTEX_STATE, GPUBuffer::id, GPUBuffer::pointer, GPUDrawObject::points, and useVBOs.
Referenced by cdDM_drawFacesColored(), cdDM_drawFacesSolid(), cdDM_drawFacesTex_common(), cdDM_drawMappedFaces(), cdDM_drawMappedFacesGLSL(), and cdDM_drawVerts().
GPUAttrib attribData[MAX_GPU_ATTRIB_DATA] = { { -1, 0, 0 } } [static] |
Definition at line 70 of file gpu_buffers.c.
GPUBufferState GLStates = 0 [static] |
Definition at line 69 of file gpu_buffers.c.
Referenced by GPU_buffer_unbind(), GPU_color_setup(), GPU_color_switch(), GPU_edge_setup(), GPU_normal_setup(), GPU_uv_setup(), GPU_uvedge_setup(), and GPU_vertex_setup().
GPUBufferPool* gpu_buffer_pool = NULL [static] |
Definition at line 167 of file gpu_buffers.c.
Referenced by gpu_get_global_buffer_pool().
{ {GPU_buffer_copy_vertex, GL_ARRAY_BUFFER_ARB, 3}, {GPU_buffer_copy_normal, GL_ARRAY_BUFFER_ARB, 3}, {GPU_buffer_copy_mcol, GL_ARRAY_BUFFER_ARB, 3}, {GPU_buffer_copy_uv, GL_ARRAY_BUFFER_ARB, 2}, {GPU_buffer_copy_edge, GL_ELEMENT_ARRAY_BUFFER_ARB, 2}, {GPU_buffer_copy_uvedge, GL_ELEMENT_ARRAY_BUFFER_ARB, 4} }
Definition at line 848 of file gpu_buffers.c.
int useVBOs = -1 [static] |
Definition at line 68 of file gpu_buffers.c.
Referenced by GPU_buffer_alloc(), GPU_buffer_draw_elements(), GPU_buffer_lock(), GPU_buffer_lock_stream(), gpu_buffer_pool_delete_last(), gpu_buffer_pool_new(), gpu_buffer_setup(), GPU_buffer_unbind(), GPU_buffer_unlock(), GPU_color_setup(), GPU_edge_setup(), GPU_interleaved_attrib_setup(), GPU_normal_setup(), GPU_uv_setup(), GPU_uvedge_setup(), and GPU_vertex_setup().