gallivm: fix border color for integer textures
authorRoland Scheidegger <sroland@vmware.com>
Wed, 9 Jan 2013 22:38:14 +0000 (14:38 -0800)
committerRoland Scheidegger <sroland@vmware.com>
Fri, 11 Jan 2013 02:02:01 +0000 (18:02 -0800)
Need to bitcast the float border color (luckily we already get
the color as int just disguised as float).
Fixes piglit texwrap GL_EXT_texture_integer bordercolor.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c

index 57298a47ffae68d9939d338965cdedab55254eac..918dd36fbf56fabbad7a3b62bc22ae5247cdc4c7 100644 (file)
@@ -190,6 +190,11 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
                                lp_build_const_int32(bld->gallivm, chan));
          LLVMValueRef border_chan_vec =
             lp_build_broadcast_scalar(&bld->float_vec_bld, border_chan);
+
+         if (!bld->texel_type.floating) {
+            border_chan_vec = LLVMBuildBitCast(builder, border_chan_vec,
+                                               bld->texel_bld.vec_type, "");
+         }
          texel_out[chan] = lp_build_select(&bld->texel_bld, use_border,
                                            border_chan_vec, texel_out[chan]);
       }