GPU: Cleanup: Rename vbo to ibo for index buffers

This commit is contained in:
Clément Foucault
2018-12-08 15:53:23 +01:00
parent f179ac9fc1
commit a99eb0ca68
2 changed files with 7 additions and 7 deletions

View File

@@ -53,7 +53,7 @@ typedef struct GPUIndexBuf {
uint max_index;
uint base_index;
#endif
uint32_t vbo_id; /* 0 indicates not yet sent to VRAM */
uint32_t ibo_id; /* 0 indicates not yet sent to VRAM */
bool use_prim_restart;
} GPUIndexBuf;

View File

@@ -284,14 +284,14 @@ void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *builder, GPUIndexBuf *elem)
elem->gl_index_type = convert_index_type_to_gl(elem->index_type);
#endif
if (elem->vbo_id == 0) {
elem->vbo_id = GPU_buf_alloc();
if (elem->ibo_id == 0) {
elem->ibo_id = GPU_buf_alloc();
}
/* send data to GPU */
/* GL_ELEMENT_ARRAY_BUFFER changes the state of the last VAO bound,
* so we use the GL_ARRAY_BUFFER here to create a buffer without
* interfering in the VAO state. */
glBindBuffer(GL_ARRAY_BUFFER, elem->vbo_id);
glBindBuffer(GL_ARRAY_BUFFER, elem->ibo_id);
glBufferData(GL_ARRAY_BUFFER, GPU_indexbuf_size_get(elem), builder->data, GL_STATIC_DRAW);
/* discard builder (one-time use) */
@@ -302,13 +302,13 @@ void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *builder, GPUIndexBuf *elem)
void GPU_indexbuf_use(GPUIndexBuf *elem)
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elem->vbo_id);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elem->ibo_id);
}
void GPU_indexbuf_discard(GPUIndexBuf *elem)
{
if (elem->vbo_id) {
GPU_buf_free(elem->vbo_id);
if (elem->ibo_id) {
GPU_buf_free(elem->ibo_id);
}
MEM_freeN(elem);
}