An Open Letter to Microsoft: Do the Right Thing for the 3D Game Industry
Total Page:16
File Type:pdf, Size:1020Kb
Attention: This material is copyright 1995-1997 Chris Hecker. All rights reserved. You have permission to read this article for your own education. You do not have permission to put it on your website (but you may link to my main page, below), or to put it in a book, or hand it out to your class or your company, etc. If you have any questions about using this article, send me email. If you got this article from a web page that was not mine, please let me know about it. Thank you, and I hope you enjoy the article, Chris Hecker definition six, incorporated [email protected] http://www.d6.com/users/checker PS. The email address at the end of the article is incorrect. Please use [email protected] for any correspondence. BEHIND THE SCREEN by Chris Hecker An Open Letter to Microsoft: Do the Right Thing for the 3D Game Industry debate is raging in the game development community on an incredibly important topic: 3D APIs for the PC, and specifically, Direct3D versus OpenGL. This debate has its share of contentless flames, but at its core A is an issue that will affect the daily lives of 3D game developers for many years to come. Being one of vendors have voting seats). In the My opinion started to change last 14 these developers, I care deeply about space I have here, I’m not going to be year, after a few important events. how this issue is resolved. To put it able to describe either API, so I’m going First, a bunch of people at SGI got fed very bluntly, I believe it would be best to assume you’re familiar with both up with Microsoft’s game evangelists for the 3D game industry if Microsoft (check the references at the end of the telling developers that OpenGL was canceled Direct3D Immediate Mode article for more information on the inherently slow. They decided to and put all their 3D immediate mode APIs themselves). prove that it was at least as fast as resources behind their OpenGL team. Next, the history: This debate has Direct3D — if not faster — with a This article will give my rationale for been going on for a long time. I demo at Siggraph ‘96. This event got that statement. stopped looking for the original everyone’s attention, and indeed, The API issue has many twists and “Direct3D versus OpenGL” Usenet post- focused it on Microsoft’s implementa- turns. Debating it is like wrestling Jell- ing when I found one (a reply, no less) tion of OpenGL, which was starting to O; every time you think you’ve got it dating all the way back to March 1996. get pretty fast as well. I took an inter- cornered, it squeezes out somewhere The conventional wisdom used to be est in the issue at this time, and start- else. For this reason, I’m going to pro- that OpenGL was inherently slow — ed reading Usenet posts by knowl- ceed very methodically and lay out a too slow for games — and that edgeable 3D engineers from many logical framework for my opinion. I’m Microsoft had to design their own API. I different companies. Eventually, I sure to leave some holes through bought into this wisdom when I was at became convinced not only that which someone can squeeze if they are OpenGL wasn’t inherently slow, but intent on disagreeing with me, but I Where’s Physics, Part 4 ? that it was inherently faster than think I’ll provide a vast preponderance I’m going to take a short break from our Direct3D at the limit, for reasons I’ll of evidence to back up my claims. Note physics series to cover a topic of great detail below. Next, as everyone proba- that most of the ideas I’ll present have importance to the 3D game industry. bly knows, John Carmack of id been stated by other people in various I’ll be back with physics next issue. Software released a position statement places, so I can’t claim to have origi- in which he made known his choice nated many of these arguments myself. of 3D API: OpenGL. He ported Quake Microsoft (and even helped spread it to OpenGL to prove that the API has there) about two or three years ago. In what it takes for the highest end game Background fact, everyone I knew was convinced programming. Finally, Microsoft irst, some clarifications: When I OpenGL was big and slow, and the only announced plans to update Direct3D F refer to Direct3D in this article, I solution for games was a new and dif- to address some of the issues people mean Direct3D Immediate Mode, not ferent API. In retrospect, I realize that were raising. Retained Mode. Retained Mode will be didn’t understand the technical issues; That’s the history in two paragraphs. useful to some developers, but high- what’s worse, I didn’t know that I did- You’ll notice I keep using the term end 3D games probably won’t use it n’t understand the issues. Even worse “inherent” with regards to perfor- since they need more control over yet, no one within earshot understood mance. I should describe what I mean database traversal and culling. Just to the technical issues well enough to by this. When I say API A is “inherent- be totally clear, Direct3D is a explain why we were all wrong. The ly faster” than API B, I mean that on Microsoft-designed API; OpenGL was people who really understood OpenGL the vast majority of hardware, the dri- originally designed by SGI, but is now were in the workstation business at this ver and application writers for A will handled by an independent time, and didn’t realize 3D games were have more opportunities for optimiza- Architecture Review Board (the ARB, about to become an important market tions, and programs running on top of where Microsoft, SGI, and several other segment. A will be faster in general, than equiva- http://www.gdmag.com APRIL-MAY 1997 GAME DEVELOPER BEHIND THE SCREEN lent programs running on B. So, clearly Performance Direct3D, I’ll still cover the specific a bit of hand waving and faith is technical reasons that OpenGL is an involved in saying one API is inherent- et’s start with performance. The inherently faster immediate mode API. ly faster than another. Still, I think it’s L first and most telling thing about If you already agree that OpenGL is possible to take knowledge of the prob- the performance issue is that no one at inherently as fast or faster than lem domain and make a convincing Microsoft (or anywhere, actually) has Direct3D and you just want to see all case for “inherent speed” based on been able to give me a single technical the other overwhelming reasons why things like memory bandwidth and reason why Direct3D is even OpenGL’s OpenGL is superior, you can skip this access patterns, bus speeds, existence equal in 3D performance, let alone its whole next section. It’s going to be proofs embodied in current high-end better. I’m talking about technical heavy reading — remember, I need to hardware, and so on. The inherent engineers on the Direct3D team; when try to prevent the Jell-O from squeez- speed is important, since we don’t asked point blank for an architectural ing out. want to run into performance ceilings reason why Direct3D is (or could be) The performance comparison has imposed by our API. inherently faster than OpenGL, they two aspects. First, we’ll compare This argument takes place on many admit they have none. The only people OpenGL to Direct3D execute buffers. levels. I’m going to show that OpenGL who routinely say Direct3D is faster for Then, we’ll compare OpenGL to the is inherently faster than Direct3D. games are the Microsoft game evange- new Direct3D DrawPrimitive API. However, even if they’re just equal in lists, and they’re marketing people, not performance, the conclusion that technical engineers. Microsoft con- 16 OpenGL is superior still holds, as you’ll stantly refers to Direct3D as being Execute Buffers see. I’m reminded of one of Dave “designed for games,” but when hen comparing OpenGL’s out- Baraff’s dynamics papers that I read pressed, no one seems to be able to Wput model to Direct3D’s execute recently. To paraphrase, “We can always come up with how that translates into buffers, we must consider the three solve this problem because A is never actual performance improvements over types of 3D vertex data: static data, singular, but even if it is singular we can OpenGL. where the vertices of the model don’t solve the problem anyway for this other Although this lack of technical change relative to one another (like the reason.” response is pretty damning for fuselage of an airplane or the arm of a hierarchical model); dynamic data, sible — for the driver writer who’d like the card by the CPU. In DMA-based where most vertices change every frame to optimize for performance. Direct3D hardware, the 3D card starts up an (like undulating water, morphing geom- simply does not allow 3D hardware asynchronous memory transfer to read etry, or a continuous-skinned animating manufacturers the flexibility they need the data directly from main memory figure); and finally, partially static data, to optimize static vertex data render- without needing the CPU. There are, of which is a mix of the previous two.