On Mon, Nov 16, 2015 at 8:31 AM, Nicolai Hähnle <nhaeh...@gmail.com> wrote: > Hi Glenn, > > On 14.11.2015 00:11, Glenn Kennard wrote: >> >> On Fri, 13 Nov 2015 18:57:28 +0100, Nicolai Hähnle <nhaeh...@gmail.com> >> wrote: >> >>> On 13.11.2015 00:14, Glenn Kennard wrote: >>>> >>>> Signed-off-by: Glenn Kennard <glenn.kenn...@gmail.com> >>>> --- >>>> Maybe there is a better way to check if a thread is a helper invocation? >>> >>> >>> Is ctx->face_gpr guaranteed to be initialized when >>> load_helper_invocation is called? >>> >> >> allocate_system_value_inputs() sets that if needed, and is called before >> parsing any opcodes. > > > Sorry, you're right, I missed the second change to the inputs array there. > > >>> Aside, I'm not sure I understand correctly what this is supposed to >>> do. The values you're querying are related to multi-sampling, but my >>> understanding has always been that helper invocations can also happen >>> without multi-sampling: you always want to process 2x2 quads of pixels >>> at a time to be able to compute derivatives for texture sampling. When >>> the boundary of primitive intersects such a quad, you get helper >>> invocations outside the primitive. >>> >> >> Non-MSAA buffers act just like 1 sample buffers with regards to the >> coverage mask supplied by the hardware, so helper invocations which have >> no coverage get a 0 for the mask value, and normal fragments get 1. >> Works with the piglit test case posted at least... > > > Here's why I'm still skeptical: According to the GLSL spec, the fragment > shader is only run once per pixel by default, even when MSAA is enabled. > _However_, if a shader statically accesses the SampleID, _then_ it must be > run once per fragment. The way I understand it, your change forces the > fragment shader to access SampleID, even when people ostensibly use > HelperInvocation in the hope of optimizing something.
GPU's don't operate based on GLSL specs. Per-sample shading is enabled separately. > > In the usual MSAA operation of only running the fragment shader once per > pixel, HelperInvocation should be the same as SampleMask != 0, right? It > seems like the right thing to do is to _not_ allocate the > TGSI_SEMANTIC_SAMPLEID when TGSI_SEMANTIC_HELPER_INVOCATION is used, and > then use different code paths in load_helper_invocation based on which of > the source registers are actually there. This, however is a good point -- for MSAA presumably the sample id will always work out to 0, but the bottom bit of the sample mask may not be set. In the non-SSAA case, should probably check if the whole mask != 0. -ilia _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev