[Mesa-dev] [PATCH 01/11] gallium/tgsi: pass TGSI tex target to tgsi_transform_tex_inst()
Marek Olšák
maraeo at gmail.com
Mon Mar 21 10:38:34 UTC 2016
For patches 1-10:
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Sat, Mar 19, 2016 at 12:49 AM, Brian Paul <brianp at vmware.com> wrote:
> Instead of hard-coded 2D tex target in tgsi_transform_tex_2d_inst()
> ---
> src/gallium/auxiliary/draw/draw_pipe_aaline.c | 10 +++++-----
> src/gallium/auxiliary/tgsi/tgsi_transform.h | 17 ++++++++++-------
> src/gallium/auxiliary/util/u_pstipple.c | 10 +++++-----
> src/mesa/state_tracker/st_cb_bitmap_shader.c | 8 ++++----
> src/mesa/state_tracker/st_cb_drawpixels_shader.c | 6 +++---
> 5 files changed, 27 insertions(+), 24 deletions(-)
>
> diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
> index e85ae16..cd9ee54 100644
> --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
> +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
> @@ -264,11 +264,11 @@ aa_transform_epilog(struct tgsi_transform_context *ctx)
> if (aactx->colorOutput != -1) {
> /* insert texture sampling code for antialiasing. */
>
> - /* TEX texTemp, input_coord, sampler */
> - tgsi_transform_tex_2d_inst(ctx,
> - TGSI_FILE_TEMPORARY, aactx->texTemp,
> - TGSI_FILE_INPUT, aactx->maxInput + 1,
> - aactx->freeSampler);
> + /* TEX texTemp, input_coord, sampler, 2D */
> + tgsi_transform_tex_inst(ctx,
> + TGSI_FILE_TEMPORARY, aactx->texTemp,
> + TGSI_FILE_INPUT, aactx->maxInput + 1,
> + TGSI_TEXTURE_2D, aactx->freeSampler);
>
> /* MOV rgb */
> tgsi_transform_op1_inst(ctx, TGSI_OPCODE_MOV,
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.h b/src/gallium/auxiliary/tgsi/tgsi_transform.h
> index 4dd7dda..c21ff95 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_transform.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_transform.h
> @@ -516,15 +516,18 @@ tgsi_transform_kill_inst(struct tgsi_transform_context *ctx,
>
>
> static inline void
> -tgsi_transform_tex_2d_inst(struct tgsi_transform_context *ctx,
> - unsigned dst_file,
> - unsigned dst_index,
> - unsigned src_file,
> - unsigned src_index,
> - unsigned sampler_index)
> +tgsi_transform_tex_inst(struct tgsi_transform_context *ctx,
> + unsigned dst_file,
> + unsigned dst_index,
> + unsigned src_file,
> + unsigned src_index,
> + unsigned tex_target,
> + unsigned sampler_index)
> {
> struct tgsi_full_instruction inst;
>
> + assert(tex_target < TGSI_TEXTURE_COUNT);
> +
> inst = tgsi_default_full_instruction();
> inst.Instruction.Opcode = TGSI_OPCODE_TEX;
> inst.Instruction.NumDstRegs = 1;
> @@ -532,7 +535,7 @@ tgsi_transform_tex_2d_inst(struct tgsi_transform_context *ctx,
> inst.Dst[0].Register.Index = dst_index;
> inst.Instruction.NumSrcRegs = 2;
> inst.Instruction.Texture = TRUE;
> - inst.Texture.Texture = TGSI_TEXTURE_2D;
> + inst.Texture.Texture = tex_target;
> inst.Src[0].Register.File = src_file;
> inst.Src[0].Register.Index = src_index;
> inst.Src[1].Register.File = TGSI_FILE_SAMPLER;
> diff --git a/src/gallium/auxiliary/util/u_pstipple.c b/src/gallium/auxiliary/util/u_pstipple.c
> index 74e6f99..bcbe2a2 100644
> --- a/src/gallium/auxiliary/util/u_pstipple.c
> +++ b/src/gallium/auxiliary/util/u_pstipple.c
> @@ -344,11 +344,11 @@ pstip_transform_prolog(struct tgsi_transform_context *ctx)
> pctx->wincoordFile, wincoordInput,
> TGSI_FILE_IMMEDIATE, pctx->numImmed);
>
> - /* TEX texTemp, texTemp, sampler; */
> - tgsi_transform_tex_2d_inst(ctx,
> - TGSI_FILE_TEMPORARY, texTemp,
> - TGSI_FILE_TEMPORARY, texTemp,
> - sampIdx);
> + /* TEX texTemp, texTemp, sampler, 2D; */
> + tgsi_transform_tex_inst(ctx,
> + TGSI_FILE_TEMPORARY, texTemp,
> + TGSI_FILE_TEMPORARY, texTemp,
> + TGSI_TEXTURE_2D, sampIdx);
>
> /* KILL_IF -texTemp; # if -texTemp < 0, kill fragment */
> tgsi_transform_kill_inst(ctx,
> diff --git a/src/mesa/state_tracker/st_cb_bitmap_shader.c b/src/mesa/state_tracker/st_cb_bitmap_shader.c
> index 88779bc..42aa033 100644
> --- a/src/mesa/state_tracker/st_cb_bitmap_shader.c
> +++ b/src/mesa/state_tracker/st_cb_bitmap_shader.c
> @@ -89,10 +89,10 @@ transform_instr(struct tgsi_transform_context *tctx,
> tgsi_transform_sampler_decl(tctx, ctx->sampler_index);
>
> /* TEX tmp0, fragment.texcoord[0], texture[0], 2D; */
> - tgsi_transform_tex_2d_inst(tctx,
> - TGSI_FILE_TEMPORARY, 0,
> - TGSI_FILE_INPUT, texcoord_index,
> - ctx->sampler_index);
> + tgsi_transform_tex_inst(tctx,
> + TGSI_FILE_TEMPORARY, 0,
> + TGSI_FILE_INPUT, texcoord_index,
> + TGSI_TEXTURE_2D, ctx->sampler_index);
>
> /* KIL if -tmp0 < 0 # texel=0 -> keep / texel=0 -> discard */
> inst = tgsi_default_full_instruction();
> diff --git a/src/mesa/state_tracker/st_cb_drawpixels_shader.c b/src/mesa/state_tracker/st_cb_drawpixels_shader.c
> index 2cf75f8..2170850 100644
> --- a/src/mesa/state_tracker/st_cb_drawpixels_shader.c
> +++ b/src/mesa/state_tracker/st_cb_drawpixels_shader.c
> @@ -129,9 +129,9 @@ transform_instr(struct tgsi_transform_context *tctx,
> /* Get initial pixel color from the texture.
> * TEX temp, fragment.texcoord[0], texture[0], 2D;
> */
> - tgsi_transform_tex_2d_inst(tctx, TGSI_FILE_TEMPORARY, ctx->color_temp,
> - TGSI_FILE_INPUT, texcoord_index,
> - ctx->drawpix_sampler);
> + tgsi_transform_tex_inst(tctx, TGSI_FILE_TEMPORARY, ctx->color_temp,
> + TGSI_FILE_INPUT, texcoord_index,
> + TGSI_TEXTURE_2D, ctx->drawpix_sampler);
>
> /* Apply the scale and bias. */
> if (ctx->scale_and_bias) {
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list