[Mesa-dev] [PATCH 3/8] i965: Faking the ETC2 compression on Gen < 8 GPUs using two miptrees.

Nanley Chery nanleychery at gmail.com
Mon Jan 28 19:50:27 UTC 2019


On Sat, Jan 26, 2019 at 05:22:06PM +0200, Eleni Maria Stea wrote:
> Hi Nanley,
> 
> On Fri, 18 Jan 2019 15:32:02 -0800
> Nanley Chery <nanleychery at gmail.com> wrote:
> 
> 
> > > diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> > > b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index
> > > e214fae140..4d1eafac91 100644 ---
> > > a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++
> > > b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -329,6
> [...]
> 
> > > @@ -474,6 +485,11 @@ static void brw_update_texture_surface(struct
> > > gl_context *ctx, struct intel_texture_object *intel_obj =
> > > intel_texture_object(obj); struct intel_mipmap_tree *mt =
> > > intel_obj->mt; 
> > > +      if (mt->needs_fake_etc) {
> > > +         assert(mt->shadow_mt);
> > > +         mt = mt->shadow_mt;
> > > +      }
> > > +
> > >        if (plane > 0) {
> > >           if (mt->plane[plane - 1] == NULL)
> > >              return;
> > > @@ -512,7 +528,7 @@ static void brw_update_texture_surface(struct
> > > gl_context *ctx,
> > >            * is safe because texture views aren't allowed on
> > > depth/stencil. */
> > >           mesa_fmt = mt->format;
> > > -      } else if (mt->etc_format != MESA_FORMAT_NONE) {
> > > +      } else if (intel_obj->mt->etc_format != MESA_FORMAT_NONE) {
> > >           mesa_fmt = mt->format;  
> > 
> > For uniformity, lets access mt->shadow_mt->format here and move the
> > mt->needs_fake_etc check from above to below this condition:
> > 
> > 	} else if (devinfo->gen <= 7 && mt->format ==
> > MESA_FORMAT_S_UINT8) {
> 
> I'd like to ask you one more question on this change: if I do the check
> for the fake etc later, the following code will run for the main
> miptree that contains the compressed data and has ETC2 format:
> 
> > >        if (plane > 0) {
> > >           if (mt->plane[plane - 1] == NULL)
> > >              return;
> > > @@ -512,7 +528,7 @@ static void brw_update_texture_surface(struct
> > > gl_context *ctx,
> > >            * is safe because texture views aren't allowed on
> > > depth/stencil. */
> > >           mesa_fmt = mt->format;
> 
> Wouldn't this be a problem?
> 

These miptrees won't have more than one plane so this isn't a problem.

-Nanley

> Thank you in advance,
> Eleni
> 


More information about the mesa-dev mailing list