Archived

This topic is now archived and is closed to further replies.

Why DirectX can fill a triangle so fast?

This topic is 5624 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Because the filling is done by a completely different microprosessor while your app goes on doing ''app'' things

Over simplified, when you call DrawPrimitive, DX downloads some data to the video card and then returns. While your app is executing the next bunch of code the microprocessor on the card is doing all the work.

_____________________________________________
Come join us on IRC in #directxdev @ irc.afternet.org

Share this post


Link to post
Share on other sites
quote:
Original post by CrazedGenius
Because lots and lots of really smart people built it specifically for that purpose.


I like this answer better


_____________________________________________
Come join us on IRC in #directxdev @ irc.afternet.org

Share this post


Link to post
Share on other sites
Algorithms.
Also, how does it work so fast when it is in software mode?
Algoirthms.
Better algorithms win out over faster hardware any day.
Put them together, and you get a winning combination.
Now go out there and win one for the team!

Share this post


Link to post
Share on other sites
Hmm... Speed can be relative according to the viewer... And, it''s relative to what you think is fast.
Light on a vacuum goes at aprox. 300.000km/s (correct me if I''m wrong), and DirectX doesn''t even get close to that speed when filling polygons... So, we can say filling 22 millon polygons a second is fast, but.. Is it really fast? What is fast? If a GF2 can fill 22mil tris/s and a GF4 can fill three times more, is the GF4 uber-fast or is the GF2 slow?

I think you will never get the real answer since there is another question to be answered before. What is fast?

Share this post


Link to post
Share on other sites
Oh come on Matux
Don''t play with words.

I can say your speed is 0 even you are running at 100km/h.
Why? because your speed is 0 relative to your own body.

I asked the triangle filling speed because I am curious how the tool(directx) works.

I really want to see the source code of this tool, and how it interact with the hardware.

speed speed speed
fast fast fast

Share this post


Link to post
Share on other sites
quote:
Original post by JoeZ
I really want to see the source code of this tool, and how it interact with the hardware.



No you don''t. Most of the speed really comes from the hardware. You are essentially asking to see the source code of the firmware and the driver. I''m guessing that you would learn absolutely nothing from that.

Share this post


Link to post
Share on other sites
quote:
Original post by JoeZ
Oh come on Matux
Don''t play with words.

I can say your speed is 0 even you are running at 100km/h.
Why? because your speed is 0 relative to your own body.

I asked the triangle filling speed because I am curious how the tool(directx) works.

I really want to see the source code of this tool, and how it interact with the hardware.

speed speed speed
fast fast fast


Hehe, it was a good answer . Your question is still wrong though, AFAIK, DirectX just tells the Hardware''s driver "Fill that polygon!" then the driver uses the video card to fill it.

Share this post


Link to post
Share on other sites
want to see how d3d works (not directx since you care only about the 3d part and not the rest) then look at opengl or mesa. then look at driver source code for linux that implements opengl (because at the core opengl and d3d do the same thing, transform user data to a format that the video card can deal with).

for software rendering, there are plenty of software renderes you can look at on the net. they sue specilized asm triangle fillers and techniques to reduce fillrate required by trying to prevent redundent pixels from being drawn.

d3d and opengl are nothing more then an abstraction layer over the drivers much like the driver interface is an abstraction layer at the OS level to the actual hardware.

if you are serious, go online and search for gpl linux drivers for varoius video cards that allow accelerated 3d displays. look at how glide works (the lowest of the low level 3d apis) unders linux.

then you get to see how the data gets transformed for the use on the card. you dont get to see how the card actual draws the data, and unfortunatly without emulation technology and firmware that the card runs you wont see how the actual triangle is filled.

the reason its fast?

simple, the video card is specifically designed to fill triangles. its designed to map data in one are of video memory to another, skewing, rotating, scaling, and clipping as required to draw what is requested of it. there is no magic. the hardware on the card is just good at filling triangles. d3d or opengl dont do much beyond sending the data to the driver which is why its the driver that affects performence not the api.

you wont see the source code to d3d or any other portion of directx. its a closed source project by MS, and like all closed source project, the source code is for the ppl working on the code only. in other words, not you or other ppl in the general public. you could look at wineX as i think they actually implement directx now as part of its simulation of windows on linux, however they may still be just loading windows dlls. i have not kept up with the project so i dont know. have a look if your interested.

you wont learn much. i suggest writing a software engine instead.

Share this post


Link to post
Share on other sites