Sorry, I've should have drunk my morning coffee before replying. You're refferring to writing and not reading...
Anyway, my comment for u_format still stands. But back to your example, it works because out[0] has position semantic. When writing to depth textures, their are bound as depth stencil buffer. Not in the color buffer. And whatever gets written to the z channel of the output position register will be used as the depth value. Jose ________________________________________ From: [email protected] [[email protected]] On Behalf Of Jose Fonseca [[email protected]] Sent: Thursday, September 30, 2010 7:28 To: Dave Airlie; [email protected] Subject: Re: [Mesa-dev] depth writing and missing something There are two things to consider: u_format.csv description for depth stencils is a bit special for practical reasons, and pipe_sampler_view swizzles. Several functions in u_format_xxx.c need to be able to read/write stencil, and this is why u_format.csv describes depth stencil's swizzles as producing Z S x x. But the stencil channel will never be present when the texture is read as RGBA tuple. Sampling from a depthstencil texture should always produce Z Z Z 1 or Z 0 0 1, even before any sampler swizzles are applied. I think Brian documented this somewhere in gallium/docs/ but I can't find it now. At any rate, provided the first channel has z, then the state tracker will specify how he wants the other channels to be filled in the pipe_sampler_view' swizzles. Effectively, the gallium spec could say that sampling from depth textures should match (Z x x x). This is my understanding of the current state. We could polish this more a little. Jose ________________________________________ From: [email protected] [[email protected]] On Behalf Of Dave Airlie [[email protected]] Sent: Thursday, September 30, 2010 2:34 To: [email protected] Subject: [Mesa-dev] depth writing and missing something 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. 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. Dave. _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
