[Mesa-dev] st/pbo: fix pbo uploads without PIPE_CAP_TGSI_VS_LAYER_VIEWPORT

Ilia Mirkin imirkin at alum.mit.edu
Mon Dec 14 16:07:08 UTC 2020


Hm, I thought reading gl_Layer in a fragment shader is well-defined
(to be 0) when there's no GS. Reading back over
ARB_fragment_layer_viewport, it doesn't seem to address this point at
all. It just says that if GS doesn't write gl_Layer, then it will be
read as 0 by the fragment shader. I'd be curious if there are any
interpretations that allow this case to be undefined.

It's definitely the case on NVIDIA hw that you'll get a 0 (since it
reflects the layer being rendered). The pbo logic has worked well on
NVIDIA hw for many years, so this is just a regression there.

Cheers,

  -ilia

On Mon, Dec 14, 2020 at 10:55 AM Mike Blumenkrantz
<michael.blumenkrantz at gmail.com> wrote:
>
> Hi Ilia,
>
> I'm not entirely sure what you're asking here.
>
> This patch doesn't change anything related to gl_Layer reads, it just forces the geometry shader codepath unconditionally when VS_LAYER_VIEWPORT isn't enabled in order to successfully write the gl_Layer output. If anything, this should be beneficial to those nvidia chipsets based on your description since previously the fragment shader would've had nothing to read.
>
>
> Mike
>
> On Mon, Dec 14, 2020 at 10:48 AM Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>
>> Hey Mike,
>>
>> This is in reference to your change
>> https://cgit.freedesktop.org/mesa/mesa/commit/?id=614c77772ac2f48955537efcfefaf0609d6c03e5
>> .
>>
>> A fragment shader should still be able to read gl_Layer even without
>> PIPE_CAP_TGSI_VS_LAYER_VIEWPORT. A frag shader can read gl_Layer any
>> time ARB_fragment_layer_viewport is supported -- I forget the precise
>> conditions for it, but basically any DX10 hardware supports that.
>>
>> However the VS_LAYER_VIEWPORT feature isn't supported on any NVIDIA
>> hardware until fairly late models (GM20x+). So this will regress the
>> majority case (single-layer) on all NVIDIA hw.
>>
>> Can you instead adjust the conditions to allow this for the drivers
>> that implement layer/viewport sysvals in frag shaders? Or just
>> implement ARB_fragment_layer_viewport in zink?
>>
>> Thanks,
>>
>>   -ilia


More information about the mesa-dev mailing list