From f92873be2c7fcb07154282bd0e418a4c88b6507e Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 12 Jul 2012 10:41:39 -0400 Subject: [PATCH] radeon/llvm: Don't use lp_build_swizzle_aos() for swizzles This function assumes that lp_build_context::type is a vector type, which is not true for r600 or radeonsi. This fixes an assertion failure using glamor 2D accel. --- src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c index 9c2c449..641d277 100644 --- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c +++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c @@ -65,14 +65,19 @@ static LLVMValueRef emit_swizzle( unsigned swizzle_z, unsigned swizzle_w) { - unsigned char swizzles[4]; - swizzles[0] = swizzle_x; - swizzles[1] = swizzle_y; - swizzles[2] = swizzle_z; - swizzles[3] = swizzle_w; - - - return lp_build_swizzle_aos(&bld_base->base, value, swizzles); + LLVMValueRef swizzles[4]; + LLVMTypeRef i32t = + LLVMInt32TypeInContext(bld_base->base.gallivm->context); + + swizzles[0] = LLVMConstInt(i32t, swizzle_x, 0); + swizzles[1] = LLVMConstInt(i32t, swizzle_y, 0); + swizzles[2] = LLVMConstInt(i32t, swizzle_z, 0); + swizzles[3] = LLVMConstInt(i32t, swizzle_w, 0); + + return LLVMBuildShuffleVector(bld_base->base.gallivm->builder, + value, + LLVMGetUndef(LLVMTypeOf(value)), + LLVMConstVector(swizzles, 4), ""); } static LLVMValueRef -- 2.7.4