[Mesa-dev] [RFC PATCH 24/26] i965/vs: emit sample index for txf

Paul Berry stereotype441 at gmail.com
Fri Jan 4 13:52:43 PST 2013


On 29 December 2012 04:35, Chris Forbes <chrisf at ijw.co.nz> wrote:

> When fetching texels from a multisample surface, the sample index is
> provided as an extra argument after the lod, and the actual lod needs
> to be hardwired to 0.
>
> The frontend gives us the sample index in the lod parameter, so fix this
> up.
>

How much work would it be to modify the front end so that instead of giving
us the sample index in the lod parameter, we add a "sample_index" element
to the ir_texture::lod_info union?  It seems like that would make this code
easier to follow.


>
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 15 +++++++++++++--
>  1 file changed, 13 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 104057c..8aa4b2d 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -2088,8 +2088,19 @@ vec4_visitor::visit(ir_texture *ir)
>          }
>          emit(MOV(dst_reg(MRF, mrf, ir->lod_info.lod->type, writemask),
> lod));
>        } else if (ir->op == ir_txf) {
> -        emit(MOV(dst_reg(MRF, param_base, ir->lod_info.lod->type,
> WRITEMASK_W),
> -                 lod));
> +         if (ir->sampler->type->sampler_dimensionality ==
> GLSL_SAMPLER_DIM_MS) {
> +            /* for multisample samplers, actual lod is always 0, and the
> +             * extra parameter is the sample index */
> +            emit(MOV(dst_reg(MRF, param_base, ir->lod_info.lod->type,
> WRITEMASK_W),
> +                     src_reg(0)));
> +            emit(MOV(dst_reg(MRF, param_base + 1, ir->lod_info.lod->type,
> WRITEMASK_X),
> +                     lod));   /* sample_index */
> +            inst->mlen++;     /* spilled over into a second reg of args */
> +         }
> +         else {
> +            emit(MOV(dst_reg(MRF, param_base, ir->lod_info.lod->type,
> WRITEMASK_W),
> +                     lod));
> +         }
>        } else if (ir->op == ir_txd) {
>          const glsl_type *type = ir->lod_info.grad.dPdx->type;
>
> --
> 1.8.0.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130104/187ca139/attachment.html>


More information about the mesa-dev mailing list