gallium: a lot more complete implementation of stream output
[mesa.git] / src / gallium / auxiliary / draw / draw_vs.c
index 120b976d9f4661c48c3c523f26d7479b86208b5e..b9db886a24da41a98466298a77b40daddd0f3c2a 100644 (file)
@@ -46,7 +46,7 @@
 #include "tgsi/tgsi_dump.h"
 #include "tgsi/tgsi_exec.h"
 
-
+DEBUG_GET_ONCE_BOOL_OPTION(gallium_dump_vs, "GALLIUM_DUMP_VS", FALSE)
 
 void
 draw_vs_set_constants(struct draw_context *draw,
@@ -61,6 +61,7 @@ draw_vs_set_constants(struct draw_context *draw,
          }
          draw->vs.aligned_constant_storage[slot] = align_malloc(size, 16);
       }
+      assert(constants);
       memcpy((void *)draw->vs.aligned_constant_storage[slot],
              constants,
              size);
@@ -84,21 +85,22 @@ struct draw_vertex_shader *
 draw_create_vertex_shader(struct draw_context *draw,
                           const struct pipe_shader_state *shader)
 {
-   struct draw_vertex_shader *vs;
+   struct draw_vertex_shader *vs = NULL;
 
    if (draw->dump_vs) {
       tgsi_dump(shader->tokens, 0);
    }
 
-   vs = draw_create_vs_llvm( draw, shader );
-   if (!vs) {
+   if (!draw->pt.middle.llvm) {
+#if defined(PIPE_ARCH_X86)
       vs = draw_create_vs_sse( draw, shader );
-      if (!vs) {
-         vs = draw_create_vs_ppc( draw, shader );
-         if (!vs) {
-            vs = draw_create_vs_exec( draw, shader );
-         }
-      }
+#elif defined(PIPE_ARCH_PPC)
+      vs = draw_create_vs_ppc( draw, shader );
+#endif
+   }
+
+   if (!vs) {
+      vs = draw_create_vs_exec( draw, shader );
    }
 
    if (vs)
@@ -159,7 +161,7 @@ draw_delete_vertex_shader(struct draw_context *draw,
 boolean 
 draw_vs_init( struct draw_context *draw )
 {
-   draw->dump_vs = debug_get_bool_option("GALLIUM_DUMP_VS", FALSE);
+   draw->dump_vs = debug_get_option_gallium_dump_vs();
 
    draw->vs.machine = tgsi_exec_machine_create();
    if (!draw->vs.machine)
@@ -196,7 +198,7 @@ draw_vs_destroy( struct draw_context *draw )
    if (draw->vs.aos_machine)
       draw_vs_aos_machine_destroy(draw->vs.aos_machine);
 
-   for (i = 0; i < PIPE_MAX_CONSTANT; i++) {
+   for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
       if (draw->vs.aligned_constant_storage[i]) {
          align_free((void *)draw->vs.aligned_constant_storage[i]);
       }