为什么Direct3D仅适用于Windows?

什么是Direct3D?它是一个API,不是吗?它是由
Windows还是显卡实现的?

如果显卡实现Direct3D API,为什么其他操作系统不能使用显卡的Direct3D资源?

如果Direct3D由Windows实现,则必须使用图形卡资源,例如OpenGL或OpenCL.如果Direct3D呼叫不是直接连接到显卡,则由于中间呼叫,它会更慢.

请帮助我理解Direct3D是什么.

最佳答案

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

是的,Direct3D是一个API.它(主要)由Windows本身实现.但是,Windows会将相当一部分实际工作卸载到显卡驱动程序并最终卸载到gfx卡本身,因此也可以说gfx卡“实现”D3D.

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

它们可以,而且它们确实如此,但只有相对较小(但通常是关键部分)的D3D功能是由卡的硬件直接实现的,因此需要在软件中进行更多的工作才能实现D3D.

If Direct3D is implemented by Windows,
it has to use graphics card resources,
such as OpenGL or OpenCL.

不,这是一个误解. OpenGL和OpenCL也是API,仅部分由gfx硬件实现(就像D3D一样). gfx硬件通常具有(专有)“本机”API,这是gfx驱动程序(D3D和OpenGL)使用的.

If Direct3D calls are not directly to
the graphics card, it would be slower
due to intermediate calls.

没有任何“中间调用” – D3D驱动程序使用卡本机API,如上所述.

点赞