Mesa (main): nouveau/nv50: Enable mesa/st alpha test lowering on nv50 with NIR.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 20 22:13:40 UTC 2022
Module: Mesa
Branch: main
Commit: 814b0edae5a76ab4bc5f9d7673adc81f70c77178
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=814b0edae5a76ab4bc5f9d7673adc81f70c77178
Author: Emma Anholt <emma at anholt.net>
Date: Thu Apr 14 10:55:12 2022 -0700
nouveau/nv50: Enable mesa/st alpha test lowering on nv50 with NIR.
With TGSI, the driver allocates space for the alpha ref as a uniform and
adds a conditional discard to the shader. We could either replicate that
with NIR, or just set the flag saying we need the shader lowering and get
the same thing.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16063>
---
src/gallium/drivers/nouveau/nv50/nv50_screen.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index bba8d386298..43e09ddffa5 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -104,8 +104,9 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
static int
nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
{
- const uint16_t class_3d = nouveau_screen(pscreen)->class_3d;
- struct nouveau_device *dev = nouveau_screen(pscreen)->device;
+ struct nouveau_screen *screen = nouveau_screen(pscreen);
+ const uint16_t class_3d = screen->class_3d;
+ struct nouveau_device *dev = screen->device;
static bool debug_cap_printed[PIPE_CAP_LAST] = {};
switch (param) {
@@ -256,7 +257,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_DIV:
case PIPE_CAP_PREFER_IMM_ARRAYS_AS_CONSTBUF:
case PIPE_CAP_FLATSHADE:
- case PIPE_CAP_ALPHA_TEST:
case PIPE_CAP_POINT_SIZE_FIXED:
case PIPE_CAP_TWO_SIDED_COLOR:
case PIPE_CAP_CLIP_PLANES:
@@ -270,6 +270,14 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_SHAREABLE_SHADERS:
case PIPE_CAP_PREFER_BACK_BUFFER_REUSE:
return 1;
+
+ case PIPE_CAP_ALPHA_TEST:
+ /* nvc0 has fixed function alpha test support, but nv50 doesn't. The TGSI
+ * backend emits the conditional discard code against a driver-uploaded
+ * uniform, but with NIR we can have the st emit it for us.
+ */
+ return class_3d >= NVC0_3D_CLASS || !screen->prefer_nir;
+
case PIPE_CAP_TEXTURE_TRANSFER_MODES:
return PIPE_TEXTURE_TRANSFER_BLIT;
case PIPE_CAP_SEAMLESS_CUBE_MAP:
More information about the mesa-commit
mailing list