radv: fix invalid element type when filling vertex input default values
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 15 Feb 2019 13:14:03 +0000 (14:14 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sat, 16 Feb 2019 14:33:18 +0000 (15:33 +0100)
The elements added into a vector should have the same type as the
first one, otherwise this hits an assertion in LLVM.

Fixes: 4b3549c0846 ("radv: reduce the number of loaded channels for vertex input fetches")
reported-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_nir_to_llvm.c

index b4b09c9fed6cc225bea64aa8a98c72701c919754..ec11f6e729e9c96c302781d26e1baac9f50be3ae 100644 (file)
@@ -2089,8 +2089,10 @@ radv_fixup_vertex_input_fetches(struct radv_shader_context *ctx,
                elemtype = LLVMTypeOf(value);
        }
 
-       for (unsigned i = num_channels; i < 4; i++)
+       for (unsigned i = num_channels; i < 4; i++) {
                chan[i] = i == 3 ? one : zero;
+               chan[i] = ac_to_float(&ctx->ac, chan[i]);
+       }
 
        return ac_build_gather_values(&ctx->ac, chan, 4);
 }