Merge commit 'origin/master' into gallium-0.2
[mesa.git] / src / gallium / drivers / softpipe / sp_state_fs.c
index 2921066ce3640475aadf032a14c69bdb203f24ae..e5b609cf6c98b83231207e31b353ec36beab12a1 100644 (file)
 #include "sp_fs.h"
 
 #include "pipe/p_defines.h"
-#include "pipe/p_util.h"
+#include "util/u_memory.h"
 #include "pipe/p_inlines.h"
 #include "pipe/p_winsys.h"
 #include "pipe/p_shader_tokens.h"
 #include "draw/draw_context.h"
-#include "tgsi/util/tgsi_dump.h"
-#include "tgsi/util/tgsi_scan.h"
+#include "tgsi/tgsi_dump.h"
+#include "tgsi/tgsi_scan.h"
 
 
 void *
@@ -82,10 +82,9 @@ softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
 void
 softpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
 {
-   struct softpipe_context *softpipe = softpipe_context(pipe);
    struct sp_fragment_shader *state = fs;
 
-   assert(fs != softpipe->fs);
+   assert(fs != softpipe_context(pipe)->fs);
    
    state->delete( state );
 }
@@ -103,10 +102,7 @@ softpipe_create_vs_state(struct pipe_context *pipe,
       return NULL;
    }
 
-   state->shader = *templ;
-
-   state->draw_data = draw_create_vertex_shader(softpipe->draw,
-                                                &state->shader);
+   state->draw_data = draw_create_vertex_shader(softpipe->draw, templ);
    if (state->draw_data == NULL) {
       FREE( state );
       return NULL;
@@ -156,10 +152,10 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
    assert(index == 0);
 
    /* note: reference counting */
-   pipe_buffer_reference(ws,
+   winsys_buffer_reference(ws,
                         &softpipe->constants[shader].buffer,
-                        buf->buffer);
-   softpipe->constants[shader].size = buf->size;
+                        buf ? buf->buffer : NULL);
+   softpipe->constants[shader].size = buf ? buf->size : 0;
 
    softpipe->dirty |= SP_NEW_CONSTANTS;
 }