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@collabora.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16063>
This commit is contained in:
Emma Anholt 2022-04-14 10:55:12 -07:00 committed by Marge Bot
parent 6040107dc1
commit 814b0edae5
1 changed files with 11 additions and 3 deletions

View File

@ -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: