iris: depth or stencil fixes
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 3 Aug 2018 08:24:51 +0000 (01:24 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:08 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_resource.c

index 79dcd94566d011112aaef89ce4acef47b58d480d..4930def9098af6a33ca3de33872948dde2a1aecb 100644 (file)
@@ -198,12 +198,12 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen,
    if (!res)
       return NULL;
 
-   bool depth = util_format_is_depth_or_stencil(templ->format);
+   bool depth_or_stencil = util_format_is_depth_or_stencil(templ->format);
 
    uint64_t modifier = DRM_FORMAT_MOD_INVALID;
 
    if (modifiers_count == 0 || !modifiers) {
-      if (depth) {
+      if (depth_or_stencil) {
          modifier = I915_FORMAT_MOD_Y_TILED;
       } else if (templ->bind & PIPE_BIND_DISPLAY_TARGET) {
          /* Display is X-tiled for historical reasons. */
@@ -236,16 +236,17 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen,
        templ->target == PIPE_TEXTURE_CUBE_ARRAY)
       usage |= ISL_SURF_USAGE_CUBE_BIT;
 
-   // XXX: separate stencil...
-   enum pipe_format pfmt = templ->format;
-
-   if (util_format_is_depth_or_stencil(pfmt) &&
-       templ->usage != PIPE_USAGE_STAGING)
+   if (depth_or_stencil && templ->usage != PIPE_USAGE_STAGING)
       usage |= ISL_SURF_USAGE_DEPTH_BIT;
 
+   enum pipe_format pfmt = templ->format;
+
    if (util_format_is_depth_and_stencil(pfmt)) {
-      // XXX: Z32S8
-      pfmt = PIPE_FORMAT_Z24X8_UNORM;
+      struct pipe_resource t = *templ;
+      t.format = PIPE_FORMAT_S8_UINT;
+      res->base.next =
+         iris_resource_create_with_modifiers(pscreen, &t, NULL, 0);
+      pfmt = util_format_get_depth_only(pfmt);
    }
 
    enum isl_format isl_format = iris_isl_format_for_pipe_format(pfmt);