summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-12-21 00:31:33 +0800
committerChia-I Wu <[email protected]>2014-01-08 18:11:34 +0800
commit0a2a221d019651c98dabe6773e56118ae0009f8d (patch)
tree4b46f10fd285fa338425631be0f113c3703d22db /src/gallium
parent8d9f5d57e25af3de0e35e5c7f3c0bff03b080ba7 (diff)
ilo: allow ilo_zs_surface to skip layer offsetting
Make offset to layer optional in ilo_gpe_init_zs_surface.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/ilo/ilo_gpe.h5
-rw-r--r--src/gallium/drivers/ilo/ilo_gpe_gen6.c26
-rw-r--r--src/gallium/drivers/ilo/ilo_state.c6
3 files changed, 18 insertions, 19 deletions
diff --git a/src/gallium/drivers/ilo/ilo_gpe.h b/src/gallium/drivers/ilo/ilo_gpe.h
index 318650d9f54..9347d889d83 100644
--- a/src/gallium/drivers/ilo/ilo_gpe.h
+++ b/src/gallium/drivers/ilo/ilo_gpe.h
@@ -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,
diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen6.c b/src/gallium/drivers/ilo/ilo_gpe_gen6.c
index 5babbce2ad9..a84cb4d565e 100644
--- a/src/gallium/drivers/ilo/ilo_gpe_gen6.c
+++ b/src/gallium/drivers/ilo/ilo_gpe_gen6.c
@@ -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:
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index 8437ab171c5..4953e52ec68 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -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;
}