[Mesa-dev] [PATCH] i965/skl: Add a message header for the TXF_MCS instruction in vec4vs

Kenneth Graunke kenneth at whitecape.org
Sat May 23 12:19:42 PDT 2015


On Thursday, May 21, 2015 04:59:13 PM Neil Roberts wrote:
> When using SIMD4x2 on Skylake, the sampler instructions need a message
> header to select the correct mode. This was added for most sample
> instructions in 0ac4c2727 but the TXF_MCS instruction is emitted
> separately and it was missed.
> 
> This fixes a bunch of Piglit tests which test texelFetch in a geometry
> shader, for example:
> 
>  spec/arb_texture_multisample/texelfetch/2-gs-sampler2dms
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 20 ++++++++++++++++++--
>  1 file changed, 18 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 5a60fe4..59a73a9 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -2460,11 +2460,27 @@ vec4_visitor::emit_mcs_fetch(ir_texture *ir, src_reg coordinate, src_reg sampler
>        new(mem_ctx) vec4_instruction(SHADER_OPCODE_TXF_MCS,
>                                      dst_reg(this, glsl_type::uvec4_type));
>     inst->base_mrf = 2;
> -   inst->mlen = 1;
>     inst->src[1] = sampler;
>  
> +   int param_base;
> +
> +   if (devinfo->gen >= 9) {
> +      /* Gen9+ needs a message header in order to use SIMD4x2 mode */
> +      vec4_instruction *header_inst = new(mem_ctx)
> +         vec4_instruction(VS_OPCODE_SET_SIMD4X2_HEADER_GEN9,
> +                          dst_reg(MRF, inst->base_mrf));
> +
> +      emit(header_inst);
> +
> +      inst->mlen = 2;
> +      inst->header_size = 1;
> +      param_base = inst->base_mrf + 1;
> +   } else {
> +      inst->mlen = 1;
> +      param_base = inst->base_mrf;
> +   }
> +
>     /* parameters are: u, v, r, lod; lod will always be zero due to api restrictions */
> -   int param_base = inst->base_mrf;
>     int coord_mask = (1 << ir->coordinate->type->vector_elements) - 1;
>     int zero_mask = 0xf & ~coord_mask;
>  
> 

Good catch, thanks for fixing this, Neil!

Cc: mesa-stable at lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150523/f4bdfc61/attachment.sig>


More information about the mesa-dev mailing list