Why does Direct3D only work on Windows?

What is Direct3D? This is an API, right? Is it implemented by Windows or graphics cards?

If graphics cards implement the Direct3D API, why can't other operating systems use Direct3D resources from the video card?

If Direct3D is implemented by Windows, it must use video card resources such as OpenGL or OpenCL. If Direct3D calls are not directly related to the graphics card, this will be slower due to intermediate calls.

Please help me understand what Direct3D is.

+4
source share
4 answers

What is Direct3D? This is an API, is it not? Is it implemented by Windows or graphics cards?

Yes, Direct3D is an API. It is implemented (mainly) by Windows itself. However, Windows will upload a significant part of the actual work to the graphics card drivers and, ultimately, to the gfx card itself, so we can also say that the gfx card "implements" D3D.

If graphics cards implement the Direct3D API, why can't operating systems use Direct3D resources from a video card?

They can, and they do, but only the relatively small (but often important part) of the D3D functionality is implemented directly by the hardware for the cards, so the implementation of D3D requires much more work in the software.

If Direct3D is implemented by Windows, it must use video card resources such as OpenGL or OpenCL.

No, this is a misunderstanding. OpenGL and OpenCL are also APIs and are only partially implemented by gfx hardware (like D3D). Gfx hardware usually has a (native) “native” API that uses gfx drivers (for both D3D and OpenGL).

If Direct3D calls are not a graphics card, it will be slower due to intermediate calls.

There is no need for any “intermediate calls" - the D3D driver uses the map API as described above.

0
source

Direct 3D is a graphics API created by Microsoft. Its similarity is in the opengl function. OpenGL is a competing 3D graphics API created as an open standard. D3D does not need the OpenGL function.

Card manufacturers decide which APIs they want to implement; most of them always include DirectX (which includes Direct3D) and possibly OpenGL.

There is indirection, since it does not go directly to the card, D3D cards, in turn, cause drivers, but this is typically insignificant.

+1
source

Direct3D is an API developed by Microsoft designed to help developers in 3D graphics. OpenGL and Direct3D are two separate APIs, but they should both interact with the video card using drivers developed by companies that produce video cards. Both APIs (Direct3D and OpenGL) must go through the driver to access the video card, and their speed depends on their design and their implementation in the video card drivers.

OpenCL is something else - it is intended for developers who write programs that perform general-purpose computing on the GPU (and not just for graphics). OpenCL is comparable to CUDA, but the latter is only supported on NVIDIA cards. Using CUDA instead of OpenCL may have some advantages, depending on your target system, since NVIDIA can make new features available to the CUDA API before they are accepted in the OpenCL API. However, even OpenCL and CUDA must interact with the driver in order to do something on the GPU.

As you already know, Direct3D works only on Microsoft and on Wine (for the most part), but its structure as an API is significantly different from the structure of OpenGL. Direct3D uses structures and includes more OOP elements in its API, while OpenGL acts as a state machine, without any OOP structures or functions. Direct3D can often progress a little faster than OpenGL in terms of features that it claims to officially support in its API, as it is not designed for maximum compatibility with a wide range of devices; On the other hand, OpenGL, as a rule, showed great inertia when it came to adopting new functions due to the inherent difficulty of adding new functions to its API (the Khronos Group is strongly influenced by the CAD industry, as well as many others, therefore it must satisfy a wide range of needs). The time it takes for the Khronos group to finally accept asynchronous API calls in OpenGL is a testament to this fact and has caused many people to lose faith in OpenGL.

However, OpenGL is cross-platform, Apple-approved, and it works on all the operating systems on which it is implemented. You can easily use it with many popular Windows tools (Qt, SDL, FreeGLUT, JogAmp, gtk, etc.) and you are sure that your application will compile on other operating systems if you write it correctly. The OpenGL API, unlike Direct3D, is an open source industry standard.

As far as performance is concerned, it is still debatable which one is faster: depending on how you structure your program or make your calls, this may change. However, performance should not be the subject of consideration which API you use unless you have tested your application and proven that choosing an API is the cause of your bottleneck.

+1
source

From Wikipedia :

Direct3D is the Microsoft DirectX API subsystem component. The goal of Direct3D is to abstract the connection between the graphics application and the graphics equipment drivers. It is presented as a thin abstract layer at a level comparable to GDI (see the attached diagram). Direct3D contains many features that GDI is missing.

Direct3D - Immediate API graphical interface. It provides a low-level interface for every function of a 3D graphics card (transform, clipping, lighting, materials, textures, depth buffering, and so on). It also had a higher level Component with a saved mode, which is now officially discontinued.

0
source

Source: https://habr.com/ru/post/1347466/


All Articles