gallivm: Fix USCALED translation. Minor Cleanups.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 31 Mar 2010 13:05:21 +0000 (14:05 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 31 Mar 2010 13:05:21 +0000 (14:05 +0100)
src/gallium/auxiliary/gallivm/lp_bld_format_soa.c

index 45ee4b12ced5facc761b70ab48f5f5667c89b1ef..c9fbe0ad10c0e20b2409cf1a09d70bd38d1e0906 100644 (file)
@@ -92,14 +92,14 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
    unsigned chan;
 
    /* FIXME: Support more formats */
-   assert(format_desc->layout == UTIL_FORMAT_LAYOUT_PLAIN);
+   assert(format_desc->is_bitmask);
    assert(format_desc->block.width == 1);
    assert(format_desc->block.height == 1);
    assert(format_desc->block.bits <= 32);
 
    /* Decode the input vector components */
    start = 0;
-   for (chan = 0; chan < 4; ++chan) {
+   for (chan = 0; chan < format_desc->nr_channels; ++chan) {
       unsigned width = format_desc->channel[chan].size;
       unsigned stop = start + width;
       LLVMValueRef input;
@@ -123,7 +123,7 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
             if(format_desc->channel[chan].normalized)
                input = lp_build_unsigned_norm_to_float(builder, width, type, input);
             else
-               input = LLVMBuildFPToSI(builder, input, lp_build_vec_type(type), "");
+               input = LLVMBuildSIToFP(builder, input, lp_build_vec_type(type), "");
          }
          else {
             /* FIXME */