[Mesa-dev] [PATCH 05/12] i965/vec4/skl+: Use lcd2dms_w instead of lcd2dms

Neil Roberts neil at linux.intel.com
Wed Sep 23 08:49:36 PDT 2015


Ben Widawsky <ben at bwidawsk.net> writes:

>>        } else if (op == ir_txf_ms) {
>>           emit(MOV(dst_reg(MRF, param_base + 1, sample_index.type, WRITEMASK_X),
>>                    sample_index));
>> -         if (devinfo->gen >= 7) {
>> +         if (opcode == SHADER_OPCODE_TXF_CMS_W) {
>> +            /* MCS data is stored in the first two channels of ‘mcs’, but we
>> +             * need to get it into the .y and .z channels of the second vec4
>> +             * of params.
>> +             */
>
> I don't understand what you mean by the "second vec4". Do you just mean the .y
> and .z channel?

No, the arguments in the send message are laid out like this:

         Register 1                    Register 2          
┌────────────┴──────────────┐ ┌────────────┴──────────────────────┐
 .x .y .z .w    .x .y .z .w    .x .y   .z   .w    .x .y   .z   .w 
 u  v  r  n/a   u  v  r  n/a   si mcsl mcsh n/a   si mcsl mcsh n/a
└────┬───────┘ └────┬───────┘ └───────┬────────┘ └────────┬───────┘
 vertex 1        vertex 2          vertex 1            vertex 2    

So the “second vec4” refers to the pair of vec4s in register 2. This is
a bit confusing but it is the same wording that is used for the TXF_CMS
case just below this.

>> +            mcs.swizzle = BRW_SWIZZLE4(0, 0, 1, 1);
>
> I don't really understand how the swizzle stuff works. Quick
> explanation on why it's not BRW_SWIZZLE_XYXY would be greatly
> appreciated.

The MCS data is returned as the two .xy pairs of components in a single
register. Because the sample index is the first argument in the second
register, we need to shift this over by 32 bits so that is occupies the
.yz pairs. This is done with the swizzle. The writemask in the MOV
instruction filters out the X and W components of the swizzled register.
Only the second and third arguments to BRW_SWIZZLE4 actually matter.
This could be something like BRW_SWIZZLE_XXYX except that that define
doesn't exist.

This would be easier to review if there was more context so you could
see the CMS case as well.

Regards,
- Neil


More information about the mesa-dev mailing list