gallium/tgsi: Fix tgsi_build_full_immediate() for non-float data types.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 20 Mar 2012 20:29:36 +0000 (21:29 +0100)
committerFrancisco Jerez <currojerez@riseup.net>
Fri, 11 May 2012 10:39:43 +0000 (12:39 +0200)
src/gallium/auxiliary/tgsi/tgsi_build.c

index ed725c53966b09545b5268ad6ef693b5915bb55e..1d3c4bcdf71ed608d42f22b7375e0e2914751fb6 100644 (file)
@@ -496,11 +496,13 @@ tgsi_default_immediate( void )
 
 static struct tgsi_immediate
 tgsi_build_immediate(
-   struct tgsi_header *header )
+   struct tgsi_header *header,
+   unsigned type )
 {
    struct tgsi_immediate immediate;
 
    immediate = tgsi_default_immediate();
+   immediate.DataType = type;
 
    header_bodysize_grow( header );
 
@@ -533,21 +535,6 @@ immediate_grow(
    header_bodysize_grow( header );
 }
 
-static union tgsi_immediate_data
-tgsi_build_immediate_float32(
-   float value,
-   struct tgsi_immediate *immediate,
-   struct tgsi_header *header )
-{
-   union tgsi_immediate_data immediate_data;
-
-   immediate_data.Float = value;
-
-   immediate_grow( immediate, header );
-
-   return immediate_data;
-}
-
 unsigned
 tgsi_build_full_immediate(
    const struct tgsi_full_immediate *full_imm,
@@ -563,7 +550,7 @@ tgsi_build_full_immediate(
    immediate = (struct tgsi_immediate *) &tokens[size];
    size++;
 
-   *immediate = tgsi_build_immediate( header );
+   *immediate = tgsi_build_immediate( header, full_imm->Immediate.DataType );
 
    assert( full_imm->Immediate.NrTokens <= 4 + 1 );
 
@@ -572,13 +559,12 @@ tgsi_build_full_immediate(
 
       if( maxsize <= size )
          return  0;
+
       data = (union tgsi_immediate_data *) &tokens[size];
-      size++;
+      *data = full_imm->u[i];
 
-      *data = tgsi_build_immediate_float32(
-         full_imm->u[i].Float,
-         immediate,
-         header );
+      immediate_grow( immediate, header );
+      size++;
    }
 
    return size;