mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
panfrost: Set allow_rotating_primitives
On Valhall, the driver should set this flag if the hardware may rotate primitives. This happens if: 1. The rasterization of lines does not matter, AND 2. The provoking vertex does not matter. The first condition we may satisfy by checking for LINES and the second by checking for flat shading. Otherwise, we should set this flag to allow optimizations. This may be more efficient for tiling. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16748>
This commit is contained in:
parent
e7a7679b9a
commit
67f5721349
3 changed files with 18 additions and 4 deletions
|
|
@ -3087,6 +3087,10 @@ panfrost_emit_primitive(struct panfrost_context *ctx,
|
|||
{
|
||||
UNUSED struct pipe_rasterizer_state *rast = &ctx->rasterizer->base;
|
||||
|
||||
bool lines = (info->mode == PIPE_PRIM_LINES ||
|
||||
info->mode == PIPE_PRIM_LINE_LOOP ||
|
||||
info->mode == PIPE_PRIM_LINE_STRIP);
|
||||
|
||||
pan_pack(out, PRIMITIVE, cfg) {
|
||||
cfg.draw_mode = pan_draw_mode(info->mode);
|
||||
if (panfrost_writes_point_size(ctx))
|
||||
|
|
@ -3097,9 +3101,7 @@ panfrost_emit_primitive(struct panfrost_context *ctx,
|
|||
* be set to true and the provoking vertex is selected with
|
||||
* DRAW.flat_shading_vertex.
|
||||
*/
|
||||
if (info->mode == PIPE_PRIM_LINES ||
|
||||
info->mode == PIPE_PRIM_LINE_LOOP ||
|
||||
info->mode == PIPE_PRIM_LINE_STRIP)
|
||||
if (lines)
|
||||
cfg.first_provoking_vertex = true;
|
||||
else
|
||||
cfg.first_provoking_vertex = rast->flatshade_first;
|
||||
|
|
@ -3113,7 +3115,10 @@ panfrost_emit_primitive(struct panfrost_context *ctx,
|
|||
|
||||
cfg.job_task_split = 6;
|
||||
#else
|
||||
cfg.allow_rotating_primitives = false;
|
||||
struct panfrost_shader_state *fs =
|
||||
panfrost_get_shader_state(ctx, PIPE_SHADER_FRAGMENT);
|
||||
|
||||
cfg.allow_rotating_primitives = !(lines || fs->info.bifrost.uses_flat_shading);
|
||||
cfg.primitive_restart = info->primitive_restart;
|
||||
|
||||
/* Non-fixed restart indices should have been lowered */
|
||||
|
|
|
|||
|
|
@ -547,6 +547,9 @@ bi_emit_load_vary(bi_builder *b, nir_intrinsic_instr *instr)
|
|||
*/
|
||||
if (b->shader->arch >= 9)
|
||||
src0 = bi_preload(b, 61);
|
||||
|
||||
/* Gather info as we go */
|
||||
b->shader->info.bifrost->uses_flat_shading = true;
|
||||
}
|
||||
|
||||
nir_src *offset = nir_get_io_offset_src(instr);
|
||||
|
|
|
|||
|
|
@ -256,6 +256,12 @@ struct bifrost_shader_info {
|
|||
nir_alu_type blend_src1_type;
|
||||
bool wait_6, wait_7;
|
||||
struct bifrost_message_preload messages[2];
|
||||
|
||||
/* Whether any flat varyings are loaded. This may disable optimizations
|
||||
* that change the provoking vertex, since that would load incorrect
|
||||
* values for flat varyings.
|
||||
*/
|
||||
bool uses_flat_shading;
|
||||
};
|
||||
|
||||
struct midgard_shader_info {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue