st/mesa: set the MaxVarying GLSL constant
authorMarek Olšák <maraeo@gmail.com>
Wed, 25 Aug 2010 03:25:41 +0000 (05:25 +0200)
committerMarek Olšák <maraeo@gmail.com>
Mon, 30 Aug 2010 11:27:36 +0000 (13:27 +0200)
src/mesa/state_tracker/st_extensions.c

index 90e78679e472c20101d6df14014cceab1f46db77..6cd74db897b34ad1c82804a2d9429ee2ecfd1a19 100644 (file)
@@ -161,6 +161,13 @@ void st_init_limits(struct st_context *st)
    pc->MaxNativeTemps           = screen->get_param(screen, PIPE_CAP_MAX_VS_TEMPS);
    pc->MaxNativeAddressRegs     = screen->get_param(screen, PIPE_CAP_MAX_VS_ADDRS);
    pc->MaxNativeParameters      = screen->get_param(screen, PIPE_CAP_MAX_VS_CONSTS);
+
+   /* PIPE_CAP_MAX_FS_INPUTS specifies the number of COLORn + GENERICn inputs
+    * and is set in MaxNativeAttribs. It's always 2 colors + N generic
+    * attributes. The GLSL compiler never uses COLORn for varyings, so we
+    * subtract the 2 colors to get the maximum number of varyings (generic
+    * attributes) supported by a driver. */
+   c->MaxVarying = screen->get_param(screen, PIPE_CAP_MAX_FS_INPUTS) - 2;
 }