Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_vertex_buffer.c
| Show First 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | |||||
| #if TRUST_NO_ONE | #if TRUST_NO_ONE | ||||
| assert(a_idx < format->attr_len); | assert(a_idx < format->attr_len); | ||||
| #endif | #endif | ||||
| const uint stride = a->sz; /* tightly packed input data */ | const uint stride = a->sz; /* tightly packed input data */ | ||||
| GPU_vertbuf_attr_fill_stride(verts, a_idx, stride, data); | GPU_vertbuf_attr_fill_stride(verts, a_idx, stride, data); | ||||
| } | } | ||||
| /** Fills a whole vertex (all attribs). Data must match packed layout. */ | |||||
| void GPU_vertbuf_vert_set(GPUVertBuf *verts, uint v_idx, const void *data) | |||||
| { | |||||
| const GPUVertFormat *format = &verts->format; | |||||
| #if TRUST_NO_ONE | |||||
| assert(v_idx < verts->vertex_alloc); | |||||
| assert(verts->data != NULL); | |||||
| #endif | |||||
| verts->dirty = true; | |||||
| memcpy((GLubyte *)verts->data + v_idx * format->stride, data, format->stride); | |||||
| } | |||||
| void GPU_vertbuf_attr_fill_stride(GPUVertBuf *verts, uint a_idx, uint stride, const void *data) | void GPU_vertbuf_attr_fill_stride(GPUVertBuf *verts, uint a_idx, uint stride, const void *data) | ||||
| { | { | ||||
| const GPUVertFormat *format = &verts->format; | const GPUVertFormat *format = &verts->format; | ||||
| const GPUVertAttr *a = &format->attrs[a_idx]; | const GPUVertAttr *a = &format->attrs[a_idx]; | ||||
| #if TRUST_NO_ONE | #if TRUST_NO_ONE | ||||
| assert(a_idx < format->attr_len); | assert(a_idx < format->attr_len); | ||||
| assert(verts->data != NULL); | assert(verts->data != NULL); | ||||
| ▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines | |||||