• Treeniks@lemmy.ml
        link
        fedilink
        arrow-up
        14
        ·
        7 months ago

        This is correct, while OpenGL and DirectX 11 and before are considered high level APIs, Vulkan and DirectX 12 are both considered low level APIs.

      • velox_vulnus@lemmy.ml
        link
        fedilink
        English
        arrow-up
        10
        ·
        edit-2
        7 months ago

        Printing a gradient triangle using C, in OpenGL, takes about a few 100-130 lines - it could be lesser, I think. In Vulkan, it takes about a thousand lines.

        Source: I wrote a “simple” gradient triangle in Vulkan, using C during my free time. Created the gradient triangle in C as a part of my university coursework.

        • kingthrillgore@lemmy.ml
          link
          fedilink
          arrow-up
          5
          ·
          7 months ago

          It takes 75 lines to draw a blank window. It takes like three in CoreAnimation in macOS. We really need an OSS take on CoreAnimation but I’m also fine leaving the graphics work to a game engine.

      • Ansis@iusearchlinux.fyi
        link
        fedilink
        arrow-up
        8
        ·
        7 months ago

        Lower level means you have more control over the small details. However, that also means that you have to reimplement some things from scratch, while higher level frameworks do those things for you.

        • heartsofwar@lemmy.world
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          edit-2
          7 months ago

          ^ this is the key

          There were two major problems with OpenGL:

          • It was originally designed and intended as a professional software (high-level) 3D CAD API; not gaming
          • Extensive changes to the API were constantly being submitted by different vendors (AMD (ATI), Nvidia, Microsoft, etc) to enhance its performance on their respective hardware in their respective situations.

          This meant that almost every API change that was submitted by any one vendor was immediately scrutinized as whether it was for gaming or 3D CAD, and usually disliked for adding bloat that the other vendors didn’t need or worse causing hardware conflicts which often lead to degradation in performance for the other vendors.

          This is exactly why Nvidia bundles their own version of OpenGL with their drivers; they can make the changes immediately and release to see the impact of the API changes without approval and if it does well-enough then submit. At the end of the day though, some submissions are accepted and others are not which means Nvidia then has to maintain the changes on their own… so there is benefit to getting the API changes accepted.

          Microsoft actually blazed the path that Nvidia took; Windows use to (might still… not sure) ship with its own version of OpenGL binaries, but they disliked having to maintain the changes and fight for acceptance enough that they decided to eventually develop DirectX (among other desires to access input and audio, etc).

          DirectX 3D and Vulkan (based on AMD’s Mantle which was inspired by DirectX 12 3D) do not have these issues because both are low-level APIs which means that most of the code that would be specific to the GPU or AMD (ATI), Nvidia, etc is not hard-coded like OpenGL on the driver side… it is done by the application.

          • teawrecks@sopuli.xyz
            link
            fedilink
            arrow-up
            4
            ·
            7 months ago

            I think you are confused about the difference between the opengl spec and an actual implementation of the spec, and who is responsible for shipping what.

            • Nvidia ships their own opengl implementation with their drivers, because that’s what a driver is.
            • Microsoft doesn’t ship “opengl binaries”, they don’t have any hardware. Maybe you mean they published their own fork of the ogl spec before giving up and making DX? That may be true.
            • Mantle predates DX12, both vulkan and dx12 took inspiration from it, not the other way around.
            • There are two interpretations being thrown around for “low level”:
              • The more traditional meaning is “how far are you from natively talking to hardware?” which is not determined by the rendering API, but the specific implementation. Ex. Nvidia’s dx9 driver is equally “low level” as their DX12 driver, in that the API calls you make are 1 step away from sending commands directly to GPU hardware. Meanwhile, using DX12 via DXVK would be 2 steps away from hardware, which is “higher level” than just using Nvidia’s DX9 implementation directly. Again, “level” is not determined by the API.
              • the other interpretation is what I would call “granularity” or “terse-ness” of the API, i.e. how much control over the hardware does it expose. In this case, yes, dx12 and vulkan give finer control over the hardware vs dx9 and ogl.
            • your last statement…doesn’t make sense, I don’t understand it. Maybe you’re trying to say that DX12/VK are made to be thinner, with less internal state tracking and less overhead per call, and therefore now all that state tracking is the app’s responsibility? Yes, that is true. But I wouldn’t say that code is “specific to a GPU”.
            • heartsofwar@lemmy.world
              link
              fedilink
              arrow-up
              1
              ·
              edit-2
              7 months ago

              Nvidia ships their own opengl implementation with their drivers, because that’s what a driver is.

              Including OpenGL does not a driver make… ie. Nvidia doesn’t have to ship their own implementation of OpenGL. They could do what AMD does on Linux and rely on the openGL upstream implementation from Mesa; however, they choose not to do so because of the reasons I outlined among others.

              Microsoft doesn’t ship “opengl binaries”, they don’t have any hardware.

              There was a time they did, yes, before Direct X existed

              Maybe you mean they published their own fork of the ogl spec before giving up and making DX? That may be true.

              No, they made their own contributions to the spec to improve Windows game performance, but didn’t publish their own spec; however they did implement the upstream spec with their contributions and ship them integrated into Windows. This was practically over with by 1995 when Direct X was introduced, so a very long time ago

              Mantle predates DX12, both vulkan and dx12 took inspiration from it, not the other way around.

              Yes and No… DirectX 3D was always low-level; its why DirectX (among being a one-stop shop) worked so well for XBox, etc. So, AMD got the idea for Mantle from MS Direct X and when AMD met with Khronos to spin off Vulkan, MS took notice that their implementation was not as low-level as Direct X 11 and they actually made Direct X 12 less low-level dependent.

              Ex. Nvidia’s dx9 driver is equally “low level” as their DX12 driver

              No its not, see above… Direct X 9 is actually much lower level than 12; however, Direct X 12 has many more requirements for certain tech that games today see as necessary that Direct X 9 didn’t

              dx12 and vulkan give finer control over the hardware vs dx9 and ogl.

              yes and no… depends on the particular portion of the spec you are talking about. For example, Direct X 9 had much more lower leve control of the CPU, but as time moved on and less CPU reliance became a thing, DirectX 12 has less control of the CPU but more control of the GPU.

              • teawrecks@sopuli.xyz
                link
                fedilink
                arrow-up
                1
                ·
                7 months ago

                So, here’s the thing, I don’t consider myself an expert in many things, but this subject is literally my day job, and it’s possibly the only thing I do consider myself an expert in. And I’m telling you, you are confused and I would gladly help clear it up if you’ll allow me.

                They could do what AMD does on Linux and rely on the openGL upstream implementation from Mesa

                Nvidia’s OGL driver is a driver. Mesa’s radv backend is a driver. Nouveau, the open source Nvidia meds backend is a driver. An opengl implementation does a driver make.

                There was a time they did, yes

                What GPU did Microsoft’s driver target? Or are you referring to a software implementation?

                Yes and No… DirectX 3D was always low-level

                You literally said that Mantle was inspired by DX12, which is false. You can try to pivot to regurgitating more Mantle history, but I’m just saying…

                No its not, see above…

                Yes, it is, see above my disambiguation of the term “low-level”. The entire programming community has always used the term to refer to how far “above the metal” you are, not how granular an API is. The first party DX9 and DX12 drivers are equally “low-level”, take it from someone who literally wrote them for a living. The APIs themselves function very differently to give finer control over the API, and many news outlets and forums full of confused information (like this one) like to infer that that means it’s “lower level”.

                Your last statement doesn’t make sense, so I don’t know how to correct it.

                • heartsofwar@lemmy.world
                  link
                  fedilink
                  arrow-up
                  1
                  ·
                  edit-2
                  7 months ago

                  Nvidia’s OGL driver is a driver. Mesa’s radv backend is a driver. Nouveau, the open source Nvidia meds backend is a driver. An opengl implementation does a driver make.

                  No, a driver is kernel code that interfaces with hardware; Mesa’s RADV implements Vulkan and RadeonSI implements OpenGL but both sit at the user level and get called by AMDGPU (the driver in the kernel). Above the kernel at user level is simply software…

                  Nouveau is a driver, yes… but it is in the kernel and calls into Mesa as well…

                  What GPU did Microsoft’s driver target? Or are you referring to a software implementation?

                  You seem to be confused that Microsoft needed to develop a GPU before implementing a version of their own OpenGL… this is flawed for a couple reasons that I’ve already outlined:

                  1. when OpenGL was designed, GPUs didn’t exist. Video cards existed, but a video card != GPU
                  2. OpenGLs original purpose was to be a 3D CAD (Computer Aided Design) graphics API …
                  3. If you’ve ever used MS Windows before Windows 95 or even Windows 95 before Direct X was released, you’d know… MS shipped their own opengl32.dll with Windows

                  You literally said that Mantle was inspired by DX12, which is false. You can try to pivot to regurgitating more Mantle history, but I’m just saying…

                  AMD Mantle was inspired by Direct X 12… it was inspired by all of Direct X and the current next gen in development at the time which was Direct X 12.

                  take it from someone who literally wrote them for a living

                  For someone of your calibre, I’d expect a better understanding of what a driver is then. “above the metal” or more commonly “bare metal” should give that first clue. implementation of OpenGL a graphics library != driver…

                  I will refrain from posting any further… this is going no where…

                  • Vik@lemmy.world
                    link
                    fedilink
                    English
                    arrow-up
                    1
                    ·
                    edit-2
                    6 months ago

                    This is confusing. There are kernel and user space drivers. For example, amdgpu is the kernel driver (inclusive of KMD, DAL & several other functions like powerplay), RadeonSI / RADV / AMDVLK / OGLP (amdgpu-pro) are UMDs for 3D GFX API implementations.

                    Mantle was not inspired by DX at its time. It was designed as an alternative to OGL and d3d11.