Mesa (main): pvr: use a helper to translate compare-ops

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Mar 23 16:56:44 UTC 2022


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

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Wed Mar 23 15:37:32 2022 +0100

pvr: use a helper to translate compare-ops

This gives us a single place to handle the conversion, and fixes a
compilation warning by adding an explicit cast.

Reviewed-by: Karmjit Mahil <Karmjit.Mahil at imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15525>

---

 src/imagination/vulkan/pvr_cmd_buffer.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/imagination/vulkan/pvr_cmd_buffer.c b/src/imagination/vulkan/pvr_cmd_buffer.c
index d1677451c22..ff48d1f13c2 100644
--- a/src/imagination/vulkan/pvr_cmd_buffer.c
+++ b/src/imagination/vulkan/pvr_cmd_buffer.c
@@ -2979,6 +2979,12 @@ pvr_ppp_state_get_ispa_objtype_from_vk(const VkPrimitiveTopology topology)
    }
 }
 
+static inline enum PVRX(TA_CMPMODE) pvr_cmpmode(VkCompareOp op)
+{
+   /* enum values are identical, so we can just cast the input directly. */
+   return (enum PVRX(TA_CMPMODE))op;
+}
+
 static void pvr_setup_isp_faces_and_control(
    struct pvr_cmd_buffer *const cmd_buffer,
    struct pvr_cmd_struct(TA_STATE_ISPA) *const ispa_out)
@@ -3047,7 +3053,7 @@ static void pvr_setup_isp_faces_and_control(
       if (disable_depth_test)
          ispa.dcmpmode = PVRX(TA_CMPMODE_ALWAYS);
       else
-         ispa.dcmpmode = gfx_pipeline->depth_compare_op;
+         ispa.dcmpmode = pvr_cmpmode(gfx_pipeline->depth_compare_op);
 
       /* FIXME: Can we just have this and remove the assignment above?
        * The user provides a depthTestEnable at vkCreateGraphicsPipelines()
@@ -3107,7 +3113,7 @@ static void pvr_setup_isp_faces_and_control(
          ispb.sop2 = gfx_pipeline->stencil_front.depth_fail_op;
          ispb.sop1 = gfx_pipeline->stencil_front.fail_op;
 
-         ispb.scmpmode = gfx_pipeline->stencil_front.compare_op;
+         ispb.scmpmode = pvr_cmpmode(gfx_pipeline->stencil_front.compare_op);
       }
 
       pvr_csb_pack (&back_b, TA_STATE_ISPB, ispb) {
@@ -3119,7 +3125,7 @@ static void pvr_setup_isp_faces_and_control(
          ispb.sop2 = gfx_pipeline->stencil_back.depth_fail_op;
          ispb.sop1 = gfx_pipeline->stencil_back.fail_op;
 
-         ispb.scmpmode = gfx_pipeline->stencil_back.compare_op;
+         ispb.scmpmode = pvr_cmpmode(gfx_pipeline->stencil_back.compare_op);
       }
    }
 



More information about the mesa-commit mailing list