ilo: allow ilo_zs_surface to skip layer offsetting
authorChia-I Wu <olvaffe@gmail.com>
Fri, 20 Dec 2013 16:31:33 +0000 (00:31 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Wed, 8 Jan 2014 10:11:34 +0000 (18:11 +0800)
Make offset to layer optional in ilo_gpe_init_zs_surface.

src/gallium/drivers/ilo/ilo_gpe.h
src/gallium/drivers/ilo/ilo_gpe_gen6.c
src/gallium/drivers/ilo/ilo_state.c

index 318650d9f54965e0872b9da7983a0cd3ff54876e..9347d889d83c1042d074fe4f2acf9506371f0b5e 100644 (file)
@@ -470,10 +470,9 @@ ilo_gpe_init_view_surface_for_texture(const struct ilo_dev_info *dev,
 void
 ilo_gpe_init_zs_surface(const struct ilo_dev_info *dev,
                         const struct ilo_texture *tex,
-                        enum pipe_format format,
-                        unsigned level,
+                        enum pipe_format format, unsigned level,
                         unsigned first_layer, unsigned num_layers,
-                        struct ilo_zs_surface *zs);
+                        bool offset_to_layer, struct ilo_zs_surface *zs);
 
 void
 ilo_gpe_init_vs_cso(const struct ilo_dev_info *dev,
index 5babbce2ad9e1a48c40d263ffb397d6227d53b92..a84cb4d565e43adee369539c5a43b4145b195d78 100644 (file)
@@ -979,12 +979,10 @@ zs_init_info_null(const struct ilo_dev_info *dev,
 static void
 zs_init_info(const struct ilo_dev_info *dev,
              const struct ilo_texture *tex,
-             enum pipe_format format,
-             unsigned level,
+             enum pipe_format format, unsigned level,
              unsigned first_layer, unsigned num_layers,
-             struct ilo_zs_surface_info *info)
+             bool offset_to_layer, struct ilo_zs_surface_info *info)
 {
-   const bool rebase_layer = true;
    struct intel_bo * const hiz_bo = NULL;
    bool separate_stencil;
    uint32_t x_offset[3], y_offset[3];
@@ -1080,7 +1078,7 @@ zs_init_info(const struct ilo_dev_info *dev,
       info->zs.stride = tex->bo_stride;
       info->zs.tiling = tex->tiling;
 
-      if (rebase_layer) {
+      if (offset_to_layer) {
          info->zs.offset = ilo_texture_get_slice_offset(tex,
                level, first_layer, &x_offset[0], &y_offset[0]);
       }
@@ -1105,7 +1103,7 @@ zs_init_info(const struct ilo_dev_info *dev,
 
       info->stencil.tiling = s8_tex->tiling;
 
-      if (rebase_layer) {
+      if (offset_to_layer) {
          info->stencil.offset = ilo_texture_get_slice_offset(s8_tex,
                level, first_layer, &x_offset[1], &y_offset[1]);
       }
@@ -1129,7 +1127,7 @@ zs_init_info(const struct ilo_dev_info *dev,
    info->first_layer = first_layer;
    info->num_layers = num_layers;
 
-   if (rebase_layer) {
+   if (offset_to_layer) {
       /* the size of the layer */
       info->width = u_minify(info->width, level);
       info->height = u_minify(info->height, level);
@@ -1201,10 +1199,9 @@ zs_init_info(const struct ilo_dev_info *dev,
 void
 ilo_gpe_init_zs_surface(const struct ilo_dev_info *dev,
                         const struct ilo_texture *tex,
-                        enum pipe_format format,
-                        unsigned level,
+                        enum pipe_format format, unsigned level,
                         unsigned first_layer, unsigned num_layers,
-                        struct ilo_zs_surface *zs)
+                        bool offset_to_layer, struct ilo_zs_surface *zs)
 {
    const int max_2d_size = (dev->gen >= ILO_GEN(7)) ? 16384 : 8192;
    const int max_array_size = (dev->gen >= ILO_GEN(7)) ? 2048 : 512;
@@ -1213,10 +1210,13 @@ ilo_gpe_init_zs_surface(const struct ilo_dev_info *dev,
 
    ILO_GPE_VALID_GEN(dev, 6, 7.5);
 
-   if (tex)
-      zs_init_info(dev, tex, format, level, first_layer, num_layers, &info);
-   else
+   if (tex) {
+      zs_init_info(dev, tex, format, level, first_layer, num_layers,
+            offset_to_layer, &info);
+   }
+   else {
       zs_init_info_null(dev, &info);
+   }
 
    switch (info.surface_type) {
    case BRW_SURFACE_NULL:
index 8437ab171c543686321b92e0a441f39de49448dc..4953e52ec68e39be7cdbe5b541cc89527a5057cc 100644 (file)
@@ -1000,7 +1000,7 @@ ilo_create_surface(struct pipe_context *pipe,
             templ->format, templ->u.tex.level,
             templ->u.tex.first_layer,
             templ->u.tex.last_layer - templ->u.tex.first_layer + 1,
-            &surf->u.zs);
+            true, &surf->u.zs);
    }
 
    return &surf->base;
@@ -1189,8 +1189,8 @@ ilo_init_states(struct ilo_context *ilo)
 {
    ilo_gpe_set_scissor_null(ilo->dev, &ilo->scissor);
 
-   ilo_gpe_init_zs_surface(ilo->dev, NULL,
-         PIPE_FORMAT_NONE, 0, 0, 1, &ilo->fb.null_zs);
+   ilo_gpe_init_zs_surface(ilo->dev, NULL, PIPE_FORMAT_NONE,
+         0, 0, 1, false, &ilo->fb.null_zs);
 
    ilo->dirty = ILO_DIRTY_ALL;
 }