From baadc1ec13fae38247fab6dd7bbe74c43c6d142c Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 4 Sep 2022 14:51:05 -0400 Subject: [PATCH] asahi: Don't use lower_wpos_pntc Instead we can flip point coords with the object type. That means fewer instructions without shader variants. Thanks, PowerVR ^_^ Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.h | 1 - src/gallium/drivers/asahi/agx_pipe.c | 1 - src/gallium/drivers/asahi/agx_state.c | 17 +++++++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/asahi/compiler/agx_compile.h b/src/asahi/compiler/agx_compile.h index 2b7cc0c4cd6..20068664541 100644 --- a/src/asahi/compiler/agx_compile.h +++ b/src/asahi/compiler/agx_compile.h @@ -301,7 +301,6 @@ static const nir_shader_compiler_options agx_nir_options = { .lower_insert_word = true, .lower_cs_local_index_to_id = true, .has_cs_global_id = true, - .lower_wpos_pntc = true, .vectorize_io = true, .use_interpolated_input_intrinsics = true, .lower_rotate = true, diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 968d58dd056..e0db174412a 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -819,7 +819,6 @@ agx_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_SEAMLESS_CUBE_MAP: case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE: return true; - case PIPE_CAP_POINT_COORD_ORIGIN_UPPER_LEFT: case PIPE_CAP_FS_POINT_IS_SYSVAL: return false; diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 33b1d564b72..9c1495fa11d 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -1525,9 +1525,18 @@ demo_rasterizer(struct agx_context *ctx, struct agx_pool *pool, bool is_points) return agx_pool_upload_aligned(pool, &out, sizeof(out), 64); } +static enum agx_object_type +agx_point_object_type(struct agx_rasterizer *rast) +{ + return (rast->base.sprite_coord_mode == PIPE_SPRITE_COORD_UPPER_LEFT) ? + AGX_OBJECT_TYPE_POINT_SPRITE_UV01 : + AGX_OBJECT_TYPE_POINT_SPRITE_UV10; +} + static uint64_t -demo_unk11(struct agx_pool *pool, bool prim_lines, bool prim_points, bool - reads_tib, bool sample_mask_from_shader, bool no_colour_output) +demo_unk11(struct agx_pool *pool, struct agx_rasterizer *rast, + bool prim_lines, bool prim_points, bool reads_tib, + bool sample_mask_from_shader, bool no_colour_output) { struct agx_ptr T = agx_pool_alloc_aligned(pool, AGX_UNKNOWN_4A_LENGTH, 64); @@ -1538,7 +1547,7 @@ demo_unk11(struct agx_pool *pool, bool prim_lines, bool prim_points, bool cfg.sample_mask_from_shader = sample_mask_from_shader; cfg.front.object_type = cfg.back.object_type = - prim_points ? AGX_OBJECT_TYPE_POINT_SPRITE_UV01 : + prim_points ? agx_point_object_type(rast) : prim_lines ? AGX_OBJECT_TYPE_LINE : AGX_OBJECT_TYPE_TRIANGLE; }; @@ -1614,7 +1623,7 @@ agx_encode_state(struct agx_context *ctx, uint8_t *out, varyings, ctx->fs->info.varyings.fs.nr_bindings)); agx_push_record(&out, 4, demo_linkage(ctx->vs, ctx->fs, pool)); agx_push_record(&out, 7, demo_rasterizer(ctx, pool, is_points)); - agx_push_record(&out, 5, demo_unk11(pool, is_lines, is_points, reads_tib, + agx_push_record(&out, 5, demo_unk11(pool, ctx->rast, is_lines, is_points, reads_tib, sample_mask_from_shader, no_colour_output)); unsigned zbias = 0;