summaryrefslogtreecommitdiffstats
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/SCsub28
-rw-r--r--platform/android/display_server_android.cpp3
-rw-r--r--platform/ios/export/export_plugin.cpp3
-rw-r--r--platform/web/detect.py14
-rw-r--r--platform/web/godot_webgl2.h2
-rw-r--r--platform/web/js/libs/library_godot_webgl2.externs.js16
-rw-r--r--platform/web/js/libs/library_godot_webgl2.js17
-rw-r--r--platform/windows/SCsub57
-rw-r--r--platform/windows/detect.py54
-rw-r--r--platform/windows/display_server_windows.cpp98
-rw-r--r--platform/windows/display_server_windows.h9
-rw-r--r--platform/windows/os_windows.h4
12 files changed, 292 insertions, 13 deletions
diff --git a/platform/android/SCsub b/platform/android/SCsub
index dfc921cc54..97262cf148 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -1,5 +1,7 @@
#!/usr/bin/env python
+import subprocess
+
Import("env")
android_files = [
@@ -77,3 +79,29 @@ if lib_arch_dir != "":
str(env["ANDROID_NDK_ROOT"]) + "/sources/cxx-stl/llvm-libc++/libs/" + lib_arch_dir + "/libc++_shared.so"
)
env_android.Command(out_dir + "/libc++_shared.so", stl_lib_path, Copy("$TARGET", "$SOURCE"))
+
+ def generate_apk(target, source, env):
+ if env["target"] != "editor" and env["dev_build"]:
+ subprocess.run(
+ [
+ "./gradlew",
+ "generateDevTemplate",
+ "--quiet",
+ ],
+ cwd="platform/android/java",
+ )
+ else:
+ # Android editor with `dev_build=yes` is handled by the `generateGodotEditor` task.
+ subprocess.run(
+ [
+ "./gradlew",
+ "generateGodotEditor" if env["target"] == "editor" else "generateGodotTemplates",
+ "--quiet",
+ ],
+ cwd="platform/android/java",
+ )
+
+ if env["generate_apk"]:
+ generate_apk_command = env_android.Command("generate_apk", [], generate_apk)
+ command = env_android.AlwaysBuild(generate_apk_command)
+ env_android.Depends(command, [lib])
diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp
index dd5ab46bd7..9529e0e683 100644
--- a/platform/android/display_server_android.cpp
+++ b/platform/android/display_server_android.cpp
@@ -486,6 +486,9 @@ Vector<String> DisplayServerAndroid::get_rendering_drivers_func() {
#ifdef GLES3_ENABLED
drivers.push_back("opengl3");
#endif
+#ifdef D3D12_ENABLED
+ drivers.push_back("d3d12");
+#endif
#ifdef VULKAN_ENABLED
drivers.push_back("vulkan");
#endif
diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp
index 86c3feb962..b478759e45 100644
--- a/platform/ios/export/export_plugin.cpp
+++ b/platform/ios/export/export_plugin.cpp
@@ -893,8 +893,7 @@ Error EditorExportPlatformIOS::_walk_dir_recursive(Ref<DirAccess> &p_da, FileHan
p_da->list_dir_end();
for (int i = 0; i < dirs.size(); ++i) {
- String dir = dirs[i];
- p_da->change_dir(dir);
+ p_da->change_dir(dirs[i]);
Error err = _walk_dir_recursive(p_da, p_handler, p_userdata);
p_da->change_dir("..");
if (err) {
diff --git a/platform/web/detect.py b/platform/web/detect.py
index b0044a80ff..579eaaff03 100644
--- a/platform/web/detect.py
+++ b/platform/web/detect.py
@@ -186,9 +186,18 @@ def configure(env: "Environment"):
env["LIBPREFIXES"] = ["$LIBPREFIX"]
env["LIBSUFFIXES"] = ["$LIBSUFFIX"]
+ # Get version info for checks below.
+ cc_version = get_compiler_version(env)
+ cc_semver = (cc_version["major"], cc_version["minor"], cc_version["patch"])
+
env.Prepend(CPPPATH=["#platform/web"])
env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"])
+ if cc_semver >= (3, 1, 25):
+ env.Append(LINKFLAGS=["-s", "STACK_SIZE=5MB"])
+ else:
+ env.Append(LINKFLAGS=["-s", "TOTAL_STACK=5MB"])
+
if env["opengl3"]:
env.AppendUnique(CPPDEFINES=["GLES3_ENABLED"])
# This setting just makes WebGL 2 APIs available, it does NOT disable WebGL 1.
@@ -203,13 +212,10 @@ def configure(env: "Environment"):
env.Append(CPPDEFINES=["PTHREAD_NO_RENAME"])
env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"])
env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"])
+ env.Append(LINKFLAGS=["-s", "DEFAULT_PTHREAD_STACK_SIZE=2MB"])
env.Append(LINKFLAGS=["-s", "PTHREAD_POOL_SIZE=8"])
env.Append(LINKFLAGS=["-s", "WASM_MEM_MAX=2048MB"])
- # Get version info for checks below.
- cc_version = get_compiler_version(env)
- cc_semver = (cc_version["major"], cc_version["minor"], cc_version["patch"])
-
if env["lto"] != "none":
# Workaround https://github.com/emscripten-core/emscripten/issues/19781.
if cc_semver >= (3, 1, 42) and cc_semver < (3, 1, 46):
diff --git a/platform/web/godot_webgl2.h b/platform/web/godot_webgl2.h
index 3ade9e4239..2c9af4313f 100644
--- a/platform/web/godot_webgl2.h
+++ b/platform/web/godot_webgl2.h
@@ -44,9 +44,11 @@ extern "C" {
#endif
void godot_webgl2_glFramebufferTextureMultiviewOVR(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
+void godot_webgl2_glFramebufferTextureMultisampleMultiviewOVR(GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews);
void godot_webgl2_glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
#define glFramebufferTextureMultiviewOVR godot_webgl2_glFramebufferTextureMultiviewOVR
+#define glFramebufferTextureMultisampleMultiviewOVR godot_webgl2_glFramebufferTextureMultisampleMultiviewOVR
#ifdef __cplusplus
}
diff --git a/platform/web/js/libs/library_godot_webgl2.externs.js b/platform/web/js/libs/library_godot_webgl2.externs.js
index 18d8d0815a..99190ab009 100644
--- a/platform/web/js/libs/library_godot_webgl2.externs.js
+++ b/platform/web/js/libs/library_godot_webgl2.externs.js
@@ -34,3 +34,19 @@ OVR_multiview2.prototype.FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR;
* @return {void}
*/
OVR_multiview2.prototype.framebufferTextureMultiviewOVR = function(target, attachment, texture, level, baseViewIndex, numViews) {};
+
+/**
+ * @constructor OCULUS_multiview
+ */
+function OCULUS_multiview() {}
+
+/**
+ * @param {number} target
+ * @param {number} attachment
+ * @param {WebGLTexture} texture
+ * @param {number} level
+ * @param {number} baseViewIndex
+ * @param {number} numViews
+ * @return {void}
+ */
+OCULUS_multiview.prototype.framebufferTextureMultisampleMultiviewOVR = function(target, attachment, texture, level, samples, baseViewIndex, numViews) {};
diff --git a/platform/web/js/libs/library_godot_webgl2.js b/platform/web/js/libs/library_godot_webgl2.js
index dbaec9f01b..005b4b7917 100644
--- a/platform/web/js/libs/library_godot_webgl2.js
+++ b/platform/web/js/libs/library_godot_webgl2.js
@@ -61,6 +61,23 @@ const GodotWebGL2 = {
const /** OVR_multiview2 */ ext = context.multiviewExt;
ext.framebufferTextureMultiviewOVR(target, attachment, GL.textures[texture], level, base_view_index, num_views);
},
+
+ godot_webgl2_glFramebufferTextureMultisampleMultiviewOVR__deps: ['emscripten_webgl_get_current_context'],
+ godot_webgl2_glFramebufferTextureMultisampleMultiviewOVR__proxy: 'sync',
+ godot_webgl2_glFramebufferTextureMultisampleMultiviewOVR__sig: 'viiiiiii',
+ godot_webgl2_glFramebufferTextureMultisampleMultiviewOVR: function (target, attachment, texture, level, samples, base_view_index, num_views) {
+ const context = GL.currentContext;
+ if (typeof context.oculusMultiviewExt === 'undefined') {
+ const /** OCULUS_multiview */ ext = context.GLctx.getExtension('OCULUS_multiview');
+ if (!ext) {
+ GodotRuntime.error('Trying to call glFramebufferTextureMultisampleMultiviewOVR() without the OCULUS_multiview extension');
+ return;
+ }
+ context.oculusMultiviewExt = ext;
+ }
+ const /** OCULUS_multiview */ ext = context.oculusMultiviewExt;
+ ext.framebufferTextureMultisampleMultiviewOVR(target, attachment, GL.textures[texture], level, samples, base_view_index, num_views);
+ },
};
autoAddDeps(GodotWebGL2, '$GodotWebGL2');
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index 1b6908d2bb..0549e408a7 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -29,7 +29,9 @@ res_file = "godot_res.rc"
res_target = "godot_res" + env["OBJSUFFIX"]
res_obj = env.RES(res_target, res_file)
-prog = env.add_program("#bin/godot", common_win + res_obj, PROGSUFFIX=env["PROGSUFFIX"])
+sources = common_win + res_obj
+
+prog = env.add_program("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"])
# Build console wrapper app.
if env["windows_subsystem"] == "gui":
@@ -58,6 +60,59 @@ if env["vsproj"]:
for x in common_win_wrap:
env.vs_srcs += ["platform/windows/" + str(x)]
+if env["d3d12"]:
+ dxc_target_aliases = {
+ "x86_32": "x86",
+ "x86_64": "x64",
+ "arm32": "arm",
+ "arm64": "arm64",
+ }
+ dxc_arch_subdir = dxc_target_aliases[env["arch"]]
+
+ agility_target_aliases = {
+ "x86_32": "win32",
+ "x86_64": "x64",
+ "arm32": "arm",
+ "arm64": "arm64",
+ }
+ agility_arch_subdir = agility_target_aliases[env["arch"]]
+
+ # Used in cases where we can have multiple archs side-by-side.
+ arch_bin_dir = "#bin/" + env["arch"]
+
+ # DXC
+ if env["dxc_path"] != "":
+ dxc_dll = "dxil.dll"
+ # Whether this one is loaded from arch-specific directory or not can be determined at runtime.
+ # Let's copy to both and let the user decide the distribution model.
+ for v in ["#bin", arch_bin_dir]:
+ env.Command(
+ v + "/" + dxc_dll,
+ env["dxc_path"] + "/bin/" + dxc_arch_subdir + "/" + dxc_dll,
+ Copy("$TARGET", "$SOURCE"),
+ )
+
+ # Agility SDK
+ if env["agility_sdk_path"] != "":
+ agility_dlls = ["D3D12Core.dll", "d3d12SDKLayers.dll"]
+ # Whether these are loaded from arch-specific directory or not has to be known at build time.
+ target_dir = arch_bin_dir if env["agility_sdk_multiarch"] else "#bin"
+ for dll in agility_dlls:
+ env.Command(
+ target_dir + "/" + dll,
+ env["agility_sdk_path"] + "/build/native/bin/" + agility_arch_subdir + "/" + dll,
+ Copy("$TARGET", "$SOURCE"),
+ )
+
+ # PIX
+ if env["pix_path"] != "":
+ pix_dll = "WinPixEventRuntime.dll"
+ env.Command(
+ "#bin/" + pix_dll,
+ env["pix_path"] + "/bin/" + dxc_arch_subdir + "/" + pix_dll,
+ Copy("$TARGET", "$SOURCE"),
+ )
+
if not os.getenv("VCINSTALLDIR"):
if env["debug_symbols"] and env["separate_debug_symbols"]:
env.AddPostAction(prog, run_in_subprocess(platform_windows_builders.make_debug_mingw))
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index dbdb13697b..4acdc8e639 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -187,6 +187,12 @@ def get_opts():
BoolVariable("debug_crt", "Compile with MSVC's debug CRT (/MDd)", False),
BoolVariable("incremental_link", "Use MSVC incremental linking. May increase or decrease build times.", False),
("angle_libs", "Path to the ANGLE static libraries", ""),
+ # Direct3D 12 support.
+ ("mesa_libs", "Path to the MESA/NIR static libraries (required for D3D12)", ""),
+ ("dxc_path", "Path to the DirectX Shader Compiler distribution (required for D3D12)", ""),
+ ("agility_sdk_path", "Path to the Agility SDK distribution (optional for D3D12)", ""),
+ ("agility_sdk_multiarch", "Whether the Agility SDK DLLs will be stored in arch-specific subdirectories", False),
+ ("pix_path", "Path to the PIX runtime distribution (optional for D3D12)", ""),
]
@@ -430,6 +436,34 @@ def configure_msvc(env, vcvars_msvc_config):
if not env["use_volk"]:
LIBS += ["vulkan"]
+ if env["d3d12"]:
+ if env["dxc_path"] == "":
+ print("The Direct3D 12 rendering driver requires dxc_path to be set.")
+ sys.exit(255)
+
+ env.AppendUnique(CPPDEFINES=["D3D12_ENABLED"])
+ LIBS += ["d3d12", "dxgi", "dxguid"]
+ LIBS += ["version"] # Mesa dependency.
+
+ # Needed for avoiding C1128.
+ if env["target"] == "release_debug":
+ env.Append(CXXFLAGS=["/bigobj"])
+
+ arch_subdir = "arm64" if env["arch"] == "arm64" else "x64"
+
+ # PIX
+ if env["pix_path"] != "":
+ env.Append(LIBPATH=[env["pix_path"] + "/bin/" + arch_subdir])
+ LIBS += ["WinPixEventRuntime"]
+
+ # Mesa
+ if env["mesa_libs"] == "":
+ print("The Direct3D 12 rendering driver requires mesa_libs to be set.")
+ sys.exit(255)
+
+ env.Append(LIBPATH=[env["mesa_libs"] + "/bin"])
+ LIBS += ["libNIR.windows." + env["arch"]]
+
if env["opengl3"]:
env.AppendUnique(CPPDEFINES=["GLES3_ENABLED"])
if env["angle_libs"] != "":
@@ -623,6 +657,26 @@ def configure_mingw(env):
if not env["use_volk"]:
env.Append(LIBS=["vulkan"])
+ if env["d3d12"]:
+ env.AppendUnique(CPPDEFINES=["D3D12_ENABLED"])
+ env.Append(LIBS=["d3d12", "dxgi", "dxguid"])
+ env.Append(LIBS=["version"]) # Mesa dependency.
+
+ arch_subdir = "arm64" if env["arch"] == "arm64" else "x64"
+
+ # PIX
+ if env["pix_path"] != "":
+ print("PIX runtime is not supported with MinGW.")
+ sys.exit(255)
+
+ # Mesa
+ if env["mesa_libs"] == "":
+ print("The Direct3D 12 rendering driver requires mesa_libs to be set.")
+ sys.exit(255)
+
+ env.Append(LIBPATH=[env["mesa_libs"] + "/bin"])
+ env.Append(LIBS=["libNIR.windows." + env["arch"]])
+
if env["opengl3"]:
env.Append(CPPDEFINES=["GLES3_ENABLED"])
if env["angle_libs"] != "":
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index c801ca96e7..77dfff2e5d 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -1107,6 +1107,11 @@ void DisplayServerWindows::delete_sub_window(WindowID p_window) {
context_vulkan->window_destroy(p_window);
}
#endif
+#ifdef D3D12_ENABLED
+ if (context_d3d12) {
+ context_d3d12->window_destroy(p_window);
+ }
+#endif
#ifdef GLES3_ENABLED
if (gl_manager_angle) {
gl_manager_angle->window_destroy(p_window);
@@ -1539,6 +1544,11 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo
context_vulkan->window_resize(p_window, w, h);
}
#endif
+#if defined(D3D12_ENABLED)
+ if (context_d3d12) {
+ context_d3d12->window_resize(p_window, w, h);
+ }
+#endif
#if defined(GLES3_ENABLED)
if (gl_manager_native) {
gl_manager_native->window_resize(p_window, w, h);
@@ -2590,6 +2600,12 @@ void DisplayServerWindows::window_set_vsync_mode(DisplayServer::VSyncMode p_vsyn
}
#endif
+#if defined(D3D12_ENABLED)
+ if (context_d3d12) {
+ context_d3d12->set_vsync_mode(p_window, p_vsync_mode);
+ }
+#endif
+
#if defined(GLES3_ENABLED)
if (gl_manager_native) {
gl_manager_native->set_use_vsync(p_window, p_vsync_mode != DisplayServer::VSYNC_DISABLED);
@@ -2608,6 +2624,12 @@ DisplayServer::VSyncMode DisplayServerWindows::window_get_vsync_mode(WindowID p_
}
#endif
+#if defined(D3D12_ENABLED)
+ if (context_d3d12) {
+ return context_d3d12->get_vsync_mode(p_window);
+ }
+#endif
+
#if defined(GLES3_ENABLED)
if (gl_manager_native) {
return gl_manager_native->is_using_vsync(p_window) ? DisplayServer::VSYNC_ENABLED : DisplayServer::VSYNC_DISABLED;
@@ -2616,7 +2638,6 @@ DisplayServer::VSyncMode DisplayServerWindows::window_get_vsync_mode(WindowID p_
return gl_manager_angle->is_using_vsync() ? DisplayServer::VSYNC_ENABLED : DisplayServer::VSYNC_DISABLED;
}
#endif
-
return DisplayServer::VSYNC_ENABLED;
}
@@ -3767,12 +3788,19 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
rect_changed = true;
}
+ // Note: Trigger resize event to update swapchains when window is minimized/restored, even if size is not changed.
+ if (window_created && window.context_created) {
#if defined(VULKAN_ENABLED)
- if (context_vulkan && window.context_created) {
- // Note: Trigger resize event to update swapchains when window is minimized/restored, even if size is not changed.
- context_vulkan->window_resize(window_id, window.width, window.height);
- }
+ if (context_vulkan) {
+ context_vulkan->window_resize(window_id, window.width, window.height);
+ }
+#endif
+#if defined(D3D12_ENABLED)
+ if (context_d3d12) {
+ context_d3d12->window_resize(window_id, window.width, window.height);
+ }
#endif
+ }
}
if (!window.minimized && (!(window_pos_params->flags & SWP_NOMOVE) || window_pos_params->flags & SWP_FRAMECHANGED)) {
@@ -4336,6 +4364,18 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode,
}
#endif
+#ifdef D3D12_ENABLED
+ if (context_d3d12) {
+ if (context_d3d12->window_create(id, p_vsync_mode, wd.hWnd, hInstance, WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top) != OK) {
+ memdelete(context_d3d12);
+ context_d3d12 = nullptr;
+ windows.erase(id);
+ ERR_FAIL_V_MSG(INVALID_WINDOW_ID, "Failed to create D3D12 Window.");
+ }
+ wd.context_created = true;
+ }
+#endif
+
#ifdef GLES3_ENABLED
if (gl_manager_native) {
if (gl_manager_native->window_create(id, wd.hWnd, hInstance, WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top) != OK) {
@@ -4644,9 +4684,26 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
}
}
#endif
+#if defined(D3D12_ENABLED)
+ if (rendering_driver == "d3d12") {
+ context_d3d12 = memnew(D3D12Context);
+ if (context_d3d12->initialize() != OK) {
+ memdelete(context_d3d12);
+ context_d3d12 = nullptr;
+ r_error = ERR_UNAVAILABLE;
+ return;
+ }
+ }
+#endif
// Init context and rendering device
#if defined(GLES3_ENABLED)
+#if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || defined(_M_ARM64)
+ // There's no native OpenGL drivers on Windows for ARM, switch to ANGLE over DX.
+ if (rendering_driver == "opengl3") {
+ rendering_driver = "opengl3_angle";
+ }
+#else
bool fallback = GLOBAL_GET("rendering/gl_compatibility/fallback_to_angle");
if (fallback && (rendering_driver == "opengl3")) {
Dictionary gl_info = detect_wgl();
@@ -4667,6 +4724,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
rendering_driver = "opengl3_angle";
}
}
+#endif
if (rendering_driver == "opengl3") {
gl_manager_native = memnew(GLManagerNative_Windows);
@@ -4720,7 +4778,6 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
show_window(MAIN_WINDOW_ID);
#if defined(VULKAN_ENABLED)
-
if (rendering_driver == "vulkan") {
rendering_device_vulkan = memnew(RenderingDeviceVulkan);
rendering_device_vulkan->initialize(context_vulkan);
@@ -4728,6 +4785,14 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
RendererCompositorRD::make_current();
}
#endif
+#if defined(D3D12_ENABLED)
+ if (rendering_driver == "d3d12") {
+ rendering_device_d3d12 = memnew(RenderingDeviceD3D12);
+ rendering_device_d3d12->initialize(context_d3d12);
+
+ RendererCompositorRD::make_current();
+ }
+#endif
if (!Engine::get_singleton()->is_editor_hint() && !OS::get_singleton()->is_in_low_processor_usage_mode()) {
// Increase priority for projects that are not in low-processor mode (typically games)
@@ -4762,6 +4827,9 @@ Vector<String> DisplayServerWindows::get_rendering_drivers_func() {
#ifdef VULKAN_ENABLED
drivers.push_back("vulkan");
#endif
+#ifdef D3D12_ENABLED
+ drivers.push_back("d3d12");
+#endif
#ifdef GLES3_ENABLED
drivers.push_back("opengl3");
drivers.push_back("opengl3_angle");
@@ -4826,6 +4894,11 @@ DisplayServerWindows::~DisplayServerWindows() {
context_vulkan->window_destroy(MAIN_WINDOW_ID);
}
#endif
+#ifdef D3D12_ENABLED
+ if (context_d3d12) {
+ context_d3d12->window_destroy(MAIN_WINDOW_ID);
+ }
+#endif
if (wintab_available && windows[MAIN_WINDOW_ID].wtctx) {
wintab_WTClose(windows[MAIN_WINDOW_ID].wtctx);
windows[MAIN_WINDOW_ID].wtctx = 0;
@@ -4846,6 +4919,19 @@ DisplayServerWindows::~DisplayServerWindows() {
}
#endif
+#if defined(D3D12_ENABLED)
+ if (rendering_device_d3d12) {
+ rendering_device_d3d12->finalize();
+ memdelete(rendering_device_d3d12);
+ rendering_device_d3d12 = nullptr;
+ }
+
+ if (context_d3d12) {
+ memdelete(context_d3d12);
+ context_d3d12 = nullptr;
+ }
+#endif
+
if (restore_mouse_trails > 1) {
SystemParametersInfoA(SPI_SETMOUSETRAILS, restore_mouse_trails, 0, 0);
}
diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h
index 48c8c20280..1e61462e95 100644
--- a/platform/windows/display_server_windows.h
+++ b/platform/windows/display_server_windows.h
@@ -58,6 +58,10 @@
#include "drivers/vulkan/rendering_device_vulkan.h"
#endif
+#if defined(D3D12_ENABLED)
+#include "drivers/d3d12/rendering_device_d3d12.h"
+#endif
+
#if defined(GLES3_ENABLED)
#include "gl_manager_windows_angle.h"
#include "gl_manager_windows_native.h"
@@ -347,6 +351,11 @@ class DisplayServerWindows : public DisplayServer {
RenderingDeviceVulkan *rendering_device_vulkan = nullptr;
#endif
+#if defined(D3D12_ENABLED)
+ D3D12Context *context_d3d12 = nullptr;
+ RenderingDeviceD3D12 *rendering_device_d3d12 = nullptr;
+#endif
+
RBMap<int, Vector2> touch_state;
int pressrc;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index e873fb8a13..02f062f2de 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -52,6 +52,10 @@
#include "drivers/vulkan/rendering_device_vulkan.h"
#endif
+#if defined(D3D12_ENABLED)
+#include "drivers/d3d12/rendering_device_d3d12.h"
+#endif
+
#include <io.h>
#include <shellapi.h>
#include <stdio.h>