2 ms·
> we were talking about "compiled code", then your answer jumps to talking about shaders. Can all OpenGL code be represented as shaders? Or is the OpenGL code n
by wtallis 6y ago
> we were talking about "compiled code", then your answer jumps to talking about shaders. Can all OpenGL code be represented as shaders? Or is the OpenGL code needing hardware-specific compilation shaders only? When the above poster said that Mesa "compiles code from OpenGL to some target backend", were they referring to shaders already?
OpenGL code consists of both code running on the CPU, and shader programs running on the GPU. Most of the heavy number crunching is handled by the shader programs and the CPU acts mostly as the control plane, handling resource allocation and dispatching data and work items to the GPU.
Early versions of OpenGL predated programmable GPUs and had no concept of shader programs. Instead, various GPU mode registers were programmed to set up the rendering pipeline, which was then fed vertex and texture data to render. Modern OpenGL largely abandons that beginner-friendly immediate mode paradigm and requires you to provide shader programs and do various other setup work to get anything on screen; you can't simply make a DrawTriangle kind of function call on the CPU. Newer APIs like Vulkan strip away even more abstractions.
- ronjouch 6y agoThanks for the clarification! On "Newer APIs like Vulkan strip away even more abstractions", another comment links to multi-part article https://software.intel.com/content/www/us/en/develop/articles/api-without-secrets-introduction-to-vulkan-part-1.html https://software.intel.com/content/www/us/en/develop/article... , and uuuuh yes indeed it's a lot of setup code to draw a triangle :D