gallium: add flag to draw info to indicate converted draws

this draw mode in particular requires driver-specific conversions
for queries (e.g., number of vertices), so pass that info through

the only limitation is that it doesn't work for dlists,
but I have yet to see a real use case of a statistics query being used with dlists

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15326>
This commit is contained in:
Mike Blumenkrantz 2022-03-08 17:38:06 -05:00 committed by Marge Bot
parent 864f3c0ee0
commit 65bf1cbc26
4 changed files with 10 additions and 1 deletions

View File

@ -2371,6 +2371,7 @@ init_draw_info(struct pipe_draw_info *info,
info->take_index_buffer_ownership = FALSE;
info->index_bias_varies = FALSE;
info->increment_draw_id = FALSE;
info->was_line_loop = FALSE;
info->restart_index = 0;
}

View File

@ -845,7 +845,8 @@ struct pipe_draw_info
bool take_index_buffer_ownership:1; /**< callee inherits caller's refcount
(no need to reference indexbuf, but still needs to unreference it) */
bool index_bias_varies:1; /**< true if index_bias varies between draws */
uint8_t _pad:2;
bool was_line_loop:1; /**< true if pipe_prim_type was LINE_LOOP before translation */
uint8_t _pad:1;
unsigned start_instance; /**< first instance id */
unsigned instance_count; /**< number of instances */

View File

@ -1308,6 +1308,7 @@ _mesa_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
info.has_user_indices = false;
info.index_bounds_valid = true;
info.increment_draw_id = false;
info.was_line_loop = false;
info.take_index_buffer_ownership = false;
info.index_bias_varies = false;
/* Packed section end. */
@ -1635,6 +1636,7 @@ _mesa_MultiDrawArrays(GLenum mode, const GLint *first,
info.has_user_indices = false;
info.index_bounds_valid = false;
info.increment_draw_id = primcount > 1;
info.was_line_loop = false;
info.take_index_buffer_ownership = false;
info.index_bias_varies = false;
/* Packed section end. */
@ -1757,6 +1759,7 @@ _mesa_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
info.has_user_indices = index_bo == NULL;
info.index_bounds_valid = index_bounds_valid;
info.increment_draw_id = false;
info.was_line_loop = false;
info.take_index_buffer_ownership = false;
info.index_bias_varies = false;
/* Packed section end. */
@ -2143,6 +2146,7 @@ _mesa_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
info.has_user_indices = index_bo == NULL;
info.index_bounds_valid = false;
info.increment_draw_id = primcount > 1;
info.was_line_loop = false;
info.take_index_buffer_ownership = false;
info.index_bias_varies = !!basevertex;
/* Packed section end. */
@ -2554,6 +2558,7 @@ _mesa_MultiDrawArraysIndirect(GLenum mode, const GLvoid *indirect,
info.has_user_indices = false;
info.index_bounds_valid = false;
info.increment_draw_id = primcount > 1;
info.was_line_loop = false;
info.take_index_buffer_ownership = false;
info.index_bias_varies = false;
/* Packed section end. */
@ -2645,6 +2650,7 @@ _mesa_MultiDrawElementsIndirect(GLenum mode, GLenum type,
info.has_user_indices = false;
info.index_bounds_valid = false;
info.increment_draw_id = primcount > 1;
info.was_line_loop = false;
info.take_index_buffer_ownership = false;
info.index_bias_varies = false;
/* Packed section end. */

View File

@ -258,6 +258,7 @@ primconvert_init_draw(struct primconvert_context *pc,
else {
gen_func(draw.start, new_draw->count, dst);
}
new_info->was_line_loop = info->mode == PIPE_PRIM_LINE_LOOP;
if (src_transfer)
pipe_buffer_unmap(pc->pipe, src_transfer);