Mesa (master): ilo: use a helper to determine if HiZ is enabled
Chia-I Wu
olv at kemper.freedesktop.org
Tue Jan 14 07:43:42 UTC 2014
Module: Mesa
Branch: master
Commit: 18645d1533032e0ee64714731977e12ee16d959b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=18645d1533032e0ee64714731977e12ee16d959b
Author: Chia-I Wu <olvaffe at gmail.com>
Date: Tue Jan 14 13:50:12 2014 +0800
ilo: use a helper to determine if HiZ is enabled
Add ilo_texture_can_enable_hiz and replace all checks for tex->hiz.bo by calls
to ilo_texture_can_enable_hiz().
---
src/gallium/drivers/ilo/ilo_blit.c | 3 ++-
src/gallium/drivers/ilo/ilo_blit.h | 4 ++--
src/gallium/drivers/ilo/ilo_blitter_rectlist.c | 8 +++++---
src/gallium/drivers/ilo/ilo_gpe_gen6.c | 5 +++--
src/gallium/drivers/ilo/ilo_resource.h | 7 +++++++
5 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/src/gallium/drivers/ilo/ilo_blit.c b/src/gallium/drivers/ilo/ilo_blit.c
index 17193ab..ab1ec5b 100644
--- a/src/gallium/drivers/ilo/ilo_blit.c
+++ b/src/gallium/drivers/ilo/ilo_blit.c
@@ -155,7 +155,8 @@ ilo_blit_resolve_slices_for_hiz(struct ilo_context *ilo,
ILO_TEXTURE_CPU_WRITE;
unsigned i;
- assert(tex->base.target != PIPE_BUFFER && tex->hiz.bo);
+ assert(tex->base.target != PIPE_BUFFER &&
+ ilo_texture_can_enable_hiz(tex, level, first_slice, num_slices));
if (flags & ILO_TEXTURE_RENDER_WRITE) {
/*
diff --git a/src/gallium/drivers/ilo/ilo_blit.h b/src/gallium/drivers/ilo/ilo_blit.h
index 6e85f79..61fa322 100644
--- a/src/gallium/drivers/ilo/ilo_blit.h
+++ b/src/gallium/drivers/ilo/ilo_blit.h
@@ -60,7 +60,7 @@ ilo_blit_resolve_slices(struct ilo_context *ilo,
* As it is only used to resolve HiZ right now, return early when there is
* no HiZ.
*/
- if (!tex->hiz.bo)
+ if (!ilo_texture_can_enable_hiz(tex, level, first_slice, num_slices))
return;
/*
@@ -74,7 +74,7 @@ ilo_blit_resolve_slices(struct ilo_context *ilo,
* It is assumed there is at most one writer, and that readers read before
* writers write.
*/
- if (tex->hiz.bo) {
+ if (ilo_texture_can_enable_hiz(tex, level, first_slice, num_slices)) {
ilo_blit_resolve_slices_for_hiz(ilo, res, level,
first_slice, num_slices, flags);
}
diff --git a/src/gallium/drivers/ilo/ilo_blitter_rectlist.c b/src/gallium/drivers/ilo/ilo_blitter_rectlist.c
index 6314c35..015cfa4 100644
--- a/src/gallium/drivers/ilo/ilo_blitter_rectlist.c
+++ b/src/gallium/drivers/ilo/ilo_blitter_rectlist.c
@@ -382,7 +382,9 @@ ilo_blitter_rectlist_clear_zs(struct ilo_blitter *blitter,
struct pipe_depth_stencil_alpha_state dsa_state;
uint32_t uses;
- if (!tex->hiz.bo)
+ if (!ilo_texture_can_enable_hiz(tex,
+ zs->u.tex.level, zs->u.tex.first_layer,
+ zs->u.tex.last_layer - zs->u.tex.first_layer + 1))
return false;
if (!hiz_can_clear_zs(blitter, tex))
@@ -464,7 +466,7 @@ ilo_blitter_rectlist_resolve_z(struct ilo_blitter *blitter,
struct ilo_texture *tex = ilo_texture(res);
struct pipe_depth_stencil_alpha_state dsa_state;
- if (!tex->hiz.bo)
+ if (!ilo_texture_can_enable_hiz(tex, level, slice, 1))
return;
/*
@@ -499,7 +501,7 @@ ilo_blitter_rectlist_resolve_hiz(struct ilo_blitter *blitter,
struct ilo_texture *tex = ilo_texture(res);
struct pipe_depth_stencil_alpha_state dsa_state;
- if (!tex->hiz.bo)
+ if (!ilo_texture_can_enable_hiz(tex, level, slice, 1))
return;
/*
diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen6.c b/src/gallium/drivers/ilo/ilo_gpe_gen6.c
index 1351e19..b395727 100644
--- a/src/gallium/drivers/ilo/ilo_gpe_gen6.c
+++ b/src/gallium/drivers/ilo/ilo_gpe_gen6.c
@@ -1020,7 +1020,8 @@ zs_init_info(const struct ilo_dev_info *dev,
* same value (enabled or disabled) as Hierarchical Depth Buffer
* Enable."
*/
- separate_stencil = (tex->hiz.bo != NULL);
+ separate_stencil =
+ ilo_texture_can_enable_hiz(tex, level, first_layer, num_layers);
}
/*
@@ -1109,7 +1110,7 @@ zs_init_info(const struct ilo_dev_info *dev,
}
}
- if (tex->hiz.bo) {
+ if (ilo_texture_can_enable_hiz(tex, level, first_layer, num_layers)) {
info->hiz.bo = tex->hiz.bo;
info->hiz.stride = tex->hiz.bo_stride;
info->hiz.tiling = INTEL_TILING_Y;
diff --git a/src/gallium/drivers/ilo/ilo_resource.h b/src/gallium/drivers/ilo/ilo_resource.h
index afb49ff..125535a 100644
--- a/src/gallium/drivers/ilo/ilo_resource.h
+++ b/src/gallium/drivers/ilo/ilo_resource.h
@@ -157,4 +157,11 @@ ilo_texture_set_slice_flags(struct ilo_texture *tex, unsigned level,
}
}
+static inline bool
+ilo_texture_can_enable_hiz(const struct ilo_texture *tex, unsigned level,
+ unsigned first_slice, unsigned num_slices)
+{
+ return (tex->hiz.bo != NULL);
+}
+
#endif /* ILO_RESOURCE_H */
More information about the mesa-commit
mailing list