[Mesa-stable] [Mesa-dev] [PATCH 01/64] i965: Drop Max3DTextureLevels to 512 on Sandy Bridge and prior

Ian Romanick idr at freedesktop.org
Thu Jun 16 19:40:28 UTC 2016


On 06/16/2016 11:50 AM, Jason Ekstrand wrote:
> 
> 
> On Thu, Jun 16, 2016 at 11:43 AM, Ian Romanick <idr at freedesktop.org
> <mailto:idr at freedesktop.org>> wrote:
> 
>     On 06/11/2016 09:02 AM, Jason Ekstrand wrote:
>     > The RenderTargetViewExtent field of RENDER_SURFACE_STATE is supposed to be
>     > set to the depth of a 3-D texture when rendering.  Unfortunatley, that
>                                                          Unfortunately
> 
>     > field is only 9 bits on Sandy Bridge and prior so we can't actually bind
>     > a 3-D texturing for rendering if it has depth > 512.  On Ivy Bridge, this
>     > field was bumpped to 11 bits so we can go all the way up to 2048.
>                 bumped
> 
>     > Cc: "11.1 11.2 12.0" <mesa-stable at lists.freedesktop.org
>     <mailto:mesa-stable at lists.freedesktop.org>>
>     > ---
>     >  src/mesa/drivers/dri/i965/brw_context.c | 5 ++++-
>     >  1 file changed, 4 insertions(+), 1 deletion(-)
>     >
>     > diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
>     > index 7bbc128..3b11bef 100644
>     > --- a/src/mesa/drivers/dri/i965/brw_context.c
>     > +++ b/src/mesa/drivers/dri/i965/brw_context.c
>     > @@ -467,7 +467,10 @@ brw_initialize_context_constants(struct brw_context *brw)
>     >     ctx->Const.MaxImageUnits = MAX_IMAGE_UNITS;
>     >     ctx->Const.MaxRenderbufferSize = 8192;
>     >     ctx->Const.MaxTextureLevels = MIN2(14 /* 8192 */, MAX_TEXTURE_LEVELS);
>     > -   ctx->Const.Max3DTextureLevels = 12; /* 2048 */
>     > +   if (brw->gen >= 7)
>     > +      ctx->Const.Max3DTextureLevels = 12; /* 2048 */
>     > +   else
>     > +      ctx->Const.Max3DTextureLevels = 10; /* 512 */
> 
>     This should use ?: like MaxArrayTextureLayers below.
> 
>     This was increased from 512 to 2048 in 2014 in commit 06b047eb.  There
>     was some assertion in the commit message that the Windows driver was
>     already advertising 2048.  There is no mention, however, of which
>     hardware the Windows driver was checked on.  In the related bug report
>     (https://bugs.freedesktop.org/show_bug.cgi?id=74130), Ken says, "All
>     Gen4+ systems support 2048x2048 3D textures, so we could just bump the
>     limit."
> 
>     It sounds like this may be a temporary fix, and we need a work around
>     for rendering to slices > 9?
> 
> It's a bit more subtle than that, I'm afraid.  The current gen4 render
> target setup code (which isn't used on SNB) can handle rendering to any
> layer of a 3-D texture regardless of size and SNB could be fixed up to
> do the same.  The problem is when you use layered rendering.  When doing
> layered rendering, we can only access at most 512 layers.  This means
> that we need to either limit the texture size or we need to give the
> user an incomplete framebuffer if they try and do layered rendering on a
> 3-D texture with more than 512 slices.  That's kind-of a nasty edge for
> applications to hit.

Oh yuck.  It is mean to give a spurious incomplete framebuffer, but
reducing a limit can make a previously working app fail... also mean.
I think there's a less-mean plan possible.  I believe these are the
facts:

 * Gen4 and Gen5 don't have layered rendering, so Max3DTextureLevels =
   12 should "just work" there.

 * According to http://feedback.wildfiregames.com/report/opengl/device/Intel%28R%29%20HD%20Graphics%203000,
   the Windows driver only supports OpenGL 3.1, so they never had the
   layered rendering issue.  They also advertise 2048 starting with
   driver version 9.17.10.2792.

 * In OpenGL ES and OpenGL Compatibility profile, there is no way to do
   layered rendering on SNB with our driver.

 * With a bit of work, we could handle 2048 on SNB for all non-layered
   rendering cases.

Assuming that's all correct, how about if we change the current patch to

   ctx->Const.Max3DTextureLevels = brw->gen == 6 ? 9 /* 512 */ : 12 /* 2048 */;

and add a release note.

For 12.next let's plan to do Gen4-style layer offsetting for SNB.  Then
change the limit setting code to

   ctx->Const.Max3DTextureLevels = brw->gen == 6 && ctx->API == API_OPENGL_CORE
      ? 9 /* 512 */ : 12 /* 2048 */;

We can also add a driconf option to force 2048.

A "patches welcome" follow-up would be to implement
GL_NV_deep_texture3D to expose width or height of 2048 with depth
limited to 512.

> --Jason
> 
>     >     ctx->Const.MaxCubeTextureLevels = 14; /* 8192 */
>     >     ctx->Const.MaxArrayTextureLayers = brw->gen >= 7 ? 2048 : 512;
>     >     ctx->Const.MaxTextureMbytes = 1536;
>     >



More information about the mesa-stable mailing list