2
votes

Am I right thinking that modern consumer graphics cards (say those conventional nVidia and ATi models) use exactly the same GPU structures and operations for actual graphics rendering (through DirectX, OpenGL, etc.) and bare computations (through OpenCL, CUDA, etc.)? Is that actually the software (firmware+drivers) part that does all the DirectX/OpenGL functions support without doing any graphics-specific operations a pure hardware way? Is all that makes it a graphics acceleration card (rather than a purely general-purpose computation acceleration unit) a software logic abstraction layer - a mere application running on the hardware?

What I am actually interested in is if it is possible (regardless of how much work and know-how it is going to take) to write a full-software (user-space) 3D rendering (say a 3D game) engine using CUDA/OpenCL that would implement all the DirectX/OpenGL functions as efficiently (or close to it) as the card itself (with its firmware and drivers) does it and if any card hardware parts are going to be left unused when this engine works.

The reason that has led me to this question consists of the following facts I know from experience:

  1. Hardware graphics acceleration drivers use to have many visible bugs.

  2. Software rendering (I used to play 3D games the days it was an option) is almost always more stable (less prone to hangs and visual artifacts).

  3. General-purpose CUDA/OpenCL operation seem to be relatively stable and deterministic, working much more reliable than "hardware" graphics acceleration.

So it seems a curious idea to implement 3D rendering the "software" way but employing the GPU instead of the CPU for the calculations as far as possible. It seems like this could nearly solve the Linux drivers mess for example.

2

2 Answers

2
votes

No, you can't implement a full-speed OpenGL/Direct3D using OpenCL/Cuda.

Some critical part of the 3D rendering process, such as tessellation and rasterization, are hardwired, as well as the whole Programmable Graphics Pipeline thing. From page 12 of the AMD's GCN whitepaper:

The 3D pipeline consists of several types of programmable shaders (e.g. vertex, hull, domain, geometry and pixel shaders) and a variety of fixed function hardware that manipulates triangles and pixels.

In the AMD's GCN architecture, there is what they call an Export Unit (page 8), which is "the Compute Unit's window to the fixed function graphics hardware" which you can't get access to with the last OpenCL standard.

You will most likely find some things similar in NVidia GPUs.

To answer more pragmatically to your last interrogation: you'll need a driver in order to do GPGPU, which means you wouldn't be able to solve the "Linux drivers mess" anyway.

1
votes

A graphics card is physically designed differently from a general purpose computation unit.

A general purpose computation acceleration unit would have fewer, faster cores. For example, Intel has one with 80 x86 cores on it as opposed to Nvidia's cards having a thousand or two cores.

Beyond that however, they would be mostly the same. Same latency problems, same throughput goals because of the latency problems.

And to answer the other question, DirectX and OpenGL are done in software in such a way to benefit massively from the architecture of the GPU.