[Mesa-dev] [PATCH 26/35] meta: Use common GLSL code for blits

Roland Scheidegger sroland at vmware.com
Tue Feb 4 21:06:50 CET 2014


Am 04.02.2014 13:19, schrieb Marek Olšák:
> On Tue, Feb 4, 2014 at 10:29 AM, Rogovin, Kevin <kevin.rogovin at intel.com> wrote:
>>
>>
>>> I don't believe our hardware can support GL_ARB_shader_stencil_export.
>>> The render target write message can take RGBA, depth, and sample masks,
>>> but not stencil.  Without that, it's not at all obvious how to implement it.
>>
>> There is a terrible hack-ish way to do it, but I stress the word terrible and hackish and
>> it may not work correctly depending on the tile modes and all that fun.
>>
>> Here goes. Assuming the depth-stencil is D24S8 we can do this and that the
>> tile modes work out:
>>
>> Bind src depth-stencil as RGBA_8UI, the depth should be in RGB and the stencil in A.
>> Bind the dst  depth-stencil as RGBA_8UI as well. Fragment shader is simple unfiltered
>> read and write to dest. If not writing to depth or stencil, mask our RGB or A respectively.
>>
>> The above does not handle MSAA->non-MSAA. Going further, it can be done in general
>> on *paper* with GL_ARB_texture_view if that is extended to allow D24S8 to be on the same
>> castable category as RGBA_8UI. The main catch is how the tile modes work out, i.e. if the
>> tile mode for a D24S8 is "compatible" with a RGBA_8UI render target.
> 
> This is how r300g does it. It blits D24S8 as RGBA_UNORM. Gallium has
> texture views and it has no limitations on how you can change the
> format, so it's pretty trivial. r300g changes the format, then calls
> our "meta" code (u_blitter).
> 

It is not actually obvious this is something which should work in
gallium in that way. The docs say the format must be "compatible"
without saying much else (obviously, same number of block bits is a
requirement). u_format has some function which would check if formats
are compatible (albeit for a different purpose) and it wouldn't consider
your example compatible.
The intention of sampler views is it should allow casting allowed by the
APIs (d3d10, whatever GL extension).
The definition of this is definitely loose.

Roland


More information about the mesa-dev mailing list