Diff b/t DirectX and Drivers?

MichaelD

Lifer
Jan 16, 2001
31,528
3
76
Yo, At. :)

In my office, I'm known as "the hardware geek." I'm the guy with the info on building PCs. OK, whatever.

I was asked today "What does DirectX do?" I answered that it was Microsoft's interface b/t the operating system and the multimedia hardware, such as video and sound cards.

I was then asked, "But isn't that what the driver does?"

:confused: <--me was
/head explodes <--it did

We all know that a driver is a piece of software that tells a piece of hardware how it works, what it's limits are, how to communicate w/the OS, etc.

So, this begs the question: What IS the difference b/t DirectX and a driver (say for a video card)?

Is it that the DRIVER is device specific and DX is OS specific?
 

homercles337

Diamond Member
Dec 29, 2004
6,340
3
71
AFAIK, its more of an API between the OS and hardware--optimized for specific hardware. This is why you see hardware with support for directX feature X, Y, or Z.
 

bersl2

Golden Member
Aug 2, 2004
1,617
0
0
Originally posted by: homercles337
AFAIK, its more of an API between the OS and hardware--optimized for specific hardware. This is why you see hardware with support for directX feature X, Y, or Z.

Programs make subsystem (graphics, sound, network, etc...) API calls. These libraries make calls to the driver, which talks with the hardware. The performance enhancements come from the design and refinement of hardware, drivers, and programs, not really from the design of the API, which mostly affects ease of use to the programmer.
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Originally posted by: bersl2
Originally posted by: homercles337
AFAIK, its more of an API between the OS and hardware--optimized for specific hardware. This is why you see hardware with support for directX feature X, Y, or Z.

Programs make subsystem (graphics, sound, network, etc...) API calls. These libraries make calls to the driver, which talks with the hardware. The performance enhancements come from the design and refinement of hardware, drivers, and programs, not really from the design of the API, which mostly affects ease of use to the programmer.

Yes. The idea behind DirectX was to allow developers to have a "direct" line of communication with the hardware. If abstracted enough, a developer could use the same code and support a slew of different manufacturers (unlike the SoundBlaster/AdLib proprietary support of the DOS days).
 

MichaelD

Lifer
Jan 16, 2001
31,528
3
76
Wow, really great, technical answers! Thanks guys. Keep it coming...I'm filling up the spaces in my brain w/this info. :Q
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Like they said, it's an API = application programming interface. It defines an abstract video card and sound, but in a very detailed, low-level way. It also allows supporting some of the features of the abstract cards in software if the card lacks hardware for that feature.

The original Win32 graphics API also defines an abstract video card, but in a very high-level, simplistic way: essentially a circa 1987 dumb frame buffer that only supports fonts and bitmaps without even features like syncing buffer refreshes to the monitor's vertical blank interval to prevent "tearing."

DirectX defines a known set of commands and features that a programmer can write to, the video card driver then takes each command and translates it in to whatever command or set of commands a specific video card uses.

A programmer might use the DirectX command I just made up, "LoadTriangleStrip( triangle_array, count )" and

video card driver 1 might translate this into something like:
nVLoadTStrip( count, triangle_array )

while video card driver 2 might translate it into
for ( i = count -1 ; i >= 0 ; i -- )
{
PushTriangle( triangle_array [ i ] ) ;
}
TriangleStripFinish () ;

... but the programmer doesn't need to know about either of them.
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Basically what everyone else has said. DirectX is a set of APIs, so DirectX could include a function called "drawPolygon", and when a programmer writes a game using DirectX, he has access to it's APIs, including "drawPolygon". So the programmer writes a program that uses drawPolygon. When that program runs, it sends the drawPolygon to the video card. Since the video card has drivers that support DirectX, the driver sees the command "drawPolygon" and tells the video card to turn on it's T&L engine, then load some data into memory, and then output it to the screen, or whatever needs to be done to draw a polygon.

Now, since you have these seperate layers, you have the ability to upgrade your video card. You can replace your card with another one, and the new driver will be able to make the translation from "drawPolygon" to whatever specific instructions the new hardware needs. This way, the guy writing the game only has to write it once, and it'll work with any video card that has DirectX drivers.
 

MichaelD

Lifer
Jan 16, 2001
31,528
3
76
Thanks, Dave and notfred. :) I'm copy/pasting your responses into an email that I'm sending to myself at work to show said coworker.

You guys explained it very well. Even I understand it. :D