Re: [1/2] d3dx9_36: D3DXDeclaratorFromFVF returns D3DERR_INVALIDCALL when an invalid declarator is passed.
On 22 September 2010 03:26, Misha Koshelev <misha680(a)gmail.com> wrote:
Credit for the idea of comparing the result of D3DXDeclaratorFromFVF to D3DXFVFFromDeclarator goes to Tony Wasserka: http://repo.or.cz/w/wine/d3dx9TW.git/blob/Merge:/dlls/d3dx9_36/mesh.c (see line 405, and his comparison is vice versa - i.e., D3DXDeclaratorFromFVF to D3DXFVFFromDeclarator) --- That's insane. Any FVF validation should be done before starting the conversion, not afterwards by calling D3DXFVFFromDeclarator().
Henri Verbeet wrote:
That's insane. Any FVF validation should be done before starting the conversion, not afterwards by calling D3DXFVFFromDeclarator().
Thank you Henri for your wonderful feedback. I was wondering if you had any particular suggestions as to the strategy for verification of FVF validity. Right now I am thinking of a simple mask based approach, e.g., extending: d3d9types.h:#define D3DFVF_POSITION_MASK 0x400E d3d9types.h:#define D3DFVF_TEXCOUNT_MASK 0x0f00 as well as other masks, and then doing a simple validation for flags that may be outside this mask, such as: d3dtypes.h:#define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16)) d3dtypes.h:#define D3DFVF_TEXCOORDSIZE2(CoordIndex) (D3DFVF_TEXTUREFORMAT2) d3dtypes.h:#define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16)) d3dtypes.h:#define D3DFVF_TEXCOORDSIZE1(CoordIndex) (D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16)) If you have any other suggestions/comments please let me know. I will try to take a look later today. Thank you! Yours Misha -- View this message in context: http://wine.1045685.n5.nabble.com/Re-1-2-d3dx9-36-D3DXDeclaratorFromFVF-retu... Sent from the Wine - Devel mailing list archive at Nabble.com.
On 22 September 2010 17:29, misha680 <misha680(a)gmail.com> wrote:
Right now I am thinking of a simple mask based approach, e.g., extending: d3d9types.h:#define D3DFVF_POSITION_MASK 0x400E d3d9types.h:#define D3DFVF_TEXCOUNT_MASK 0x0f00 as well as other masks, and then doing a simple validation for flags that may be outside this mask, such as:
That basically comes down to testing for "fvf & (D3DFVF_RESERVED0 | D3DFVF_RESERVED2)". In fact, that would also explain the results for D3DFVF_XYZW, and make the explicit check for that redundant.
Henri Verbeet wrote:
That basically comes down to testing for "fvf & (D3DFVF_RESERVED0 | D3DFVF_RESERVED2)". In fact, that would also explain the results for D3DFVF_XYZW, and make the explicit check for that redundant.
Thank you so much for your helpful feedback. So I take it something like this: http://wine.1045685.n5.nabble.com/file/n2850219/0001-d3dx9_36-D3DXDeclarator... 0001-d3dx9_36-D3DXDeclaratorFromFVF-returns-D3DERR_INVALIDC.txt Thx Misha -- View this message in context: http://wine.1045685.n5.nabble.com/Re-1-2-d3dx9-36-D3DXDeclaratorFromFVF-retu... Sent from the Wine - Devel mailing list archive at Nabble.com.
participants (2)
-
Henri Verbeet -
misha680