On Tue, 2010-03-02 at 03:26 -0800, Luca Barbieri wrote:
> I've been looking at shader semantics some more, and I'm a bit
> surprised by how the svga driver works.
> It seems that an obvious implementation of a DirectX 9 state tracker
> just won't work with the svga driver.

I don't think anybody has tried hooking it up - so far the primary
purpose of the svga gallium driver has been GL support, but thinking
about it you're probably right.

> In SM3, vertex/fragment semantics can be arbitrary (independent of
> hardware resources), but indices are limited to a 0-15 range.
> 
> A DirectX 9 state tracker must convert those to TGSI_SEMANTIC_GENERIC.
> How does the VMware one do that?
> Assuming that it maps them directly, this means that the driver must
> support GENERIC semantic indices up to a number that varies between
> about 200 and 255.

The details of the closed code aren't terribly important as they could
always be changed.

But you're right that any DX9 state tracker would have to try to pack
all or almost all the DX9 semantics into the TGSI GENERIC range.  The
simplest implementation would end up using 0..255.

> The problem is that the vmware svga driver, as far as I can see,
> doesn't support indices greater than 15.
> This is caused by the fact that it maps all GENERIC semantics to
> SVGA3D_DECLUSAGE_TEXCOORD, and the index bitfield in the svga virtual
> interface only supports 4 bits.

Indeed, good point.  That's basically a shortcoming of the current svga
gallium driver which needs to be addressed somehow.

> In other words, SM3 under VMware with arbitrary semantics (allowed by
> SM3 and other drivers) really seems broken, for a straightforward
> DirectX9 state tracker implementation.
> 
> The only way it can work now is if the DirectX 9 state tracker looks
> at both the vertex and pixel shaders, links them, and outputs
> sequential semantic indices.
> 
> It seems to me that the svga driver should be fixed to map GENERIC to
> *all* SM3 semantic types, ideally in a way that reverses the SM3 ->
> GENERIC transformation done by the DX9 state tracker.

Agree, though I don't think reversibility is necessary.

> Doing this requires to specify a maximum index for
> TGSI_SEMANTIC_GENERIC which is very carefully chosen to allow 1:1
> mapping with SM3, so that DirectX 9 state trackers have enough indices
> to represent all SM3, and the svga driver can fit all indices in the
> SM3-like semantics of the VMware virtual GPU interface.
> 
> The correct value in this case seems to be 219 = 14 * 16 SM3 semantics
> - 5 for COLOR0, COLOR1, PSIZE0, POSITION0, FOG0 which have specific
> TGSI semantics which they need to mapped to/from.

Agree, though I'd opt for 255 as a round number.

> I'm looking at this because this seems the strictest constraint on
> choosing a limit for TGSI_SEMANTIC_GENERIC indices.
> The other constraint is due to r600 supporting only byte-sized
> semantic/index combinations, which is less strict than SM3.
> 
> BTW, glsl also looks artificially limited on svga, as only 6 varyings
> will be supported, due to it starting from 10.

Agree, well spotted.  I'll take a look at that.

Keith


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to