Mesa (master): panfrost: Replace varyings for point sprites
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 24 20:00:12 UTC 2019
Module: Mesa
Branch: master
Commit: f35f37385038099158e05602ae0ca083429258dc
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f35f37385038099158e05602ae0ca083429258dc
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Mon Jun 24 11:53:58 2019 -0700
panfrost: Replace varyings for point sprites
This doesn't handle Y-flipping, but it's good enough to render the stars
in Neverball.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
src/gallium/drivers/panfrost/pan_context.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 1e3c0dccc79..895dcceff4e 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -610,6 +610,29 @@ panfrost_emit_varying_descriptor(
for (unsigned i = 0; i < fs->tripipe->varying_count; i++) {
unsigned j;
+ /* If we have a point sprite replacement, handle that here. We
+ * have to translate location first. TODO: Flip y in shader.
+ * We're already keying ... just time crunch .. */
+
+ unsigned loc = fs->varyings_loc[i];
+ unsigned pnt_loc =
+ (loc >= VARYING_SLOT_VAR0) ? (loc - VARYING_SLOT_VAR0) :
+ (loc == VARYING_SLOT_PNTC) ? 8 :
+ ~0;
+
+ if (~pnt_loc && fs->point_sprite_mask & (1 << pnt_loc)) {
+ /* gl_PointCoord index by convention */
+ fs->varyings[i].index = 3;
+ fs->reads_point_coord = true;
+
+ /* Swizzle out the z/w to 0/1 */
+ fs->varyings[i].format = MALI_RG16F;
+ fs->varyings[i].swizzle =
+ panfrost_get_default_swizzle(2);
+
+ continue;
+ }
+
if (fs->varyings[i].index)
continue;
@@ -1668,7 +1691,10 @@ panfrost_bind_rasterizer_state(
/* Point sprites are emulated */
- if (ctx->rasterizer->base.sprite_coord_enable)
+ struct panfrost_shader_state *variant =
+ ctx->fs ? &ctx->fs->variants[ctx->fs->active_variant] : NULL;
+
+ if (ctx->rasterizer->base.sprite_coord_enable || (variant && variant->point_sprite_mask))
ctx->base.bind_fs_state(&ctx->base, ctx->fs);
}
More information about the mesa-commit
mailing list