-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 26.07.2011 um 11:29 schrieb Michael Mc Donnell:
Duplicating the code for 16 and 32 bit indices looks a bit ugly. Maybe you can use inline functions to read and write values from the proper buffer? The other possibility, which the ddraw blitting code uses is to write a sort of template as a macro and then generate both versions, but I don't like that idea.
Yes I agree it's ugly. I've added the functions read_ib and write_ib to handle 32 bit indices. Does that look like a good solution to you too?
Looks OK to me.
Wrt the D3DDECLTYPE epsilon, it may be more efficient to scale the epsilon and calculate the diff and comparison as UBYTEs rather than floats. You'll need the diff functions for the other types like *BYTE*, *SHORT* anyway. Also tests would be helpful here, especially how the epsilon is treated in normalized values like D3DCOLOR and UBYTE4N and how it is treated in non-normalized values like UBYTE4.
Ok I'll look into that and get back to you later.
Wrt the usage/index fields, what happens when a combination that isn't supported by the fixed function pipeline is used, e.g. NORMAL3 or POSITION5? Those are valid in a vertex declaration and can be used with shaders.
It works because the code does not check the UsageIndex field, except for differentiating between DIFFUSE and SPECULAR. I've added test 13 that shows this (tested on Windows 7 and Linux).
You may still get into trouble with something like TEXCOORD10
I'd recommend to change test 13(or add a new one) that tests a TEXCOORD > 7 and COLOR > 1