On 4 February 2013 21:48, Chris Forbes <chr...@ijw.co.nz> wrote:

> On Gen6, lower this to `ld` with lod=0 and an extra sample_index
> parameter.
>
> On Gen7, use `ld2dms`. This takes an additional MCS parameter to support
> compressed multisample surfaces, but we're not enabling them for
> multisample textures for now, so it's always zero and can be safely
> omitted.
>

Nit pick: this should say "so it's always ignored and can be safely
omitted."  (If ld2dms actually paid attention to the MCS parameter when
sampling from a UMS surface, and we omitted it, the implicit value of zero
would actually cause sample zero to always be loaded, which isn't what we
want.  Fortunately the hardware ignores the MCS parameter when sampling
from a UMS surface, so we're ok :))


>
> V2: Reworked completely, added support for Gen7.
>
> Signed-off-by: Chris Forbes <chr...@ijw.co.nz>
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index 1863fe5..008fa1d 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -2108,6 +2108,11 @@ vec4_visitor::visit(ir_texture *ir)
>        lod = this->result;
>        lod_type = ir->lod_info.lod->type;
>        break;
> +   case ir_txf_ms:
> +      ir->lod_info.sample_index->accept(this);
> +      lod = this->result;
> +      lod_type = ir->lod_info.sample_index->type;
> +      break;
>

It seems kludgy to repurpose the local variables "lod" and "lod_type" for
sample_index in this case.  Can we go ahead and create local variables
"sample_index" and "sample_index_type", and use them instead?


>     case ir_txd:
>        ir->lod_info.grad.dPdx->accept(this);
>        dPdx = this->result;
> @@ -2133,6 +2138,9 @@ vec4_visitor::visit(ir_texture *ir)
>     case ir_txf:
>        inst = new(mem_ctx) vec4_instruction(this, SHADER_OPCODE_TXF);
>        break;
> +   case ir_txf_ms:
> +      inst = new(mem_ctx) vec4_instruction(this, SHADER_OPCODE_TXF_MS);
> +      break;
>     case ir_txs:
>        inst = new(mem_ctx) vec4_instruction(this, SHADER_OPCODE_TXS);
>        break;
> @@ -2219,8 +2227,15 @@ vec4_visitor::visit(ir_texture *ir)
>          }
>          emit(MOV(dst_reg(MRF, mrf, lod_type, writemask), lod));
>        } else if (ir->op == ir_txf) {
> -        emit(MOV(dst_reg(MRF, param_base, lod_type, WRITEMASK_W),
> -                 lod));
> +         emit(MOV(dst_reg(MRF, param_base, lod_type, WRITEMASK_W), lod));
> +      } else if (ir->op == ir_txf_ms) {
> +         emit(MOV(dst_reg(MRF, param_base + 1, lod_type, WRITEMASK_X),
> lod /*sample_index*/));
> +         inst->mlen++;
> +
> +         /* on Gen7, there is an additional MCS parameter here after SI,
> +          * but we don't bother to emit it since it's always zero. If
> +          * we start supporting texturing from CMS surfaces, this will
> have
> +          * to change */
>        } else if (ir->op == ir_txd) {
>          const glsl_type *type = lod_type;
>
> --
> 1.8.1.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to