Re: A beginner in DirectX - A question about DrawIndexedPrimitive

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Richard [Microsoft Direct3D MVP] <legalize+jeeves@xxxxxxxxxxxxxxxxx> schreef
in berichtnieuws eu9ocRLwHHA.4800@xxxxxxxxxxxxxxxxxxxxxxx

Hello Richard ,

Are you sure about that ? 'Cause in that case the function would *allso*
be able to easily calculate that value ...

It *could* calculate it, but that would require a pass over all
the indices. Making unnecessary passes over the data is not
a good thing for a high-performance API.

You're right. But it has to be calculated *somewhere*. Maybe I'm just
lazy, but I would expect a (helper?) function doing it for me, as whomever
made the DirectX API know best about what the actual value should become.

If the batch encompasses thousands of triangles, making an extra
pass over the index buffer would incur cache misses and go even
slower, when the application could just pass the data to the API.
D3D has to serve the master of best performance as much as it
can, so it doesn't make extra passes over data just to make things
a little easier for the programmer.

Thanks. What you describe here is about the only reason I could come up with
myself too. :-)

It however does leave the question what the calculation should exactly be :
An indication so the function can buffer as many triangles as the indices
are actually trying to draw ? Or a buffer that can hold all used vertices
from the first one used to the last one used, and all in between.

If the last, why does the function talk about primitives instead of vertices
? What logic lies behind me having to do calculations transforming a number
of vertices back to a number of primitives, when the underlying software
probably needs to know the exact buffer, in bytes, needed to store that kind
of primitive ?

I just can't seem to wrap my head around it I'm afraid.

Regards,
Rudy Wieser



.



Relevant Pages