Hi
-> SetFVF()... sets FVF -> GetVertexDeclaration() ... vdecl is null, but there is an FVF, grab the FVF, and make a declaration out of it. Store the declaration, and return it to the caller with refcount 1. -> GetVertexDeclaration() again - just grab the stored declaration and follow regular code path, increasing the refcount.
Now, if the caller does not release the ref, it will leak memory [ because d3d certainly doesn't free it - not on SetFVF, or on SetVertexDecl ]. On the other hand, if the caller does release it, will it cause damage (1) on subsequent get calls? (2) at draw time... and how can we test that.
3 tests I can think of:
* If you release the decl, does GetVertexDecl return a different pointer? * If you call SetFVF with a different FVF, do you get a different decl pointer? * If you call SetFVF, GetVertexDecl and AddRef the decl, then SetFVF again with a different FVF, does the refcount of the previously returned declaration change? What happens if you allocate a huge amount of memory and fill it with garbage? Can you still access the vertex declaration?