[Mesa-dev] [PATCH 1/3] r600g: Handle texture fetch instructions with swizzle on source register

Henri Verbeet hverbeet at gmail.com
Thu Mar 24 03:34:35 PDT 2011


On 24 March 2011 10:26, Fabian Bieler <der.fabe at gmx.net> wrote:
>  	if (inst->Texture.Texture == TGSI_TEXTURE_CUBE) {
> -		static const unsigned src0_swizzle[] = {2, 2, 0, 1};
> -		static const unsigned src1_swizzle[] = {1, 0, 2, 2};
> +		unsigned src0_swizzle[4];
> +		unsigned src1_swizzle[4];
> +		if (src_loaded) {
> +			src0_swizzle[0] = 2; src0_swizzle[1] = 2;
> +			src0_swizzle[2] = 0; src0_swizzle[3] = 1;
> +			src1_swizzle[0] = 1; src1_swizzle[1] = 0;
> +			src1_swizzle[2] = 2; src1_swizzle[3] = 2;
> +		} else {
> +			src0_swizzle[0] = ctx->src[0].swizzle[2];
> +			src0_swizzle[1] = ctx->src[0].swizzle[2];
> +			src0_swizzle[2] = ctx->src[0].swizzle[0];
> +			src0_swizzle[3] = ctx->src[0].swizzle[1];
>
> +			src1_swizzle[0] = ctx->src[0].swizzle[1];
> +			src1_swizzle[1] = ctx->src[0].swizzle[0];
> +			src1_swizzle[2] = ctx->src[0].swizzle[2];
> +			src1_swizzle[3] = ctx->src[0].swizzle[2];
> +		}
What is this supposed to do? It looks like you're trying to avoid a
double swizzle in case of projected cube textures, but note that the
CUBE instruction always uses r600_bc_src() with ctx->src[0], never
src_gpr.


More information about the mesa-dev mailing list