mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 00:20:11 +01:00
glthread: do vertex uploads if an index buffer is present for glDrawElements
glthread didn't implement uploading non-VBO vertices if indices were in a buffer. This implements that. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20824>
This commit is contained in:
parent
ed7d3b33b0
commit
c00db0dbc8
3 changed files with 24 additions and 16 deletions
|
|
@ -934,22 +934,23 @@ draw_elements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
|
|||
unsigned index_size = get_index_size(type);
|
||||
|
||||
if (need_index_bounds && !index_bounds_valid) {
|
||||
/* Sync if indices come from a buffer and vertices come from memory
|
||||
* and index bounds are not valid.
|
||||
*
|
||||
* We would have to map the indices to compute the index bounds, and
|
||||
* for that we would have to sync anyway.
|
||||
*/
|
||||
if (!has_user_indices)
|
||||
goto sync;
|
||||
|
||||
/* Compute the index bounds. */
|
||||
min_index = ~0;
|
||||
max_index = 0;
|
||||
vbo_get_minmax_index_mapped(count, index_size,
|
||||
ctx->GLThread._RestartIndex[index_size - 1],
|
||||
ctx->GLThread._PrimitiveRestart, indices,
|
||||
&min_index, &max_index);
|
||||
if (has_user_indices) {
|
||||
min_index = ~0;
|
||||
max_index = 0;
|
||||
vbo_get_minmax_index_mapped(count, index_size,
|
||||
ctx->GLThread._RestartIndex[index_size - 1],
|
||||
ctx->GLThread._PrimitiveRestart, indices,
|
||||
&min_index, &max_index);
|
||||
} else {
|
||||
/* Indices in a buffer. */
|
||||
_mesa_glthread_finish_before(ctx, "DrawElements - need index bounds");
|
||||
vbo_get_minmax_index(ctx, ctx->Array.VAO->IndexBufferObj,
|
||||
NULL, (intptr_t)indices, count, index_size,
|
||||
ctx->GLThread._PrimitiveRestart,
|
||||
ctx->GLThread._RestartIndex[index_size - 1],
|
||||
&min_index, &max_index);
|
||||
}
|
||||
index_bounds_valid = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -227,6 +227,13 @@ vbo_get_minmax_index_mapped(unsigned count, unsigned index_size,
|
|||
const void *indices,
|
||||
unsigned *min_index, unsigned *max_index);
|
||||
|
||||
void
|
||||
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);
|
||||
|
||||
bool
|
||||
vbo_get_minmax_indices_gallium(struct gl_context *ctx,
|
||||
struct pipe_draw_info *info,
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ vbo_get_minmax_index_mapped(unsigned count, unsigned index_size,
|
|||
* If primitive restart is enabled, we need to ignore restart
|
||||
* indexes when computing min/max.
|
||||
*/
|
||||
static void
|
||||
void
|
||||
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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue