No, an API is not a translator. To go back to my earlier analogy: When you're reading this post, your brain is interpreting the English that I have written - the English language itself isn't translating it for you. In the same way, a GPU driver can interpret e.g. OpenGL commands - there isn't necessarily an independent "OpenGL API software" that runs on your computer and translates commands. If both a game and the GPU driver know how to speak OpenGL, they don't need a translator in between them.
(Fun fact, though: It is possible to make translators between two different APIs. For instance,
https://en.wikipedia.org/wiki/ANGLE_(software) translates OpenGL to Direct3D. Do note that such a translator can
implement an API (instead of the GPU driver implementing it directly) but can't
be an API.)
So the API is the actual language itself, and both application and GPU driver must be able to speak it in order to talk to each other indeed. But if an app supports certain APIs and GPU driver supports other different ones, what does happen here? Could it be that both app and driver happen to always have a "common" API language to speak? If not, the game should not even recognize the GPU!! Does this have to do with the saying "this OS -note, not referring to the GPU driver- supports these APIs"?
Also, with the restaurant analogy any beginner would/should understand APIs certainly like a library/table/something else rather than an entire language!! English is clearly not spoken by selecting fixed items from a bloody table...
Also, this OpenCL made my nerves creep again... yet another API, or language?
(01-26-2017, 05:53 AM)ZLRK Wrote: [ -> ]But if an app supports certain APIs and GPU driver supports other different ones, what does happen here?
If the app doesn't support any of the APIs that the GPU driver supports, then too bad for you: The app won't be able to use the GPU. This is not much of a problem nowadays since there now are common standardized APIs that application developers can expect GPU drivers to support (Direct3D on Windows and OpenGL (ES) on most platforms). But in the 90s, there were many manufacturer-exclusive APIs instead, so you could indeed have had problems with being unable to use your GPU with a certain game back then.
(01-26-2017, 05:53 AM)ZLRK Wrote: [ -> ]Also, with the restaurant analogy any beginner would/should understand APIs certainly like a library/table/something else rather than an entire language!! English is clearly not spoken by selecting fixed items from a bloody table...
Keep in mind that neither the language analogy nor the restaurant analogy is perfect. The complexity of an API is somewhere in between a list of choices and a spoken language. Maybe it makes more sense if I describe it this way: An API is a specification for what a software library must contain (in other words, how other applications are able to use it). In fact, you can consider included header files in C/C++ to be a kind of API specification. The .h file specifies what a library contains, and the .c/.cpp file contains the actual implementation.
That makes (sadly) more sense; and saying "sadly" because as you describe it, it's NOTHING of a simple concept, as I expected to be (and probably should be, but it's not...). Thanks very much sir.
Finally, and since I don't think I'll be able to understand any more things since I'm doomed to NEVER be a dev, just last doubts:
What side would this "software libraries" part be in, the app (game) side or the GPU drivers side?
What's this OpenCL thing at all?
Again, thanks beforehand.
(01-26-2017, 12:12 PM)ZLRK Wrote: [ -> ]What side would this "software libraries" part be in, the app (game) side or the GPU drivers side?
The GPU driver side.
(01-26-2017, 12:12 PM)ZLRK Wrote: [ -> ]What's this OpenCL thing at all?
It's a bit like OpenGL, except instead of letting you use GPUs to render graphics, it lets you use GPUs (and some other devices too) for general-purpose computation. Note that the OpenCL standard defines both an API and a programming language. At least that's how I've understood it, but I haven't really looked at it much.
Thanks very much sir for all. Thanks.