x1 = depth.width;
y1 = depth.height;
- assert(mt->hiz_mt != NULL);
+ assert(intel_miptree_slice_has_hiz(mt, level, layer));
switch (mt->format) {
case MESA_FORMAT_Z16: depth_format = BRW_DEPTHFORMAT_D16_UNORM; break;
if (intel->gen < 6)
return false;
- if (!mt->hiz_mt)
+ if (!intel_renderbuffer_has_hiz(depth_irb))
return false;
/* We only handle full buffer clears -- otherwise you'd have to track whether
uint32_t depth_offset, uint32_t depthbuffer_format,
uint32_t depth_surface_type,
struct intel_mipmap_tree *stencil_mt,
- struct intel_mipmap_tree *hiz_mt,
- bool separate_stencil, uint32_t width,
- uint32_t height, uint32_t tile_x, uint32_t tile_y);
+ bool hiz, bool separate_stencil,
+ uint32_t width, uint32_t height,
+ uint32_t tile_x, uint32_t tile_y);
void
gen7_emit_depth_stencil_hiz(struct brw_context *brw,
uint32_t depth_offset, uint32_t depthbuffer_format,
uint32_t depth_surface_type,
struct intel_mipmap_tree *stencil_mt,
- struct intel_mipmap_tree *hiz_mt,
- bool separate_stencil, uint32_t width,
- uint32_t height, uint32_t tile_x, uint32_t tile_y);
+ bool hiz, bool separate_stencil,
+ uint32_t width, uint32_t height,
+ uint32_t tile_x, uint32_t tile_y);
#ifdef __cplusplus
}
intel_region_get_tile_masks(depth_mt->region,
&tile_mask_x, &tile_mask_y, false);
- struct intel_mipmap_tree *hiz_mt = depth_mt->hiz_mt;
- if (hiz_mt) {
+ if (intel_miptree_slice_has_hiz(depth_mt, depth_level, depth_layer)) {
uint32_t hiz_tile_mask_x, hiz_tile_mask_y;
- intel_region_get_tile_masks(hiz_mt->region,
+ intel_region_get_tile_masks(depth_mt->hiz_mt->region,
&hiz_tile_mask_x, &hiz_tile_mask_y, false);
/* Each HiZ row represents 2 rows of pixels */
depth_irb->draw_x & ~tile_mask_x,
depth_irb->draw_y & ~tile_mask_y,
false);
- if (depth_mt->hiz_mt) {
+ if (intel_renderbuffer_has_hiz(depth_irb)) {
brw->depthstencil.hiz_mt = depth_mt->hiz_mt;
brw->depthstencil.hiz_offset =
intel_region_get_aligned_offset(depth_mt->region,
struct intel_renderbuffer *stencil_irb = intel_get_renderbuffer(fb, BUFFER_STENCIL);
struct intel_mipmap_tree *depth_mt = brw->depthstencil.depth_mt;
struct intel_mipmap_tree *stencil_mt = brw->depthstencil.stencil_mt;
- struct intel_mipmap_tree *hiz_mt = brw->depthstencil.hiz_mt;
uint32_t tile_x = brw->depthstencil.tile_x;
uint32_t tile_y = brw->depthstencil.tile_y;
+ bool hiz = depth_irb && intel_renderbuffer_has_hiz(depth_irb);
bool separate_stencil = false;
uint32_t depth_surface_type = BRW_SURFACE_NULL;
uint32_t depthbuffer_format = BRW_DEPTHFORMAT_D32_FLOAT;
* set to the same value. Gens after 7 implicitly always set
* Separate_Stencil_Enable; software cannot disable it.
*/
- if ((intel->gen < 7 && depth_mt->hiz_mt) || intel->gen >= 7) {
+ if ((intel->gen < 7 && hiz) || intel->gen >= 7) {
assert(!_mesa_is_format_packed_depth_stencil(depth_mt->format));
}
/* Prior to Gen7, if using separate stencil, hiz must be enabled. */
- assert(intel->gen >= 7 || !separate_stencil || hiz_mt);
+ assert(intel->gen >= 7 || !separate_stencil || hiz);
assert(intel->gen < 6 || region->tiling == I915_TILING_Y);
- assert(!hiz_mt || region->tiling == I915_TILING_Y);
+ assert(!hiz || region->tiling == I915_TILING_Y);
depthbuffer_format = brw_depthbuffer_format(brw);
depth_surface_type = BRW_SURFACE_2D;
intel->vtbl.emit_depth_stencil_hiz(brw, depth_mt, depth_offset,
depthbuffer_format, depth_surface_type,
- stencil_mt, hiz_mt, separate_stencil,
+ stencil_mt, hiz, separate_stencil,
width, height, tile_x, tile_y);
}
uint32_t depth_offset, uint32_t depthbuffer_format,
uint32_t depth_surface_type,
struct intel_mipmap_tree *stencil_mt,
- struct intel_mipmap_tree *hiz_mt,
- bool separate_stencil, uint32_t width,
- uint32_t height, uint32_t tile_x, uint32_t tile_y)
+ bool hiz, bool separate_stencil,
+ uint32_t width, uint32_t height,
+ uint32_t tile_x, uint32_t tile_y)
{
struct intel_context *intel = &brw->intel;
* [DevGT]: This field must be set to the same value (enabled or
* disabled) as Hierarchical Depth Buffer Enable
*/
- bool enable_hiz_ss = hiz_mt || separate_stencil;
+ bool enable_hiz_ss = hiz || separate_stencil;
/* 3DSTATE_DEPTH_BUFFER, 3DSTATE_STENCIL_BUFFER are both
ADVANCE_BATCH();
- if (hiz_mt || separate_stencil) {
+ if (hiz || separate_stencil) {
/*
* In the 3DSTATE_DEPTH_BUFFER batch emitted above, the 'separate
* stencil enable' and 'hiz enable' bits were set. Therefore we must
*/
/* Emit hiz buffer. */
- if (hiz_mt) {
+ if (hiz) {
+ struct intel_mipmap_tree *hiz_mt = depth_mt->hiz_mt;
BEGIN_BATCH(3);
OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER << 16) | (3 - 2));
OUT_BATCH(hiz_mt->region->pitch - 1);
* 3DSTATE_CLEAR_PARAMS packet must follow the DEPTH_BUFFER_STATE packet
* when HiZ is enabled and the DEPTH_BUFFER_STATE changes.
*/
- if (intel->gen >= 6 || hiz_mt) {
+ if (intel->gen >= 6 || hiz) {
if (intel->gen == 6)
intel_emit_post_sync_nonzero_flush(intel);
uint32_t depth_offset, uint32_t depthbuffer_format,
uint32_t depth_surface_type,
struct intel_mipmap_tree *stencil_mt,
- struct intel_mipmap_tree *hiz_mt,
- bool separate_stencil, uint32_t width,
- uint32_t height, uint32_t tile_x, uint32_t tile_y)
+ bool hiz, bool separate_stencil,
+ uint32_t width, uint32_t height,
+ uint32_t tile_x, uint32_t tile_y)
{
struct intel_context *intel = &brw->intel;
struct gl_context *ctx = &intel->ctx;
OUT_BATCH(GEN7_3DSTATE_DEPTH_BUFFER << 16 | (7 - 2));
OUT_BATCH((depth_mt ? depth_mt->region->pitch - 1 : 0) |
(depthbuffer_format << 18) |
- ((hiz_mt ? 1 : 0) << 22) |
+ ((hiz ? 1 : 0) << 22) |
((stencil_mt != NULL && ctx->Stencil._WriteEnabled) << 27) |
((ctx->Depth.Mask != 0) << 28) |
(depth_surface_type << 29));
OUT_BATCH(0);
ADVANCE_BATCH();
- if (hiz_mt == NULL) {
+ if (!hiz) {
BEGIN_BATCH(3);
OUT_BATCH(GEN7_3DSTATE_HIER_DEPTH_BUFFER << 16 | (3 - 2));
OUT_BATCH(0);
OUT_BATCH(0);
ADVANCE_BATCH();
} else {
+ struct intel_mipmap_tree *hiz_mt = depth_mt->hiz_mt;
BEGIN_BATCH(3);
OUT_BATCH(GEN7_3DSTATE_HIER_DEPTH_BUFFER << 16 | (3 - 2));
OUT_BATCH(hiz_mt->region->pitch - 1);
uint32_t depthbuffer_format,
uint32_t depth_surface_type,
struct intel_mipmap_tree *stencil_mt,
- struct intel_mipmap_tree *hiz_mt,
- bool separate_stencil,
+ bool hiz, bool separate_stencil,
uint32_t width, uint32_t height,
uint32_t tile_x, uint32_t tile_y);
intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
{
struct intel_context *intel = intel_context(ctx);
- const struct intel_renderbuffer *depthRb =
+ struct intel_renderbuffer *depthRb =
intel_get_renderbuffer(fb, BUFFER_DEPTH);
- const struct intel_renderbuffer *stencilRb =
+ struct intel_renderbuffer *stencilRb =
intel_get_renderbuffer(fb, BUFFER_STENCIL);
struct intel_mipmap_tree *depth_mt = NULL, *stencil_mt = NULL;
int i;
_mesa_get_format_name(stencil_mt->format));
fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
}
- if (intel->gen < 7 && depth_mt->hiz_mt == NULL) {
+ if (intel->gen < 7 && !intel_renderbuffer_has_hiz(depthRb)) {
/* Before Gen7, separate depth and stencil buffers can be used
* only if HiZ is enabled. From the Sandybridge PRM, Volume 2,
* Part 1, Bit 3DSTATE_DEPTH_BUFFER.SeparateStencilBufferEnable:
uint32_t level,
uint32_t layer)
{
- intel_miptree_check_level_layer(mt, level, layer);
-
- if (!mt->hiz_mt)
+ if (!intel_miptree_slice_has_hiz(mt, level, layer))
return;
intel_resolve_map_set(&mt->hiz_map,
uint32_t level,
uint32_t layer)
{
- intel_miptree_check_level_layer(mt, level, layer);
-
- if (!mt->hiz_mt)
+ if (!intel_miptree_slice_has_hiz(mt, level, layer))
return;
intel_resolve_map_set(&mt->hiz_map,