[Mesa-dev] [PATCH 3/7] i965: Refactor brw_is_hiz_depth_format()
Chad Versace
chad.versace at intel.com
Mon Apr 13 07:36:06 PDT 2015
On Fri 10 Apr 2015, Pohjolainen, Topi wrote:
>On Thu, Apr 09, 2015 at 08:57:04PM -0700, Chad Versace wrote:
>> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> index a906460..492338b 100644
>> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> @@ -403,7 +403,8 @@ intel_miptree_create_layout(struct brw_context *brw,
>> if (!for_bo &&
>> _mesa_get_format_base_format(format) == GL_DEPTH_STENCIL &&
>> (brw->must_use_separate_stencil ||
>> - (brw->has_separate_stencil && brw_is_hiz_depth_format(brw, format)))) {
>> + (brw->has_separate_stencil &&
>> + intel_miptree_wants_hiz_buffer(brw, mt)))) {
>
>I had to check that format == mt->format, and indeed that is the case. I
>noticed that we probably want to make intel_miptree_create_layout() a little
>more consistent - it uses randomly both the stack variable and the one in
>miptree.
I agree. For large functions like intel_miptree_create_layout(), I like
to group together all assignments to the struct at the bottom of the
function, and use stack variables until then. Otherwise, it's too easy
to accidentally use an unitialized struct field in the middle of the
function.
More information about the mesa-dev
mailing list