gallium: basic and initial implementation of the stream output interface
[mesa.git] / src / gallium / auxiliary / draw / draw_private.h
index 6a7190e9750b0985e6b02a14677223d106a99b76..ca8f9cfab1eb13bff4138330efaa8603ba666492 100644 (file)
 
 #include "tgsi/tgsi_scan.h"
 
+#ifdef HAVE_LLVM
+#include <llvm-c/ExecutionEngine.h>
+#endif
+
 
 struct pipe_context;
-struct gallivm_prog;
-struct gallivm_cpu_engine;
 struct draw_vertex_shader;
 struct draw_context;
 struct draw_stage;
@@ -84,6 +86,8 @@ struct vertex_header {
  */
 struct draw_context
 {
+   struct pipe_context *pipe;
+
    /** Drawing/primitive pipeline stages */
    struct {
       struct draw_stage *first;  /**< one of the following */
@@ -107,6 +111,7 @@ struct draw_context
 
       float wide_point_threshold; /**< convert pnts to tris if larger than this */
       float wide_line_threshold;  /**< convert lines to tris if wider than this */
+      boolean wide_point_sprites; /**< convert points to tris for sprite mode */
       boolean line_stipple;       /**< do line stipple? */
       boolean point_sprite;       /**< convert points to quads for sprites? */
 
@@ -127,6 +132,7 @@ struct draw_context
          struct draw_pt_middle_end *fetch_emit;
          struct draw_pt_middle_end *fetch_shade_emit;
          struct draw_pt_middle_end *general;
+         struct draw_pt_middle_end *llvm;
       } middle;
 
       struct {
@@ -146,6 +152,7 @@ struct draw_context
          const void *elts;
          /** bytes per index (0, 1, 2 or 4) */
          unsigned eltSize;
+         int eltBias;
          unsigned min_index;
          unsigned max_index;
          
@@ -176,8 +183,14 @@ struct draw_context
 
    double mrd;  /**< minimum resolvable depth value, for polygon offset */
 
-   /* pipe state that we need: */
+   /** Current rasterizer state given to us by the driver */
    const struct pipe_rasterizer_state *rasterizer;
+   /** Driver CSO handle for the current rasterizer state */
+   void *rast_handle;
+
+   /** Rasterizer CSOs without culling/stipple/etc */
+   void *rasterizer_no_cull[2][2];
+
    struct pipe_viewport_state viewport;
    boolean identity_viewport;
 
@@ -193,10 +206,6 @@ struct draw_context
       uint num_samplers;
       struct tgsi_sampler **samplers;
 
-      /* This (and the tgsi_exec_machine struct) probably need to be moved somewhere private.
-       */
-      struct gallivm_cpu_engine *engine;   
-
       /* Here's another one:
        */
       struct aos_machine *aos_machine; 
@@ -226,6 +235,12 @@ struct draw_context
       struct tgsi_sampler **samplers;
    } gs;
 
+   struct {
+      struct pipe_stream_output_state state;
+      void *buffers[PIPE_MAX_SO_BUFFERS];
+      uint num_buffers;
+   } so;
+
    /* Clip derived state:
     */
    float plane[12][4];
@@ -243,9 +258,17 @@ struct draw_context
 
    unsigned instance_id;
 
+#ifdef HAVE_LLVM
+   LLVMExecutionEngineRef engine;
+#endif
+
    void *driver_private;
 };
 
+/*******************************************************************************
+ * Draw common initialization code
+ */
+boolean draw_init(struct draw_context *draw);
 
 /*******************************************************************************
  * Vertex shader code:
@@ -280,8 +303,8 @@ void draw_gs_destroy( struct draw_context *draw );
 /*******************************************************************************
  * Common shading code:
  */
-int draw_current_shader_outputs(struct draw_context *draw);
-int draw_current_shader_position_output(struct draw_context *draw);
+uint draw_current_shader_outputs(const struct draw_context *draw);
+uint draw_current_shader_position_output(const struct draw_context *draw);
 
 /*******************************************************************************
  * Vertex processing (was passthrough) code:
@@ -351,5 +374,10 @@ void draw_do_flush( struct draw_context *draw, unsigned flags );
 
 
 
+void *
+draw_get_rasterizer_no_cull( struct draw_context *draw,
+                             boolean scissor,
+                             boolean flatshade );
+
 
 #endif /* DRAW_PRIVATE_H */