[Mesa-dev] [PATCH V2 17/22] i965: Add layer_count to intel_renderbuffer
Chris Forbes
chrisf at ijw.co.nz
Fri Feb 21 12:48:18 PST 2014
This is the effective layer count, for clears etc. This differs from the
depth of the miptree level when views are involved.
Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
src/mesa/drivers/dri/i965/intel_fbo.c | 10 ++++++++++
src/mesa/drivers/dri/i965/intel_fbo.h | 3 +++
2 files changed, 13 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index efdffe1..cb37fea 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -317,6 +317,8 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer
if (!irb->mt)
return false;
+ irb->layer_count = 1;
+
return true;
}
@@ -381,6 +383,7 @@ intel_image_target_renderbuffer_storage(struct gl_context *ctx,
rb->Format = image->format;
rb->_BaseFormat = _mesa_base_fbo_format(ctx, image->internal_format);
rb->NeedsFinishRenderTexture = true;
+ irb->layer_count = 1;
}
/**
@@ -433,6 +436,7 @@ intel_create_renderbuffer(mesa_format format, unsigned num_samples)
}
rb = &irb->Base.Base;
+ irb->layer_count = 1;
_mesa_init_renderbuffer(rb, 0);
rb->ClassID = INTEL_RB_CLASS;
@@ -530,6 +534,12 @@ intel_renderbuffer_update_wrapper(struct brw_context *brw,
irb->mt_layer = layer_multiplier * layer;
+ if (layered) {
+ irb->layer_count = image->TexObject->NumLayers ?: mt->level[level].depth / layer_multiplier;
+ } else {
+ irb->layer_count = 1;
+ }
+
intel_miptree_reference(&irb->mt, mt);
intel_renderbuffer_set_draw_offset(irb);
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.h b/src/mesa/drivers/dri/i965/intel_fbo.h
index b8db7e2..6c761e6 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.h
+++ b/src/mesa/drivers/dri/i965/intel_fbo.h
@@ -90,6 +90,9 @@ struct intel_renderbuffer
*/
unsigned int mt_level;
unsigned int mt_layer;
+
+ /* The number of attached logical layers. */
+ unsigned int layer_count;
/** \} */
GLuint draw_x, draw_y; /**< Offset of drawing within the region */
--
1.9.0
More information about the mesa-dev
mailing list