[Mesa-dev] [PATCH 2/2] i965: Avoid unnecessary copy when depthstencil workaround invoked by clear.

Eric Anholt eric at anholt.net
Thu Mar 14 12:38:55 PDT 2013


Paul Berry <stereotype441 at gmail.com> writes:

> On 12 March 2013 16:33, Eric Anholt <eric at anholt.net> wrote:
>
>> Paul Berry <stereotype441 at gmail.com> writes:
>> >  void
>> > -brw_workaround_depthstencil_alignment(struct brw_context *brw)
>> > +brw_workaround_depthstencil_alignment(struct brw_context *brw,
>> > +                                      GLbitfield clear_mask)
>> >  {
>> >     struct intel_context *intel = &brw->intel;
>> >     struct gl_context *ctx = &intel->ctx;
>> > @@ -341,10 +343,24 @@ brw_workaround_depthstencil_alignment(struct
>> brw_context *brw)
>> >     struct intel_mipmap_tree *stencil_mt =
>> get_stencil_miptree(stencil_irb);
>> >     uint32_t tile_x = 0, tile_y = 0, stencil_tile_x = 0, stencil_tile_y
>> = 0;
>> >     uint32_t stencil_draw_x = 0, stencil_draw_y = 0;
>> > +   bool invalidate_depth = clear_mask & GL_DEPTH_BUFFER_BIT;
>> > +   bool invalidate_stencil = clear_mask & GL_STENCIL_BUFFER_BIT;
>> >
>> >     if (depth_irb)
>> >        depth_mt = depth_irb->mt;
>> >
>> > +   if (depth_irb && invalidate_depth
>> > +       && _mesa_is_depthstencil_format(
>> > +              _mesa_get_format_base_format(depth_mt->format))
>> > +       && !depth_mt->stencil_mt) {
>>
>> The only _mesa_is_depthstencil_format() returned by
>> _mesa_get_format_base_format() is GL_DEPTH_STENCIL, so calling that
>> seems kinda overkill.
>>
>
> Good point.  I'll fix that before pushing.  I'll also make a follow-up
> patch to fix the function I borrowed this test from
> (intel_miptree_create_layout).
>
>
>>
>> If depth_mt->stencil_mt, then depth_mt->format's base format will not be
>> GL_DEPTH_STENCIL.  I'm concerned that you're going to lose the
>> depth_mt->stencil_mt contents of a gl-level packed depth/stencil texture
>> that's backed by separate stencil.

For a separate stencil packed depth/stencil texture, mt->format will be,
for example, Z24X8, and mt->stencil_mt->format will be S8 -- see the
intel_mipmap_tree.h comment for the format field.

> I think you inverted your logic there (if depth_mt->stencil_mt, then
> depth_mt->format's base format *will* be GL_DEPTH_STENCIL).  Am I correct
> in inferring that the cases you're worried about are cases like:
>
> - Client creates a GL_DEPTH_STENCIL texture on a platform such as Gen7 that
> uses separate stencil
> - Client executes a glClear(GL_DEPTH_BIT) on a miplevel that needs the
> workaround, expecting stencil data to be preserved

Yep.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130314/9d6e4e52/attachment.pgp>


More information about the mesa-dev mailing list