if (intel && irb->region) {
intel_region_release(&irb->region);
}
+ if (intel && irb->hiz_region) {
+ intel_region_release(&irb->hiz_region);
+ }
free(irb);
}
if (irb->region) {
intel_region_release(&irb->region);
}
+ if (irb->hiz_region) {
+ intel_region_release(&irb->hiz_region);
+ }
/* allocate new memory region/renderbuffer */
ASSERT(irb->region->buffer);
+ if (intel->vtbl.is_hiz_depth_format(intel, rb->Format)) {
+ irb->hiz_region = intel_region_alloc(intel->intelScreen,
+ I915_TILING_Y,
+ irb->region->cpp,
+ irb->region->width,
+ irb->region->height,
+ GL_TRUE);
+ if (!irb->hiz_region) {
+ intel_region_release(&irb->region);
+ return GL_FALSE;
+ }
+ }
+
rb->Width = width;
rb->Height = height;
#ifndef INTEL_FBO_H
#define INTEL_FBO_H
+#include <stdbool.h>
#include "main/formats.h"
#include "intel_screen.h"
{
struct gl_renderbuffer Base;
struct intel_region *region;
+
+ /** Only used by depth renderbuffers for which HiZ is enabled. */
+ struct intel_region *hiz_region;
};
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_framebuffer_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;
+}
+
+static INLINE bool
+intel_framebuffer_has_hiz(struct gl_framebuffer *fb)
+{
+ return intel_framebuffer_get_hiz_region(fb) != NULL;
+}
+
extern void
intel_renderbuffer_set_region(struct intel_context *intel,