clover: Wrap event::wait_count in a method taking care of the required locking.
[mesa.git] / src / gallium / drivers / llvmpipe / lp_state_so.c
index c20ff26639daa9e0594208604201db487d370fdc..b2afd6fbf702ba202b031cf0aed830af0654762c 100644 (file)
@@ -64,19 +64,32 @@ static void
 llvmpipe_set_so_targets(struct pipe_context *pipe,
                         unsigned num_targets,
                         struct pipe_stream_output_target **targets,
-                        unsigned append_bitmask)
+                        const unsigned *offsets)
 {
    struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
    int i;
    for (i = 0; i < num_targets; i++) {
+      const boolean append = (offsets[i] == (unsigned)-1);
+      /*
+       * Warn if the so target was created in another context.
+       * XXX Not entirely sure if mesa/st may rely on this?
+       * Otherwise should just assert.
+       */
+      if (targets[i] && targets[i]->context != pipe) {
+         debug_printf("Illegal setting of so target with target %d created in "
+                       "another context\n", i);
+      }
       pipe_so_target_reference((struct pipe_stream_output_target **)&llvmpipe->so_targets[i], targets[i]);
+      /* If we're not appending then lets set the internal
+         offset to what was requested */
+      if (!append && llvmpipe->so_targets[i]) {
+         llvmpipe->so_targets[i]->internal_offset = offsets[i];
+      }
    }
 
    for (; i < llvmpipe->num_so_targets; i++) {
       pipe_so_target_reference((struct pipe_stream_output_target **)&llvmpipe->so_targets[i], NULL);
    }
-
-   llvmpipe->so_append_bitmask = append_bitmask;
    llvmpipe->num_so_targets = num_targets;
 }