[Mesa-dev] [PATCH] r600g/llvm: Undefines unrequired texture coord values

Tom Stellard tom at stellard.net
Thu May 2 10:25:43 PDT 2013


On Tue, Apr 30, 2013 at 03:59:43PM +0200, Vincent Lejeune wrote:
> This is a port of "r600g:mask unused source components for SAMPLE"
> patch from Vadim Girlin.

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>

Can you wrap those long line before you commit.
> ---
>  src/gallium/drivers/r600/r600_llvm.c | 25 ++++++++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
> index 83d7340..a94faf2 100644
> --- a/src/gallium/drivers/r600/r600_llvm.c
> +++ b/src/gallium/drivers/r600/r600_llvm.c
> @@ -429,9 +429,32 @@ static void llvm_emit_tex(
>  		}
>  	}
>  
> +	if (emit_data->inst->Instruction.Opcode == TGSI_OPCODE_TEX) {
> +		LLVMValueRef Vector[4] = {
> +			LLVMBuildExtractElement(gallivm->builder, emit_data->args[0], lp_build_const_int32(gallivm, 0), ""),
> +			LLVMBuildExtractElement(gallivm->builder, emit_data->args[0], lp_build_const_int32(gallivm, 1), ""),
> +			LLVMBuildExtractElement(gallivm->builder, emit_data->args[0], lp_build_const_int32(gallivm, 2), ""),
> +			LLVMBuildExtractElement(gallivm->builder, emit_data->args[0], lp_build_const_int32(gallivm, 3), ""),
> +		};
> +		switch (emit_data->inst->Texture.Texture) {
> +		case TGSI_TEXTURE_2D:
> +		case TGSI_TEXTURE_RECT:
> +			Vector[2] = Vector[3] = LLVMGetUndef(bld_base->base.elem_type);
> +			break;
> +		case TGSI_TEXTURE_1D:
> +			Vector[1] = Vector[2] = Vector[3] = LLVMGetUndef(bld_base->base.elem_type);
> +			break;
> +		default:
> +			break;
> +		}
> +		args[0] = lp_build_gather_values(gallivm, Vector, 4);
> +	} else {
> +		args[0] = emit_data->args[0];
> +	}
> +
>  	assert(emit_data->arg_count + 2 <= Elements(args));
>  
> -	for (c = 0; c < emit_data->arg_count; ++c)
> +	for (c = 1; c < emit_data->arg_count; ++c)
>  		args[c] = emit_data->args[c];
>  
>  	sampler_src = emit_data->inst->Instruction.NumSrcRegs-1;
> -- 
> 1.8.1.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list