godot icon indicating copy to clipboard operation
godot copied to clipboard

Direct3D 12 Rendering Driver (Mesa NIR approach)

Open RandomShaper opened this issue 2 years ago • 61 comments

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 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) 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.
    • Change the file extension to .zip.
    • Unzip the file to some path.
  • (Update for this new PR) Install the Python package mako (https://www.makotemplates.org/), needed to generate some files during the compilation of Mesa.
  • 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=<...>.

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.

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: https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator/pull/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:

  • ~https://gitlab.freedesktop.org/mesa/mesa/-/issues/7904~ Done.
  • ~https://gitlab.freedesktop.org/mesa/mesa/-/issues/7905~ Done.

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. 🍀

RandomShaper avatar Dec 19 '22 20:12 RandomShaper

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.

panreyes avatar Dec 21 '22 22:12 panreyes

("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.

Calinou avatar Dec 21 '22 23:12 Calinou

("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.

panreyes avatar Dec 21 '22 23:12 panreyes

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:

  • Missing various enum values in D3D12_HEAP_FLAGS which D3D12MA needs: https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/include/d3d12.h#l627
  • Missing d3dx12.h

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

akien-mga avatar Dec 23 '22 10:12 akien-mga

@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 avatar Dec 23 '22 12:12 RandomShaper

@panreyes, I've applied the aforementioned Mesa3D patch to this branch, It solves the issue for me. Please try again and let me know the outcome.

RandomShaper avatar Jan 05 '23 19:01 RandomShaper

@RandomShaper When I try this pr on an Intel UHD Graphics 620 and try to open a project using the Direct3D 12 driver the editor crashes and the console displays this:

ERROR: CreateRootSignature failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:5147)
ERROR: Condition "!canvas_singleton->shader.canvas_shader.version_is_valid(version)" is true.
   at: RendererCanvasRenderRD::CanvasShaderData::set_code (servers\rendering\renderer_rd\renderer_canvas_render_rd.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Condition "!t" is true.
   at: RendererRD::TextureStorage::texture_free (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:690)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Condition "!t" is true.
   at: RendererRD::TextureStorage::texture_free (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:690)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Condition "!t" is true.
   at: RendererRD::TextureStorage::texture_free (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:690)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)
ERROR: Condition "!t" is true.
   at: RendererRD::TextureStorage::texture_free (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:690)
ERROR: CreateResource failed with error 0x-7785fffb.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:2211)
ERROR: Condition "texture.rd_texture.is_null()" is true.
   at: RendererRD::TextureStorage::texture_2d_initialize (servers\rendering\renderer_rd\storage_rd\texture_storage.cpp:)
ERROR: Attempting to use an uninitialized RID
   at: (.\core/templates/rid_owner.h:199)

================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.0.beta.custom_build (c19d348a3a0cb32805e5e6ab41cf3884cf04b143)
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>

LiveTrower avatar Jan 06 '23 02:01 LiveTrower

@panreyes, I've applied the aforementioned Mesa3D patch to this branch, It solves the issue for me. Please try again and let me know the outcome.

@RandomShaper Now it throws a different error. Instead of complaining about "SceneForwardClusteredShaderRD:9" now it does about "SceneForwardMobileShaderRD:0":

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

panreyes avatar Jan 07 '23 02:01 panreyes

@AlfonsoGrimaldo, it's a bit hard to tell what's going on. I think a device removal has happened earlier due to the GPU not supporting something. I will investigate further when I can.

RandomShaper avatar Jan 09 '23 16:01 RandomShaper

@panreyes, could you try again? I'm certain it's fixed now.

RandomShaper avatar Jan 10 '23 18:01 RandomShaper

@panreyes, could you try again? I'm certain it's fixed now.

It is fixed, thanks! Feel free to ping me again if you need to test anything more else.

panreyes avatar Jan 10 '23 21:01 panreyes

@panreyes, could you try again? I'm certain it's fixed now.

It is fixed, thanks! Feel free to ping me again if you need to test anything more else.

I'll do! 🙂 Thank you.

RandomShaper avatar Jan 10 '23 22:01 RandomShaper

Does this Direct3D 12 backend support "native" GLSL shaders as part of Godot projects, such as the one used in https://github.com/godotengine/godot-demo-projects/tree/4.0-dev/misc/compute_shader_heightmap?

If not, is it planned to be supported by translating GLSL code, or by requiring users to write HLSL instead? (I don't need this feature right now, I'm just asking for documentation purposes.)

Calinou avatar Jan 24 '23 10:01 Calinou

To be honest, I haven't tried, but given how the RD is wired to the engine, it should work out of the box.

RandomShaper avatar Jan 24 '23 12:01 RandomShaper

I've integrated some of the features newly added to DXIL-NIR and rebased once again.

At this point, I think this is done for now, enough to be potentially merged as a experimental feature (disabled in official builds by now).

In the future we may look into measures such as:

  • Moving it to its own repo.
  • Making it buildable as a dynamic library so official builds can provide it without bloating the binaries.

It should be safe for 4.0 given it's not included by default and by merging it early we stop running the risk of it getting rot again and again when global changes happen to RD or the Vulkan RD gets a new feature.

CC @akien-mga @clayjohn @reduz

RandomShaper avatar Jan 25 '23 13:01 RandomShaper

I would prefer to merge after 4.0 is released, if it's not going to be enabled by default, and will premiere in 4.1, it can wait a couple more weeks. Having it disabled by default in 4.0 would mean that we'd have to provide support to people who want to enable it, while we haven't had much internal testing going on during beta.

If we merge once the 4.1 release cycle start, then we can enable it and do proper testing / buildsystem integration.

akien-mga avatar Jan 25 '23 13:01 akien-mga

Note that LLVM has started to support HLSL/DXIL officially since LLVM 15: https://releases.llvm.org/15.0.0/tools/clang/docs/HLSLSupport.html, so the prior approach may not need the source code of DXC anymore.

hez2010 avatar Jan 28 '23 03:01 hez2010

Note that LLVM has started to support HLSL/DXIL officially since LLVM 15: https://releases.llvm.org/15.0.0/tools/clang/docs/HLSLSupport.html, so the prior approach may not need the source code of DXC anymore.

In case the former approach would be maintained, it would need to be updated. However, DXC is a fork of LLVM, so I don't think it would make much of a difference.

RandomShaper avatar Jan 28 '23 13:01 RandomShaper

However, DXC is a fork of LLVM, so I don't think it would make much of a difference.

You may want to check this: https://github.com/microsoft/DirectXShaderCompiler/wiki/Contributing-HLSL-to-LLVM-main, the future work will be merge into LLVM, and DXC will be deprecated.

hez2010 avatar Jan 28 '23 14:01 hez2010

I'll try to explain my point better: if the former D3D12 branch was still maintained, of course it would make sense to ditch DXC in favor of the new HLSL capable upstream LLVM. However, that would consist in replacing the source code of DXC by that of LLVM (i.e., upgrading LLVM from 3.7 to 15.0), which would still be a huge dependency.

(Note to myself: be extra careful when using GitHub on the phone. Too many PR close accidents lately. 😅)

RandomShaper avatar Jan 28 '23 16:01 RandomShaper

Trying it out now 🙂

Some comments:

  • I've created a PowerShell script to install DXCompiler. It's committed as part of this branch: https://github.com/Calinou/godot/tree/d3d12_mesa
    • I recommend pulling it to make CI setup easier, but also to make initial setup more straightforward for new contributors.
  • The renderer string printed on startup should be modified to match Vulkan: https://github.com/godotengine/godot/pull/72625
    • It should be identical, except it should display "Direct3D 12" instead of "Vulkan".
  • Every time I start the editor, the GeForce Experience overlay notification appears ("Press Alt + Z to show the overlay..."). This does not occur when using the Vulkan renderer. Is there a way to hint the NVIDIA driver that the overlay should never appear for a given application?
  • Variable rate shading works, as evidenced when running the testing project linked in https://github.com/godotengine/godot-docs/pull/6402 with Direct3D 12.
  • Enabling Auto HDR then restarting the project on Windows 11 appears to make no noticeable difference (tested on LG C2 42" with an HDR calibration profile created). Bright emissive materials don't become any brighter, regardless of the tonemapping algorithm chosen.
  • With its default settings, https://github.com/Calinou/godot-reflection is broken when using D3D12. Only the transparent glass panes and volumetric fog show up - no opaque geometry appears.
    • This is caused by having either SSAO or SDFGI enabled. SSIL and volumetric fog can be left enabled without issues.
    • Enabling SSR works, but causes gizmos and grid to be visible through walls in the editor.
  • https://github.com/godotengine/tps-demo/pull/158 does not work correctly with D3D12. The player model never shows up on the main menu, and loading the level will spam errors in the console until the game freezes indefinitely.

godot-reflection with default settings

Vulkan Direct3D 12
vulkan webp d3d12 webp

godot-reflection after disabling SSAO and SDFGI

Rendering appears pixel-perfect identical (though Forward+ is a bit softer due to TAA being implemented there). Images were downsampled from 3840x2160 to 1280x720, so they all appear to have antialiasing.

Forward+

Vulkan Direct3D 12
vulkanforwardplus webp d3d12forwardplus webp

Mobile

Vulkan Direct3D 12
vulkanmobile webp d3d12mobile webp

Performance

OS: Windows 11 CPU: Intel Core i9-13900K GPU: NVIDIA GeForce RTX 4090 Test project: https://github.com/Calinou/godot-reflection at start location

godot-reflection with default settings

1152x648

Vulkan Forward+ Direct3D 12 Forward+[^1] Vulkan Mobile Direct3D 12 Mobile[^1] OpenGL[^2]
1185 FPS 1053 FPS 1262 FPS 1063 FPS 4264 FPS

3840x2160

Vulkan Forward+ Direct3D 12 Forward+[^1] Vulkan Mobile Direct3D 12 Mobile[^1] OpenGL[^2]
296 FPS 328 FPS 342 FPS 381 FPS 3536 FPS

godot-reflection after disabling SSAO and SDFGI (for consistent rendering on both Vulkan and Direct3D 12)

1152x648

Likely hitting CPU bottlenecks (I was using a debug build for this test).

Vulkan Forward+ Direct3D 12 Forward+ Vulkan Mobile Direct3D 12 Mobile OpenGL[^2]
2304 FPS 1326 FPS 2569 FPS 1318 FPS 4351 FPS

3840x2160

Vulkan Forward+ Direct3D 12 Forward+ Vulkan Mobile Direct3D 12 Mobile OpenGL[^2]
460 FPS 453 FPS 584 FPS 577 FPS 3568 FPS

[^1]: Rendering is broken. [^2]: Rendering is technically correct, but most rendering features are missing, including shadows, SDFGI and volumetric fog.


godot-cmvalley performance in the editor

According to the Show Frame Time editor panel, with the same window size, camera position and settings:

Vulkan Direct3D 12
image image

CPU time in particular increases more than GPU time (but it's still not a bottleneck in this case, at least according to the GPU time readout).

Calinou avatar Feb 03 '23 17:02 Calinou

Hugo, thank you very much for the detailed report. This is a bit on hold since I'm currently busy with other matters, but I will eventually come back to address the issues and leave it as polished as possible for the future merge.

RandomShaper avatar Feb 03 '23 21:02 RandomShaper

@RandomShaper The last set of changes has resulted in D3D12Context::adapter_type no longer being set resulting in D3D12Context::get_device_type() always returning DEVICE_TYPE_OTHER.

lmurray avatar Mar 04 '23 08:03 lmurray

Thanks, @lmurray. Fixed.

RandomShaper avatar Mar 04 '23 09:03 RandomShaper

Pushed with important improvements:

  • Supports more subresources.
  • Reuses descriptors much better (history of several items).
  • Updated Mesa (DXIL-NIR): adds almost full set of subgroup operations.
  • Updated D3D12MA: bug fixed plus some additions that will be leveraged.

RandomShaper avatar Mar 10 '23 00:03 RandomShaper

@RandomShaper When it is possible to download from the main repository and it will support directx? Still Godot 4.1?

GeorgeS2019 avatar Apr 01 '23 10:04 GeorgeS2019

Pushed with a bunch of new enhancements:

  • Integrated Agility SDK.
  • Use proper API for castable formats (Agility SDK needed here).
  • Updated Mesa (DXIL-NIR): completes the set of subgroup operations supported.
  • Constrained D3D12-related preprocessor defines to the D3D12 driver code.
  • Fixed minor, benign debug layer errors.
  • PIX allowed in release builds.

RandomShaper avatar Apr 10 '23 17:04 RandomShaper

@RandomShaper When it is possible to download from the main repository and it will support directx? Still Godot 4.1?

Godot 4.1, I think.

RandomShaper avatar Apr 10 '23 17:04 RandomShaper

I tested locally on a Windows device and it appears to be working really well. I ran the TPS demo and saw similar performance and no obvious visual glitches.

I am thinking about what the next steps are to get this merged:

  1. Will need a more fulsome review including a code review of the main changes (e.g. the driver)
  2. @akien-mga How are things looking on the buildsystem side for building using MinGW-GCC? Is it safe to assume that is still broken?
  3. @RandomShaper Are their any other must-haves that we are missing before this is ready to merge?

clayjohn avatar Apr 14 '23 19:04 clayjohn

~~I get a build error with the latest revision of this PR (I have mako installed via pip too):~~

$ scons platform=windows d3d12=yes DXC_PATH=C:\Apps\dxc -j1
scons: Reading SConscript files ...
Found MSVC version 14.3, arch x86_64
Building for platform "windows", architecture "x86_64", target "editor".
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[ 18%] Linking Static Library modules\module_gdscript.windows.editor.x86_64.lib ...
[ 39%] Linking Static Library modules\text_server_adv\harfbuzz_builtin.windows.editor.x86_64.lib ...
[ 46%] Compiling modules\text_server_adv\register_types.cpp ...
register_types.cpp
[ 46%] Compiling modules\text_server_adv\script_iterator.cpp ...
script_iterator.cpp
[ 46%] Compiling modules\text_server_adv\text_server_adv.cpp ...
text_server_adv.cpp
[ 46%] Compiling modules\text_server_adv\thorvg_bounds_iterator.cpp ...
thorvg_bounds_iterator.cpp
[ 46%] Compiling modules\text_server_adv\thorvg_svg_in_ot.cpp ...
thorvg_svg_in_ot.cpp
[ 46%] Linking Static Library modules\module_text_server_adv.windows.editor.x86_64.lib ...
[ 51%] Linking Static Library modules\module_websocket.windows.editor.x86_64.lib ...
[ 51%] Linking Static Library modules\module_xatlas_unwrap.windows.editor.x86_64.lib ...
[ 52%] Compiling drivers\vulkan\rendering_device_vulkan.cpp ...
rendering_device_vulkan.cpp
[ 52%] Compiling drivers\vulkan\vulkan_context.cpp ...
vulkan_context.cpp
[ 53%] Compiling thirdparty\mesa\src\compiler\nir\nir.c ...
cl : Command line warning D9025 : overriding '/W3' with '/W0'
nir.c
thirdparty\mesa\src\compiler\nir\nir.c(2505): error C2065: 'nir_intrinsic_load_fully_covered': undeclared identifier
thirdparty\mesa\src\compiler\nir\nir.c(2507): error C2065: 'nir_intrinsic_load_frag_size': undeclared identifier
thirdparty\mesa\src\compiler\nir\nir.c(2509): error C2065: 'nir_intrinsic_load_frag_invocation_count': undeclared identifier
thirdparty\mesa\src\compiler\nir\nir.c(2657): error C2065: 'nir_intrinsic_load_fully_covered': undeclared identifier
thirdparty\mesa\src\compiler\nir\nir.c(2659): error C2065: 'nir_intrinsic_load_frag_size': undeclared identifier
thirdparty\mesa\src\compiler\nir\nir.c(2661): error C2065: 'nir_intrinsic_load_frag_invocation_count': undeclared identifier
thirdparty\mesa\src\compiler\nir\nir.c(2657): error C2051: case expression not constant
thirdparty\mesa\src\compiler\nir\nir.c(2659): error C2051: case expression not constant
thirdparty\mesa\src\compiler\nir\nir.c(2661): error C2051: case expression not constant
scons: *** [thirdparty\mesa\src\compiler\nir\nir.windows.editor.x86_64.obj] Error 2
scons: building terminated because of errors.

Note that I'm using this DXC version, which is more recent than the one listed in the PR description (1.7.2207).

Edit: Nevermind, this was caused by lingering files from an older local build of this PR. git clean -dfxi did the trick 🙂 It seems to be taking a very long time to link though, unlike a build of the master branch (I'm using MSVC 2022).


I've tested this PR again:

[...]
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_bind_index_array (drivers\d3d12\rendering_device_d3d12.cpp:7242)
ERROR: Condition "!E" is true. Returning: TEXTURE_SAMPLES_1
   at: RenderingDeviceD3D12::framebuffer_format_get_texture_samples (drivers\d3d12\rendering_device_d3d12.cpp:3646)
ERROR: CreateGraphicsPipelineState failed with error 0x-7785fffb for shader 'SceneForwardClusteredShaderRD:0'.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:6507)
ERROR: Condition "pipeline.is_null()" is true. Returning: RID()
   at: PipelineCacheRD::_generate_version (servers\rendering\renderer_rd\pipeline_cache_rd.cpp:61)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_set_push_constant (drivers\d3d12\rendering_device_d3d12.cpp:7628)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_draw (drivers\d3d12\rendering_device_d3d12.cpp:7648)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_bind_vertex_array (drivers\d3d12\rendering_device_d3d12.cpp:7212)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_bind_index_array (drivers\d3d12\rendering_device_d3d12.cpp:7242)
ERROR: Condition "!E" is true. Returning: TEXTURE_SAMPLES_1
   at: RenderingDeviceD3D12::framebuffer_format_get_texture_samples (drivers\d3d12\rendering_device_d3d12.cpp:3646)
ERROR: CreateGraphicsPipelineState failed with error 0x-7785fffb for shader 'SceneForwardClusteredShaderRD:0'.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:6507)
ERROR: Condition "pipeline.is_null()" is true. Returning: RID()
   at: PipelineCacheRD::_generate_version (servers\rendering\renderer_rd\pipeline_cache_rd.cpp:61)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_set_push_constant (drivers\d3d12\rendering_device_d3d12.cpp:7628)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_draw (drivers\d3d12\rendering_device_d3d12.cpp:7648)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_bind_vertex_array (drivers\d3d12\rendering_device_d3d12.cpp:7212)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_bind_index_array (drivers\d3d12\rendering_device_d3d12.cpp:7242)
ERROR: Condition "!E" is true. Returning: TEXTURE_SAMPLES_1
   at: RenderingDeviceD3D12::framebuffer_format_get_texture_samples (drivers\d3d12\rendering_device_d3d12.cpp:3646)
ERROR: CreateGraphicsPipelineState failed with error 0x-7785fffb for shader 'SceneForwardClusteredShaderRD:0'.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:6507)
ERROR: Condition "pipeline.is_null()" is true. Returning: RID()
   at: PipelineCacheRD::_generate_version (servers\rendering\renderer_rd\pipeline_cache_rd.cpp:61)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_set_push_constant (drivers\d3d12\rendering_device_d3d12.cpp:7628)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_draw (drivers\d3d12\rendering_device_d3d12.cpp:7648)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_bind_vertex_array (drivers\d3d12\rendering_device_d3d12.cpp:7212)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_bind_index_array (drivers\d3d12\rendering_device_d3d12.cpp:7242)
ERROR: Condition "!E" is true. Returning: TEXTURE_SAMPLES_1
   at: RenderingDeviceD3D12::framebuffer_format_get_texture_samples (drivers\d3d12\rendering_device_d3d12.cpp:3646)
ERROR: CreateGraphicsPipelineState failed with error 0x-7785fffb for shader 'SceneForwardClusteredShaderRD:0'.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:6507)
ERROR: Condition "pipeline.is_null()" is true. Returning: RID()
   at: PipelineCacheRD::_generate_version (servers\rendering\renderer_rd\pipeline_cache_rd.cpp:61)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_set_push_constant (drivers\d3d12\rendering_device_d3d12.cpp:7628)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_draw (drivers\d3d12\rendering_device_d3d12.cpp:7648)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_bind_vertex_array (drivers\d3d12\rendering_device_d3d12.cpp:7212)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_bind_index_array (drivers\d3d12\rendering_device_d3d12.cpp:7242)
ERROR: Condition "!E" is true. Returning: TEXTURE_SAMPLES_1
   at: RenderingDeviceD3D12::framebuffer_format_get_texture_samples (drivers\d3d12\rendering_device_d3d12.cpp:3646)
ERROR: CreateGraphicsPipelineState failed with error 0x-7785fffb for shader 'SceneForwardClusteredShaderRD:0'.
   at: (drivers\d3d12\rendering_device_d3d12.cpp:6507)
ERROR: Condition "pipeline.is_null()" is true. Returning: RID()
   at: PipelineCacheRD::_generate_version (servers\rendering\renderer_rd\pipeline_cache_rd.cpp:61)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_set_push_constant (drivers\d3d12\rendering_device_d3d12.cpp:7628)
ERROR: Condition "!dl" is true.
   at: RenderingDeviceD3D12::draw_list_draw (drivers\d3d12\renderin
[...]

This is caused by SDFGI being enabled in the demo. After disabling SDFGI[^1], there's no more spam and rendering works correctly (even with SSAO, SSIL, SSR, glow and volumetric fog all enabled).

[^1]: You can switch to Vulkan and disable SDFGI, or edit reflection/reflection.tscn using a text editor to do so.

Creating a VoxelGI then baking it also results in error spam:

[...]
Set: 0 Binding: 11 Type: UniformBuffer Writable: N Length: 896
Set: 0 Binding: 12 Type: Texture Writable: N Length: 8
Set: 0 Binding: 13 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 14 Type: UniformBuffer Writable: N Length: 304
Set: 0 Binding: 15 Type: Texture Writable: N Length: 1
Set: 0 Binding: 16 Type: Image Writable: Y Length: 1
Set: 0 Binding: 17 Type: Image Writable: Y Length: 1
Set: 0 Binding: 18 Type: Image Writable: Y Length: 1
Set: 0 Binding: 19 Type: Texture Writable: N Length: 1
   at: (drivers\d3d12\rendering_device_d3d12.cpp:8322)
ERROR: Condition "!uniform_set" is true.
   at: RenderingDeviceD3D12::compute_list_bind_uniform_set (drivers\d3d12\rendering_device_d3d12.cpp:8235)
ERROR: Uniforms were never supplied for set (0) at the time of drawing, which are required by the pipeline
   at: (drivers\d3d12\rendering_device_d3d12.cpp:8319)
ERROR: Condition "!uniform_set" is true.
   at: RenderingDeviceD3D12::compute_list_bind_uniform_set (drivers\d3d12\rendering_device_d3d12.cpp:8235)
ERROR: Uniforms were never supplied for set (0) at the time of drawing, which are required by the pipeline
   at: (drivers\d3d12\rendering_device_d3d12.cpp:8319)
ERROR: Condition "!uniform_set" is true.
   at: RenderingDeviceD3D12::compute_list_bind_uniform_set (drivers\d3d12\rendering_device_d3d12.cpp:8235)
ERROR: Uniforms supplied for set (0):
Set: 0 Binding: 1 Type: Texture Writable: N Length: 1
Set: 0 Binding: 2 Type: Texture Writable: N Length: 1
Set: 0 Binding: 3 Type: StorageBuffer Writable: N Length: 0
Set: 0 Binding: 4 Type: StorageBuffer Writable: N Length: 0
Set: 0 Binding: 5 Type: UniformBuffer Writable: N Length: 3712
Set: 0 Binding: 6 Type: StorageBuffer Writable: N Length: 0
Set: 0 Binding: 7 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 8 Type: Image Writable: Y Length: 1
Set: 0 Binding: 9 Type: Image Writable: Y Length: 1
Set: 0 Binding: 10 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 11 Type: UniformBuffer Writable: N Length: 896
Set: 0 Binding: 12 Type: Texture Writable: N Length: 8
Set: 0 Binding: 13 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 14 Type: UniformBuffer Writable: N Length: 304
are not the same format as required by the pipeline shader. Pipeline shader requires the following bindings:
Set: 0 Binding: 1 Type: Texture Writable: N Length: 1
Set: 0 Binding: 2 Type: Texture Writable: N Length: 1
Set: 0 Binding: 3 Type: StorageBuffer Writable: N Length: 0
Set: 0 Binding: 4 Type: StorageBuffer Writable: N Length: 0
Set: 0 Binding: 5 Type: UniformBuffer Writable: N Length: 3712
Set: 0 Binding: 6 Type: StorageBuffer Writable: N Length: 0
Set: 0 Binding: 7 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 8 Type: Image Writable: Y Length: 1
Set: 0 Binding: 9 Type: Image Writable: Y Length: 1
Set: 0 Binding: 10 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 11 Type: UniformBuffer Writable: N Length: 896
Set: 0 Binding: 12 Type: Texture Writable: N Length: 8
Set: 0 Binding: 13 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 14 Type: UniformBuffer Writable: N Length: 304
Set: 0 Binding: 15 Type: Texture Writable: N Length: 1
Set: 0 Binding: 16 Type: Image Writable: Y Length: 1
Set: 0 Binding: 17 Type: Image Writable: Y Length: 1
Set: 0 Binding: 18 Type: Image Writable: Y Length: 1
Set: 0 Binding: 19 Type: Texture Writable: N Length: 1
   at: (drivers\d3d12\rendering_device_d3d12.cpp:8322)
ERROR: Condition "!uniform_set" is true.
   at: RenderingDeviceD3D12::compute_list_bind_uniform_set (drivers\d3d12\rendering_device_d3d12.cpp:8235)
ERROR: Uniforms were never supplied for set (0) at the time of drawing, which are required by the pipeline
   at: (drivers\d3d12\rendering_device_d3d12.cpp:8319)
ERROR: Condition "!uniform_set" is true.
   at: RenderingDeviceD3D12::compute_list_bind_uniform_set (drivers\d3d12\rendering_device_d3d12.cpp:8235)
ERROR: Uniforms were never supplied for set (0) at the time of drawing, which are required by the pipeline
   at: (drivers\d3d12\rendering_device_d3d12.cpp:8319)
ERROR: Condition "!uniform_set" is true.
   at: RenderingDeviceD3D12::compute_list_bind_uniform_set (drivers\d3d12\rendering_device_d3d12.cpp:8235)
ERROR: Uniforms supplied for set (0):
Set: 0 Binding: 1 Type: Texture Writable: N Length: 1
Set: 0 Binding: 2 Type: Texture Writable: N Length: 1
Set: 0 Binding: 3 Type: StorageBuffer Writable: N Length: 0
Set: 0 Binding: 4 Type: StorageBuffer Writable: N Length: 0
Set: 0 Binding: 5 Type: UniformBuffer Writable: N Length: 3712
Set: 0 Binding: 6 Type: StorageBuffer Writable: N Length: 0
Set: 0 Binding: 7 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 8 Type: Image Writable: Y Length: 1
Set: 0 Binding: 9 Type: Image Writable: Y Length: 1
Set: 0 Binding: 10 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 11 Type: UniformBuffer Writable: N Length: 896
Set: 0 Binding: 12 Type: Texture Writable: N Length: 8
Set: 0 Binding: 13 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 14 Type: UniformBuffer Writable: N Length: 304
are not the same format as required by the pipeline shader. Pipeline shader requires the following bindings:
Set: 0 Binding: 1 Type: Texture Writable: N Length: 1
Set: 0 Binding: 2 Type: Texture Writable: N Length: 1
Set: 0 Binding: 3 Type: StorageBuffer Writable: N Length: 0
Set: 0 Binding: 4 Type: StorageBuffer Writable: N Length: 0
Set: 0 Binding: 5 Type: UniformBuffer Writable: N Length: 3712
Set: 0 Binding: 6 Type: StorageBuffer Writable: N Length: 0
Set: 0 Binding: 7 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 8 Type: Image Writable: Y Length: 1
Set: 0 Binding: 9 Type: Image Writable: Y Length: 1
Set: 0 Binding: 10 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 11 Type: UniformBuffer Writable: N Length: 896
Set: 0 Binding: 12 Type: Texture Writable: N Length: 8
Set: 0 Binding: 13 Type: Sampler Writable: N Length: 1
Set: 0 Binding: 14 Type: UniformBuffer Writable: N Length: 304
Set: 0 Binding: 15 Type: Texture Writable: N Length: 1
Set: 0 Binding: 16 Type: Image Writable: Y Length: 1
Set: 0 Binding: 17 Type: Image Writable: Y Length: 1
Set: 0 Binding: 18 Type: Image Writable: Y Length: 1
Set: 0 Binding: 19 Type: Texture Writable: N Length: 1
   at: (drivers\d3d12\rendering_device_d3d12.cpp:8322)
ERROR: Condition "!uniform_set" is true.
   at: RenderingDeviceD3D12::compute_list_bind_uniform_set (drivers\d3d12\rendering_device_d3d12.cpp:8235)
ERROR: Uniforms were never supplied for set (0) at the time of drawing, which are required by the pipeline
   at: (drivers\d3d12\rendering_device_d3d12.cpp:8319)
[...]

CPU: Intel Core i9-13900K, GPU: GeForce RTX 4090

Demo Vulkan Direct3D 12
Platformer 3D 1136 FPS (0.88 mspf) 853 FPS (1.17 mspf)
Truck Town 1056 FPS (0.94 mspf) 846 FPS (1.18 mspf)
Mode Vulkan Direct3D 12
OC enabled, ML enabled 1401 FPS (0.71 mspf) 854 FPS (1.17 mspf)
OC disabled, ML enabled 1464 FPS (0.68 mspf) 1000 FPS (1.00 mspf)
OC enabled, ML disabled 1415 FPS (0.70 mspf) 886 FPS (1.12 mspf)
OC disabled, ML disabled 614 FPS (1.62 mspf) 575 FPS (1.74 mspf)
OL disabled, ML disabled - Unshaded 675 FPS (1.48 mspf) 614 FPS (1.63 mspf)
OL disabled, ML disabled - Lighting 695 FPS (1.43 mspf) 632 FPS (1.58 mspf)
OL disabled, ML disabled - Overdraw[^2] 991 FPS (1.00 mspf) 216 FPS (4.62 mspf)
OL disabled, ML disabled - Wireframe 293 FPS (3.41 mspf) 7 FPS (142.85 mspf)

[^2]: This is essentially a stress test for unshaded transparent material rendering.

In general, Direct3D 12 is more affected by CPU bottlenecks than Vulkan. Fewer draw calls are preferable even if more primitives have to be rendered in exchange.

Wireframe rendering performance is very low compared to Vulkan.

Calinou avatar Apr 16 '23 21:04 Calinou