OSDN Git Service

i965: Drop the maximum 3D texture size to 512 on Sandy Bridge
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 9 Jun 2016 21:57:33 +0000 (14:57 -0700)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 24 Jun 2016 19:28:06 +0000 (20:28 +0100)
The RenderTargetViewExtent field of RENDER_SURFACE_STATE is supposed to be
set to the depth of a 3-D texture when rendering.  Unfortunatley, that
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.  On Iron
Lake and prior, we don't support layered rendering and we use OffsetX/Y
hacks to render to particular layers so 2048 is ok there too.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "11.1 11.2 12.0" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 6ba88bce64b343761aabe3a6c7ee285c6020a959)

src/mesa/drivers/dri/i965/brw_context.c

index 8aec819..0da0608 100644 (file)
@@ -467,7 +467,16 @@ 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 */
+
+   /* On Sandy Bridge and prior, the "Render Target View Extent" field of
+    * RENDER_SURFACE_STATE is only 9 bits so the largest 3-D texture we can do
+    * a layered render into has a depth of 512.  On Iron Lake and earlier, we
+    * don't support layered rendering and we use manual offsetting to render
+    * into the different layers so this doesn't matter.  On Sandy Bridge,
+    * however, we do support layered rendering so this is a problem.
+    */
+   ctx->Const.Max3DTextureLevels = brw->gen == 6 ? 10 /* 512 */ : 12; /* 2048 */
+
    ctx->Const.MaxCubeTextureLevels = 14; /* 8192 */
    ctx->Const.MaxArrayTextureLayers = brw->gen >= 7 ? 2048 : 512;
    ctx->Const.MaxTextureMbytes = 1536;