[Mesa-dev] [PATCH] gallivm, tgsi: provide fake sample_i_ms implementations

Jose Fonseca jfonseca at vmware.com
Wed Feb 17 21:36:00 UTC 2016


On 17/02/16 19:42, sroland at vmware.com wrote:
> From: Roland Scheidegger <sroland at vmware.com>
>
> Just like the rest of the msaa "implementation" it's just fake for now...
> ---
>   src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 7 ++++++-
>   src/gallium/auxiliary/tgsi/tgsi_exec.c          | 8 +++++---
>   2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> index 8c39ab0..a19be8a 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> @@ -2592,7 +2592,10 @@ emit_fetch_texels( struct lp_build_tgsi_soa_context *bld,
>         explicit_lod = lp_build_emit_fetch(&bld->bld_base, inst, 0, 3);
>         lod_property = lp_build_lod_property(&bld->bld_base, inst, 0);
>      }
> -   /* XXX: for real msaa support, the w component would be the sample index. */
> +   /*
> +    * XXX: for real msaa support, the w component (or src2.x for sample_i_ms)
> +    * would be the sample index.
> +    */
>
>      for (i = 0; i < dims; i++) {
>         coords[i] = lp_build_emit_fetch(&bld->bld_base, inst, 0, i);
> @@ -2742,6 +2745,7 @@ near_end_of_shader(struct lp_build_tgsi_soa_context *bld,
>            opcode == TGSI_OPCODE_SAMPLE_C_LZ ||
>            opcode == TGSI_OPCODE_SAMPLE_D ||
>            opcode == TGSI_OPCODE_SAMPLE_I ||
> +         opcode == TGSI_OPCODE_SAMPLE_I_MS ||
>            opcode == TGSI_OPCODE_SAMPLE_L ||
>            opcode == TGSI_OPCODE_SVIEWINFO ||
>            opcode == TGSI_OPCODE_CAL ||
> @@ -3989,6 +3993,7 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
>      bld.bld_base.op_actions[TGSI_OPCODE_SAMPLE_C_LZ].emit = sample_c_lz_emit;
>      bld.bld_base.op_actions[TGSI_OPCODE_SAMPLE_D].emit = sample_d_emit;
>      bld.bld_base.op_actions[TGSI_OPCODE_SAMPLE_I].emit = sample_i_emit;
> +   bld.bld_base.op_actions[TGSI_OPCODE_SAMPLE_I_MS].emit = sample_i_emit;
>      bld.bld_base.op_actions[TGSI_OPCODE_SAMPLE_L].emit = sample_l_emit;
>      bld.bld_base.op_actions[TGSI_OPCODE_SVIEWINFO].emit = sviewinfo_emit;
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
> index d898fd6..126259f 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
> @@ -2300,7 +2300,8 @@ exec_txf(struct tgsi_exec_machine *mach,
>
>      IFETCH(&r[3], 0, TGSI_CHAN_W);
>
> -   if (inst->Instruction.Opcode == TGSI_OPCODE_SAMPLE_I) {
> +   if (inst->Instruction.Opcode == TGSI_OPCODE_SAMPLE_I ||
> +       inst->Instruction.Opcode == TGSI_OPCODE_SAMPLE_I_MS) {
>         target = mach->SamplerViews[unit].Resource;
>      }
>      else {
> @@ -2342,7 +2343,8 @@ exec_txf(struct tgsi_exec_machine *mach,
>         r[3].f[j] = rgba[3][j];
>      }
>
> -   if (inst->Instruction.Opcode == TGSI_OPCODE_SAMPLE_I) {
> +   if (inst->Instruction.Opcode == TGSI_OPCODE_SAMPLE_I ||
> +       inst->Instruction.Opcode == TGSI_OPCODE_SAMPLE_I_MS) {
>         unsigned char swizzles[4];
>         swizzles[0] = inst->Src[1].Register.SwizzleX;
>         swizzles[1] = inst->Src[1].Register.SwizzleY;
> @@ -4967,7 +4969,7 @@ exec_instruction(
>         break;
>
>      case TGSI_OPCODE_SAMPLE_I_MS:
> -      assert(0);
> +      exec_txf(mach, inst);
>         break;
>
>      case TGSI_OPCODE_SAMPLE:
>

Looks good. Thanks.

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>


More information about the mesa-dev mailing list