Skip to content

Add Direct3D 12 rendering driver (Mesa NIR approach)#70315

Merged
akien-mga merged 3 commits into
godotengine:masterfrom
RandomShaper:d3d12_mesa
Dec 12, 2023
Merged

Add Direct3D 12 rendering driver (Mesa NIR approach)#70315
akien-mga merged 3 commits into
godotengine:masterfrom
RandomShaper:d3d12_mesa

Conversation

@RandomShaper

@RandomShaper RandomShaper commented Dec 19, 2022

Copy link
Copy Markdown
Member

Direct3D 12 Rendering Driver (via Mesa 3D's NIR)

This is a replacement of #64304. The difference lies in how they approach shader compilation; i.e., how they manage to take SPIR-V shaders into Direct3D. The old one used SPIRV-Cross plus mix and match of SPIR-V and DXIL reflection data. Also, for emulating specialization constants in Direct3D it needed part of the source code of the DirectX Shader Compiler, to be able to patch the LLVM IR bitcode. The new one does the shader translation via Mesa's intermediate representation of shaders (NIR), plus the Microsoft-contributed code to that project that translates NIR to DXIL. That also allows this PR to adjust the shader bindings in a way that avoids the need for the DXIL reflection and mix-and-match steps. Furthermore, the trick for specialization constants is also made much simpler, thanks to a local patch to the Mesa source code, so there's no need to bundle part of DXC either.

The description of this PR is mostly the same as the one of the old incarnation. Differences are emphasized via text formatting for the reader's convenience.


DirectX 12 image

This is a feature-complete Direct3D 12 RenderingDevice implementation for Godot Engine. It works as a drop-in replacement for the Vulkan one. It is selectable in the project settings as an alternative to use on Windows.

By supporting Direct3D 12, Godot gains support for multiple new platforms, such as:

  • Windows Store (UWP).
  • Windows on ARM.
  • GDK.
  • XBox —which can't be supported officially by Godot, but for which Direct3D 12 support is essential—.

This PR includes some preparatory changes, to uncouple the RenderingDevice from Vulkan, that is, abstracting the modern Godot rendering architecture from whatever rendering API is used. Moreover, instead of a monolithic commit, the code of the driver itself is split into three, much more manageable commits.

Highlights

Performance

Depending on the complexity of the scene, effects used, etc., this first version of the renderer performs generally worse than the Vulkan one. In some tests, D3D12 has not been able to deliver more than 75% of the Vulkan frames per second. In some other, D3D12 has been able to outperform Vulkan by a small margin. Performance improvements will be ironed out over time.

Homogeneity

The D3D12 rendering driver has been written taking the Vulkan one as a basis and keeping as much as possible from the original. This effort gives two-fold benefits: on the one hand, the overall structure of the code files, including auxiliary structures and other elements, is very similar, which makes maintenance easier; on the other hand, both renderers are more similar at the functional level. An example of this is that the D3D12 renderer will be as picky as the Vulkan one when it comes to validation and error checking, even in areas where the Microsft API wouldn't impose such strict constraints.

Specialization Constants

In Vulkan it is possible to create multiple variations of a pipeline with different values for certain parameters that end up as compile-time constants in the shader generated under the hood. Those parameters are called specialization constants.

In Direct3D there's no counterpart of that mechanism. However, Godot rendering relies on it for some of its shaders. A way to have specialization constants in the Direct3D/DXIL world had to be researched. It was finally found and is used in this code. The technique is explained in this Twitter thread: https://twitter.com/RandomPedroJ/status/1532725156623286272. Update for this new PR: The new approach shares some details, but it's both more powerful and simpler. An article about it will be published soon.

Code Comments

To avoid making this PR description unnecessarily long, the reader is advised to find additional insight in the comments.

Assertions

Given that some data crosses many stages from its inception to where it's finally used, the code is full of dev-only checks ensure the sanity of many different data structures at different points in time. The expectation is that this will make easier to catch bugs —even subtle ones— in areas of high complexity.

Known Issues

  • Multiview rendering does not work. Only the left eye is rendered.
  • SDFGI glitches on AMD GPUs. At least, it does on integrated AMD Radeon. Deep investigation led to the finding that it's a bug in some third-party element — e.g. the Radeon driver, Direct3D or the DirectX Shader compiler. The clue is that graphics debugging tools show the pipeline status as if some of the needed bindings hadn't been set. Moreover, the affected shaders work fine if compiled with optimizations disabled.
  • No MinGW supported. So far only building with MSVC works, due to some vendor-specific stuff in third-party code.

Compilation & Distribution

  • Grab the (main, not PDB) .zip file corresponding to the 1.7.2207 (2023-12-12) v1.7.2308 version of the DirectX Shader Compiler from https://github.com/Microsoft/DirectXShaderCompiler/releases.

  • Unzip the file to some path.

  • Optional (only for developers wanting to debug graphics with the PIX tool, only for debug builds):

    • Locate the WinPixEventRuntime package (version 1.0.220810001 is the latest tested), at https://devblogs.microsoft.com/pix/download/. You’ll be finally taken to a NuGet package page where you can click Download package to get it.
    • Change the file extension to .zip.
    • Unzip the file to some path.
  • (Update for this new PR) Optional:

    • Locate the Agility SDK package (version 1.710.0-preview 1.610.5) is the latest tested), at https://devblogs.microsoft.com/directx/directx12agility/. You’ll be finally taken to a NuGet package page where you can click Download package to get it. UPDATE: If you use a preview version of the Agility SDK, remembe to enable developer mode in Windows; otherwise it won't be used.
    • Change the file extension to .zip.
    • Unzip the file to some path.
  • 2023-12-07: Download the latest godot-nir-static distribution from https://github.com/godotengine/godot-nir-static/releases/ (23.1.0-devel is the only tested at the time of this writing), or make one yourself with these steps:

    • Install the Python package mako (https://www.makotemplates.org/), needed to generate some files.
    • Clone the repo and switch current directory to it. (The mesa_libs path you have to provide later is this directory.)
    • Run these:
      • git submodule update --init
      • ./update_mesa.sh
      • scons

    Huge thanks to @bruvzg for making this workflow possible!

  • Build Godot with the following additional parameters to SCons: d3d12=yes dxc_path=<...>, plus (if using the Agility SDK) agility_sdk_path=<...>, plus (if using PIX) pix_path=<...>, (2023-12-07) plus mesa_libs=<...>.

NOTE: The build process will copy dxcompiler.dll and dxil.dll (Update for this new PR: Now the shader compiler DLL is not needed at all; only the validator-signer, dxil.dll, is required.) from the bin/x64/ directory in the DXC zipfile to the Godot binary directory. D3D12-enabled Godot packages for distribution to end users must include those files that file, both for the editor and games.
2023-12-07: Both dxil.dll and the DLLs from the Agility SDK come in multiple versions, for different architectures. Now, to allow you to have builds of Godot for multiple archs in the same build tree, the D3D12 driver and build system have the following enhancements:

  • DXIL.dll is copied both to bin/ and the appropriate bin/<arch>/, so you can end up with multiple arch-specific versions of the DLL plus the latest one (or single one) built in bin/. That lets you use a single or multi-arch workflow without build-time changes. At runtime, the renderer will try to load the DLL from the arch-specific one, falling back to the same directory as the Godot executable.
  • For the Agility SDK's DLLs you have to explicitly choose the kind of workflow. Single-arch is the default (DLLs copied to bin/). If you pass agility_sdk_multi_arch=yes to SCons, you'll opt-in for multi-arch. DLLs will be copied to the appropiate bin/<arch>/ subdirs and at runtime the right one will be loaded.

Future Work

Besides fixing the known issues described in another section, there are many options for potential improvement, the most important of which are described below. The code also has a number of TODO items that refer to these and other, generally smaller, potential enhancements or nice-to-haves.

Render Pass API

The D3D12 renderer uses what in the Vulkan world is called dynamic rendering. In other words, it doesn't use render pass —and subpass— APIs. This was done to make things simpler, but came with a couple of downsides.

  • First, a lot of code to do the proper setup of rendering passes is avoided, but some of the things the API would do by itself still require an amount of code —operations like clearing or discarding a framebuffer—.
  • Second, this mentioned sort of emulation of builtin render subpasses won't perform as well on TBDR hardware because of the performance gains that input attachments provide can't be obtained from manual management of subpasses. This performance limitation only affects the mobile backend, though.

Actionable item: Re-work render pass management with the proper APIs, which may be needed to squeeze performance from certain kind of devices.

Enhanced Barriers

Direct3D 12 was released with a way to synchronize the GPU work consisting in resource barriers. In short, they are not nearly as fine-grained as Vulkan's memory and pipeline barriers are, the biggest consequence of this being comparatively worse performance. Microsoft has later powered Direct3D with the so-called enhanced barriers, which are the same that Vulkan has. Recent GPU drivers and Windows versions already support them.

Actionable item: Re-work synchronization based on enhanced barriers, which will give more performance and make the code more similar to the one in the Vulkan renderer.

More Reasonable Dependencies

Currently, this is using SPIRV-Cross for shader translation to HLSL and an important chunk of DXC for the specialization constants hack. When the Microsoft provided support for DXIL in Mesa is mature —when checked for the purpose of this work it wasn't yet—, we may be able to use it —via NIR— instead of that two other dependencies for those purposes. Microsoft is donating engineer time to Mesa for this effort, so we hope it will be in an usable state soon for us.

Actionable item: Watch the status of DXIL in Mesa and replace SPIRV-Cross and the DXC source code as soon as feasible.

Update for this new PR: This actionable item is precisely what this new PR is about!

Deprecate Texture Aliasing

In Vulkan it is possible to tell upfront which formats a texture will be interpreted as, and it'll just work. In Direct3D 12 there was traditionally no way to do the same. Therefore, there are limitations on which reinterpretations one can do.

Godot needs to do two of them that are illegal in D3D12: write as R32 and read as R9G9B9E5, and write as R16 and read as R4B4G4A4. The Direct3D 12 renderer code works around that limitation by abusing texture aliases, which, according to some tests across different GPUs, seems to work fine in practice.

The legal approach would be to make copies of the textures when the time to read comes. However, that won't still work for the R4B4G4A4 case. Therefore, the aliasing workaround is used for every case by now.

Luckily, Direct3D has recently added a new API CreateCommittedResource3() that provides the same nicety as Vulkan, but it's still not widely available and, at the time of this writing, the D3D12 Memory Allocator library still doesn't support it (there's a PR, though: GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator#44).

Thanks go to Matías N. Goldberg, which was of great help in this investigation.

Actionable item: Add check support and prefer CreateCommittedResource3() to the aliasing hack where possible.
UPDATE: Done.

Further Homogeneity

Actionable item: Fuse as much as possible the elements that Vulkan and D3D12 have in common —staging buffer, static arrays of data format names, etc.—. This should reduce the codebase size and make it easier to maintain (and eventually add more platforms).

Missing NIR-to-DXIL Features (new for this PR)

These two feature requests in the Mesa 3D repo must be honored so multi-view and shader subgroup operations can be enabled back:

More

Just to make it complete, there are a few more potential improvements that may or may not be already in a TODO in the comments:

  • Try to assign HLSL bindings manually and inform SPIRV-Cross in a deterministic way. That would make reflection, management of root signature and population of handle heaps simpler and more efficient. (Credit: @reduz.) Update for this new PR: As mentioned above, matching bindings between the SPIR-V and DXIL realms is now much more convenient.
  • More sensible use of the shared heap (i.e., track which resources/samplers are already bound and reuse somehow). Update: Done.
  • Leverage promotion and decay of the state of buffers.
  • While still using resource barriers, do split barriering where possible. (Maybe by taking the now neglected p_post_barrier parameters as a hint somehow?)
  • A way to use the HLSL implementation of fsr_upscale.h directly, given the appropriate defines.
  • Consider promoting some samplers (material_samplers) to static samplers and/or descriptors to root descriptors when possible.
  • In case of D3D12_FEATURE_DATA_ARCHITECTURE being UMA, use WriteToSubresource() instead of memcpy().
  • Consider D3D12_BUFFER_SRV_FLAG_RAW for CBV, or another usage.

🍀 This work has been financed and kindly donated to the Godot Engine project by W4 Games. 🍀

Production edit: closes godotengine/godot-roadmap#30

@RandomShaper RandomShaper added this to the 4.0 milestone Dec 19, 2022
@RandomShaper RandomShaper force-pushed the d3d12_mesa branch 6 times, most recently from 9844db9 to 7292df9 Compare December 20, 2022 21:51
@RandomShaper RandomShaper marked this pull request as ready for review December 21, 2022 13:01
@RandomShaper RandomShaper requested review from a team as code owners December 21, 2022 13:01
@RandomShaper RandomShaper force-pushed the d3d12_mesa branch 2 times, most recently from 0647208 to faa55d1 Compare December 21, 2022 19:05
@panreyes

panreyes commented Dec 21, 2022

Copy link
Copy Markdown

I own a Samsung Galaxy Book Go, which is a Windows on ARM laptop that only supports DirectX 12 (not Vulkan nor OpenGL natively).

These two first errors might be more related to other parts of Godot.
Please let me know if I shall open separate issues for them.

1.- Error opening Godot editor in WoA: OpenGL / Vulkan are preferred by default even if they are not available.

I executed the Editor build/artifact (win x86_64) available in the checks of this PR and it did not start because Godot tried to use OpenGL to render the Project manager window by default, showing an error mentioning that OpenGL is not available.

Seeing the given advice in the error dialog, I ran Godot again with the parameter --rendering-driver d3d12

After that, I could open or create a project, but only "Forward+" or "Mobile" projects would let me continue ("Compatibility" depends on OpenGL/GLES3).

2.- Error executing a Godot project: In "Forward+" or "Mobile" projects Vulkan is preferred by default even if it is not available.

In the editor, when pressing "Play" the game would also trigger the error dialog mentioning that Vulkan is not available.
I could solve this issue by forcing Godot to use the d3d12 driver in Project settings with Advanced Settings enabled.

3.- Errors logged when selecting a CSGBox3D in the editor

When running the editor with d3d12 renderer in that laptop, when I select a CSGBox3D these messages are thrown in the debug log on every frame until I select another node:

The vertex format used to create the pipeline does not match the vertex format bound.
CreateGraphicsPipelineState failed with error 0x-7ff8ffa9 for shader 'SceneForwardClusteredShaderRD:9'.
servers\rendering\renderer_rd\pipeline_cache_rd.cpp:61 - Condition "pipeline.is_null()" is true. Returning: RID()

Feel free to get in touch in case you need to test anything in this laptop.
[Updated] Mobile works as well. I thought it depended on GLES3. Thanks to @Calinou for noticing.

@Calinou

Calinou commented Dec 21, 2022

Copy link
Copy Markdown
Member

("Compatibility" or "Mobile" depend on OpenGL/GLES3).

The Forward Mobile backend uses Vulkan/Direct3D 12, not OpenGL. According to this PR's description, it should be able to work with Direct3D 12.

@panreyes

Copy link
Copy Markdown

("Compatibility" or "Mobile" depend on OpenGL/GLES3).

The Forward Mobile backend uses Vulkan/Direct3D 12, not OpenGL. According to this PR's description, it should be able to work with Direct3D 12.

Yes, you are right. I just checked and it works too but with the same issues.

@akien-mga

akien-mga commented Dec 23, 2022

Copy link
Copy Markdown
Member

Starting having a look at what it will take to build this driver using MinGW-GCC on Linux.

I had to do some fixes to the SCsub (and some cleanup while at it), please test them with MSVC and integrate if appropriate:

diff --git a/drivers/d3d12/SCsub b/drivers/d3d12/SCsub
index 95d7937807..c4c4e45a4a 100644
--- a/drivers/d3d12/SCsub
+++ b/drivers/d3d12/SCsub
@@ -12,26 +12,26 @@ thirdparty_obj = []
 
 # DirectX Headers (must take precedence over Windows SDK's).
 
-env.Prepend(CPPPATH=["#thirdparty/directx_headers"])
 env_d3d12_rd.Prepend(CPPPATH=["#thirdparty/directx_headers"])
 
 
 # Direct3D 12 Memory Allocator.
 
-env.Append(CPPPATH=["#thirdparty/d3d12ma"])
 env_d3d12_rd.Append(CPPPATH=["#thirdparty/d3d12ma"])
 
 thirdparty_sources_d3d12ma = ["#thirdparty/d3d12ma/D3D12MemAlloc.cpp"]
 
-env_thirdparty_d3d12ma = env.Clone()
+env_thirdparty_d3d12ma = env_d3d12_rd.Clone()
+env_thirdparty_d3d12ma.disable_warnings()
 env_thirdparty_d3d12ma.add_source_files(thirdparty_obj, thirdparty_sources_d3d12ma)
-env_thirdparty_d3d12ma.Append(CCFLAGS=["/std:c++14", "/permissive-"])
-env_thirdparty_d3d12ma.Append(CCFLAGS=["/wd4189", "/wd4324", "/wd4505"])
+if env.msvc:
+    env_thirdparty_d3d12ma.Append(CCFLAGS=["/std:c++14", "/permissive-"])
 
 
 # Mesa (SPIR-V to DXIL functionality).
 
 env_thirdparty_mesa = env.Clone()
+env_thirdparty_mesa.disable_warnings()
 
 mesa_dir = "#thirdparty/mesa"
 mesa_gen_dir = "#thirdparty/mesa/generated"
@@ -147,7 +147,7 @@ env_thirdparty_mesa.Append(
         ("PACKAGE_BUGREPORT", '\\"https://gitlab.freedesktop.org/mesa/mesa/-/issues\\"'),
         "PIPE_SUBSYSTEM_WINDOWS_USER",
         "_USE_MATH_DEFINES",
-      
+        "HAVE_STRUCT_TIMESPEC",
     ]
 )
 if env.msvc:
@@ -162,7 +162,6 @@ if env.msvc:
             "_ALLOW_KEYWORD_MACROS",
             ("_HAS_EXCEPTIONS", 0),
             "NOMINMAX",
-            "HAVE_STRUCT_TIMESPEC",
         ]
     )
     env_thirdparty_mesa.Append(CFLAGS=["/std:c11"])
@@ -174,13 +173,7 @@ else:
         ]
     )
     env_thirdparty_mesa.Append(CFLAGS=["-std=c11"])
-    env_thirdparty_mesa.Append(CXXFLAGS=["-std=cpp++17"])
-
-# No point in fighting warnings in Mesa.
-if env.msvc:
-    env_thirdparty_mesa.Append(CCFLAGS=["/W0"])
-else:
-    env_thirdparty_mesa.Append(CCFLAGS=["-w"])
+    env_thirdparty_mesa.Append(CXXFLAGS=["-std=c++17"])
 
 
 # Add all.
  • We already have env.disable_warnings() that properly removes warning flags. We always use that for thirdparty code and it should work here too.
  • Avoid adding stuff to the general env if it's not needed, as it pollutes the command line for all files in the engine. If some thirdparty include dirs are needed only for thirdparty code, or for our d3d12 driver code, they should be added to the CPPPATH only for those cloned envs. As such, when you clone an env, keep in mind which one you're clone (env or env_d3d12_rd, etc.) to share added defines and include paths or not.
  • ("_Static_assert", "static_assert") define would break MinGW as its assert.h actually defines static_assert to _Static_assert. Chances are that it's not needed for MSVC either, but if it is it should be moved to the env.msvc block.
  • HAVE_STRUCT_TIMESPEC is needed for MinGW too, which defines it.
  • Not changed, but all the -std wrangling seems a bit overkill. We already build the whole engine with -std=c++17 for C++ and -std=c11 for C. I see D3D12MA uses C++14 but I assume it's as a baseline for compatibility, it's probably fine if we compile it with C++17 like everything else?

With the above changes, some stuff compiles fine but I still have some roadblocks:

x86_64-w64-mingw32-g++ -o thirdparty/d3d12ma/D3D12MemAlloc.windows.editor.dev.x86_64.o -c -std=gnu++17 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wplacement-new=1 -Wa,-mbig-obj -mwindows -g3 -O0 -Wall -Wextra -Wwrite-strings -Wno-unused-parameter -Wshadow-local -Wno-misleading-indentation -Wno-return-type -Walloc-zero -Wduplicated-branches -Wduplicated-cond -Wstringop-overflow=4 -Wattribute-alias=2 -Wlogical-op -Werror -DTOOLS_ENABLED -DDEBUG_ENABLED -DDEV_ENABLED -DNO_EDITOR_SPLASH -DWINDOWS_ENABLED -DWASAPI_ENABLED -DWINMIDI_ENABLED -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DVULKAN_ENABLED -DD3D12_ENABLED -DGLES3_ENABLED -DMINGW_ENABLED -DMINGW_HAS_SECURE_API=1 -DMINIZIP_ENABLED -DZSTD_STATIC_LINKING_ONLY -DUSE_VOLK -DVK_USE_PLATFORM_WIN32_KHR -Ithirdparty/directx_headers -Ithirdparty/volk -Ithirdparty/vulkan -Ithirdparty/vulkan/include -Ithirdparty/zstd -Ithirdparty/zlib -Iplatform/windows -I. -Ithirdparty/d3d12ma thirdparty/d3d12ma/D3D12MemAlloc.cpp
In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/wtypes.h:8,
                 from /usr/x86_64-w64-mingw32/sys-root/mingw/include/winscard.h:10,
                 from /usr/x86_64-w64-mingw32/sys-root/mingw/include/windows.h:97,
                 from /usr/x86_64-w64-mingw32/sys-root/mingw/include/rpc.h:16,
                 from thirdparty/directx_headers/d3d12.h:26,
                 from thirdparty/d3d12ma/D3D12MemAlloc.h:64,
                 from thirdparty/d3d12ma/D3D12MemAlloc.cpp:23:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/rpcndr.h:15:2: error: #error incorrect <rpcndr.h> version. Use the header that matches with the MIDL compiler.

Here it's on d3d12ma but the same error happens later for d3d12_context.cpp.

MinGW headers are typically not fully in sync with the Windows SDK, and notably for DirectX they've historically been missing some bits. Together with Pedro we tried to see what happens when not using our vendored directx_headers and using the MinGW ones, but as of 10.0.0 (and latest Git), they have several issues:

And when using our vendored headers, the above problem with rpcndr.h version mismatch happens. To be continued.

@RandomShaper

Copy link
Copy Markdown
Member Author

@panreyes, I've been able to reproduce your issue. I also found other ways to trigger it. My investigation led to the hypothesis that it's due to a bug in upstream NIR-to-DXIL functionality. I've reported it: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7950

@RandomShaper RandomShaper force-pushed the d3d12_mesa branch 3 times, most recently from c9a28b4 to a482fa7 Compare January 5, 2023 19:45
@RandomShaper

Copy link
Copy Markdown
Member Author

Pushed addressing all the feedback and rebasing on top of latest master.

I've fixed the V-sync issue with different logic than @TempoLabGames's, but with their insight is at its core. Thank you!

@TempoLabGames

Copy link
Copy Markdown

Regarding latency, the Vulkan renderer is seeing a huge improvement in that regard and eventually D3D12 will share a base with it, which should improve things on this side, too.

The waitable swap chain approach already outperforms the Vulkan renderer in terms of latency. I'm not familiar with the Vulkan API, but as far as I can tell, it lacks the information you would need to do this. It looks like it's been discussed in KhronosGroup/Vulkan-Docs#370 and KhronosGroup/Vulkan-Docs#1364 but it's not clear to me whether what's been proposed would actually allow you to match this.

The core problem is that the application needs to know when to generate a frame. In a typical game loop you'll process input and run the frame update logic, and only when you go to call Present will you find out whether the queue is full. If it is, you've effectively queued up a whole extra frame.

@linyaa-kiwi

Copy link
Copy Markdown

The core problem is that the application needs to know when to generate a frame. In a typical game loop you'll process input and run the frame update logic, and only when you go to call Present will you find out whether the queue is full. If it is, you've effectively queued up a whole extra frame.

I believe that using VK_PRESENT_MODE_MAILBOX_KHR rather than VK_PRESENT_MODE_FIFO_KHR would fix the problem of "oops, the present queue was already full and the engine queued up a whole extra frame". Or does MAILBOX introduce unwanted problems in Godot? (Of course, VK_EXT_present_timing is a more complete solution to latency issues, but it's not released yet).

@Calinou

Calinou commented Sep 26, 2023

Copy link
Copy Markdown
Member

I believe that using VK_PRESENT_MODE_MAILBOX_KHR rather than VK_PRESENT_MODE_FIFO_KHR would fix the problem of "oops, the present queue was already full and the engine queued up a whole extra frame". Or does MAILBOX introduce unwanted problems in Godot?

Mailbox V-Sync isn't supported on all platforms and drivers, so we need to ensure FIFO provides an experience that's as good as possible.

@TempoLabGames

Copy link
Copy Markdown

I believe that using VK_PRESENT_MODE_MAILBOX_KHR rather than VK_PRESENT_MODE_FIFO_KHR would fix the problem of "oops, the present queue was already full and the engine queued up a whole extra frame". Or does MAILBOX introduce unwanted problems in Godot? (Of course, VK_EXT_present_timing is a more complete solution to latency issues, but it's not released yet).

@versalinyaa Mailbox, when working as intended, is effectively the same as disabling VSync, except only complete frames get drawn to the screen. This has two problems:

  1. If your game is otherwise well-optimised, you can easily end up with 200x resource usage generating frames that are discarded and never seen by the user. This is particularly terrible for battery usage on portable devices if they allow it at all.

  2. If your game is not otherwise well-optimised and takes most of the available time to render a frame (or you artificially cap your frame rate with Engine.MaxFPS), your latency will drift and periodically snap back. This will never be worse than the latency you get with FIFO in an absolute sense, but this variance may be undesirable.

By synchronising on the VBlank, you end up consistently one frame behind. If you wanted, you could set a time budget less than the length of a frame and sleep for the rest (before sampling input) to reduce this further.

Having said all that, VSYNC_MAILBOX doesn't seem to work properly for me on Windows. I expect VSYNC_MAILBOX to have the same latency as the frame that shows above the top tear line with VSYNC_OFF, but in ExclusiveFullscreen it's a full frame behind. It appears to be preventing DirectFlip from bypassing DWM.

@akien-mga

akien-mga commented Oct 26, 2023

Copy link
Copy Markdown
Member

For the record, confirming that this is being delayed a bit more and should be merged early in the 4.3 release cycle. It's too late for 4.2 as we're in feature freeze, mostly due to me not finding the time early enough to get this formatted the way I think we can merge it.

@bruvzg did some initial work to evaluate moving the mesa code to a separate repo so we could build it as a static library, reducing the impact on the Godot repo in term of thirdparty code and build time: https://github.com/bruvzg/godot-nir-static/
This also makes it easier to track upstream Mesa without having to do a lot of work to remove unneeded files - the linker will only keep the code we use.

But the new pre-requisite for this work to be merged will first be rebasing it on top of the RenderingDeviceDriver which @RandomShaper has been working on in #83452, which will also be merged early on for 4.3.

In the meantime, this PR is still functional and recently rebased, so anyone interested in D3D 12 should be able to merge it in their fork on top of the 4.2 release.

@bruvzg

bruvzg commented Oct 26, 2023

Copy link
Copy Markdown
Member

@bruvzg did some initial work to evaluate moving the mesa code to a separate repo so we could build it as a static library, reducing the impact on the Godot repo in term of thirdparty code and build time: https://github.com/bruvzg/godot-nir-static/

For the reference, there are some additional modification (related to the static Mesa and MinGW build) in the https://github.com/bruvzg/godot/tree/d3d12_mesa, MinGW build still fails to link, probably due to outdated DX import libs in MinGW distros.

@RandomShaper

Copy link
Copy Markdown
Member Author

But the new pre-requisite for this work to be merged will first be rebasing it on top of the RenderingDeviceDriver

I'd like to suggest merging the current one first, when it's time, even if the RDD version comes immediately after. I believe that the diff between both "styles," the same we'll have for Vulkan, would be a valuable piece of the repo history. It will be an additional sample of the architectural shift and also it will be there at hand for looking for small pieces of logic that may get lost in translation and we may want to recover some day. Not a strong opinion, but I'd rather keep the non-RDD version "snapshotted" in the main history instead of opening yet another PR for the RDD version so we can keep the non-RDD one in the archives, let alone in a branch in my fork.

@akien-mga

Copy link
Copy Markdown
Member

Sounds good to me :)

@clayjohn clayjohn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Giving my stamp of approval. I have worked with this code for awhile now and reviewed it in depth during a few of its iterations. Today I did a light review to look out for any major issues and found none. I trust at this stage in the lifecycle of this work, if issues are discovered, we can fix them promptly in master.

The new build instructions work perfectly when compiling with MSVC. I'll make a PR shortly updating the documentation with the content from this PR's description.

Comment thread drivers/d3d12/update_mesa.sh Outdated
Comment thread drivers/d3d12/rendering_device_d3d12.h Outdated

@akien-mga akien-mga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a buildsystem code review, looks pretty good to me!
Great work @RandomShaper (and thanks @bruvzg for the help with godot-nir-static!).

I'll do a bit more testing on Windows and approve/merge.

Comment thread COPYRIGHT.txt Outdated
Comment thread core/config/project_settings.cpp Outdated
Comment thread doc/classes/ProjectSettings.xml Outdated
Comment thread drivers/d3d12/SCsub Outdated
Comment thread drivers/d3d12/SCsub Outdated
Comment thread drivers/d3d12/SCsub Outdated
Comment on lines 109 to 131

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a lot of these are overkill, duplicate defines we already set or are not useful (e.g. the bugreport URL for Mesa). I also had issues with the _Static_assert define that breaks mingw (but there are other issues with mingw).

I'm puzzled to still see this here though, isn't all this to compile mesa, and thus stuff that should be in godot-nir-static's SConstruct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added all that I found in the Mesa build system. I'm not sure if all of them are required, but probably most at least. Sadly we need them here as well as in godot-nir-static because the Mesa headers need to see the same definitions here and therre. Considering here we only care about certain headers, the right answer may be a subset of them, though.

Comment thread thirdparty/README.md Outdated
Comment thread platform/windows/detect.py Outdated
Comment thread platform/windows/detect.py Outdated

@akien-mga akien-mga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested successfully on Windows 10 with latest dxc and our mesa 23.1.0-devel build.

I ran it on those two projects, which worked fine:

Edit: Actually I tested wrongly, and was still using Vulkan. With my d3d12, both projects crash on edit. I suspect using latest dxc was a mistake, I'll test again with the version from March 2023.

Edit 2: Well, DXC_PATH only seems to be used to copy a DLL in dev_builds, which is not what I compiled, so it must be something else.


This is outstanding work @RandomShaper, really impressive!

I apologize again for the long delay reviewing and merging this.

@RandomShaper

Copy link
Copy Markdown
Member Author

Edit 2: Well, DXC_PATH only seems to be used to copy a DLL in dev_builds, which is not what I compiled, so it must be something else.

Removed env["dev_build"] and from the condition to copy dxil.dll. That part was a left-behind of the reversion of the patch that avoided it altogether.

Comment thread .github/workflows/windows_builds.yml Outdated
@akien-mga

akien-mga commented Dec 12, 2023

Copy link
Copy Markdown
Member

Tested the latest version again, now I can confirm it seems functional even in non-dev builds. dxil.dll is properly copied to bin/.

I could open and run Desert Light fine 🎉

On the other hand the GDQuest TPS demo crashes when importing some scene.

Crash logs (no debug syms)
$ ./bin/godot.windows.editor.x86_64.console.exe
Godot Engine v4.3.dev.custom_build.f60b64765 - https://godotengine.org
OpenGL API 3.3.0 Core Profile Context 23.11.1.231017 - Compatibility - Using Dev
ice: ATI Technologies Inc. - Radeon RX Vega

Editing project: D:/Dev/Godot/Projects/godot-4-3d-third-person-controller
Godot Engine v4.3.dev.custom_build.f60b64765 - https://godotengine.org
D3D12 feature level 12_0 - Forward+ - Using D3D12 Adapter #0: Radeon RX Vega

WARNING: Blend file import is enabled in the project settings, but no Blender pa
th is configured in the editor settings. Blend files will not be imported.
     at: _editor_init (.\modules/gltf/register_types.cpp:63)
ERROR: Condition "!preset.is_valid()" is true. Continuing.
   at: EditorExport::load_config (.\editor/export/editor_export.cpp:225)
ERROR: Couldn't open MTL file 'res://Environment/grass/grass_1_geo.mtl', it may
not exist or not be readable.
   at: (.\editor/import/resource_importer_obj.cpp:48)
WARNING: Ignoring face with non-finite normal in LOD generation.
     at: ImporterMesh::generate_lods (.\scene/resources/importer_mesh.cpp:518)
ERROR: Command list Reset failed with error 0x80070057.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:9023)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:3042)
ERROR: Condition "data.size() == 0" is true. Returning: Ref<Image>()
   at: RendererRD::TextureStorage::texture_2d_get (.\servers/rendering/renderer_
rd/storage_rd/texture_storage.cpp:1272)
ERROR: CreateResource failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2242)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (.\servers/rendering/re
nderer_rd/storage_rd/texture_storage.cpp:841)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_size_override (.\servers/renderin
g/renderer_rd/storage_rd/texture_storage.cpp:1407)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_path (.\servers/rendering/rendere
r_rd/storage_rd/texture_storage.cpp:1416)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_detect_3d_callback (.\servers/ren
dering/renderer_rd/storage_rd/texture_storage.cpp:1437)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_detect_roughness_callback (.\serv
ers/rendering/renderer_rd/storage_rd/texture_storage.cpp:1453)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_detect_normal_callback (.\servers
/rendering/renderer_rd/storage_rd/texture_storage.cpp:1445)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_path (.\servers/rendering/rendere
r_rd/storage_rd/texture_storage.cpp:1416)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_2d_get (.\servers/rendering/renderer_
rd/storage_rd/texture_storage.cpp:1264)
ERROR: CreateResource failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2242)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (.\servers/rendering/re
nderer_rd/storage_rd/texture_storage.cpp:841)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_size_override (.\servers/renderin
g/renderer_rd/storage_rd/texture_storage.cpp:1407)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_path (.\servers/rendering/rendere
r_rd/storage_rd/texture_storage.cpp:1416)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_detect_3d_callback (.\servers/ren
dering/renderer_rd/storage_rd/texture_storage.cpp:1437)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_detect_roughness_callback (.\serv
ers/rendering/renderer_rd/storage_rd/texture_storage.cpp:1453)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_detect_normal_callback (.\servers
/rendering/renderer_rd/storage_rd/texture_storage.cpp:1445)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_path (.\servers/rendering/rendere
r_rd/storage_rd/texture_storage.cpp:1416)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_2d_get (.\servers/rendering/renderer_
rd/storage_rd/texture_storage.cpp:1264)
ERROR: CreateResource failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2242)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (.\servers/rendering/re
nderer_rd/storage_rd/texture_storage.cpp:841)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_size_override (.\servers/renderin
g/renderer_rd/storage_rd/texture_storage.cpp:1407)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_path (.\servers/rendering/rendere
r_rd/storage_rd/texture_storage.cpp:1416)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_detect_3d_callback (.\servers/ren
dering/renderer_rd/storage_rd/texture_storage.cpp:1437)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_detect_roughness_callback (.\serv
ers/rendering/renderer_rd/storage_rd/texture_storage.cpp:1453)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_detect_normal_callback (.\servers
/rendering/renderer_rd/storage_rd/texture_storage.cpp:1445)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_path (.\servers/rendering/rendere
r_rd/storage_rd/texture_storage.cpp:1416)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_2d_get (.\servers/rendering/renderer_
rd/storage_rd/texture_storage.cpp:1264)
ERROR: CreateResource failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2242)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (.\servers/rendering/re
nderer_rd/storage_rd/texture_storage.cpp:841)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_size_override (.\servers/renderin
g/renderer_rd/storage_rd/texture_storage.cpp:1407)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_path (.\servers/rendering/rendere
r_rd/storage_rd/texture_storage.cpp:1416)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_detect_3d_callback (.\servers/ren
dering/renderer_rd/storage_rd/texture_storage.cpp:1437)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_detect_roughness_callback (.\serv
ers/rendering/renderer_rd/storage_rd/texture_storage.cpp:1453)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_detect_normal_callback (.\servers
/rendering/renderer_rd/storage_rd/texture_storage.cpp:1445)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_set_path (.\servers/rendering/rendere
r_rd/storage_rd/texture_storage.cpp:1416)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "tex" is null.
   at: RendererRD::TextureStorage::texture_2d_get (.\servers/rendering/renderer_
rd/storage_rd/texture_storage.cpp:1264)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Parameter "t" is null.
   at: RendererRD::TextureStorage::texture_free (.\servers/rendering/renderer_rd
/storage_rd/texture_storage.cpp:767)
ERROR: Can't create buffer of size: 432, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::vertex_buffer_create (drivers\d3d12\rendering_devic
e_d3d12.cpp:4039)
ERROR: Can't create buffer of size: 144, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::vertex_buffer_create (drivers\d3d12\rendering_devic
e_d3d12.cpp:4039)
ERROR: Can't create buffer of size: 192, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::index_buffer_create (drivers\d3d12\rendering_device
_d3d12.cpp:4213)
ERROR: Condition "!index_buffer_owner.owns(p_index_buffer)" is true. Returning:
RID()
   at: RenderingDeviceD3D12::index_array_create (drivers\d3d12\rendering_device_
d3d12.cpp:4230)
ERROR: Can't create buffer of size: 204, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::vertex_buffer_create (drivers\d3d12\rendering_devic
e_d3d12.cpp:4039)
ERROR: Can't create buffer of size: 68, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::vertex_buffer_create (drivers\d3d12\rendering_devic
e_d3d12.cpp:4039)
ERROR: Can't create buffer of size: 144, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::index_buffer_create (drivers\d3d12\rendering_device
_d3d12.cpp:4213)
ERROR: Condition "!index_buffer_owner.owns(p_index_buffer)" is true. Returning:
RID()
   at: RenderingDeviceD3D12::index_array_create (drivers\d3d12\rendering_device_
d3d12.cpp:4230)
ERROR: Can't create buffer of size: 72, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::index_buffer_create (drivers\d3d12\rendering_device
_d3d12.cpp:4213)
ERROR: Condition "!index_buffer_owner.owns(p_index_buffer)" is true. Returning:
RID()
   at: RenderingDeviceD3D12::index_array_create (drivers\d3d12\rendering_device_
d3d12.cpp:4230)
ERROR: Can't create buffer of size: 36, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::index_buffer_create (drivers\d3d12\rendering_device
_d3d12.cpp:4213)
ERROR: Condition "!index_buffer_owner.owns(p_index_buffer)" is true. Returning:
RID()
   at: RenderingDeviceD3D12::index_array_create (drivers\d3d12\rendering_device_
d3d12.cpp:4230)
ERROR: Can't create buffer of size: 288, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::vertex_buffer_create (drivers\d3d12\rendering_devic
e_d3d12.cpp:4039)
ERROR: Can't create buffer of size: 192, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::index_buffer_create (drivers\d3d12\rendering_device
_d3d12.cpp:4213)
ERROR: Condition "!index_buffer_owner.owns(p_index_buffer)" is true. Returning:
RID()
   at: RenderingDeviceD3D12::index_array_create (drivers\d3d12\rendering_device_
d3d12.cpp:4230)
ERROR: Can't create buffer of size: 136, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::vertex_buffer_create (drivers\d3d12\rendering_devic
e_d3d12.cpp:4039)
ERROR: Can't create buffer of size: 144, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::index_buffer_create (drivers\d3d12\rendering_device
_d3d12.cpp:4213)
ERROR: Condition "!index_buffer_owner.owns(p_index_buffer)" is true. Returning:
RID()
   at: RenderingDeviceD3D12::index_array_create (drivers\d3d12\rendering_device_
d3d12.cpp:4230)
ERROR: Can't create buffer of size: 72, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::index_buffer_create (drivers\d3d12\rendering_device
_d3d12.cpp:4213)
ERROR: Condition "!index_buffer_owner.owns(p_index_buffer)" is true. Returning:
RID()
   at: RenderingDeviceD3D12::index_array_create (drivers\d3d12\rendering_device_
d3d12.cpp:4230)
ERROR: Can't create buffer of size: 36, error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1694)
ERROR: Condition "err != OK" is true. Returning: RID()
   at: RenderingDeviceD3D12::index_buffer_create (drivers\d3d12\rendering_device
_d3d12.cpp:4213)
ERROR: Condition "!index_buffer_owner.owns(p_index_buffer)" is true. Returning:
RID()
   at: RenderingDeviceD3D12::index_array_create (drivers\d3d12\rendering_device_
d3d12.cpp:4230)
ERROR: Condition "res" is true. Returning: ERR_UNAVAILABLE
   at: D3D12Context::_update_swap_chain (drivers\d3d12\d3d12_context.cpp:742)
ERROR: CreateRootSignature failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:5236)
ERROR: Parameter "p_version->variants" is null.
   at: ShaderRD::_allocate_placeholders (.\servers/rendering/renderer_rd/shader_
rd.cpp:483)
ERROR: Parameter "p_version->variants" is null.
   at: ShaderRD::_allocate_placeholders (.\servers/rendering/renderer_rd/shader_
rd.cpp:483)
ERROR: Parameter "p_version->variants" is null.
   at: ShaderRD::_allocate_placeholders (.\servers/rendering/renderer_rd/shader_
rd.cpp:483)
ERROR: Condition "!shader_singleton->shader.version_is_valid(version)" is true.
   at: RendererSceneRenderImplementation::SceneShaderForwardClustered::ShaderDat
a::set_code (servers\rendering\renderer_rd\forward_clustered\scene_shader_forwar
d_clustered.cpp:181)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)
ERROR: Map failed with error 0x887a0005.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:1903)

================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.3.dev.custom_build (f60b64765c52d043a1fc2405af5b
375d22864914)
Dumping the backtrace. Please include this when reporting the bug to the project
 developer.
[0] <couldn't map PC to fn name>
[1] <couldn't map PC to fn name>
[2] <couldn't map PC to fn name>
[3] <couldn't map PC to fn name>
[4] <couldn't map PC to fn name>
[5] <couldn't map PC to fn name>
[6] <couldn't map PC to fn name>
[7] <couldn't map PC to fn name>
[8] <couldn't map PC to fn name>
[9] <couldn't map PC to fn name>
[10] <couldn't map PC to fn name>
[11] <couldn't map PC to fn name>
[12] <couldn't map PC to fn name>
[13] <couldn't map PC to fn name>
[14] <couldn't map PC to fn name>
[15] <couldn't map PC to fn name>
[16] <couldn't map PC to fn name>
[17] <couldn't map PC to fn name>
[18] <couldn't map PC to fn name>
[19] <couldn't map PC to fn name>
[20] <couldn't map PC to fn name>
[21] <couldn't map PC to fn name>
[22] <couldn't map PC to fn name>
[23] <couldn't map PC to fn name>
[24] <couldn't map PC to fn name>
[25] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================

I'm fine merging anyway and leaving this to debug in a follow up issue/PR.

@akien-mga

Copy link
Copy Markdown
Member

Thanks! Truly amazing work Pedro! 🥇🎉👏

@RandomShaper

Copy link
Copy Markdown
Member Author

Big thanks to everyone that has been involved, giving feedback, testing, etc., the production team and @bruvzg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.