Tag Archives: programming

GPU Pro 5 is out

Really, the title says it all, the book GPU Pro 5 is shipping. Sadly, there’s no “Look Inside” for the book on Amazon; I’ll hope they at least put the Table of Contents there. You can find a rough Table of Contents on the CRC site; rough in that you can’t see the number of pages for each article. A few articles are quite lengthy: Physically Base Area Lights is 34 pages long, Hi-Z Screen-Space Cone-Traced Reflections is an incredible 44. The rest are in the 10-20 page range.

You can get a taste of the book at the GPU Pro blog, it has previews of a large number of the articles. At $70 this is not a casual purchase, but if you’re a practitioner and just one article saves you 2 hours, the book’s more than paid for itself.

Me, I was amused to see the following, a model from Morgan McGuire’s high-quality model repository – hey, that’s from our world! (And you thought I was done with Minecraft references here.)

VoxeliaMC

C++, Baby

I was catching up on the Communications of the ACM, and noticed this article, Computer Science in the Conceptual Age. The “catch your eye” text on one page was: “Programming interns/job seekers from our program Spring 2009 (35 interviewed in the game industry) found no companies administering programming tests in Java.”

There are other chewy bits, such as: “The USC experience is that 100% of its students interviewed for programming positions are given three-to-four-hour-long programming tests, with almost all companies administering the tests in C++.”

Also, this: “The game industry will also tell you that it wants the first four programming classes in C++, not Java, according to M.M. McGill and my own private communications with directors of human resources in major game-development companies.”

One final morsel: “Many game companies say they will not interview or hire someone whose first programming language is Java.”

Wow, that last one’s harsh, especially since my experience with two teenage sons (one in high school, the other a freshman computer science major) is that Java is the norm for the first “real” language taught (I don’t count Scheme as a real, “you’ll get paid programming in it” type of language). I don’t think I’d rule someone out for knowing Java first, though having gone from C++ to Java and then back, the transition from Java to C++ is like being thrown out of the promised land: you suddenly again spend half your time messing with memory in one form or another. C# and Java are darn productive in that way. And, no, for me at least, those auto-pointer classes in C++ never quite seem to work—they need a different sort of discipline I don’t appear to have. I also love that my first Java program, from 1997, still works on the web; some of my C++ programs from back then won’t run on Vista or Windows 7 because the WinG DLLs are not a part of those operating systems (thanks, Microsoft).

Nonetheless, the article’s right: at Autodesk we’ve dabbled with Java and C#, I’ve seen Python used for UI control around the fringes of a program, but the heart of client-side graphical programs is almost always C++ (or isn’t, with regrets and cancellation often soon following—been there myself, though Java was only a little bit to blame, to be fair). Also, XNA, which uses C#, does not have a 64 bit version. In addition, Microsoft’s managed code support usually lags behind the “real” DirectX, i.e., the one for C++.

Looking around, I did find an open-source project, SlimDX, that does support 64-bit assemblies for interfacing with DirectX. Interestingly, they claim one AAA game title shipped using SlimDX, but no mention of which. So I asked. They’re keeping the information confidential, which is fine, but the other comment sounds about right: “The large majority of professional commercial PC/console games are still developed in C++ because of the sheer amount of legacy code the studios developing those games have that is already in C++ (and because of the generally poor support from major console vendors for languages other than C or C++, which contributes to lock-in).”

Long and short: it’s C++, baby.

Shader variations and ifdefs

Morgan McGuire’s page is the only twitter feed I follow (though Marc Laidlaw’s Trog Act Manly But is darn tempting), as he simply offers up worthwhile links on computer graphics and on game design. Strangely, though, some ideas cannot be expressed in 140 characters. So, here’s our first guest post, from Morgan:

When experimenting on a new algorithm, I have a zillion variations I’m testing packed into one shader and a lot of #ifdefs and helper functions to switch between them.  Often you need the invoking C++ code to line up, and I’m always forgetting to switch the routines in both the shaders and C++ to keep them in sync…

I just realized that I can put my #defines in a header and include the exact same header into HLSL, Cg, GLSL, CUDA, and C++ code, since they have exactly the same syntax.  So I now have both C++ and GLSL files that say #include “myoptions.h” at the top.  Cool!

(Ok, my GLSL infrastructure adds #include to the base spec, but I assume everyone else’s does too).