[Mesa-dev] [PATCH 8/8 v2] i965: Enable EXT_shader_samples_identical

Ian Romanick idr at freedesktop.org
Thu Nov 19 20:12:56 PST 2015


On 11/19/2015 02:13 PM, Neil Roberts wrote:
> Ian Romanick <idr at freedesktop.org> writes:
> 
>> Am I correct that nothing special is needed in the vec4 backend? It
>> seems like mcs should know the register size, and the CMP with 0
>> should just do the right thing.
> 
> I think you probably will have to do something for the vec4 backend.
> Currently it generates an instruction like this:
> 
> cmp.z.f0(8)     g8<1>.xUD       g9<4,4,1>.xUD   0x00000000UD
> 
> g9 contains the MCS data. If I understand correctly for 16x MSAA the
> second half of the MCS data is in the y component which is currently
> ignored by this instruction. Maybe something like this would work:
> 
>       if (mcs.file == BRW_IMMEDIATE_VALUE) {
>          emit(MOV(dest, src_reg(0u)));
>       } else if ((key_tex->msaa_16 & (1 << sampler))) {
>          dst_reg tmp(this, glsl_type::uint_type);
>          dst_reg swizzled_mcs = mcs;
>          swizzled_mcs.swizzle = BRW_SWIZZLE_YYYY;
>          emit(OR(tmp, mcs, swizzled_mcs));
>          emit(CMP(dest, tmp, src_reg(0u), BRW_CONDITIONAL_EQ));
>       } else {
>          emit(CMP(dest, mcs, src_reg(0u), BRW_CONDITIONAL_EQ));
>       }
> 
> Sadly the optimiser doesn't optimise out the extra instruction this
> time. There's probably a better way to do it. On the other hand I can't
> think why anyone would be using this function in the vec4 backend so
> it's probably not worth worrying about.
> 
> I haven't tested this at all. I guess to test it you would have to write
> a GS version of the Piglit test? I think that is the only place that
> uses the vec4 backend on SKL.
> 
> If we don't want to risk this we could always just make it return false
> when msaa_16 is set for the sampler. On the other hand if there is

As far as I could tell, there is no msaa_16 for vec4.  It looks like it
always takes the equivalent of the FS msaa_16 path when gen >= 9.

> currently no test for the 8x version either then we should probably
> assume that neither of them work… maybe it wouldn't be so bad to just
> always return false in the vec4 backend until we've tested it?

Hmm... yeah, I'll do that.  It's an optimization, and I don't think
anyone will miss it in vec4 on any platform.  That way I don't have to
worry about applying a bunch of fixes to the 11.1 branch after I create
tests.  We can either implement it ("fix") in 11.1 or 11.2.

> Regards,
> - Neil



More information about the mesa-dev mailing list