OpenGL 3 & DirectX 11: The War Is Over

Multi-Threaded Rendering

Multi-threaded rendering? "But," you’re saying, "we’ve had multi-core CPUs for several years now and developers have learned to use them. So multi-threading their rendering engines is nothing new with Direct3D 11." Well, this may come as a surprise to you, but current engines still use only a single thread for rendering. The other threads are used for sound, decompression of resources, physics, etc. But rendering is a heavy user of CPU time, so why not thread it, too? There are a several reasons, some of them related to the way GPUs operate and others to the 3D API. So Microsoft set about solving the latter and working around the former.

First of all, threading the rendering process seems attractive at first, but when you look at it a little closer, you realize that, after all, there’s only one GPU (even when several of them are connected via SLI or CrossFire, their purpose is to create the illusion that there’s only a single, virtual GPU) and consequently only one command buffer. When a single resource is shared by several threads, mutual exclusion (mutex) is used to prevent several threads from writing commands simultaneously and stepping on each others’ feet. That means that all the advantages of using several threads are canceled out by the critical section, which serializes code. No API can solve this problem—it’s inherent in the way the CPU and GPU communicate. But Microsoft is offering an API that can try to work around it. Direct3D 11 introduces secondary command buffers that can be saved and used later.

So, each thread has a deferred context, where the commands written are recorded in a display list that can then be inserted into the main processing stream. Obviously, when a display list is called by the main thread (the “Execute” in the “Multi-threaded Submission” diagram below) it has to be ascertained that its thread has finished filling it. So there’s still synchronization, but this execution model at least allows some of the rendering work to be parallelized, even if the resulting acceleration won’t be ideal.

Another problem with the previous Direct3D versions had to do with creation of resources—textures, for example. In the current versions of the API (9 and 10), resource creation had to take place in the rendering thread. Developers got around the problem by creating a thread that read and decompressed the texture from the disk and filled the resource (the Direct3D object), which itself was created in the main thread.

But as you can see, a large share of the workload was still on the main thread, which was already overloaded. That doesn’t ensure good balance, needed for good execution times. So, Microsoft has introduced a new interface with Direct3D 11: a programmer can create one Device object per thread, which will be used to load resources. Synchronization within the functions of a Device is more finely managed than in Direct3D 10 and is much more economical with CPU time.

Create a new thread in the US Reviews comments forum about this subject
This thread is closed for comments
109 comments
Comment from the forums
    Your comment
  • Gatekeeper_Guy
    Cool, but it will be a few years before we see at DX11 graphic card on the market.
    2
  • stridervm
    Sadly, I agree by the author's opinions. Not simply for, but because it still give away the idea that PC gaming cannot be considered serious..... Unless you're using Windows, which is proprietary, the only viable alternative cannot be used because of the fear of losing compability. I just hope this can be remedied before Microsoft becomes.... Unreasonable and becomes power hungry..... If it isn't already. Look at how Windows systems cost now compared to the the alternative.
    0
  • johnbilicki
    DirectX 11 will be available on Windows 7 and Vista? Great news indeed! Normal noobs will be able to own super noobs who are standing around looking at over-detailed shrubs.

    As for real gamers, we'll stick with XP until either Microsoft gets smart and clones XP and only adds on Aero or OpenGL gets it's act together and Linux becomes a viable gaming platform. It would be nice if it became a viable anything-other-then-a-web-server viable platform though. Linux gurus, feel free to let us know in sixty years that I won't have to explain to my grandmother how to type console commands to install a copy of Opera.

    OpenGL can go screw backwards compatibility, look what it's done to (competent) web designers who are stuck dealing with Internet Explorer.

    All the bad news about DirectX, OpenGL, and DRM makes me wonder if these companies want us to pirate the hell out of everything. At this rate "next generation" consoles might actually become the next generation consoles!
    -18
  • jimmysmitty
    Gatekeeper_GuyCool, but it will be a few years before we see at DX11 graphic cardhttp://en.wikipedia.org/wiki/Video_card on the market.


    I thought the article said that DX11 is supposed to be compatable with previous gen hardware.

    I know the Gemoetry Shader with Tesselation is already in all of the ATI Radeon HD GPUs so thats one thing it will support.

    But no SP 5.0 support. I have heard that Intels GPU, Larrabee will support DX11. So that would mean late 2009/2010 will have at least one and that should mean that ATIs HD5K series and nVidias next step should includ support if they were smart and jumped on the wagon early.
    1
  • Anonymous
    OpenGL may not have gotten the changes it needed to compete with DirectX as a gaming graphics API. But then you have people like Tim Sweeney telling us that graphics APIs are not going to be relevant that much longer (http://arstechnica.com/articles/paedia/gpu-sweeney-interview.ars).

    Direct3D 10 has changed very little in the industry so far, predictably only a very small number of games us it. And those who do can do most of it on Direct3D 9 as well. Maybe MS learned by now that releasing a new API on only the latest platform is a huge mistake, but it will still be a while before people will adapt their new API. And if Tim Sweeney's predictions come true, it will likely not happen at all.
    2
  • martel80
    johnbilickiLinux gurus, feel free to let us know in sixty years that I won't have to explain to my grandmother how to type console commands to install a copy of Opera.
    I have been able to "accidentally" (because I'm no Linux guru, you know) install Opera through the Synaptic Package Manager on Ubuntu. So please, stop talking nonsense. :)
    The process was a bit different but overall faster than under Windows.
    3
  • Anonymous
    dx 10 may not appear major but for devs its actually is.. no more checking cap bits.. that is a big improvment. dx10 is alot more strict in terms of what the drivers should do and thats good. doing away with fixed functions is also great

    however hardware tesselation if huge.. dx 11 also allows for hardware voxel rendering /raymarching thru compute shaders and alot of other stuff.. as apis become more general [as dx 10/11 are] im sure the pace of new apis: will slow down, but that's not a indicator that pc gaming is dying (un informed people have claimed that the pc is dead since the ps1)

    as for the windows/other platforms discussion, it is not the fault of microsoft that there is no viable alternative on other platforms. if someone chose to compete with microsoft, they could. but no one seems willing. what really should be done is a port/implementation of dx11 in open source..

    however, in the cut throat buisness of game engines[epic vs whats-their-name anyone?] and gpu drivers, i seriously doubt that open source systems will ever be at the forefront of gaming
    1
  • phantom93
    DX11 is compatiable with DX10 hardware. It should work when it is released unless they have bugs.
    1
  • spaztic7
    From my understanding, all HD4800 serious are DX11 compatible... and the HD4800 line is ray tracing compatible at ray tracings frame cap. I do not know about the 4600 line, but I don’t see why they wouldn’t be.
    1
  • GAZZOO
    ow PC gameing is dieing allright the major game componies are starting to squeese out the PC games from there production list useing the excuse that they are loosing money through pirecy but what they are realy doing is cutting out one version forcing PC gamers to evolve into console players
    And from this article I get the impresion that microsoft has a hand in it aswell by making sure that the console games end up running better or as good as PC games
    I think if the origenal Opengl was alowed to proceed years ago and if the follow up was taken and there wasnt any sabotage happening then the PC and its performance with mutly CPU GPU and the tecnolegy evolving with the progamers and propper apis in this area would have left the console market in the shade but this way Microsoft is eliminating other similar competion Apple
    To cut to the chace Apple and OpenGl is getting the Microsft squeese and who has an interest in a console product :-)
    I guess I might be one of the old dinosorse but I still am a PC gamer through and through even though I am grampar foda I love buiding PC units and playing well I havent been to a net game in a couple of years Pizza and beer he he heee But Il be buggered If I will lie down and die because of big buisness
    Gazza
    -10
  • romans11
    johnbilickiLinux gurus, feel free to let us know in sixty years that I won't have to explain to my grandmother how to type console commands to install a copy of Opera.


    If your Grandmother is still around in 60 years, I will personally install Opera (if it is still around) for her.
    2
  • kschoche
    al3891:
    "as for the windows/other platforms discussion, it is not the fault of microsoft that there is no viable alternative on other platforms. if someone chose to compete with microsoft, they could. but no one seems willing. what really should be done is a port/implementation of dx11 in open source.."
    Have fun making a viable open alternative to a closed source api that runs really close to the closed source kernel of the closed source OS. To even get access to the necessary functions you'd have to cripple your efforts with M$ bs.
    3
  • cjl
    stridervm Look at how Windows systems cost now compared to the the alternative.

    OK. A decent windows gaming machine can be had for around $800, the same one in Linux is $700, and you can't buy a mac for that price other than the pitiful (for anything like games) mac mini.
    7
  • spaztic7
    Anonymous said:
    ow PC gameing is dieing allright the major game componies are starting to squeese out the PC games from there production list useing the excuse that they are loosing money through pirecy but what they are realy doing is cutting out one version forcing PC gamers to evolve into console players
    And from this article I get the impresion that microsoft has a hand in it aswell by making sure that the console games end up running better or as good as PC games
    I think if the origenal Opengl was alowed to proceed years ago and if the follow up was taken and there wasnt any sabotage happening then the PC and its performance with mutly CPU GPU and the tecnolegy evolving with the progamers and propper apis in this area would have left the console market in the shade but this way Microsoft is eliminating other similar competion Apple
    To cut to the chace Apple and OpenGl is getting the Microsft squeese and who has an interest in a console product :-)
    I guess I might be one of the old dinosorse but I still am a PC gamer through and through even though I am grampar foda I love buiding PC units and playing well I havent been to a net game in a couple of years Pizza and beer he he heee But Il be buggered If I will lie down and die because of big buisness
    Gazza


    um... what?
    0
  • knickle
    aL3891if someone chose to compete with microsoft, they could. but no one seems willing. what really should be done is a port/implementation of dx11 in open source..however, in the cut throat buisness of game engines[epic vs whats-their-name anyone?] and gpu drivers, i seriously doubt that open source systems will ever be at the forefront of gaming


    Give it a few more years and I bet Google will take a stab at it. They have their paws into just about everything these days. Why not grahpics?
    0
  • Kaldor
    Great article. Reminds me of some of the old school Tom's articles we used to see.
    2
  • tomc100
    If MS was smart they should release the xbox3 that is fully dx11 compliant several years before Windows 7 is released. That will ultimately increase the library of dx11 games, real FULL dx11 games incompatible with dx9. For dx11 to move forward and windows 7 to take hold, dx9 must die COMPLETELY. The dx11 games will then force people to upgrade to windows 7. As far as I know, dx11 features is not possible on the open platforms like the PS3 or 4 so multiplatform games will always look and run better (provided that dx11 does what it says it will do) on the xbox3 thus annihilating the console market.
    -3
  • LunaticWolf
    Sadly Tom, that would ruin us all, as all new consoles would cost $1000s
    0
  • eodeo
    Great article- very interesting reading. I'm glad I didn't stop coming to THG.

    --

    It would be interesting (if possible at all) to make an unbiased API performance shootout. I know that professional 3d programs like max and maya run much smoother on d3d even when run on the non-crippled version of OpenGL (on workstation cards). Is this due to particular software optimizations or just speed deficiency of OGL?

    Also, you said that opengl 3.0 is more like 2.2, but you also said that it barely caches up with dx10. I find these to statements contradictory. I'm under impression that OGL 3.0 is in ~2003 while dx10 is ~2007. opengl 2.1 is in ~1999. How can .1 increase bring ~2007 things while staying 5 years behind. Or is my logic simply flawed here?

    Also, for 3ds Max specific, you are able to have real time shadows and lightning conditions in viewports, but only under d3d. Am I to understand that openGL can do the same, but the AutoDesk programmers chose not to implement them? I always assumed that ogl simply couldn’t due to obsoleteness.

    In conclusion, THG needs more of these articles. Latest GPU roundup was another massive success.
    2
  • Anonymous
    I use several AutoDesk products for engineering and AutoDesk made it clear about 1.5 years ago that their 3D products would only support DirectX in the future. This has already occurred for Inventor running on Vista, so I do not know how far the other products are. Their timeline may also be affected since those products have not been under the direct control of AutoDesk for quite as long (3ds Max and Maya).
    2