On Wed, 2010-02-03 at 01:42 -0800, Luca Barbieri wrote: > I tested this on Windows, using nVidia driver 195 on nv40, and it > seems we are all partially wrong. > > SM3 does indeed allow semantics unrelated to hardware resources. > However, the semantic indices for any semantic type must be in the > range 0-15, or D3DX will report a compiler error during shader > compilation: > error X2000: syntax error : unexpected token 'dcl_texcoord16' > > This is further confirmed by the following lines in d3d9types.h: > #define MAXD3DDECLUSAGE D3DDECLUSAGE_SAMPLE > #define MAXD3DDECLUSAGEINDEX 15
> I would guess that these two 4-bit values are combined into an 8-bit > value that is then passed directly to hardware like r600 which > supports 8-bit semantic indices in hardware. Further down that file they define the binary shader tokens for DX9, which match your guess: // For dcl info tokens requiring a semantic (usage + index) #define D3DSP_DCL_USAGE_SHIFT 0 #define D3DSP_DCL_USAGE_MASK 0x0000000f #define D3DSP_DCL_USAGEINDEX_SHIFT 16 #define D3DSP_DCL_USAGEINDEX_MASK 0x000f0000 Not for the first time, hardware capabilities directly match what was required to implement the DX version of the era. > Is this the case on Radeon? > > Is the 8-bit semantic table a feature of r300 too or only of r600+? At some point this would have been introduced to hardware to remove the headache from software of dealing with the DX9 semantic scheme. I don't know at what point in the hardware/driver evolution it became important enough to devote silicon to. > In light of this, it may make sense to do some range limitation ourselves too. > In particular, a good plan could be limiting all semantic indices to > 0-15, except GENERIC, which could support a 0-127 range. > This would allow to both directly take advantage of Radeon hardware, > and let drivers that need to remap in software do so with direct > lookup in a small array. This level of restriction is fine with me. It seems to allow us to capture all the important APIs - GL and DX9 clearly, and DX10 seems to match outputs to inputs by position, without needing to examine semantics. Also, we've been proliferating semantic names, one each for various system values. It sounds like we might want to consolidate them down designated indices within a single name. Thanks for looking into this Luca, Keith ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev