gallium/util: add 1d/2d mipmap generation support
[mesa.git] / src / gallium / auxiliary / draw / draw_vs_aos.h
index fb6d43d32e26186d5213ab9cf99fba8f53dda9eb..55e63d8b9fabbc68a8319e25b23a4abde062767d 100644 (file)
 #ifndef DRAW_VS_AOS_H
 #define DRAW_VS_AOS_H
 
+#include "pipe/p_config.h"
+#include "tgsi/tgsi_exec.h"
+#include "draw_vs.h"
+
+#ifdef PIPE_ARCH_X86
 
 struct tgsi_token;
 struct x86_function;
@@ -48,11 +53,11 @@ struct x86_function;
 #define W    3
 
 #define MAX_INPUTS     PIPE_MAX_ATTRIBS
-#define MAX_OUTPUTS    PIPE_MAX_ATTRIBS
-#define MAX_TEMPS      PIPE_MAX_ATTRIBS /* say */
-#define MAX_CONSTANTS  PIPE_MAX_ATTRIBS /* say */
-#define MAX_IMMEDIATES PIPE_MAX_ATTRIBS /* say */
-#define MAX_INTERNALS  8
+#define MAX_OUTPUTS    PIPE_MAX_SHADER_OUTPUTS
+#define MAX_TEMPS      TGSI_EXEC_NUM_TEMPS
+#define MAX_CONSTANTS  1024  /** only used for sanity checking */
+#define MAX_IMMEDIATES 1024  /** only used for sanity checking */
+#define MAX_INTERNALS  8     /** see IMM_x values below */
 
 #define AOS_FILE_INTERNAL TGSI_FILE_COUNT
 
@@ -84,17 +89,18 @@ struct lit_info {
 #define MAX_SHINE_TAB    4
 #define MAX_LIT_INFO     16
 
-struct aos_attrib {
-   const void *input_ptr;
-   unsigned input_stride;
+struct aos_buffer {
+   const void *base_ptr;
+   unsigned stride;
+   void *ptr;                   /* updated per vertex */
 };
 
 
 
 
-/* This is the temporary storage used by all the aos_sse vs varients.
+/* This is the temporary storage used by all the aos_sse vs variants.
  * Create one per context and reuse by passing a pointer in at
- * vs_varient creation??
+ * vs_variant creation??
  */
 struct aos_machine {
    float input    [MAX_INPUTS    ][4];
@@ -118,9 +124,9 @@ struct aos_machine {
    ushort fpucntl;              /* one of FPU_* above */
 
    const float (*immediates)[4];     /* points to shader data */
-   const float (*constants)[4];      /* points to draw data */
+   const void *constants[PIPE_MAX_CONSTANT_BUFFERS]; /* points to draw data */
 
-   const struct aos_attrib *attrib; /* points to ? */
+   const struct aos_buffer *buffer; /* points to ? */
 };
 
 
@@ -128,7 +134,7 @@ struct aos_machine {
 
 struct aos_compilation {
    struct x86_function *func;
-   struct draw_vs_varient_aos_sse *vaos;
+   struct draw_vs_variant_aos_sse *vaos;
 
    unsigned insn_counter;
    unsigned num_immediates;
@@ -142,7 +148,7 @@ struct aos_compilation {
       unsigned last_used;
    } xmm[8];
 
-   unsigned ebp;                /* one of X86_* */
+   unsigned x86_reg[2];                /* one of X86_* */
 
    boolean input_fetched[PIPE_MAX_ATTRIBS];
    unsigned output_last_write[PIPE_MAX_ATTRIBS];
@@ -172,12 +178,15 @@ void aos_adopt_xmm_reg( struct aos_compilation *cp,
                         unsigned idx,
                         unsigned dirty );
 
+void aos_spill_all( struct aos_compilation *cp );
+
 struct x86_reg aos_get_shader_reg( struct aos_compilation *cp, 
                                    unsigned file,
                                    unsigned idx );
 
-boolean aos_fetch_inputs( struct aos_compilation *cp,
-                          boolean linear );
+boolean aos_init_inputs( struct aos_compilation *cp, boolean linear );
+boolean aos_fetch_inputs( struct aos_compilation *cp, boolean linear );
+boolean aos_incr_inputs( struct aos_compilation *cp, boolean linear );
 
 boolean aos_emit_outputs( struct aos_compilation *cp );
 
@@ -197,20 +206,20 @@ struct x86_reg aos_get_internal_xmm( struct aos_compilation *cp,
                                      unsigned imm );
 
 
-#define ERROR(cp, msg)                                                  \
+#define AOS_ERROR(cp, msg)                                                  \
 do {                                                                    \
-   debug_printf("%s: x86 translation failed: %s\n", __FUNCTION__, msg); \
+   if (0) debug_printf("%s: x86 translation failed: %s\n", __FUNCTION__, msg); \
    cp->error = 1;                                                       \
-   assert(0);                                                           \
 } while (0)
 
 
 #define X86_NULL       0
 #define X86_IMMEDIATES 1
 #define X86_CONSTANTS  2
-#define X86_ATTRIBS    3
+#define X86_BUFFERS    3
 
 struct x86_reg aos_get_x86( struct aos_compilation *cp,
+                            unsigned which_reg,
                             unsigned value );
 
 
@@ -225,11 +234,12 @@ typedef void (PIPE_CDECL *vaos_run_linear_func)( struct aos_machine *,
                                                 void *output_buffer);
 
 
-struct draw_vs_varient_aos_sse {
-   struct draw_vs_varient base;
+struct draw_vs_variant_aos_sse {
+   struct draw_vs_variant base;
    struct draw_context *draw;
 
-   struct aos_attrib *attrib;
+   struct aos_buffer *buffer;
+   unsigned nr_vb;
 
    vaos_run_linear_func gen_run_linear;
    vaos_run_elts_func gen_run_elts;
@@ -239,6 +249,7 @@ struct draw_vs_varient_aos_sse {
 };
 
 
+#endif
 
 #endif