ID3DXSprite SetTransform

Started by
2 comments, last by nhatkthanh 14 years ago
I couldn't find any more information or docs regarding how DirectX implementing ID3DXSprite SetTransform, so if someone can shed some light on this, I would greatly appreciated. Consider this example where you have a large number of sprites, each with their own transformation. When it's time to draw, you set transform for each and draw for each then finally flush. for each sprite do sprite->SetTransform( ... ); sprite->Draw ( ... ); end sprite->Flush( ... ); ID3DXSprite batch all this sprite draw up and make the DIP call when you flush, but what I'm wondering is how SetTransform work, does it transform the sprite on the CPU at the time SetTransform and Draw are called? That way all vertices are transformed by the time it's send to the GPU. Is my assumption on this correct? If not can someone gives more details on how the SetTransform gets batch up? Thanks.
Advertisement
Quote:Original post by nhatkthanh
ID3DXSprite batch all this sprite draw up and make the DIP call when you flush, but what I'm wondering is how SetTransform work, does it transform the sprite on the CPU at the time SetTransform and Draw are called? That way all vertices are transformed by the time it's send to the GPU. Is my assumption on this correct? If not can someone gives more details on how the SetTransform gets batch up?
I would assume that the vertex transformation is done on the CPU, using the most optimal CPU instruction set available; SSE, 3DNow!, etc (Which the D3DX library already does).
The reason being that I expect that doing the vertex transform on the CPU for 4 vertices is likely to be considerably more lightweight than making several DIP() calls.

The easiest way to find out is to make a test app that does a few SetTransform() and Draw() calls, and then run that through Pix and see if it results in a single DrawIndexedPrimitive() call.
Quote:Original post by nhatkthanh
does it transform the sprite on the CPU at the time SetTransform and Draw are called?


Yup.

Thanks guys.

This topic is closed to new replies.

Advertisement