What sort of data is handed over from a CPU to the GPU?

0

1

I'm wondering what type of data is handed off from a CPU to the GPU when using accelerated 3D graphics (for example, for a typical modern 3D video game)?

I am aware of the existing question here:

The difference between GPU and CPU

that explains the differences between a CPU and a GPU. However, it is quite high-level and I am looking for more granular details.

For example, is it sending over a scene graph, or coordinates of vertices of 3D primitives? What calculations are being done on the data by the CPU, before this hand-over occurs?

Time4Tea

Posted 2017-11-28T23:09:23.927

Reputation: 329

I see how this can be considered too broad but really unawnserable too broad? Yep it'd require about 10-20 paragraphs though. Small book but not crazy. – jdwolf – 2017-11-29T00:49:30.873

@DavidPostill I know the question is a bit broad, but didn't think it would get flagged. I can break it up into 2-3 separate questions, if that is preferable? – Time4Tea – 2017-11-29T13:32:54.533

It would be nice to know why someone voted down. I know it is quite broad, but is it a bad question? – Time4Tea – 2017-11-29T13:33:38.623

@Time4Tea You can try ... – DavidPostill – 2017-11-29T13:35:55.260

Question has been edited to reduce the scope. – Time4Tea – 2017-11-29T13:50:00.390

@Time4Tea Moving in the right direction. Reopened. – DavidPostill – 2017-11-29T13:51:14.590

"What calculations are being done on the data by the CPU, before this hand-over occurs?" - This is up to the programmer. DX12 or Vulkan has functions, that return a value, calculated by the hardware. What is calculated is up to the programmer. The CPU in most of these applications are left to the non-floating point calculations. – Ramhound – 2017-11-29T14:16:45.913

@Ramhound thanks for your input and I take your point that much of these details are up to the application programmer (in the same way as non-graphical programming for the CPU). So, am I correct in saying that, in the example of a 3D game, part of the task of coding the game engine is defining the data workflow for the graphics rendering and how exactly the GPU will be utilised? Is there any generally-accepted industry practice for where the data handover takes place or a widely-used engine that could be looked at as an example? – Time4Tea – 2017-11-29T17:04:05.483

There is indeed around 4 major game engines on the market currently. Depending if you are dealing with DX12 or Vulkan determines how something is drawn on the screen. Outside of that, how you manipulate what you have drawn on the screen, is entirely up the programmer. I honestly am not entirely sure what you are looking for. Seems strange you wouldn't know about Unity or Unreal. – Ramhound – 2017-11-29T17:22:42.503

@Ramhound sure, I have heard of those engines, although I don't know much about what they are doing 'under the hood'. The thing is, the CPU and GPU have separate memory regions, so I am assuming (which may be incorrect) that, at some point, the 'scene/geometry data' has to be transferred from the CPU RAM to the GPU RAM. I am curious as to at what stage that hand-over typically happens, although I understand it may differ between game engines. Perhaps I should instead ask how this is done for a specific example engine (e.g. Unreal)? – Time4Tea – 2017-11-29T17:46:45.673

If you are calling DX12 or Vulkan functions then you are putting stuff directly into the GPU's memory. The CPU is going to compute things the GPU cannot easily compute. It sounds like you need to do more research on how DX12, Vulkan, and Unity/Unreal actually work. Your question isn't at the point where it can be easily answered without a complete tutorial on everything involved (which is extremely broad) and doesn't make a good answer on a Q&A website like Superuser. – Ramhound – 2017-11-29T17:50:18.893

@Ramhound ok, thanks for your input. Yes, perhaps I have a fundamental lack of understanding about how 3D graphics processing (and the interplay between the CPU/GPU) works. Maybe it would help me to understand if I was to go through an introductory online tutorial for OpenGL/Vulkan? – Time4Tea – 2017-11-29T17:57:13.123

No answers