From b40cbf5915e0b8b7dc3abb4d7407cf8f69279eae Mon Sep 17 00:00:00 2001 From: Vadim Girlin Date: Thu, 24 May 2012 18:01:28 +0400 Subject: [PATCH] radeon/llvm: fix sampler index in llvm_emit_tex Sampler index isn't a second source operand for some tgsi tex instructions. Assuming that it's always the last. Signed-off-by: Vadim Girlin --- src/gallium/drivers/r600/r600_llvm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c index 2ca838f..5e073e0 100644 --- a/src/gallium/drivers/r600/r600_llvm.c +++ b/src/gallium/drivers/r600/r600_llvm.c @@ -144,15 +144,17 @@ static void llvm_emit_tex( { struct gallivm_state * gallivm = bld_base->base.gallivm; LLVMValueRef args[6]; - unsigned c; + unsigned c, sampler_src; assert(emit_data->arg_count + 2 <= Elements(args)); for (c = 0; c < emit_data->arg_count; ++c) args[c] = emit_data->args[c]; + sampler_src = emit_data->inst->Instruction.NumSrcRegs-1; + args[c++] = lp_build_const_int32(gallivm, - emit_data->inst->Src[1].Register.Index); + emit_data->inst->Src[sampler_src].Register.Index); args[c++] = lp_build_const_int32(gallivm, emit_data->inst->Texture.Texture); -- 1.7.10.2