nv20: set surface status in clear()
[mesa.git] / src / gallium / drivers / softpipe / sp_fs_exec.c
index 701ee4c72f2c538f59de3f1db6a61e9169a62a14..453b0373f0feffdf554b2c8fdfb3b3e5e695ba1f 100644 (file)
 #include "tgsi/tgsi_exec.h"
 #include "tgsi/tgsi_parse.h"
 
-struct sp_exec_fragment_shader {
+struct sp_exec_fragment_shader
+{
    struct sp_fragment_shader base;
 };
 
 
+/** cast wrapper */
+static INLINE struct sp_exec_fragment_shader *
+sp_exec_fragment_shader(const struct sp_fragment_shader *base)
+{
+   return (struct sp_exec_fragment_shader *) base;
+}
+
 
 /**
  * Compute quad X,Y,Z,W for the four fragments in a quad.
@@ -84,12 +92,18 @@ sp_setup_pos_vector(const struct tgsi_interp_coef *coef,
 static void
 exec_prepare( const struct sp_fragment_shader *base,
              struct tgsi_exec_machine *machine,
-             struct tgsi_sampler *samplers )
+             struct tgsi_sampler **samplers )
 {
-   tgsi_exec_machine_bind_shader( machine,
-                                 base->shader.tokens,
-                                 PIPE_MAX_SAMPLERS,
-                                 samplers );
+   /*
+    * Bind tokens/shader to the interpreter's machine state.
+    * Avoid redundant binding.
+    */
+   if (machine->Tokens != base->shader.tokens) {
+      tgsi_exec_machine_bind_shader( machine,
+                                     base->shader.tokens,
+                                     PIPE_MAX_SAMPLERS,
+                                     samplers );
+   }
 }