anv/gen9: Fix cube surface state
authorChad Versace <chad.versace@intel.com>
Fri, 8 Jan 2016 01:05:22 +0000 (17:05 -0800)
committerChad Versace <chad.versace@intel.com>
Fri, 8 Jan 2016 01:20:25 +0000 (17:20 -0800)
For gen9 SURFTYPE_CUBE, the RENDER_SURFACE_STATE's Depth,
MinimumArrayElement, and RenderTargetViewExtent is in units of full
cubes and so must be divided by 6.

Fixes 'dEQP-VK.pipeline.image.view_type.cube_array.cube_array.*'.

Now all of 'dEQP-VK.pipeline.image.*' passes.

src/vulkan/gen8_state.c

index a446cb26391a33b645e45ef1c45702ae68a5fe3a..c29d100f9f556e7e0d3f1ac1cab292bfdb55c55e 100644 (file)
@@ -212,7 +212,7 @@ genX(image_view_init)(struct anv_image_view *iview,
       .Depth = 0, /* TEMPLATE */
       .SurfacePitch = surface->isl.row_pitch - 1,
       .RenderTargetViewExtent = 0, /* TEMPLATE */
-      .MinimumArrayElement = range->baseArrayLayer,
+      .MinimumArrayElement = 0, /* TEMPLATE */
       .NumberofMultisamples = MULTISAMPLECOUNT_1,
       .XOffset = 0,
       .YOffset = 0,
@@ -240,7 +240,8 @@ genX(image_view_init)(struct anv_image_view *iview,
    switch (surface_state.SurfaceType) {
    case SURFTYPE_1D:
    case SURFTYPE_2D:
-   case SURFTYPE_CUBE:
+      surface_state.MinimumArrayElement = range->baseArrayLayer;
+
       /* From the Broadwell PRM >> RENDER_SURFACE_STATE::Depth:
        *
        *    For SURFTYPE_1D, 2D, and CUBE: The range of this field is reduced
@@ -259,7 +260,22 @@ genX(image_view_init)(struct anv_image_view *iview,
        */
       surface_state.RenderTargetViewExtent = surface_state.Depth;
       break;
+   case SURFTYPE_CUBE:
+      #if ANV_GENx10 >= 90
+         /* Like SURFTYPE_2D, but divided by 6. */
+         surface_state.MinimumArrayElement = range->baseArrayLayer / 6;
+         surface_state.Depth = range->layerCount / 6 - 1;
+         surface_state.RenderTargetViewExtent = surface_state.Depth;
+      #else
+         /* Same as SURFTYPE_2D */
+         surface_state.MinimumArrayElement = range->baseArrayLayer;
+         surface_state.Depth = range->layerCount - 1;
+         surface_state.RenderTargetViewExtent = surface_state.Depth;
+      #endif
+      break;
    case SURFTYPE_3D:
+      surface_state.MinimumArrayElement = range->baseArrayLayer;
+
       /* From the Broadwell PRM >> RENDER_SURFACE_STATE::Depth:
        *
        *    If the volume texture is MIP-mapped, this field specifies the