[Mesa-dev] [PATCH 1/3] radeonsi: Refactor packing of texture coordinates
Tom Stellard
tom at stellard.net
Fri Feb 22 08:49:56 PST 2013
On Fri, Feb 22, 2013 at 05:02:37PM +0100, Michel Dänzer wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> The number of coordinates to pack will be useful for other address parameters
> as well.
>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
These patches depend on LLVM changes, and I would like to track this somehow.
Do you have an ideas for how to do this? My suggestion is to add a file
called LLVM_REVISION.txt in the radeonsi directory that we use to record
the llvm commit that mesa changes depend on.
-Tom
> ---
> src/gallium/drivers/radeonsi/radeonsi_shader.c | 54 +++++++++++++++-----------
> 1 file changed, 32 insertions(+), 22 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> index 7922928..b5925b5 100644
> --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
> +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> @@ -830,6 +830,7 @@ static void tex_fetch_args(
> LLVMValueRef offset;
> LLVMValueRef coords[4];
> LLVMValueRef address[16];
> + unsigned num_coords;
> unsigned count = 0;
> unsigned chan;
>
> @@ -837,6 +838,35 @@ static void tex_fetch_args(
> /* XXX: should be optimized using emit_data->inst->Dst[0].Register.WriteMask*/
> emit_data->args[0] = lp_build_const_int32(bld_base->base.gallivm, 0xf);
>
> + switch (target) {
> + case TGSI_TEXTURE_1D:
> + case TGSI_TEXTURE_1D_ARRAY:
> + case TGSI_TEXTURE_SHADOW1D:
> + case TGSI_TEXTURE_SHADOW1D_ARRAY:
> + num_coords = 1;
> + break;
> + case TGSI_TEXTURE_2D:
> + case TGSI_TEXTURE_2D_ARRAY:
> + case TGSI_TEXTURE_2D_ARRAY_MSAA:
> + case TGSI_TEXTURE_2D_MSAA:
> + case TGSI_TEXTURE_RECT:
> + case TGSI_TEXTURE_SHADOW2D:
> + case TGSI_TEXTURE_SHADOW2D_ARRAY:
> + case TGSI_TEXTURE_SHADOWRECT:
> + num_coords = 2;
> + break;
> + case TGSI_TEXTURE_3D:
> + case TGSI_TEXTURE_CUBE:
> + case TGSI_TEXTURE_CUBE_ARRAY:
> + case TGSI_TEXTURE_SHADOWCUBE:
> + case TGSI_TEXTURE_SHADOWCUBE_ARRAY:
> + num_coords = 3;
> + break;
> + default:
> + assert(!"Unknown texture target");
> + num_coords = 0;
> + }
> +
> /* Fetch and project texture coordinates */
> coords[3] = lp_build_emit_fetch(bld_base, emit_data->inst, 0, TGSI_CHAN_W);
> for (chan = 0; chan < 3; chan++ ) {
> @@ -879,30 +909,10 @@ static void tex_fetch_args(
>
> /* Pack texture coordinates */
> address[count++] = coords[0];
> - switch (target) {
> - case TGSI_TEXTURE_2D:
> - case TGSI_TEXTURE_2D_ARRAY:
> - case TGSI_TEXTURE_3D:
> - case TGSI_TEXTURE_CUBE:
> - case TGSI_TEXTURE_RECT:
> - case TGSI_TEXTURE_SHADOW2D:
> - case TGSI_TEXTURE_SHADOWRECT:
> - case TGSI_TEXTURE_SHADOW2D_ARRAY:
> - case TGSI_TEXTURE_SHADOWCUBE:
> - case TGSI_TEXTURE_2D_MSAA:
> - case TGSI_TEXTURE_2D_ARRAY_MSAA:
> - case TGSI_TEXTURE_CUBE_ARRAY:
> - case TGSI_TEXTURE_SHADOWCUBE_ARRAY:
> + if (num_coords > 1)
> address[count++] = coords[1];
> - }
> - switch (target) {
> - case TGSI_TEXTURE_3D:
> - case TGSI_TEXTURE_CUBE:
> - case TGSI_TEXTURE_SHADOWCUBE:
> - case TGSI_TEXTURE_CUBE_ARRAY:
> - case TGSI_TEXTURE_SHADOWCUBE_ARRAY:
> + if (num_coords > 2)
> address[count++] = coords[2];
> - }
>
> /* Pack array slice */
> switch (target) {
> --
> 1.8.1.3
>
> _______________________________________________
> 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