OSDN Git Service

iris: Simplify iris_get_depth_stencil_resources
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 14 Feb 2019 06:12:01 +0000 (22:12 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:12 +0000 (10:26 -0800)
We can safely assume that the given resource is depth, depth/stencil,
or stencil already.  The stencil-only case is easily detectable with
a single format check, and all other cases are handled identically.

This saves some CPU overhead.

src/gallium/drivers/iris/iris_resource.c

index 7302f2e..f67d816 100644 (file)
@@ -187,14 +187,10 @@ iris_get_depth_stencil_resources(struct pipe_resource *res,
       return;
    }
 
-   const struct util_format_description *desc =
-      util_format_description(res->format);
-
-   if (util_format_has_depth(desc)) {
+   if (res->format != PIPE_FORMAT_S8_UINT) {
       *out_z = (void *) res;
       *out_s = (void *) iris_resource_get_separate_stencil(res);
    } else {
-      assert(util_format_has_stencil(desc));
       *out_z = NULL;
       *out_s = (void *) res;
    }