From: Dave Airlie Date: Thu, 4 Mar 2021 03:52:55 +0000 (+1000) Subject: gallium: add a view mask to the draw command X-Git-Tag: upstream/21.2.3~6687 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3b8f449e128e0ed95bf8d51fef5e85fe9b2b21c;p=platform%2Fupstream%2Fmesa.git gallium: add a view mask to the draw command This allows the caller to specify the view mask for this draw in a multiview draw environment This has been packed into the upper nibble and 2 bits of the index size to retain the struct size as small as possible for tc. Reviewed-by: Marek Olšák Reviewed-by: Roland Scheidegger Acked-By: Mike Blumenkrantz Part-of: --- diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index c1c0a46..ec86837 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -746,7 +746,8 @@ struct pipe_draw_info { enum pipe_prim_type mode:8; /**< the mode of the primitive */ ubyte vertices_per_patch; /**< the number of vertices per patch */ - ubyte index_size; /**< if 0, the draw is not indexed. */ + unsigned index_size:4; /**< if 0, the draw is not indexed. */ + unsigned view_mask:6; /**< mask of multiviews for this draw */ bool primitive_restart:1; bool has_user_indices:1; /**< if true, use index.user_buffer */ bool index_bounds_valid:1; /**< whether min_index and max_index are valid; @@ -754,7 +755,7 @@ struct pipe_draw_info bool increment_draw_id:1; /**< whether drawid increments for direct draws */ bool take_index_buffer_ownership:1; /**< callee inherits caller's refcount (no need to reference indexbuf, but still needs to unreference it) */ - char _pad:3; /**< padding for memcmp */ + char _pad:1; /**< padding for memcmp */ unsigned start_instance; /**< first instance id */ unsigned instance_count; /**< number of instances */ diff --git a/src/mesa/main/draw.c b/src/mesa/main/draw.c index 118cbe0..d9442f1 100644 --- a/src/mesa/main/draw.c +++ b/src/mesa/main/draw.c @@ -1336,6 +1336,7 @@ _mesa_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start, info.start_instance = baseInstance; info.instance_count = numInstances; info.drawid = 0; + info.view_mask = 0; info.min_index = start; info.max_index = start + count - 1; @@ -1664,6 +1665,7 @@ _mesa_MultiDrawArrays(GLenum mode, const GLint *first, info.start_instance = 0; info.instance_count = 1; info.drawid = 0; + info.view_mask = 0; for (int i = 0; i < primcount; i++) { draw[i].start = first[i]; @@ -1778,6 +1780,7 @@ _mesa_validated_drawrangeelements(struct gl_context *ctx, GLenum mode, info.start_instance = baseInstance; info.instance_count = numInstances; info.drawid = 0; + info.view_mask = 0; info.index_bias = basevertex; info.restart_index = ctx->Array._RestartIndex[index_size_shift]; @@ -2176,6 +2179,7 @@ _mesa_validated_multidrawelements(struct gl_context *ctx, GLenum mode, info.start_instance = 0; info.instance_count = 1; info.drawid = 0; + info.view_mask = 0; info.restart_index = ctx->Array._RestartIndex[index_size_shift]; if (info.has_user_indices) diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 36f570e..ee7b2ec 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -161,6 +161,7 @@ st_draw_vbo(struct gl_context *ctx, info.instance_count = num_instances; info.take_index_buffer_ownership = false; info._pad = 0; + info.view_mask = 0; if (ib) { struct gl_buffer_object *bufobj = ib->obj; diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 3900c16..ff2e754 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -127,6 +127,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, info.take_index_buffer_ownership = false; info.vertices_per_patch = ctx->TessCtrlProgram.patch_vertices; info.restart_index = 0; + info.view_mask = 0; st_flush_bitmap_cache(st); st_invalidate_readpix_cache(st);