Mesa (staging/21.3): crocus: wm_prog_key::key_alpha_test uses GL enums

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Dec 12 22:36:42 UTC 2021


Module: Mesa
Branch: staging/21.3
Commit: 81bab29f626741f0cb2ad0a5f36e49aa1d95e684
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=81bab29f626741f0cb2ad0a5f36e49aa1d95e684

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Thu Dec  9 18:20:55 2021 -0600

crocus: wm_prog_key::key_alpha_test uses GL enums

Fixes: f3630548f1da ("crocus: initial gallium driver for Intel gfx 4-7")
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14141>
(cherry picked from commit 4175ed50994a27b7d0b36471da58195670aa4192)

---

 .pick_status.json                         |  2 +-
 src/gallium/drivers/crocus/crocus_state.c | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 5d6f44e0553..6b2a3f5434c 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -445,7 +445,7 @@
         "description": "crocus: wm_prog_key::key_alpha_test uses GL enums",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "f3630548f1da904ec6c63b43ece7e68afdb8867e"
     },
diff --git a/src/gallium/drivers/crocus/crocus_state.c b/src/gallium/drivers/crocus/crocus_state.c
index 10705a0b7bb..4c3574216eb 100644
--- a/src/gallium/drivers/crocus/crocus_state.c
+++ b/src/gallium/drivers/crocus/crocus_state.c
@@ -4750,6 +4750,22 @@ crocus_populate_gs_key(const struct crocus_context *ice,
       key->nr_userclip_plane_consts = cso_rast->num_clip_plane_consts;
 }
 
+static inline GLenum
+compare_func_to_gl(enum pipe_compare_func pipe_func)
+{
+   static const unsigned map[] = {
+      [PIPE_FUNC_NEVER]    = GL_NEVER,
+      [PIPE_FUNC_LESS]     = GL_LESS,
+      [PIPE_FUNC_EQUAL]    = GL_EQUAL,
+      [PIPE_FUNC_LEQUAL]   = GL_LEQUAL,
+      [PIPE_FUNC_GREATER]  = GL_GREATER,
+      [PIPE_FUNC_NOTEQUAL] = GL_NOTEQUAL,
+      [PIPE_FUNC_GEQUAL]   = GL_GEQUAL,
+      [PIPE_FUNC_ALWAYS]   = GL_ALWAYS,
+   };
+   return map[pipe_func];
+}
+
 /**
  * Populate FS program key fields based on the current state.
  */
@@ -4836,7 +4852,7 @@ crocus_populate_fs_key(const struct crocus_context *ice,
 
 #if GFX_VER <= 5
    if (fb->nr_cbufs > 1 && zsa->cso.alpha_enabled) {
-      key->alpha_test_func = zsa->cso.alpha_func;
+      key->alpha_test_func = compare_func_to_gl(zsa->cso.alpha_func);
       key->alpha_test_ref = zsa->cso.alpha_ref_value;
    }
 #endif



More information about the mesa-commit mailing list