#include "i915_reg.h"
#include "i915_state.h"
-#define VBUF_MAP_BUFFER
-
/**
* Primitive renderer for i915.
*/
void *vbo_ptr;
size_t vbo_max_used;
size_t vbo_max_index; /**< index offset to be added to all indices */
-
-#ifndef VBUF_MAP_BUFFER
- size_t map_used_start;
- size_t map_used_end;
- size_t map_size;
-#endif
};
/**
i915_render->vbo_sw_offset = 0;
i915_render->vbo_index = 0;
-#ifndef VBUF_MAP_BUFFER
- if (i915_render->vbo_size > i915_render->map_size) {
- i915_render->map_size = i915_render->vbo_size;
- FREE(i915_render->vbo_ptr);
- i915_render->vbo_ptr = MALLOC(i915_render->map_size);
- }
-#endif
-
i915_render->vbo =
iws->buffer_create(iws, i915_render->vbo_size, I915_NEW_VERTEX);
i915_render->vbo_ptr = iws->buffer_map(iws, i915_render->vbo, true);
if (i915->vbo_flushed)
debug_printf("%s bad vbo flush occurred stalling on hw\n", __FUNCTION__);
-#ifdef VBUF_MAP_BUFFER
return (unsigned char *)i915_render->vbo_ptr + i915_render->vbo_sw_offset;
-#else
- return (unsigned char *)i915_render->vbo_ptr;
-#endif
}
static void
ushort max_index)
{
struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
- struct i915_context *i915 = i915_render->i915;
- struct i915_winsys *iws = i915->iws;
i915_render->vbo_max_index = max_index;
i915_render->vbo_max_used = MAX2(i915_render->vbo_max_used,
i915_render->vertex_size * (max_index + 1));
-#ifdef VBUF_MAP_BUFFER
- (void)iws;
-#else
- i915_render->map_used_start = i915_render->vertex_size * min_index;
- i915_render->map_used_end = i915_render->vertex_size * (max_index + 1);
- iws->buffer_write(
- iws, i915_render->vbo,
- i915_render->map_used_start + i915_render->vbo_sw_offset,
- i915_render->map_used_end - i915_render->map_used_start,
- (unsigned char *)i915_render->vbo_ptr + i915_render->map_used_start);
-
-#endif
}
/**
i915_render->base.release_vertices = i915_vbuf_render_release_vertices;
i915_render->base.destroy = i915_vbuf_render_destroy;
-#ifndef VBUF_MAP_BUFFER
- i915_render->map_size = 0;
- i915_render->map_used_start = 0;
- i915_render->map_used_end = 0;
-#endif
-
i915_render->vbo = NULL;
i915_render->vbo_ptr = NULL;
i915_render->vbo_size = 0;