[Mesa-dev] [PATCH 05/12] intel: Add HiZ region to intel_renderbuffer

chad at chad-versace.us chad at chad-versace.us
Fri Apr 29 18:04:55 PDT 2011


From: Chad Versace <chad.versace at intel.com>

When rendering to a depth buffer when HiZ is enabled, a GEM region must be
allocated just for HiZ. There are two potential ways to do this:
  1. Allocate a separate HiZ region.
  2. Allocate a larger depth region, and let the tail be the HiZ region.

Method 1 is chosen because, in the future, it will make lazy resolves
easier to implement.

Signed-off-by: Chad Versace <chad.versace at intel.com>
---
 src/mesa/drivers/dri/intel/intel_fbo.h |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h
index 028f657..4c94dba 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.h
+++ b/src/mesa/drivers/dri/intel/intel_fbo.h
@@ -40,6 +40,9 @@ struct intel_renderbuffer
 {
    struct gl_renderbuffer Base;
    struct intel_region *region;
+
+   /** Only used by depth renderbuffers for which HiZ is enabled. */
+   struct intel_region *hiz_region;
 };
 
 
@@ -80,6 +83,23 @@ intel_get_renderbuffer(struct gl_framebuffer *fb, int attIndex)
       return NULL;
 }
 
+/**
+ * If the framebuffer has a depth buffer attached, then return its HiZ region.
+ * The HiZ region may be null.
+ */
+static INLINE struct intel_region*
+intel_get_hiz_region(struct gl_framebuffer *fb)
+{
+   struct intel_renderbuffer *rb = NULL;
+   if (fb)
+      rb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
+
+   if (rb)
+      return rb->hiz_region;
+   else
+      return NULL;
+}
+
 
 extern void
 intel_renderbuffer_set_region(struct intel_context *intel,
-- 
1.7.4.2



More information about the mesa-dev mailing list