tu: Enable VK_EXT_shader_stencil_export
authorConnor Abbott <cwabbott0@gmail.com>
Thu, 16 Jul 2020 13:49:36 +0000 (15:49 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 16 Jul 2020 20:49:20 +0000 (20:49 +0000)
This passes the grand total of 3 CTS tests (2 actually enabled due to
missing D32_SFLOAT_S8_UINT support) under
dEQP-VK.pipeline.shader_stencil_export.*

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5936>

src/freedreno/vulkan/tu_extensions.py
src/freedreno/vulkan/tu_pipeline.c
src/freedreno/vulkan/tu_shader.c

index e2583afbe53c6b5409f48db3a9f46ad272d086ec..7a3fd7b637db567b487d0842d71d96c278877e35 100644 (file)
@@ -86,6 +86,7 @@ EXTENSIONS = [
     Extension('VK_KHR_shader_draw_parameters',            1, True),
     Extension('VK_KHR_variable_pointers',                 1, True),
     Extension('VK_EXT_private_data',                      1, True),
+    Extension('VK_EXT_shader_stencil_export',             1, True),
 ]
 
 MAX_API_VERSION = VkVersion(MAX_API_VERSION)
index b81482bd88cbd51b61af918ca1af9e9119850706..84c578ae53e10db969b999e647a20872f9b976ec 100644 (file)
@@ -1229,10 +1229,11 @@ tu6_emit_fs_outputs(struct tu_cs *cs,
                     uint32_t render_components,
                     bool is_s8_uint)
 {
-   uint32_t smask_regid, posz_regid;
+   uint32_t smask_regid, posz_regid, stencilref_regid;
 
    posz_regid      = ir3_find_output_regid(fs, FRAG_RESULT_DEPTH);
    smask_regid     = ir3_find_output_regid(fs, FRAG_RESULT_SAMPLE_MASK);
+   stencilref_regid = ir3_find_output_regid(fs, FRAG_RESULT_STENCIL);
 
    uint32_t fragdata_regid[8];
    if (fs->color0_mrt) {
@@ -1247,8 +1248,8 @@ tu6_emit_fs_outputs(struct tu_cs *cs,
    tu_cs_emit_pkt4(cs, REG_A6XX_SP_FS_OUTPUT_CNTL0, 2);
    tu_cs_emit(cs, A6XX_SP_FS_OUTPUT_CNTL0_DEPTH_REGID(posz_regid) |
                   A6XX_SP_FS_OUTPUT_CNTL0_SAMPMASK_REGID(smask_regid) |
-                  COND(dual_src_blend, A6XX_SP_FS_OUTPUT_CNTL0_DUAL_COLOR_IN_ENABLE) |
-                  0xfc000000);
+                  A6XX_SP_FS_OUTPUT_CNTL0_STENCILREF_REGID(stencilref_regid) |
+                  COND(dual_src_blend, A6XX_SP_FS_OUTPUT_CNTL0_DUAL_COLOR_IN_ENABLE));
    tu_cs_emit(cs, A6XX_SP_FS_OUTPUT_CNTL1_MRT(mrt_count));
 
    tu_cs_emit_pkt4(cs, REG_A6XX_SP_FS_OUTPUT_REG(0), 8);
@@ -1265,6 +1266,7 @@ tu6_emit_fs_outputs(struct tu_cs *cs,
    tu_cs_emit_pkt4(cs, REG_A6XX_RB_FS_OUTPUT_CNTL0, 2);
    tu_cs_emit(cs, COND(fs->writes_pos, A6XX_RB_FS_OUTPUT_CNTL0_FRAG_WRITES_Z) |
                   COND(fs->writes_smask, A6XX_RB_FS_OUTPUT_CNTL0_FRAG_WRITES_SAMPMASK) |
+                  COND(fs->writes_stencilref, A6XX_RB_FS_OUTPUT_CNTL0_FRAG_WRITES_STENCILREF) |
                   COND(dual_src_blend, A6XX_RB_FS_OUTPUT_CNTL0_DUAL_COLOR_IN_ENABLE));
    tu_cs_emit(cs, A6XX_RB_FS_OUTPUT_CNTL1_MRT(mrt_count));
 
@@ -1273,7 +1275,7 @@ tu6_emit_fs_outputs(struct tu_cs *cs,
 
    enum a6xx_ztest_mode zmode;
 
-   if (fs->no_earlyz || fs->has_kill || fs->writes_pos || is_s8_uint) {
+   if (fs->no_earlyz || fs->has_kill || fs->writes_pos || fs->writes_stencilref || is_s8_uint) {
       zmode = A6XX_LATE_Z;
    } else {
       zmode = A6XX_EARLY_Z;
index 81bb33fe63b4b912114166b01dd2e0fc212b3bdb..3e87c06252cbf45ca2205215bb3e3b2b4c4b5132 100644 (file)
@@ -64,6 +64,7 @@ tu_spirv_to_nir(struct ir3_compiler *compiler,
          .tessellation = true,
          .draw_parameters = true,
          .variable_pointers = true,
+         .stencil_export = true,
       },
    };
    const nir_shader_compiler_options *nir_options =