DirectCompute - CUDA - OpenCL are they used?

Started by
10 comments, last by FreneticPonE 11 years, 1 month ago

Hi community.

My question is very simple. Are those technologies used in real time games?

I saw they are used to implement Blur effects, Particle Systems, Fluids simulation, physics, etc.

I want to know if they are used for AAA games in the game industry and to implement what kind of things?

Thanks in advance! I will appreciate this information

Advertisement

PhysX has an option where if a CUDA-capable (i.e. nVidia) GPU is present, it is able to offload a lot of the work to the CUDA device.

They also used to have a clause in their license agreement where you promised to add a bunch of extra special effect particles if the user was running an nVidia GPU... so from that, I guess that a lot of games using PhysX probably make use of CUDA for particle/projectile/debris effects.

D3D11 compute shaders have definitely been used in shipping games. For most part they are only used for purely graphical features, like full-screen effects and times deferred rendering (used in Battlefield 3). The reason for this is that graphics is typically the easiest and most obvious use-case for compute, since graphics operations are generally well-suited to the massively-parallel model used on GPU's. Graphics operations also don't have to be synchronized with the CPU and read back to system memory, which is expensive on a typical PC architecture. Another reason for this is that PC games still need to target sub-DX11 GPU's, so it probably doesn't make sense to require DX11 functionality for gameplay-centric features.

As for CUDA, several games have made use of PhysX to run various cosmetic physics simulations on the GPU. RAGE also supported using CUDA for run-time transcoding of texture data.

I'm not an expert on OpenCL, but I would suspect that it's not getting much use in games. From what I understand it currently has a lot of issues with regards to getting a OpenCL program to run consistently on a wide range of hardware/drivers.

Can't say much about DirectCompute or CUDA, but I have been doing a lot of work on OpenCL lately. I have to say it is somewhat of a pain to get running, and the spec seems to be implemented slightly differently in some aspects by various vendors (probably due to the fact that the spec is horribly worded at times everywhere) but other than that, it does work, and is fairly nice to use once you get the hang of it. It requires quite a bit of engineering, though, so I am pretty sure nobody is using it in games. However, all three are capable of interop'ing with D3DX and GL, to some extent.

DirectCompute: neat integration with D3D10/11, so using it is really fun and easy. However, Windows only.

CUDA: simple to use, somewhat mature, NVIDIA only, and has lots of built-in libraries (for instance, I believe JC2 used the FFT library for generating water heightmaps in realtime, and other games like to run PhysX on it), cross-platform

OpenCL: the API is somewhat tedious, and is not very used nor very mature, but runs on many devices (with the caveat above), cross-platform

As you can see, they all have different advantages, weaknesses, and goals, but I believe that realistically only DirectCompute and CUDA are seeing any use in games due to maturity and easy integration. That said, you should keep in mind that OpenCL in particular was never meant for graphical work, but for general-purpose computation on various devices such as GPU's, FPGA's, etc... so while it's not being used in games, it is being used elsewhere (3D renderers like LuxMark, scientific applications, etc..)

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

The Battlefield slides on DX11 discuss DirectCompute a fair bit, since they actually do their major shading in compute.

http://www.slideshare.net/DICEStudio/directx-11-rendering-in-battlefield-3

CUDA is used massively in a lot of industries for high speed computing, but I don't think it ever got much traction in games. OpenCL may have, but I think it'll probably be relegated to high speed computing. OpenGL Compute (new in 4.3) is a much more reasonable choice for games.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

The first time I saw DirectCompute being used in a game was in STALKER Call of Prypiat (2009 for Russia, 2010 for the rest of the world) for computing ambient occlusion (i think it was AO, it might have been something else), I believe the developers claimed it was faster than doing it without DirectCompute.

The DX11 render, which had more stuff to showoff, seemed to perform even better than the DX10 one in the benchmarks I saw.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Thanks for all your detailed answers!

I asked because I want to focus on a more specific field on game development, and I think Direct Compute is a good choice. Also it will help me to improve my parallel algorithms design.

I think the compute shader is a very good idea, I don't really understand why to use Direct Compute or the OpenGL Compute Shader instead of CUDA or OpenCL though, I think the Battlefield 3 use of the Compute shader is the best example I have seen for how to integrate this into a pipeline.

https://code.google.com/p/cudaraster/

is a good and relevant open source project that uses a sophisticated tile system in two phases, coarse and fine, these are covered by the paper. This isn't the same as what Battlefield 3 does because the entire Rasterising technology is implemented in Cudaraster, and the Texture units are not used (the Tex Chip for the texturing, interpolation and texgen hardware).

Hm... seems like there isn't much of OpenCL users here.

Basically OpenCL is wide-used in ray tracing, path tracing (Luxrender, PovRay, ...), also some real time ray tracing/path tracing is done in OpenCL (mostly hobby projects). Bullet physics also uses OpenCL, and as mentioned - a LOT of sceintific applications also use it (note. that also a LOT of scientific apps use CUDA) -> so I have to oppose, the api is quite commonly used.

I'd though oppose to Bacterius. OpenCL api is definitely mature (it's been out for few years). As for the spec, it isn't as horrible (as it was - when I first saw the first spec I was like "WTF? You don't really mean that some1 will bother to use this") ... but well I think they should really work on it. On the other hand, who creates OpenCL api? Khronos - thats NVidia, AMD, Intel, etc. In my opinion it's even miracle that these companies created some kind of specifications that in the end it's actually usable.

Also to MJP - I haven't got a single problem with running my OpenCL programs on several kinds hardware (different NV cards, different AMD cards, several CPUs - both Intel and AMD). They're mostly ray-tracers/path-tracers (so not entirely simple piece of code). It's not being used in games, because you can use GL compute shader and don't need to bother with cl-gl interops (it sometimes seems like scratching on right ear with your left foot).

As for your choice, DirectCompute is (if you're using D3D) probably best choice for games.

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

As for your choice, DirectCompute is (if you're using D3D) probably best choice for games.

I'd agree with this point, unless you have invested a lot of work into CUDA or OpenCL, using Direct Compute with D3D and the OpenGL compute shader with OpenGL should simplify the code a bit. There access functions and data handling can be intuitive and easier to understand.

On the other hand, you might want to create a cross API engine, and then the two compute shader implementations might actually be better as pure OpenCL or CUDA with some kind of wrapper, since the Compute architecture (s) might be using CUDA and OpenCL on a low level.

However, since CUDA and OpenCL need to keep evolving, using a Compute shader would allow you to use the feature on a stable level without having to worry about updating libraries and shipping with DLL's etc.

This topic is closed to new replies.

Advertisement