gallium: Handle InstanceID as a true 32-bit uint.
authorMichal Krol <michal@vmware.com>
Tue, 5 Jan 2010 10:48:32 +0000 (11:48 +0100)
committerMichal Krol <michal@vmware.com>
Tue, 5 Jan 2010 10:48:32 +0000 (11:48 +0100)
src/gallium/auxiliary/draw/draw_pt_fetch.c
src/gallium/auxiliary/translate/translate_sse.c

index 36c27e22ff9b54aac0ef97650ac5a2a729aa60a3..55e7a7b81adfdcfd49b422ea7d4ac41238c7e571 100644 (file)
@@ -107,19 +107,24 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch,
    for (i = 0; i < nr_inputs; i++) {
       if (i == instance_id_index) {
          key.element[nr].type = TRANSLATE_ELEMENT_INSTANCE_ID;
-         key.element[nr].input_format = PIPE_FORMAT_R32_FLOAT;    /* XXX: Make it UINT. */
+         key.element[nr].input_format = PIPE_FORMAT_R32_USCALED;
+         key.element[nr].output_format = PIPE_FORMAT_R32_USCALED;
+         key.element[nr].output_offset = dst_offset;
+
+         dst_offset += sizeof(uint);
       } else {
          key.element[nr].type = TRANSLATE_ELEMENT_NORMAL;
          key.element[nr].input_format = draw->pt.vertex_element[ei].src_format;
          key.element[nr].input_buffer = draw->pt.vertex_element[ei].vertex_buffer_index;
          key.element[nr].input_offset = draw->pt.vertex_element[ei].src_offset;
          key.element[nr].instance_divisor = draw->pt.vertex_element[ei].instance_divisor;
+         key.element[nr].output_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+         key.element[nr].output_offset = dst_offset;
+
          ei++;
+         dst_offset += 4 * sizeof(float);
       }
-      key.element[nr].output_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
-      key.element[nr].output_offset = dst_offset;
 
-      dst_offset += 4 * sizeof(float);
       nr++;
    }
 
index 8e152a002a3bf2d6941fc31d00415ab3fae8ee81..c13e7427387985418d8d851cacfde2d2385d830d 100644 (file)
@@ -50,15 +50,13 @@ typedef void (PIPE_CDECL *run_func)( struct translate *translate,
                                      unsigned start,
                                      unsigned count,
                                      unsigned instance_id,
-                                     void *output_buffer,
-                                     float instance_id_float );
+                                     void *output_buffer);
 
 typedef void (PIPE_CDECL *run_elts_func)( struct translate *translate,
                                           const unsigned *elts,
                                           unsigned count,
                                           unsigned instance_id,
-                                          void *output_buffer,
-                                          float instance_id_float );
+                                          void *output_buffer);
 
 struct translate_buffer {
    const void *base_ptr;
@@ -102,7 +100,6 @@ struct translate_sse {
 
    boolean use_instancing;
    unsigned instance_id;
-   float instance_id_float;   /* XXX: needed while no integer support in TGSI */
 
    run_func      gen_run;
    run_elts_func gen_run_elts;
@@ -451,7 +448,7 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p,
 {
    if (var_idx == ELEMENT_BUFFER_INSTANCE_ID) {
       return x86_make_disp(p->machine_EDX,
-                           get_offset(p, &p->instance_id_float));
+                           get_offset(p, &p->instance_id));
    }
    if (linear && p->nr_buffer_varients == 1) {
       return p->idx_EBX;
@@ -587,14 +584,6 @@ static boolean build_vertex_emit( struct translate_sse *p,
       x86_mov(p->func,
               x86_make_disp(p->machine_EDX, get_offset(p, &p->instance_id)),
               p->tmp_EAX);
-
-      /* XXX: temporary */
-      x86_mov(p->func,
-              p->tmp_EAX,
-              x86_fn_arg(p->func, 6));
-      x86_mov(p->func,
-              x86_make_disp(p->machine_EDX, get_offset(p, &p->instance_id_float)),
-              p->tmp_EAX);
    }
 
    /* Get vertex count, compare to zero
@@ -715,8 +704,7 @@ static void PIPE_CDECL translate_sse_run_elts( struct translate *translate,
                    elts,
                    count,
                     instance_id,
-                    output_buffer,
-                    (float)instance_id );
+                    output_buffer);
 }
 
 static void PIPE_CDECL translate_sse_run( struct translate *translate,
@@ -731,8 +719,7 @@ static void PIPE_CDECL translate_sse_run( struct translate *translate,
               start,
               count,
                instance_id,
-               output_buffer,
-               (float)instance_id);
+               output_buffer);
 }