[Mesa-dev] [PATCH 10/19] intel: Add function intel_renderbuffer_hiz_alloc

Chad Versace chad at chad-versace.us
Tue Sep 27 09:27:43 PDT 2011


On 09/26/2011 02:19 PM, Eric Anholt wrote:
> On Fri, 23 Sep 2011 17:37:40 -0700, Chad Versace<chad at chad-versace.us>  wrote:
>> This function allocates the HiZ region and initializes the HiZ control
>> state for a depthbuffer.
>>
>> It is wise to define the logic for HiZ region allocation in a single
>> location, since when MSAA arrives that logic will become more complicated.
>>
>> Signed-off-by: Chad Versace<chad at chad-versace.us>
>> ---
>>   src/mesa/drivers/dri/intel/intel_fbo.c |   21 +++++++++++++++++++++
>>   src/mesa/drivers/dri/intel/intel_fbo.h |    8 ++++++++
>>   2 files changed, 29 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
>> index 0828af4..bf57e30 100644
>> --- a/src/mesa/drivers/dri/intel/intel_fbo.c
>> +++ b/src/mesa/drivers/dri/intel/intel_fbo.c
>> @@ -110,6 +110,27 @@ intel_framebuffer_get_hiz_region(struct gl_framebuffer *fb)
>>         return NULL;
>>   }
>>
>> +bool
>> +intel_renderbuffer_alloc_hiz(struct intel_context *intel,
>> +                             struct intel_renderbuffer *depth_irb)
>> +{
>> +   struct intel_region *depth_region = depth_irb->region;
>> +   struct intel_hiz_control *hiz =&depth_irb->region->hiz;
>> +
>> +   hiz->region = intel_region_alloc(intel->intelScreen,
>> +				    I915_TILING_Y,
>> +				    depth_region->cpp,
>> +				    depth_region->width,
>> +				    depth_region->height,
>> +				    GL_TRUE);
>> +   if (!hiz->region)
>> +      return false;
>> +
>> +   hiz->need_resolve = INTEL_HIZ_NEED_NO_RESOLVE;
>> +   hiz->depth_format = depth_irb->Base.Format;
>> +   return true;
>> +}
>
> So, if I allocate a new renderbuffer and do a glClear-equivalent (so
> Test enabled and Func == GL_ALWAYS) but not explicitly glClear, will the
> depth behavior be correct?  Basically: I'm wondering if there's any
> other state to be set up in hiz at alloc time.

I can't think of anything else.

struct intel_hiz_control is intended to contain the information
necessary to record 1) if a resolve op is necessary and 2) the information
needed to execute that op, given that the fundamental object we're tracking
is the depthbuffer's (or texture's) region. So, with that in mind, I can't
think of any other data we may need.

-- 
Chad Versace
chad at chad-versace.us


More information about the mesa-dev mailing list