From 80b391077f66eff22a544be679d4b918691026ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 1 Nov 2020 10:55:43 -0500 Subject: [PATCH] gallium: add missing bits of the direct multi draw interface Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- docs/gallium/screen.rst | 1 + src/gallium/auxiliary/util/u_screen.c | 1 + src/gallium/auxiliary/util/u_threaded_context.c | 3 +++ src/gallium/auxiliary/util/u_threaded_context.h | 2 +- src/gallium/include/pipe/p_defines.h | 1 + src/gallium/include/pipe/p_state.h | 3 ++- 6 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/gallium/screen.rst b/docs/gallium/screen.rst index 7154ad005ce..8f069c765c7 100644 --- a/docs/gallium/screen.rst +++ b/docs/gallium/screen.rst @@ -232,6 +232,7 @@ The integer capabilities: * ``PIPE_CAP_DRAW_INDIRECT``: Whether the driver supports taking draw arguments { count, instance_count, start, index_bias } from a PIPE_BUFFER resource. See pipe_draw_info. +* ``PIPE_CAP_MULTI_DRAW``: Whether the driver supports direct multi draws. * ``PIPE_CAP_MULTI_DRAW_INDIRECT``: Whether the driver supports pipe_draw_info::indirect_stride and ::indirect_count * ``PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS``: Whether the driver supports diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c index 2802280806e..2a97082e410 100644 --- a/src/gallium/auxiliary/util/u_screen.c +++ b/src/gallium/auxiliary/util/u_screen.c @@ -229,6 +229,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen, case PIPE_CAP_CLEAR_SCISSORED: case PIPE_CAP_DRAW_PARAMETERS: case PIPE_CAP_TGSI_PACK_HALF_FLOAT: + case PIPE_CAP_MULTI_DRAW: case PIPE_CAP_MULTI_DRAW_INDIRECT: case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS: case PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL: diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index b79224f4558..9401c36d3f2 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -97,6 +97,9 @@ simplify_draw_info(struct pipe_draw_info *info) info->min_index = 0; info->max_index = ~0; + /* This shouldn't be set when merging single draws. */ + info->increment_draw_id = false; + if (info->index_size) { if (!info->primitive_restart) info->restart_index = 0; diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h index ac02e1079f1..35dfa877f42 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.h +++ b/src/gallium/auxiliary/util/u_threaded_context.h @@ -145,7 +145,7 @@ * another resource's backing storage. The threaded context uses it to * implement buffer invalidation. This call is always queued. * - * pipe_context::multi_draw() must be implemented. + * PIPE_CAP_MULTI_DRAW must be supported. * * * Performance gotchas diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 38bc6fb3cfb..1b93c1a2e53 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -842,6 +842,7 @@ enum pipe_cap PIPE_CAP_CLEAR_SCISSORED, PIPE_CAP_DRAW_PARAMETERS, PIPE_CAP_TGSI_PACK_HALF_FLOAT, + PIPE_CAP_MULTI_DRAW, PIPE_CAP_MULTI_DRAW_INDIRECT, PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS, PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL, diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 3bf5832d448..705541ae823 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -764,7 +764,8 @@ struct pipe_draw_info bool has_user_indices:1; /**< if true, use index.user_buffer */ bool index_bounds_valid:1; /**< whether min_index and max_index are valid; they're always invalid if index_size == 0 */ - char _pad:5; /**< padding for memcmp */ + bool increment_draw_id:1; /**< whether drawid increments for direct draws */ + char _pad:4; /**< padding for memcmp */ unsigned start_instance; /**< first instance id */ unsigned instance_count; /**< number of instances */