gen{7,8}_pipeline: Apply 3DPRIM_RECTLIST restrictions
authorNanley Chery <nanley.g.chery@intel.com>
Thu, 31 Mar 2016 17:04:46 +0000 (10:04 -0700)
committerNanley Chery <nanley.g.chery@intel.com>
Thu, 14 Apr 2016 00:53:38 +0000 (17:53 -0700)
According to 3D Primitives Overview in the Bspec, when the RECTLIST
primitive is in use, the CLIP stage should be disabled or set to have
a different Clip Mode, and Viewport Mapping must be disabled:

   Clipping: Must not require clipping or rely on the CLIP unit’s
   ClipTest logic to determine if clipping is required. Either the CLIP
   unit should be DISABLED, or the CLIP unit’s Clip Mode should be set
   to a value other than CLIPMODE_NORMAL.

   Viewport Mapping must be DISABLED (as is typical with the use of
   screen-space coordinates).

We swap out ::disable_viewport for ::use_rectlist, because we currently
always use the RECTLIST primitive when we disable viewport mapping, and
we'll likely continue to use this primitive.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
src/intel/vulkan/gen7_pipeline.c
src/intel/vulkan/gen8_pipeline.c

index 37e4639..1039734 100644 (file)
@@ -47,7 +47,7 @@ gen7_emit_rs_state(struct anv_pipeline *pipeline,
       .StatisticsEnable                         = true,
       .FrontFaceFillMode                        = vk_to_gen_fillmode[info->polygonMode],
       .BackFaceFillMode                         = vk_to_gen_fillmode[info->polygonMode],
-      .ViewTransformEnable                      = !(extra && extra->disable_viewport),
+      .ViewTransformEnable                      = !(extra && extra->use_rectlist),
       .FrontWinding                             = vk_to_gen_front_face[info->frontFace],
       /* bool                                         AntiAliasingEnable; */
 
@@ -225,7 +225,7 @@ genX(graphics_pipeline_create)(
    anv_batch_emit(&pipeline->batch, GENX(3DSTATE_CLIP),
       .FrontWinding                             = vk_to_gen_front_face[rs_info->frontFace],
       .CullMode                                 = vk_to_gen_cullmode[rs_info->cullMode],
-      .ClipEnable                               = true,
+      .ClipEnable                               = !(extra && extra->use_rectlist),
       .APIMode                                  = APIMODE_OGL,
       .ViewportXYClipTestEnable                 = !(extra && extra->disable_viewport),
       .ClipMode                                 = CLIPMODE_NORMAL,
index b8b29d4..0d71e07 100644 (file)
@@ -56,7 +56,7 @@ emit_rs_state(struct anv_pipeline *pipeline,
 
    struct GENX(3DSTATE_SF) sf = {
       GENX(3DSTATE_SF_header),
-      .ViewportTransformEnable = !(extra && extra->disable_viewport),
+      .ViewportTransformEnable = !(extra && extra->use_rectlist),
       .TriangleStripListProvokingVertexSelect = 0,
       .LineStripListProvokingVertexSelect = 0,
       .TriangleFanProvokingVertexSelect = 1,
@@ -348,7 +348,7 @@ genX(graphics_pipeline_create)(
 
    const struct brw_wm_prog_data *wm_prog_data = get_wm_prog_data(pipeline);
    anv_batch_emit(&pipeline->batch, GENX(3DSTATE_CLIP),
-                  .ClipEnable = true,
+                  .ClipEnable = !(extra && extra->use_rectlist),
                   .EarlyCullEnable = true,
                   .APIMode = 1, /* D3D */
                   .ViewportXYClipTestEnable = !(extra && extra->disable_viewport),