gallium: delete duplicated viewmask member in draw info

this was added for lavapipe, but it should have been in the
framebuffer state since it is a framebuffer state

now the GL multiview extensions are supported with viewmask
in the framebuffer struct, which means this is all redundant
and should be corrected/deleted

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31590>
This commit is contained in:
Mike Blumenkrantz
2024-10-10 10:46:07 -04:00
committed by Marge Bot
parent 8487ecfa44
commit f5bd39e0e3
10 changed files with 30 additions and 30 deletions

View File

@@ -372,6 +372,12 @@ draw_set_clip_state(struct draw_context *draw,
memcpy(&draw->plane[6], clip->ucp, sizeof(clip->ucp));
}
void
draw_set_viewmask(struct draw_context *draw, uint8_t viewmask)
{
draw->viewmask = viewmask;
}
/**
* Set the draw module's viewport state.

View File

@@ -327,6 +327,9 @@ void draw_set_vertex_elements(struct draw_context *draw,
unsigned count,
const struct pipe_vertex_element *elements);
void
draw_set_viewmask(struct draw_context *draw, uint8_t viewmask);
void draw_set_indexes(struct draw_context *draw,
const void *elements, unsigned elem_size,
unsigned available_space);

View File

@@ -355,6 +355,8 @@ struct draw_context
*/
float plane[DRAW_TOTAL_CLIP_PLANES][4];
uint32_t viewmask;
/* If a prim stage introduces new vertex attributes, they'll be stored here
*/
struct {

View File

@@ -619,8 +619,8 @@ draw_vbo(struct draw_context *draw,
* the min_index/max_index hints given by gallium frontends.
*/
if (use_info->view_mask) {
u_foreach_bit(i, use_info->view_mask) {
if (draw->viewmask) {
u_foreach_bit(i, draw->viewmask) {
draw->pt.user.viewid = i;
draw_instances(draw, drawid_offset, use_info, use_draws, num_draws);
}

View File

@@ -4281,7 +4281,6 @@ agx_draw_without_restart(struct agx_batch *batch,
.mode = u_decomposed_prim(info->mode),
.index_size = info->index_size,
.index.resource = ctx->heap,
.view_mask = info->view_mask,
.increment_draw_id = info->increment_draw_id,
.index_bias_varies = info->index_bias_varies,
};
@@ -4813,7 +4812,6 @@ agx_draw_patches(struct agx_context *ctx, const struct pipe_draw_info *info,
.index_size = with_counts ? 4 : (point_mode ? 0 : 2),
.index.resource = (!with_counts && point_mode) ? NULL : ctx->heap,
.instance_count = 1,
.view_mask = info->view_mask,
};
/* Wrap the pool allocation in a fake resource for meta-Gallium use */
@@ -5147,7 +5145,6 @@ agx_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
.restart_index = ~0,
.index.resource = ctx->heap,
.instance_count = 1,
.view_mask = info->view_mask,
};
indirect_gs = (struct pipe_draw_indirect_info){

View File

@@ -97,6 +97,7 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe,
draw_set_zs_format(lp->draw, depth_format);
lp_setup_bind_framebuffer(lp->setup, &lp->framebuffer);
draw_set_viewmask(lp->draw, fb->viewmask);
lp->dirty |= LP_NEW_FRAMEBUFFER;
}

View File

@@ -1450,8 +1450,8 @@ static void render_clear(struct rendering_state *state)
struct lvp_image_view *imgv = state->color_att[i].imgv;
assert(imgv->surface);
if (state->info.view_mask) {
u_foreach_bit(i, state->info.view_mask)
if (state->framebuffer.viewmask) {
u_foreach_bit(i, state->framebuffer.viewmask)
clear_attachment_layers(state, imgv, &state->render_area,
i, 1, 0, 0, 0, &color_clear_val);
} else {
@@ -1480,8 +1480,8 @@ static void render_clear(struct rendering_state *state)
}
if (ds_clear_flags) {
if (state->info.view_mask) {
u_foreach_bit(i, state->info.view_mask)
if (state->framebuffer.viewmask) {
u_foreach_bit(i, state->framebuffer.viewmask)
clear_attachment_layers(state, state->ds_imgv, &state->render_area,
i, 1, ds_clear_flags, dclear_val, sclear_val, NULL);
} else {
@@ -1512,7 +1512,7 @@ static void render_clear_fast(struct rendering_state *state)
state->render_area.extent.height != state->framebuffer.height)
goto slow_clear;
if (state->info.view_mask)
if (state->framebuffer.viewmask)
goto slow_clear;
if (state->render_cond)
@@ -1828,7 +1828,7 @@ handle_begin_rendering(struct vk_cmd_queue_entry *cmd,
state->forced_stencil_resolve_mode = 0;
}
state->info.view_mask = info->viewMask;
state->framebuffer.viewmask = info->viewMask;
state->render_area = info->renderArea;
state->suspending = suspending;
state->framebuffer.width = info->renderArea.offset.x +
@@ -1915,8 +1915,8 @@ static void handle_end_rendering(struct vk_cmd_queue_entry *cmd,
for (unsigned i = 0; i < state->framebuffer.nr_cbufs; i++) {
if (state->color_att[i].imgv && state->color_att[i].store_op == VK_ATTACHMENT_STORE_OP_DONT_CARE) {
if (state->info.view_mask) {
u_foreach_bit(i, state->info.view_mask)
if (state->framebuffer.viewmask) {
u_foreach_bit(i, state->framebuffer.viewmask)
clear_attachment_layers(state, state->color_att[i].imgv, &state->render_area,
i, 1, 0, 0, 0, &color_clear_val);
} else {
@@ -1939,8 +1939,8 @@ static void handle_end_rendering(struct vk_cmd_queue_entry *cmd,
double dclear_val = 0.2389234;
uint32_t sclear_val = rand() % UINT8_MAX;
if (ds_clear_flags) {
if (state->info.view_mask) {
u_foreach_bit(i, state->info.view_mask)
if (state->framebuffer.viewmask) {
u_foreach_bit(i, state->framebuffer.viewmask)
clear_attachment_layers(state, state->ds_imgv, &state->render_area,
i, 1, ds_clear_flags, dclear_val, sclear_val, NULL);
} else {
@@ -2885,7 +2885,7 @@ static void handle_begin_query(struct vk_cmd_queue_entry *cmd,
emit_state(state);
uint32_t count = util_bitcount(state->info.view_mask ? state->info.view_mask : BITFIELD_BIT(0));
uint32_t count = util_bitcount(state->framebuffer.viewmask ? state->framebuffer.viewmask : BITFIELD_BIT(0));
for (unsigned idx = 0; idx < count; idx++) {
if (!pool->queries[qcmd->query + idx]) {
enum pipe_query_type qtype = pool->base_type;
@@ -2922,7 +2922,7 @@ static void handle_begin_query_indexed_ext(struct vk_cmd_queue_entry *cmd,
emit_state(state);
uint32_t count = util_bitcount(state->info.view_mask ? state->info.view_mask : BITFIELD_BIT(0));
uint32_t count = util_bitcount(state->framebuffer.viewmask ? state->framebuffer.viewmask : BITFIELD_BIT(0));
for (unsigned idx = 0; idx < count; idx++) {
if (!pool->queries[qcmd->query + idx]) {
enum pipe_query_type qtype = pool->base_type;
@@ -2968,7 +2968,7 @@ static void handle_write_timestamp2(struct vk_cmd_queue_entry *cmd,
if (!(qcmd->stage == VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT))
state->pctx->flush(state->pctx, NULL, 0);
uint32_t count = util_bitcount(state->info.view_mask ? state->info.view_mask : BITFIELD_BIT(0));
uint32_t count = util_bitcount(state->framebuffer.viewmask ? state->framebuffer.viewmask : BITFIELD_BIT(0));
for (unsigned idx = 0; idx < count; idx++) {
if (!pool->queries[qcmd->query + idx]) {
pool->queries[qcmd->query + idx] = state->pctx->create_query(state->pctx, PIPE_QUERY_TIMESTAMP, 0);
@@ -3185,8 +3185,8 @@ static void handle_clear_attachments(struct vk_cmd_queue_entry *cmd,
rect->rect.offset.y = MAX2(rect->rect.offset.y, 0);
rect->rect.extent.width = MIN2(rect->rect.extent.width, state->framebuffer.width - rect->rect.offset.x);
rect->rect.extent.height = MIN2(rect->rect.extent.height, state->framebuffer.height - rect->rect.offset.y);
if (state->info.view_mask) {
u_foreach_bit(i, state->info.view_mask)
if (state->framebuffer.viewmask) {
u_foreach_bit(i, state->framebuffer.viewmask)
clear_attachment_layers(state, imgv, &rect->rect,
i, 1,
ds_clear_flags, dclear_val, sclear_val,

View File

@@ -2425,7 +2425,6 @@ init_draw_info(struct pipe_draw_info *info,
info->increment_draw_id = false;
info->was_line_loop = false;
info->restart_index = 0;
info->view_mask = 0;
}
CSMT_ITEM_NO_WAIT(nine_context_draw_primitive,

View File

@@ -854,8 +854,7 @@ struct pipe_draw_info
/* sizeof(mode) == 1 is required by draw merging in u_threaded_context. */
uint8_t mode; /**< the mode of the primitive */
#endif
uint8_t index_size; /**< if 0, the draw is not indexed. */
uint8_t view_mask; /**< mask of multiviews for this draw */
uint16_t index_size; /**< if 0, the draw is not indexed. */
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;

View File

@@ -1167,7 +1167,6 @@ _mesa_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
/* Packed section end. */
info.start_instance = baseInstance;
info.instance_count = numInstances;
info.view_mask = 0;
info.min_index = start;
info.max_index = start + count - 1;
@@ -1474,7 +1473,6 @@ _mesa_MultiDrawArrays(GLenum mode, const GLint *first,
/* Packed section end. */
info.start_instance = 0;
info.instance_count = 1;
info.view_mask = 0;
for (int i = 0; i < primcount; i++) {
draw[i].start = first[i];
@@ -1640,7 +1638,6 @@ _mesa_validated_drawrangeelements(struct gl_context *ctx,
*/
draw->info.mode = mode;
draw->info.index_size = 1 << index_size_shift;
draw->info.view_mask = 0;
/* Packed section begin. */
draw->info.primitive_restart = primitive_restart;
draw->info.has_user_indices = false;
@@ -1680,7 +1677,6 @@ _mesa_validated_drawrangeelements(struct gl_context *ctx,
/* Packed section end. */
info.start_instance = baseInstance;
info.instance_count = numInstances;
info.view_mask = 0;
info.restart_index = ctx->Array._RestartIndex[index_size_shift];
if (info.has_user_indices) {
@@ -2071,7 +2067,6 @@ _mesa_validated_multidrawelements(struct gl_context *ctx,
/* Packed section end. */
info.start_instance = 0;
info.instance_count = 1;
info.view_mask = 0;
info.restart_index = ctx->Array._RestartIndex[index_size_shift];
if (info.has_user_indices) {
@@ -2450,7 +2445,6 @@ _mesa_MultiDrawArraysIndirect(GLenum mode, const GLvoid *indirect,
struct pipe_draw_info info;
info.mode = mode;
info.index_size = 0;
info.view_mask = 0;
/* Packed section begin. */
info.primitive_restart = false;
info.has_user_indices = false;
@@ -2545,7 +2539,6 @@ _mesa_MultiDrawElementsIndirect(GLenum mode, GLenum type,
struct pipe_draw_info info;
info.mode = mode;
info.index_size = 1 << index_size_shift;
info.view_mask = 0;
/* Packed section begin. */
info.primitive_restart = ctx->Array._PrimitiveRestart[index_size_shift];
info.has_user_indices = false;