mesa: change MAX_PROGRAM_ADDRESS_REGS to 1, clamp to it in state tracker
authorBrian Paul <brianp@vmware.com>
Tue, 4 Jun 2013 16:51:15 +0000 (09:51 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 4 Jun 2013 19:29:38 +0000 (13:29 -0600)
We've never properly supported more than one address register.  There
isn't even a field in prog_src_register or prog_dst_register to indicate
which address register to use if RelAddr!=0.

In the state tracker, clamp MaxAddressRegs against MAX_PROGRAM_ADDRESS_REGS
since many gallium drivers do support more.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65226

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/mesa/main/config.h
src/mesa/state_tracker/st_extensions.c

index 4a4fdc98c1db1c93044db69982f22e1c42d84e3a..4855cc0dde6a0d13928cef7dd8cde863fcd8eed9 100644 (file)
 #define MAX_PROGRAM_MATRIX_STACK_DEPTH 4
 #define MAX_PROGRAM_CALL_DEPTH         8
 #define MAX_PROGRAM_TEMPS              256
-#define MAX_PROGRAM_ADDRESS_REGS       2
+#define MAX_PROGRAM_ADDRESS_REGS       1
 #define MAX_VARYING                    32    /**< number of float[4] vectors */
 #define MAX_SAMPLERS                   MAX_TEXTURE_IMAGE_UNITS
 #define MAX_PROGRAM_INPUTS             32
index 46acc87637894a2b73c59b5de7ce7953a94df3e4..ddae95639554ac6934d36176826243991dff75e6 100644 (file)
@@ -187,7 +187,8 @@ void st_init_limits(struct st_context *st)
       pc->MaxTemps           = pc->MaxNativeTemps           =
          screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEMPS);
       pc->MaxAddressRegs     = pc->MaxNativeAddressRegs     =
-         screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_ADDRS);
+         _min(screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_ADDRS),
+              MAX_PROGRAM_ADDRESS_REGS);
       pc->MaxParameters      = pc->MaxNativeParameters      =
          screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_CONSTS);