Module: Mesa
Branch: main
Commit: 3ea393e0234c374f1ebc172c8fffc76777382dc0
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ea393e0234c374f1ebc172c8fffc76777382dc0

Author: Alyssa Rosenzweig <[email protected]>
Date:   Tue Oct 18 13:45:36 2022 -0400

asahi: Lower point sprites in driver

mesa/st can't save us now!

Fixes: 310959d9fe1 ("mesa/st: rip out point-sprite cap")
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18651>

---

 src/gallium/drivers/asahi/agx_state.c | 8 ++++++++
 src/gallium/drivers/asahi/agx_state.h | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/src/gallium/drivers/asahi/agx_state.c 
b/src/gallium/drivers/asahi/agx_state.c
index c6922ffb4bf..188bdd0175f 100644
--- a/src/gallium/drivers/asahi/agx_state.c
+++ b/src/gallium/drivers/asahi/agx_state.c
@@ -1093,6 +1093,11 @@ agx_update_shader(struct agx_context *ctx, struct 
agx_compiled_shader **out,
 
       NIR_PASS_V(nir, nir_lower_fragcolor, key->nr_cbufs);
 
+      if (key->sprite_coord_enable) {
+         NIR_PASS_V(nir, nir_lower_texcoord_replace, key->sprite_coord_enable,
+                    false /* point coord is sysval */, false /* Y-invert */);
+      }
+
       if (key->clip_plane_enable) {
          NIR_PASS_V(nir, nir_lower_clip_fs, key->clip_plane_enable,
                     false);
@@ -1148,6 +1153,9 @@ agx_update_fs(struct agx_context *ctx)
       .clip_plane_enable = ctx->rast->base.clip_plane_enable,
    };
 
+   if (ctx->batch->reduced_prim == PIPE_PRIM_POINTS)
+      key.sprite_coord_enable = ctx->rast->base.sprite_coord_enable;
+
    for (unsigned i = 0; i < key.nr_cbufs; ++i) {
       struct pipe_surface *surf = ctx->batch->cbufs[i];
 
diff --git a/src/gallium/drivers/asahi/agx_state.h 
b/src/gallium/drivers/asahi/agx_state.h
index 868ef1985df..81499553172 100644
--- a/src/gallium/drivers/asahi/agx_state.h
+++ b/src/gallium/drivers/asahi/agx_state.h
@@ -148,6 +148,10 @@ struct asahi_shader_key {
    struct agx_shader_key base;
    struct agx_blend blend;
    unsigned nr_cbufs;
+
+   /* From rasterizer state, to lower point sprites */
+   uint16_t sprite_coord_enable;
+
    uint8_t clip_plane_enable;
    enum pipe_format rt_formats[PIPE_MAX_COLOR_BUFS];
 };

Reply via email to