Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


DirectCompute - CUDA - OpenCL are they used?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
11 replies to this topic

#1 Nikko_Bertoa   Members   -  Reputation: 424

Like
0Likes
Like

Posted 05 March 2013 - 07:11 PM

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



Sponsor:

#2 Hodgman   Moderators   -  Reputation: 40007

Like
0Likes
Like

Posted 05 March 2013 - 07:33 PM

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.



#3 MJP   Moderators   -  Reputation: 14012

Like
0Likes
Like

Posted 05 March 2013 - 07:41 PM

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.

#4 Bacterius   Crossbones+   -  Reputation: 11343

Like
0Likes
Like

Posted 05 March 2013 - 08:30 PM

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.”


#5 Promit   Moderators   -  Reputation: 9847

Like
1Likes
Like

Posted 05 March 2013 - 09:05 PM

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.


Edited by Promit, 05 March 2013 - 09:05 PM.


#6 TheChubu   Crossbones+   -  Reputation: 6567

Like
0Likes
Like

Posted 05 March 2013 - 09:08 PM

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.


Edited by TheChubu, 05 March 2013 - 09:08 PM.

"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


#7 Nikko_Bertoa   Members   -  Reputation: 424

Like
0Likes
Like

Posted 05 March 2013 - 10:27 PM

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.



#8 ray_intellect   Crossbones+   -  Reputation: 258

Like
0Likes
Like

Posted 06 March 2013 - 11:24 AM

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).



#9 Vilem Otte   Crossbones+   -  Reputation: 2052

Like
0Likes
Like

Posted 06 March 2013 - 11:32 AM

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.


Edited by Vilem Otte, 06 March 2013 - 11:33 AM.

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


#10 ray_intellect   Crossbones+   -  Reputation: 258

Like
0Likes
Like

Posted 06 March 2013 - 12:31 PM

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.


Edited by ray_intellect, 06 March 2013 - 12:33 PM.


#11 Nikko_Bertoa   Members   -  Reputation: 424

Like
1Likes
Like

Posted 06 March 2013 - 01:04 PM

I also found the following:

 

http://www.tomshardware.com/reviews/directcompute-opencl-gpu-acceleration,3146-5.html

 

"Civilization 5
Civilization 5 uses DirectX 11 and DirectCompute to leverage a variable bit rate texture codec algorithm. The algorithm is so efficient that 2 GB of leader textures compress down to less than 150 MB of disk storage.

DiRT 3
DiRT 3 employs DirectCompute for its high-definition ambient occlusion (HDAO) effect. Unfortunately, there is no equivalent effect in the game based on pixel shading, so we can’t compare the two directly.

Metro 2033
The advanced depth of field (DOF) effect in Metro 2033 needs three rendering passes. Two of these employ pixel shading, while the third uses DirectCompute."



#12 Frenetic Pony   Members   -  Reputation: 1822

Like
0Likes
Like

Posted 07 March 2013 - 02:16 AM

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.

You can easily get away with DX10 as a minimum requirement today, that will at least give you compute shaders, though limited.

 

One of the reasons I suspect that graphical niceties have been the primary use is consoles, the gameplay needs to run on consoles too, which obviously don't have Compute Shaders. So sticking with a few graphical extras on the PC version doesn't hinder anything.

 

Still, I wonder what you could use it for, besides some physics acceleration ala PhysX. Regardless, I don't doubt we'll see DX11 cards as the new minimum, so compute shaders should be relevant to look into.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS