Skip to main content
GameDev.net gamedev.net
🔒 Locked

Cross platform GPU computation for real time ray tracing rendering engine!

Started by Mr.Grey Mar 24, 2015 at 8:52 AM 22 replies 6.1k views
Original Post
Mr.Grey
Mr.Grey

As optix - https://developer.nvidia.com/optix is real time ray tracing rendering engine but it only works on CUDA, I want to implement real time ray tracing engine for games like which will work on consoles(ps4 and xbox) and pc. Is there any cross platform technology like CUDA that I can use on consoles and pc for real time ray tracing rendering ?

The technologies that I am aware of are (openCL, DirectCompute, OpenACC, C++ AMP) but these are not cross platform, some work on consoles and some work on pc.

So I am looking for a cross platform parallel programming solution which will work both on consoles and pc?

L. Spiro
L. Spiro

So I am looking for a cross platform parallel programming solution which will work both on consoles and pc?

I guess you are?

Before we spend time on this issue, are you eligible to actually get console development kits?
It doesn’t make sense to go out of your way to support something you can’t actually support, taking great pains to write code that could run on a PlayStation 4, but never will.

So, before anything else, we need to establish that this question has merit. Do you have or can you get PlayStation 4 and Xbox One development kits (ignoring the fact that all Xbox one devices are development kits—you still need a license)?


L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
Hodgman
Hodgman

Cough HLSL compute shaders cough

Nothing else will run on all those platforms. You'll have to wrap up the CPU side functions that dispatch the commands to the GPU to deal with the differing CPU-side APIs, but the shader code itself will be portable, and the CPU-side concepts of compute dispatches, with read and read-write resource views of buffers/textures will be portable.

[edit] On PC you can use HLSL, it's known that the xbox uses HLSL, and the PS4 uses "PSSL", but if you have a look at that presentation, the syntax is 99.9% identical to HLSL.

jacmoe
jacmoe

OpenCL is probably the best bet, considering that it will work well with SPIR-V/Vulkan.

Too many projects; too much time
snake5
snake5

OpenCL is far from a "best bet". Each device vendor has its own SDK. So, not only OS differences matter, GPU differences do, too. What's included into that horror is varying support for features like recursion (which is reasonable but makes testing quite hard/expensive).

DirectCompute at least runs on all DX11-compatible devices, on Windows. It's far from cross-platform support but appears to be significantly better than what OpenCL offers.

Hodgman
Hodgman

OpenCL is probably the best bet, considering that it will work well with SPIR-V/Vulkan.

There's no OpenCL/SPIR-V/Vulkan support on consoles.
jacmoe
jacmoe

SPIR-V can be parsed into whatever shader language a console supports easily. That's one of the goals mentioned in that GDC Vulkan talk.

I wonder what you mean by cross-platform.. Windows on the PC and then consoles?

Then dx11 compute shaders would be the way.

Otherwise, I am still going to recommend something with SPIR-V support because it's only a matter of a short while before we will have hlsl generators for it.

Consoles is really a wholly different scene because it is anything but open.

Too many projects; too much time
ongamex92
ongamex92

i really don't think that there is a multiplatform solution.

At work we use both CUDA and opencl (via a lot of macros, restrictions ect.) but that currently won't work on consoles(as far as i know).

koiava
koiava

In general, best way to support high performance multiplatform computations is to implement things per platform :) only this case you can achieve performance close to the maximum.

Krypt0n
Krypt0n
the critical code for tracing on GPU is about 1000loc, porting it isn't that much of work compared to coming up with that piece (no matter what compute language). I've created a GPU-tracer on PC in HLSL (compute shader) over Christmas and porting was 3 Saturdays. it's about 150MRay/s in sponza, so that's your target on PC.

straight forward tasks:
-take HLSL
-make the tracer run on D3D11
-make it 150MRay/s on some 2GFlops ATI gpu in sponza
-make something eye candy (this is just one task point, but probably takes the most time)
-and just then you can start to worry about a console version
jacmoe
jacmoe

I know that OpenCL and Spir-V is wishful thinking at the moment - because Vulkan is not out yet - so I can understand that it's not totally relevant to the discussion.

Still, the Vulkan GDC talk showed/mentioned a lot of interesting projects.

And OpenCL exists for both NVidia and AMD, so why not .. ?

(( I re-edited my previous posts. It was kind of childish of me to rage-edit, but the down-vote system really got to me. I will get used to it, don't worry ))

Too many projects; too much time
ProfL
ProfL
I'm sorry, but

11 replies and 3 of them you post about OpenCL and Spir-V, although it's really not relevant to the request for a cross platform compute solution targeting XBox and PS4.
I think people don't vote you down because they dislike you, it's rather because you're off topic. I agree the down-vote is sometimes mean, because you don't know why people do it, but the point is not that you'll get used to it and continue posting. It's probably more of advantage for you if you deduce why it happens.

I'd wish people would be man/women enough to always tell why they voted down, random punishment does not help or lead to anything.
21st Century Moose
21st Century Moose

OpenCL is probably a good bet for portability across desktop platforms because it's going to be fairly widely available, but full details console APIs are of course hidden behind NDAs and I don't think the OP is being realistic in wanting to target them too. I detect a smidgin of the old "OpenGL everywhere!" fallacy in there.

SPIR-V is interesting on account of it's potential to be compiled from any language, as well as it's potential to be translated to other languages or bytecodes, but it's important to note that it's still just potential; none of this has happened for real yet so it's not suitable for use as an immediate solution.

Realistically there is no one solution that will work on all platforms. I suggest that the OP narrow his ambitions a little; as L. Spiro suggests in the first response, if the OP doesn't have access to console dev kits and/or licenses, then wanting to target them too is pointless.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 
jacmoe
jacmoe

11 replies and 3 of them you post about OpenCL and Spir-V, although it's really not relevant to the request for a cross platform compute solution targeting XBox and PS4.

Nothing is relevant for that question, it seems.

If I wasn't down-voted I would have no reason to follow up on my answer, would I? smile.png

Who gets to decide what kind of answer is right or wrong?

I still don't think that I am off-topic much laugh.png

Remember back in the 90's when there was no standard C++ and people used Watcom, Digital Mars, Borland, Djgpp, Turbo, even Microsoft.. On the same platform!

Thank God that we now have a fairly decent C++ standard.

I hope that we will see a more standardized/unified approach to computing for the GPU in the future.

Let's leave it at that, though.

Too many projects; too much time
Hodgman
Hodgman

Who gets to decide what kind of answer is right or wrong?

If you're genuinely asking, then I'll paraphrase the question and your downvoted post to:
Q: I need something that runs on A, B, C.
A: X is probably best as it works with Y, and Y will run on A in the future.

Meanwhile Z runs on A, B, C today.
So... logically X is a potential answer in the future, maybe (and should be prefaced as such), while Z is an answer.

If you're looking for a lesson to learn, I'd suggest: answers that will potentially become correct in the future should be clarified that this is the case. Without such clarification, apparently people will see the answer as being off topic / irrelevant.

I am really interested in openACC - https://developer.nvidia.com/openacc
What you think about this?

It's in a similar category to OpenMP, C++AMP, etc...
IMHO, these kinds of tools are great for when you've got existing scientific programmers who want to quickly get their code running on parallel hardware without having to do extensive porting, switch languages, or bother learning how that hardware works.
...but they're not the kind of tool I would use in a game engine / middleware project, where you can build your code from the ground up for parallel hardware, and where you can expect your staff to learn a new language to accomplish a task. Especially not a middleware project that I was going to port to consoles, as compiler support doesn't exist for them there...

jacmoe
jacmoe

I guess I was led astray by the term 'cross-platform' and the general unanswerableness of the question.

I am just wondering: even if I am being naughty and being off-topic, what harm is there in exploring the topic? Shouldn't it be in the interest of the OP to have light shed on the subject, even if that light is irrelevant(-ish) ?

Because it might lead to a highly relevant outcome later on in the discussion.

Too many projects; too much time
MxADD
MxADD

For today consoles (PS4/XOne) the only reliable solution is to write in HLSL and then optimize on consoles

(I working on PS4/XOne engine right now in my work), There is no problem compiling HLSL as PSSL / XOne HLSL dialect, but it could be made way more efficient in some areas (use of some handy intrinsics/packing/depacking built in functions, resource bindings as tables, etc.), but vanilla HLSL will compile (with some crafted 'compatibility macros' header)

and that is the only way to go, forget about openCL and such on consoles.

On the other side ... consoles barrely can handle RENDERED 1080p (especially XOne), raycasting is probably not an option for full blown console game.

MarkS_
MarkS_

Can a moderator change the title so that it is no longer "click bait"? Maybe change the exclamation mark to a question mark? I saw this and thought it was a release thread and got excited!angry.png

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.