godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.37k stars 21.26k forks source link

Add Direct3D 12 support to official Windows binaries #86490

Closed oscarbg closed 10 months ago

oscarbg commented 11 months ago

Tested versions

reproducible in Godot_v4.3-dev1_win64

System information

win11 Godot_v4.3-dev1_win64

Issue description

Hi, wanted to test Godot_v4.3-dev1 new D3D12 support by downloading prebuild Windows binary but seems it doesn't come with D3D12 support prebuilt..

Steps to reproduce

running: Godot_v4.3-dev1_win64.exe --rendering-driver d3d12 shows:

Unknown rendering driver 'd3d12', aborting.
Valid options are 'vulkan', 'opengl3', 'opengl3_angle', 'dummy', .

Minimal reproduction project (MRP)

no need

jsjtxietian commented 11 months ago

In the meantime you can try this: https://docs.godotengine.org/en/latest/contributing/development/compiling/compiling_for_windows.html#compiling-with-support-for-direct3d-12

Calinou commented 10 months ago

For context:

Being based on proprietary technology, D3D12 support comes as an optional feature keeping the open source spirit of the engine intact. Make sure to check the updated documentation for compiling Godot with D3D12 enabled (there is also an update regarding cross-compilation getting ready to be merged).

https://github.com/godotengine/godot/pull/86551 makes it possible to lift this requirement (and MinGW[^1] building support was added by https://github.com/godotengine/godot/pull/83452), so it should be possible to publish official D3D12-enabled builds once both PRs are merged.

[^1]: Official Godot Windows releases are cross-compiled from Linux using MinGW.

bruvzg commented 10 months ago

https://github.com/godotengine/godot/pull/86551 makes it possible to lift this requirement (and MinGW1 building support was added by https://github.com/godotengine/godot/pull/83452), so it should be possible to publish official D3D12-enabled builds once both PRs are merged.

While we can enable DX support in the builds (and Vulkan / OpenGL will work without any extra components, since libs are loaded dynamically), it seems to still need dxil.dll to use DX, and I was probably wrong about its license. DirectXShaderCompiler is open source, but I do not think it contains source for this lib. And binary release have a separate EULA for the lib. So I'm not sure how it should be handled, EULA for both dxil and Aglity libs allow redistribution under the following conditions:

Distribution Requirements. For any code you distribute, you must:

add significant primary functionality to it in your applications; 

i.  require distributors and external end users to agree to terms that protect it and Microsoft at least as much as this agreement; and

ii. indemnify, defend, and hold harmless Microsoft from any claims, including attorneys’ fees, related to the distribution or use of your applications, except to the extent that any claim is based solely on the unmodified distributable code.

Distribution Restrictions. You may not:

use Microsoft’s trademarks or trade dress in your application in any way that suggests your application comes from or is endorsed by Microsoft; or modify or distribute the source code of any distributable code so that any part of it becomes subject to any license that requires that the distributable code, any other part of the software, or any of Microsoft’s other intellectual property be disclosed or distributed in source code form, or that others have the right to modify it.
clayjohn commented 10 months ago

To chime in here as well. The licencing issue for dxil.dll is the largest barrier to shipping Godot builds with D3D12 enabled by default. We don't want to ship Godot in two files and we don't want to bundle non-open source code into the Godot executable (or ship non-open source code to our users at all).

We are talking with Microsoft about how to resolve this so we can enable D3D12 by default, but I expect it will take some time to resolve as it isn't a technical limitation.

bruvzg commented 10 months ago

To chime in here as well. The licencing issue for dxil.dll is the largest barrier to shipping Godot builds with D3D12 enabled by default. We don't want to ship Godot in two files and we don't want to bundle non-open source code into the Godot executable (or ship non-open source code to our users at all).

We are talking with Microsoft about how to resolve this so we can enable D3D12 by default, but I expect it will take some time to resolve as it isn't a technical limitation.

Meanwhile, we still can enable DX12 (all headers are MIT licensed, so no proprietary code in the main executable), and users who want to use it will only need to add dxil.dll to the engine folder. It's inconvenient, but at least gives an option to use it without making a custom build.