<div dir="ltr">On 11 June 2013 16:11, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>Paul Berry <<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>> writes:<br>
<br>
> +/**<br>
> + * Determine if fast color clear supports the given clear color.<br>
> + *<br>
> + * Fast color clear can only clear to color values of 1.0 or 0.0.  At the<br>
> + * moment we only support floating point buffers.<br>
<br>
</div>floating point, unorm, or snorm buffers, right?<br></blockquote><div><br></div><div>You're right.  I'll fix the comment.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div><br>
> diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c<br>
> index a75ac81..ba941c0 100644<br>
> --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c<br>
> +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c<br>
> @@ -1201,6 +1201,54 @@ intel_miptree_alloc_mcs(struct intel_context *intel,<br>
>  #endif<br>
>  }<br>
><br>
> +<br>
> +bool<br>
> +intel_miptree_alloc_non_msrt_mcs(struct intel_context *intel,<br>
> +                                 struct intel_mipmap_tree *mt)<br>
> +{<br>
> +#ifdef I915<br>
> +   assert(!"MCS not supported on i915");<br>
> +   return false;<br>
> +#else<br>
> +   assert(mt->mcs_mt == NULL);<br>
> +<br>
> +   /* The format of the MCS buffer is opaque to the driver; all that matters<br>
> +    * is that we get its size and pitch right.  We'll pretend that the format<br>
> +    * is R32.  Since an MCS tile covers 128 blocks horizontally, and a Y-tiled<br>
> +    * R32 buffer is 32 pixels across, we'll need to scale the width down by<br>
> +    * the block width and then a further factor of 4.  Since an MCS tile<br>
> +    * covers 256 blocks vertically, and a Y-tiled R32 buffer is 32 rows high,<br>
> +    * we'll need to scale the height down by the block height and then a<br>
> +    * further factor of 8.<br>
> +    */<br>
> +   const gl_format format = MESA_FORMAT_R_UINT32;<br>
> +   unsigned block_width_px;<br>
> +   unsigned block_height;<br>
> +   intel_get_non_msrt_mcs_alignment(intel, mt, &block_width_px, &block_height);<br>
> +   unsigned width_divisor = block_width_px * 4;<br>
> +   unsigned height_divisor = block_height * 8;<br>
> +   unsigned mcs_width =<br>
> +      ALIGN(mt->logical_width0, width_divisor) / width_divisor;<br>
> +   unsigned mcs_height =<br>
> +      ALIGN(mt->logical_height0, height_divisor) / height_divisor;<br>
> +   assert(mt->logical_depth0 == 1);<br>
> +   mt->mcs_mt = intel_miptree_create(intel,<br>
> +                                     mt->target,<br>
> +                                     format,<br>
> +                                     mt->first_level,<br>
> +                                     mt->last_level,<br>
> +                                     mcs_width,<br>
> +                                     mcs_height,<br>
> +                                     mt->logical_depth0,<br>
> +                                     true,<br>
> +                                     0 /* num_samples */,<br>
> +                                     INTEL_MIPTREE_TILING_Y);<br>
> +<br>
> +   return mt->mcs_mt;<br>
> +#endif<br>
<br>
</div></div>Does this actually create an appropriate miptree?  Don't you need<br>
something that has the smaller levels' sizes also aligned to<br>
width_divisor and height_divisor?<br>
</blockquote></div><br></div><div class="gmail_extra">The hardware only supports fast color clear on non-mipmapped non-array surfaces, so it doesn't matter.<br></div></div>