turnip: Add support for polygon fill modes.
authorEric Anholt <eric@anholt.net>
Wed, 10 Jun 2020 20:05:53 +0000 (13:05 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 25 Jun 2020 20:46:30 +0000 (13:46 -0700)
Passes the new tests in dEQP-VK.rasterization.culling.*

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

src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_device.c
src/freedreno/vulkan/tu_pipeline.c
src/freedreno/vulkan/tu_util.h

index 7371f9489cadc73eaf087926439a4dfd1aa399ae..db251e0eb7b241ea9705d455571538a5e47df733 100644 (file)
@@ -968,9 +968,7 @@ tu6_init_hw(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
    tu_cs_emit_write_reg(cs, REG_A6XX_VPC_UNKNOWN_9210, 0);
    tu_cs_emit_write_reg(cs, REG_A6XX_VPC_UNKNOWN_9211, 0);
    tu_cs_emit_write_reg(cs, REG_A6XX_VPC_UNKNOWN_9602, 0);
-   tu_cs_emit_write_reg(cs, REG_A6XX_PC_POLYGON_MODE, POLYMODE6_TRIANGLES);
    tu_cs_emit_write_reg(cs, REG_A6XX_PC_UNKNOWN_9E72, 0);
-   tu_cs_emit_write_reg(cs, REG_A6XX_VPC_POLYGON_MODE, POLYMODE6_TRIANGLES);
    tu_cs_emit_write_reg(cs, REG_A6XX_SP_TP_UNKNOWN_B309, 0x000000a2);
    tu_cs_emit_write_reg(cs, REG_A6XX_HLSQ_CONTROL_5_REG, 0xfc);
 
index 994b8a22331d460ee1fb80d3daf8debe94a6f1f8..263c6576cf87223a2723d2157df790e915ed9cc6 100644 (file)
@@ -594,7 +594,7 @@ tu_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
       .drawIndirectFirstInstance = true,
       .depthClamp = true,
       .depthBiasClamp = false,
-      .fillModeNonSolid = false,
+      .fillModeNonSolid = true,
       .depthBounds = true,
       .wideLines = false,
       .largePoints = false,
index b0fb1cc9e460e2f768cc4a83f214a14673cd05ff..964d7438ab6f6a437bcca813c4ed48ffb7cfd99f 100644 (file)
@@ -2194,10 +2194,10 @@ tu_pipeline_builder_parse_rasterization(struct tu_pipeline_builder *builder,
    const VkPipelineRasterizationStateCreateInfo *rast_info =
       builder->create_info->pRasterizationState;
 
-   assert(rast_info->polygonMode == VK_POLYGON_MODE_FILL);
+   enum a6xx_polygon_mode mode = tu6_polygon_mode(rast_info->polygonMode);
 
    struct tu_cs cs;
-   tu_cs_begin_sub_stream(&pipeline->cs, 7, &cs);
+   tu_cs_begin_sub_stream(&pipeline->cs, 11, &cs);
 
    tu_cs_emit_regs(&cs,
                    A6XX_GRAS_CL_CNTL(
@@ -2206,6 +2206,13 @@ tu_pipeline_builder_parse_rasterization(struct tu_pipeline_builder *builder,
                      .unk5 = rast_info->depthClampEnable,
                      .zero_gb_scale_z = 1,
                      .vp_clip_code_ignore = 1));
+
+   tu_cs_emit_regs(&cs,
+                   A6XX_VPC_POLYGON_MODE(.mode = mode));
+
+   tu_cs_emit_regs(&cs,
+                   A6XX_PC_POLYGON_MODE(.mode = mode));
+
    /* move to hw ctx init? */
    tu_cs_emit_regs(&cs, A6XX_GRAS_UNKNOWN_8001());
    tu_cs_emit_regs(&cs,
index dcb4743dd905e2e1a0a0585f25f369b70cb8e4b9..fb914cf0ceb88b8005e1de6a2301b1061398a8dc 100644 (file)
@@ -234,4 +234,19 @@ tu6_pipe2depth(VkFormat format)
    }
 }
 
+static inline enum a6xx_polygon_mode
+tu6_polygon_mode(VkPolygonMode mode)
+{
+   switch (mode) {
+   case VK_POLYGON_MODE_POINT:
+      return POLYMODE6_POINTS;
+   case VK_POLYGON_MODE_LINE:
+      return POLYMODE6_LINES;
+   case VK_POLYGON_MODE_FILL:
+      return POLYMODE6_TRIANGLES;
+   default:
+      unreachable("bad polygon mode");
+   }
+}
+
 #endif /* TU_UTIL_H */