draw: ensure vs outputs mapped correctly to vinfo attribs
authorKeith Whitwell <keith@tungstengraphics.com>
Tue, 27 May 2008 16:49:13 +0000 (17:49 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Tue, 27 May 2008 16:52:24 +0000 (17:52 +0100)
src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
src/gallium/auxiliary/draw/draw_vs.h
src/gallium/auxiliary/draw/draw_vs_aos_io.c

index 581026d..43d7095 100644 (file)
@@ -160,6 +160,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
           * that's handled by the output_offset field.
           */
          fse->key.element[vs_output].out.format = output_format;
+         fse->key.element[vs_output].out.vs_output = vs_output;
          fse->key.element[vs_output].out.offset = dst_offset;
       
          dst_offset += emit_sz;
index 17902ab..01171bc 100644 (file)
 struct draw_context;
 struct pipe_shader_state;
 
-struct draw_vs_input 
+struct draw_varient_input 
 {
    enum pipe_format format;
    unsigned buffer;
    unsigned offset; 
 };
 
-struct draw_vs_output
+struct draw_varient_output
 {
-   enum pipe_format format;
-   unsigned offset;
+   enum pipe_format format;     /* output format */
+   unsigned vs_output:8;        /* which vertex shader output is this? */
+   unsigned offset:24;          /* offset into output vertex */
 };
 
-struct draw_vs_element {
-   struct draw_vs_input in;
-   struct draw_vs_output out;
+struct draw_varient_element {
+   struct draw_varient_input in;
+   struct draw_varient_output out;
 };
 
 struct draw_vs_varient_key {
@@ -64,7 +65,7 @@ struct draw_vs_varient_key {
    unsigned viewport:1;
    unsigned clip:1;
    unsigned pad:5;
-   struct draw_vs_element element[PIPE_MAX_ATTRIBS];
+   struct draw_varient_element element[PIPE_MAX_ATTRIBS];
 };
 
 struct draw_vs_varient;
@@ -201,7 +202,7 @@ struct draw_vs_varient *draw_vs_varient_generic( struct draw_vertex_shader *vs,
 
 static INLINE int draw_vs_varient_keysize( const struct draw_vs_varient_key *key )
 {
-   return 2 * sizeof(int) + key->nr_elements * sizeof(struct draw_vs_element);
+   return 2 * sizeof(int) + key->nr_elements * sizeof(struct draw_varient_element);
 }
 
 static INLINE int draw_vs_varient_key_compare( const struct draw_vs_varient_key *a,
index ef265d6..cebfaf6 100644 (file)
@@ -285,10 +285,11 @@ boolean aos_emit_outputs( struct aos_compilation *cp )
    for (i = 0; i < cp->vaos->base.key.nr_outputs; i++) {
       unsigned format = cp->vaos->base.key.element[i].out.format;
       unsigned offset = cp->vaos->base.key.element[i].out.offset;
+      unsigned vs_output = cp->vaos->base.key.element[i].out.vs_output;
 
       struct x86_reg data = aos_get_shader_reg( cp, 
                                                 TGSI_FILE_OUTPUT,
-                                                i );
+                                                vs_output );
 
       if (data.file != file_XMM) {
          struct x86_reg tmp = aos_get_xmm_reg( cp );