[Mesa-dev] [PATCH] r600g: Support TGSI_SEMANTIC_HELPER_INVOCATION

Marek Olšák maraeo at gmail.com
Mon Nov 16 11:47:31 PST 2015


On Mon, Nov 16, 2015 at 6:03 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Mon, Nov 16, 2015 at 8:31 AM, Nicolai Hähnle <nhaehnle at 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 <nhaehnle at gmail.com>
>>> wrote:
>>>
>>>> On 13.11.2015 00:14, Glenn Kennard wrote:
>>>>>
>>>>> Signed-off-by: Glenn Kennard <glenn.kennard at 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.

FYI, per-sample shading is controlled by
pipe_context::set_min_samples. Other states can't turn it on.

Marek


More information about the mesa-dev mailing list