On Fri, Nov 21, 2014 at 3:09 PM, Jordan Justen <jordan.l.jus...@intel.com> wrote: > We now skip allocating a hiz miptree for gen8. Instead, we calculate > the required hiz buffer parameters and allocate a bo directly. > > v2: > * Update hz_height calculation as suggested by Topi > v3: > * Bail if we failed to create the bo (Ben) > > Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com> > Reviewed-by: Topi Pohjolainen <topi.pohjolai...@intel.com> > --- > src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 100 > ++++++++++++++++++++++++++ > 1 file changed, 100 insertions(+) > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > index e6ee8d7..c62b0b8 100644 > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > @@ -1497,6 +1497,104 @@ intel_gen7_hiz_buf_create(struct brw_context *brw, > } > > > +/** > + * Helper for intel_miptree_alloc_hiz() that determines the required hiz > + * buffer dimensions and allocates a bo for the hiz buffer. > + */ > +static struct intel_miptree_aux_buffer * > +intel_gen8_hiz_buf_create(struct brw_context *brw, > + struct intel_mipmap_tree *mt) > +{ > + unsigned z_width = mt->logical_width0; > + unsigned z_height = mt->logical_height0; > + const unsigned z_depth = mt->logical_depth0; > + unsigned hz_width, hz_height; > + struct intel_miptree_aux_buffer *buf = calloc(sizeof(*buf), 1); > + > + if (!buf) > + return NULL; > + > + /* Gen7 PRM Volume 2, Part 1, 11.5.3 "Hierarchical Depth Buffer" documents > + * adjustments required for Z_Height and Z_Width based on multisampling. > + */ > + switch (mt->num_samples) { > + case 0: > + case 1: > + break; > + case 2: > + case 4: > + z_width *= 2; > + z_height *= 2; > + break; > + case 8: > + z_width *= 4; > + z_height *= 2; > + break; > + default: > + assert(!"Unsupported sample count!");
Use unreachable(). _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev