Merge branch 'texformat-rework'
[mesa.git] / src / gallium / auxiliary / draw / draw_pipe_pstipple.c
index e68c824c86203a4c4f8865b040f7a9797d4a929d..283502cdf3e3bd31afd3114df5b0a854fe6b13ec 100644 (file)
@@ -34,7 +34,6 @@
  */
 
 
-#include "pipe/p_inlines.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
@@ -257,7 +256,10 @@ pstip_transform_inst(struct tgsi_transform_context *ctx,
          uint size = 4;
          immed = tgsi_default_full_immediate();
          immed.Immediate.NrTokens = 1 + size; /* one for the token itself */
-         immed.u.Pointer = (void *) value;
+         immed.u[0].Float = value[0];
+         immed.u[1].Float = value[1];
+         immed.u[2].Float = value[2];
+         immed.u[3].Float = value[3];
          ctx->emit_immediate(ctx, &immed);
       }
 
@@ -359,6 +361,7 @@ generate_pstip_fs(struct pstip_stage *pstip)
 
    pstip->fs->pstip_fs = pstip->driver_create_fs_state(pstip->pipe, &pstip_fs);
 
+   FREE((void *)pstip_fs.tokens);
    return TRUE;
 }
 
@@ -406,7 +409,7 @@ pstip_update_texture(struct pstip_stage *pstip)
 
    /* unmap */
    screen->transfer_unmap(screen, transfer);
-   screen->tex_transfer_release(screen, &transfer);
+   screen->tex_transfer_destroy(transfer);
 }
 
 
@@ -572,7 +575,7 @@ pstip_destroy(struct draw_stage *stage)
 
    pstip->pipe->delete_sampler_state(pstip->pipe, pstip->sampler_cso);
 
-   pipe_texture_release(&pstip->texture);
+   pipe_texture_reference(&pstip->texture, NULL);
 
    draw_free_temp_verts( stage );
    FREE( stage );
@@ -587,6 +590,7 @@ draw_pstip_stage(struct draw_context *draw)
    draw_alloc_temp_verts( &pstip->stage, 8 );
 
    pstip->stage.draw = draw;
+   pstip->stage.name = "pstip";
    pstip->stage.next = NULL;
    pstip->stage.point = draw_pipe_passthrough_point;
    pstip->stage.line = draw_pipe_passthrough_line;
@@ -649,6 +653,10 @@ pstip_delete_fs_state(struct pipe_context *pipe, void *fs)
    struct pstip_fragment_shader *aafs = (struct pstip_fragment_shader *) fs;
    /* pass-through */
    pstip->driver_delete_fs_state(pstip->pipe, aafs->driver_fs);
+
+   if (aafs->pstip_fs)
+      pstip->driver_delete_fs_state(pstip->pipe, aafs->pstip_fs);
+
    FREE(aafs);
 }