gallium: Disable varying packing on hardware with <=8 texture indirections.
authorPaul Berry <stereotype441@gmail.com>
Thu, 13 Dec 2012 20:45:54 +0000 (12:45 -0800)
committerPaul Berry <stereotype441@gmail.com>
Fri, 14 Dec 2012 18:51:10 +0000 (10:51 -0800)
In practice this will disable varying packing on R300, R400, i915g,
and nv30.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
src/mesa/state_tracker/st_extensions.c

index 726d86846a98b5ece09ed6c2ba0d2bcfe094e952..f3f01ebd5e4e18edf34c702bab3604fce3f78b24 100644 (file)
@@ -663,4 +663,18 @@ void st_init_extensions(struct st_context *st)
    }
    if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS))
       ctx->Extensions.ARB_texture_buffer_object = GL_TRUE;
+
+   /* Unpacking a varying in the fragment shader costs 1 texture indirection.
+    * If the number of available texture indirections is very limited, then we
+    * prefer to disable varying packing rather than run the risk of varying
+    * packing preventing a shader from running.
+    */
+   if (screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
+                                PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS) <= 8) {
+      /* We can't disable varying packing if transform feedback is available,
+       * because transform feedback code assumes a packed varying layout.
+       */
+      if (!ctx->Extensions.EXT_transform_feedback)
+         ctx->Const.DisableVaryingPacking = GL_TRUE;
+   }
 }