[Mesa-dev] depth writing and missing something

José Fonseca jfonseca at vmware.com
Thu Sep 30 09:48:37 PDT 2010


On Thu, 2010-09-30 at 07:57 -0700, Brian Paul wrote:
> On 09/29/2010 07:34 PM, Dave Airlie wrote:
> > So I've been playing with stencil writing on r600, and it lead me to
> > examine the depth writing.
> >
> > So at the moment in gallium if we are writing to depth via DrawPixels,
> > we construct a fragment program that samples from a texture.
> >
> > TEX OUT[0].z, IN[1], SAMP[0], 2D
> >
> > Now from what I can see the format we pick to sample from is
> > Z24_UNORM_S8_USCALED, which from the u_format.csv file seems to say it
> > will put the results into X and Y components.
> 
> I think what the u_format.csv file says isn't totally consistant with 
> what the table at the bottom of tgsi.rst says.
> 
> We never did nail down the Z/Gallium cell in the later table.
> 
> To be consistant with what the u_format.csv file says, I think the 
> tgsi.rgs table needs to be updated to read:
> 
>   Texture Comps   Gallium        OpenGL               Direct3D 9
> +--------------+--------------+--------------------+--------------+
> | Z            | (Z, ?, ?, ?) | (z, z, z, 1)*      | (0, z, 0, 1) |
> +--------------+--------------+--------------------+--------------+
> | ZS           | (Z, S, ?, ?) | (z, z, z, 1)*      | tbd          |
> +--------------+--------------+--------------------+--------------+
> | S            | (?, S, ?, ?) | undefined          | tbd          |
> +--------------+--------------+--------------------+--------------+
> 
> What do people think about that?

Sounds good to me.

I think the last two cells underneath Direct3D 9 should be "(0, z, 0,
1)" and "undefined".

> > Now if we sample from
> > the X and Y components and the texture dest writemask is Z, I can't
> > see how any value arrives in the right place. It seems to work but I'm
> > a bit lost where the magic is.
> >
> > I'd have expected there to be swizzles in the sampler but I can't see
> > them being set to anything special either.
> 
> I think we've just been getting lucky by the TEX instructions 
> returning (Z,Z,Z,?).
> 
> If we go with the table changes above, we need to either specify a 
> sampler swizzle or do something like this in the shader:
> 
> TEX TEMP[0].x, IN[1], SAMP[0], 2D
> MOV OUT[0].z, TEMP[0].xxxx;

Yes. I thought the state trackers were already doing that, but
apparently not.

Jose



More information about the mesa-dev mailing list