Viewing a single comment thread. View all comments

WeirdGamerAidan OP t1_j6laroy wrote

Yes, but wouldn't the GPU not know what to display if the CPU didn't tell it what to display? Or is it more like the CPU tells it "throw this object here and this object here, figure out how to put it on a screen" (albeit much more complex and many more objects)?

3

lygerzero0zero t1_j6lhvyy wrote

The CPU hands the recipe to the GPU, and the GPU actually cooks it. Knowing the recipe is not the time-consuming part, it’s the actual cooking.

33

neilk t1_j6lf4hb wrote

The CPU is like "here are all the 30 thousand triangles that represent this thing, and here is the angle from which I would like to view it. Please do the complex mathematical transformations that a) rotate all 30 thousand triangles in space b) project all 30 thousand triangles from 3D space into 2D triangles on a screen"

There's also stuff to figure out what parts of the model are hidden from view, reflections, textures, shadows, etc, but you get it.

24

TheLuteceSibling t1_j6lbu0x wrote

There are different techniques, but you can think of it like the CPU figuring out where all the objects are and then handing it to the GPU.

The GPU applies, color, texture, shadow, and everything else. Putting chess pieces on a board is easy. Making them look like marble is much more intense.

9

RSA0 t1_j6lt8mn wrote

The programmer decides, which tasks will be performed on CPU, and which - on GPU. GPU is a full capability processor that runs its own program, so in theory there is no limit on what it can do - the only limit is time. The programmer must write a program for GPU as well as for CPU. Programs for GPU are called "shaders".

If we talk about games, the GPU usually does at least 3 jobs: convert all 3D models to screen-relative coordinates, sample colors from texture images, and calculate light and shadow. However, more tasks get moved on GPU with time: modern games use it for simple physics simulation (hair, clothes, fire, smoke, rain, grass), and for post-processing (color correction, blur).

GPU can also be used in tasks unrelated to graphics. Many scientific physics simulators and machine learning tools have an option to run on GPU.

4

Xanjis t1_j6lf95a wrote

It's the second. The GPU takes all the information for the scene (the location/size/rotation) of objects in the scene and then calculates what color each pixel the screen can display. That calculation needs to be done millions of time per second but it's a very simple calculation so the GPU is suited for the task because it has a huge number of weak cores. Whereas a cpu has a small number of incredibly powerful cores.

3

Sevenstrangemelons t1_j6lcdrq wrote

Generally yes, but the GPU is the one actually executing the instructions containing the calculations that would otherwise be really slow on the CPU.

2