瀏覽代碼

vbo: rename vbo_save_vertex_store::buffer to buffer_map

To match other parts of the VBO code and make things easier to understand.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
tags/18.0-branchpoint
Brian Paul 7 年之前
父節點
當前提交
b04195b959
共有 3 個文件被更改,包括 15 次插入14 次删除
  1. 1
    1
      src/mesa/vbo/vbo_save.h
  2. 13
    12
      src/mesa/vbo/vbo_save_api.c
  3. 1
    1
      src/mesa/vbo/vbo_save_draw.c

+ 1
- 1
src/mesa/vbo/vbo_save.h 查看文件

@@ -108,7 +108,7 @@ struct vbo_save_vertex_list {
*/
struct vbo_save_vertex_store {
struct gl_buffer_object *bufferobj;
fi_type *buffer;
fi_type *buffer_map;
GLuint used;
GLuint refcount;
};

+ 13
- 12
src/mesa/vbo/vbo_save_api.c 查看文件

@@ -213,7 +213,7 @@ alloc_vertex_store(struct gl_context *ctx)
_mesa_install_save_vtxfmt(ctx, &save->vtxfmt_noop);
}

vertex_store->buffer = NULL;
vertex_store->buffer_map = NULL;
vertex_store->used = 0;
vertex_store->refcount = 1;

@@ -225,7 +225,7 @@ static void
free_vertex_store(struct gl_context *ctx,
struct vbo_save_vertex_store *vertex_store)
{
assert(!vertex_store->buffer);
assert(!vertex_store->buffer_map);

if (vertex_store->bufferobj) {
_mesa_reference_buffer_object(ctx, &vertex_store->bufferobj, NULL);
@@ -245,7 +245,7 @@ vbo_save_map_vertex_store(struct gl_context *ctx,
GL_MAP_FLUSH_EXPLICIT_BIT);

assert(vertex_store->bufferobj);
assert(!vertex_store->buffer); /* the buffer should not be mapped */
assert(!vertex_store->buffer_map); /* the buffer should not be mapped */

if (vertex_store->bufferobj->Size > 0) {
/* Map the remaining free space in the VBO */
@@ -257,12 +257,12 @@ vbo_save_map_vertex_store(struct gl_context *ctx,
MAP_INTERNAL);
if (range) {
/* compute address of start of whole buffer (needed elsewhere) */
vertex_store->buffer = range - vertex_store->used;
assert(vertex_store->buffer);
vertex_store->buffer_map = range - vertex_store->used;
assert(vertex_store->buffer_map);
return range;
}
else {
vertex_store->buffer = NULL;
vertex_store->buffer_map = NULL;
return NULL;
}
}
@@ -289,7 +289,7 @@ vbo_save_unmap_vertex_store(struct gl_context *ctx,

ctx->Driver.UnmapBuffer(ctx, vertex_store->bufferobj, MAP_INTERNAL);
}
vertex_store->buffer = NULL;
vertex_store->buffer_map = NULL;
}


@@ -311,7 +311,7 @@ _save_reset_counters(struct gl_context *ctx)
struct vbo_save_context *save = &vbo_context(ctx)->save;

save->prim = save->prim_store->prims + save->prim_store->used;
save->buffer = save->vertex_store->buffer + save->vertex_store->used;
save->buffer = save->vertex_store->buffer_map + save->vertex_store->used;

assert(save->buffer == save->buffer_ptr);

@@ -436,7 +436,7 @@ _save_compile_vertex_list(struct gl_context *ctx)
memcpy(node->attrtype, save->attrtype, sizeof(node->attrtype));
node->vertex_size = save->vertex_size;
node->buffer_offset =
(save->buffer - save->vertex_store->buffer) * sizeof(GLfloat);
(save->buffer - save->vertex_store->buffer_map) * sizeof(GLfloat);
node->count = save->vert_count;
node->wrap_count = save->copied.nr;
node->dangling_attr_ref = save->dangling_attr_ref;
@@ -462,7 +462,7 @@ _save_compile_vertex_list(struct gl_context *ctx)
*/
node->current_data = malloc(node->current_size * sizeof(GLfloat));
if (node->current_data) {
const char *buffer = (const char *) save->vertex_store->buffer;
const char *buffer = (const char *) save->vertex_store->buffer_map;
unsigned attr_offset = node->attrsz[0] * sizeof(GLfloat);
unsigned vertex_offset = 0;

@@ -504,7 +504,7 @@ _save_compile_vertex_list(struct gl_context *ctx)

vbo_loopback_vertex_list(ctx,
(const GLfloat *) ((const char *) save->
vertex_store->buffer +
vertex_store->buffer_map +
node->buffer_offset),
node->attrsz, node->prim, node->prim_count,
node->wrap_count, node->vertex_size);
@@ -536,7 +536,8 @@ _save_compile_vertex_list(struct gl_context *ctx)
}
else {
/* update buffer_ptr for next vertex */
save->buffer_ptr = save->vertex_store->buffer + save->vertex_store->used;
save->buffer_ptr = save->vertex_store->buffer_map
+ save->vertex_store->used;
}

if (save->prim_store->used > VBO_SAVE_PRIM_SIZE - 6) {

+ 1
- 1
src/mesa/vbo/vbo_save_draw.c 查看文件

@@ -257,7 +257,7 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLboolean remap_vertex_store = GL_FALSE;

if (save->vertex_store && save->vertex_store->buffer) {
if (save->vertex_store && save->vertex_store->buffer_map) {
/* The vertex store is currently mapped but we're about to replay
* a display list. This can happen when a nested display list is
* being build with GL_COMPILE_AND_EXECUTE.

Loading…
取消
儲存