vbo: change the parameters of vbo_get_minmax_index to get rid of _mesa_prim
This will be used by a new Draw interface. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7679>
This commit is contained in:
@@ -320,38 +320,35 @@ vbo_get_minmax_index_mapped(unsigned count, unsigned index_size,
|
||||
* indexes when computing min/max.
|
||||
*/
|
||||
static void
|
||||
vbo_get_minmax_index(struct gl_context *ctx,
|
||||
const struct _mesa_prim *prim,
|
||||
const struct _mesa_index_buffer *ib,
|
||||
GLuint *min_index, GLuint *max_index,
|
||||
const GLuint count,
|
||||
bool primitive_restart,
|
||||
unsigned restart_index)
|
||||
vbo_get_minmax_index(struct gl_context *ctx, struct gl_buffer_object *obj,
|
||||
const void *ptr, GLintptr offset, unsigned count,
|
||||
unsigned index_size, bool primitive_restart,
|
||||
unsigned restart_index, GLuint *min_index,
|
||||
GLuint *max_index)
|
||||
{
|
||||
const char *indices;
|
||||
GLintptr offset = 0;
|
||||
|
||||
indices = (char *) ib->ptr + (prim->start << ib->index_size_shift);
|
||||
if (ib->obj) {
|
||||
GLsizeiptr size = MIN2(count << ib->index_size_shift, ib->obj->Size);
|
||||
if (!obj) {
|
||||
indices = (const char *)ptr + offset;
|
||||
} else {
|
||||
GLsizeiptr size = MIN2((GLsizeiptr)count * index_size, obj->Size);
|
||||
|
||||
if (vbo_get_minmax_cached(ib->obj, 1 << ib->index_size_shift, (GLintptr) indices,
|
||||
count, min_index, max_index))
|
||||
if (vbo_get_minmax_cached(obj, index_size, offset, count, min_index,
|
||||
max_index))
|
||||
return;
|
||||
|
||||
offset = (GLintptr) indices;
|
||||
indices = ctx->Driver.MapBufferRange(ctx, offset, size,
|
||||
GL_MAP_READ_BIT, ib->obj,
|
||||
MAP_INTERNAL);
|
||||
indices = ctx->Driver.MapBufferRange(ctx, offset, size, GL_MAP_READ_BIT,
|
||||
obj, MAP_INTERNAL);
|
||||
}
|
||||
|
||||
vbo_get_minmax_index_mapped(count, 1 << ib->index_size_shift, restart_index,
|
||||
primitive_restart, indices, min_index, max_index);
|
||||
vbo_get_minmax_index_mapped(count, index_size, restart_index,
|
||||
primitive_restart, indices,
|
||||
min_index, max_index);
|
||||
|
||||
if (ib->obj) {
|
||||
vbo_minmax_cache_store(ctx, ib->obj, 1 << ib->index_size_shift, offset,
|
||||
count, *min_index, *max_index);
|
||||
ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
|
||||
if (obj) {
|
||||
vbo_minmax_cache_store(ctx, obj, index_size, offset, count, *min_index,
|
||||
*max_index);
|
||||
ctx->Driver.UnmapBuffer(ctx, obj, MAP_INTERNAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,8 +383,12 @@ vbo_get_minmax_indices(struct gl_context *ctx,
|
||||
count += prims[i+1].count;
|
||||
i++;
|
||||
}
|
||||
vbo_get_minmax_index(ctx, start_prim, ib, &tmp_min, &tmp_max, count,
|
||||
primitive_restart, restart_index);
|
||||
vbo_get_minmax_index(ctx, ib->obj, ib->ptr,
|
||||
(ib->obj ? (GLintptr)ib->ptr : 0) +
|
||||
(start_prim->start << ib->index_size_shift),
|
||||
count, 1 << ib->index_size_shift,
|
||||
primitive_restart, restart_index,
|
||||
&tmp_min, &tmp_max);
|
||||
*min_index = MIN2(*min_index, tmp_min);
|
||||
*max_index = MAX2(*max_index, tmp_max);
|
||||
}
|
||||
|
Reference in New Issue
Block a user