mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Merge pull request #111800 from Repiteo/scons/d3d12-cleanup
SCons: Clean up hardcoded D3D12 driver workarounds
This commit is contained in:
commit
5b527b23d8
8 changed files with 83 additions and 156 deletions
|
|
@ -7,49 +7,25 @@ from pathlib import Path
|
|||
import methods
|
||||
|
||||
Import("env")
|
||||
|
||||
env_d3d12_rdd = env.Clone()
|
||||
|
||||
thirdparty_obj = []
|
||||
|
||||
|
||||
# DirectX Headers (must take precedence over Windows SDK's).
|
||||
|
||||
env.Prepend(CPPPATH=["#thirdparty/directx_headers/include/directx"])
|
||||
env_d3d12_rdd.Prepend(CPPPATH=["#thirdparty/directx_headers/include/directx"])
|
||||
env_d3d12_rdd.Prepend(CPPPATH=["#thirdparty/directx_headers/include/dxguids"])
|
||||
|
||||
|
||||
# Direct3D 12 Memory Allocator.
|
||||
|
||||
env.Append(CPPPATH=["#thirdparty/d3d12ma"])
|
||||
env_d3d12_rdd.Append(CPPPATH=["#thirdparty/d3d12ma"])
|
||||
|
||||
|
||||
# Agility SDK.
|
||||
|
||||
if env["agility_sdk_path"] != "" and os.path.exists(env["agility_sdk_path"]):
|
||||
env_d3d12_rdd.Append(CPPDEFINES=["AGILITY_SDK_ENABLED"])
|
||||
if env["agility_sdk_multiarch"]:
|
||||
env_d3d12_rdd.Append(CPPDEFINES=["AGILITY_SDK_MULTIARCH_ENABLED"])
|
||||
|
||||
|
||||
# PIX.
|
||||
|
||||
if env["use_pix"]:
|
||||
env_d3d12_rdd.Append(CPPDEFINES=["PIX_ENABLED"])
|
||||
env_d3d12_rdd.Append(CPPPATH=[env["pix_path"] + "/Include"])
|
||||
|
||||
|
||||
# Direct composition.
|
||||
|
||||
if "dcomp" in env.get("supported", []):
|
||||
env_d3d12_rdd.Append(CPPDEFINES=["DCOMP_ENABLED"])
|
||||
env.Append(CPPDEFINES=["DCOMP_ENABLED"]) # Used in header included in platform.
|
||||
|
||||
|
||||
# Mesa (SPIR-V to DXIL functionality).
|
||||
|
||||
mesa_libs = env["mesa_libs"]
|
||||
if env.msvc and os.path.exists(env["mesa_libs"] + "-" + env["arch"] + "-msvc"):
|
||||
mesa_libs = env["mesa_libs"] + "-" + env["arch"] + "-msvc"
|
||||
|
|
@ -137,6 +113,7 @@ extra_defines += [
|
|||
("PACKAGE_BUGREPORT", '\\"https://gitlab.freedesktop.org/mesa/mesa/-/issues\\"'),
|
||||
"PIPE_SUBSYSTEM_WINDOWS_USER",
|
||||
("_Static_assert", "static_assert"),
|
||||
"HAVE_STRUCT_TIMESPEC",
|
||||
]
|
||||
|
||||
if env.msvc:
|
||||
|
|
@ -148,30 +125,39 @@ if env.msvc:
|
|||
"_SCL_SECURE_NO_WARNINGS",
|
||||
"_SCL_SECURE_NO_DEPRECATE",
|
||||
"_ALLOW_KEYWORD_MACROS",
|
||||
("_HAS_EXCEPTIONS", 0),
|
||||
"NOMINMAX",
|
||||
"HAVE_STRUCT_TIMESPEC",
|
||||
]
|
||||
else:
|
||||
extra_defines += [
|
||||
"HAVE_STRUCT_TIMESPEC",
|
||||
# Match current version used by MinGW. MSVC and Direct3D 12 headers use 500.
|
||||
("__REQUIRED_RPCNDR_H_VERSION__", 475),
|
||||
]
|
||||
if methods.using_gcc(env) and methods.get_compiler_version(env)["major"] < 13:
|
||||
# `region` & `endregion` not recognized as valid pragmas.
|
||||
env_d3d12_rdd.Append(CCFLAGS=["-Wno-unknown-pragmas"])
|
||||
env.Append(CCFLAGS=["-Wno-unknown-pragmas"])
|
||||
|
||||
# This is needed since rendering_device_d3d12.cpp needs to include some Mesa internals.
|
||||
env_d3d12_rdd.Prepend(CPPPATH=mesa_private_inc_paths)
|
||||
# For the same reason as above, the defines must be the same as in the 3rd-party code itself.
|
||||
env_d3d12_rdd.Append(CPPDEFINES=extra_defines)
|
||||
|
||||
# Thirdparty.
|
||||
thirdparty_obj = []
|
||||
|
||||
# Add all.
|
||||
env_thirdparty = env_d3d12_rdd.Clone()
|
||||
env_thirdparty.disable_warnings()
|
||||
|
||||
env_thirdparty.Prepend(
|
||||
CPPPATH=[
|
||||
"#thirdparty/directx_headers/include/directx",
|
||||
"#thirdparty/directx_headers/include/dxguids",
|
||||
"#thirdparty/d3d12ma",
|
||||
]
|
||||
)
|
||||
|
||||
env_thirdparty.add_source_files(thirdparty_obj, "#thirdparty/d3d12ma/D3D12MemAlloc.cpp")
|
||||
env.drivers_sources += thirdparty_obj
|
||||
|
||||
|
||||
# Godot source files.
|
||||
|
||||
driver_obj = []
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
/**************************************************************************/
|
||||
/* d3d12ma.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
// Wrapper needed to set the required rpcndr version for MinGW compatibility.
|
||||
// Since we're compiling thirdparty code in a Godot SCons environment with
|
||||
// warnings enabled, we also need to silence them manually.
|
||||
|
||||
#include "rendering_device_driver_d3d12.h" // For __REQUIRED_RPCNDR_H_VERSION__.
|
||||
|
||||
GODOT_GCC_WARNING_PUSH
|
||||
GODOT_GCC_WARNING_IGNORE("-Wduplicated-branches")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wimplicit-fallthrough")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wmaybe-uninitialized")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wmissing-field-initializers")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wnon-virtual-dtor")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wnonnull-compare")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wshadow")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wsign-compare")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wswitch")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wunused-function")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wunused-variable")
|
||||
GODOT_CLANG_WARNING_PUSH
|
||||
GODOT_CLANG_WARNING_IGNORE("-Wimplicit-fallthrough")
|
||||
GODOT_CLANG_WARNING_IGNORE("-Wmissing-field-initializers")
|
||||
GODOT_CLANG_WARNING_IGNORE("-Wnon-virtual-dtor")
|
||||
GODOT_CLANG_WARNING_IGNORE("-Wstring-plus-int")
|
||||
GODOT_CLANG_WARNING_IGNORE("-Wswitch")
|
||||
GODOT_CLANG_WARNING_IGNORE("-Wtautological-undefined-compare")
|
||||
GODOT_CLANG_WARNING_IGNORE("-Wunused-but-set-variable")
|
||||
GODOT_CLANG_WARNING_IGNORE("-Wunused-function")
|
||||
GODOT_CLANG_WARNING_IGNORE("-Wunused-private-field")
|
||||
GODOT_CLANG_WARNING_IGNORE("-Wunused-variable")
|
||||
GODOT_MSVC_WARNING_PUSH
|
||||
GODOT_MSVC_WARNING_IGNORE(4189) // "Local variable is initialized but not referenced".
|
||||
GODOT_MSVC_WARNING_IGNORE(4505) // "Unreferenced local function has been removed".
|
||||
|
||||
#include <D3D12MemAlloc.cpp>
|
||||
|
||||
GODOT_GCC_WARNING_POP
|
||||
GODOT_CLANG_WARNING_POP
|
||||
GODOT_MSVC_WARNING_POP
|
||||
|
|
@ -51,6 +51,7 @@ GODOT_CLANG_WARNING_IGNORE("-Wstring-plus-int")
|
|||
GODOT_CLANG_WARNING_IGNORE("-Wswitch")
|
||||
|
||||
#include <dxcapi.h>
|
||||
#include <dxgi1_6.h>
|
||||
|
||||
GODOT_GCC_WARNING_POP
|
||||
GODOT_CLANG_WARNING_POP
|
||||
|
|
@ -58,9 +59,11 @@ GODOT_CLANG_WARNING_POP
|
|||
#if !defined(_MSC_VER)
|
||||
#include <guiddef.h>
|
||||
|
||||
#include <dxguids.h>
|
||||
#include <thirdparty/directx_headers/include/dxguids/dxguids.h>
|
||||
#endif
|
||||
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
// Note: symbols are not available in MinGW and old MSVC import libraries.
|
||||
// GUID values from https://github.com/microsoft/DirectX-Headers/blob/7a9f4d06911d30eecb56a4956dab29dcca2709ed/include/directx/d3d12.idl#L5877-L5881
|
||||
const GUID CLSID_D3D12DeviceFactoryGodot = { 0x114863bf, 0xc386, 0x4aee, { 0xb3, 0x9d, 0x8f, 0x0b, 0xbb, 0x06, 0x29, 0x55 } };
|
||||
|
|
@ -72,7 +75,7 @@ const GUID CLSID_D3D12SDKConfigurationGodot = { 0x7cda6aca, 0xa03e, 0x49c8, { 0x
|
|||
#define _MSC_VER 1800
|
||||
#endif
|
||||
#define USE_PIX
|
||||
#include "WinPixEventRuntime/pix3.h"
|
||||
#include <WinPixEventRuntime/pix3.h>
|
||||
#if defined(__GNUC__)
|
||||
#undef _MSC_VER
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@
|
|||
#include "servers/display/display_server.h"
|
||||
#include "servers/rendering/rendering_context_driver.h"
|
||||
|
||||
#if !defined(_MSC_VER) && !defined(__REQUIRED_RPCNDR_H_VERSION__)
|
||||
// Match current version used by MinGW, MSVC and Direct3D 12 headers use 500.
|
||||
#define __REQUIRED_RPCNDR_H_VERSION__ 475
|
||||
#endif // !defined(_MSC_VER) && !defined(__REQUIRED_RPCNDR_H_VERSION__)
|
||||
|
||||
GODOT_GCC_WARNING_PUSH
|
||||
GODOT_GCC_WARNING_IGNORE("-Wimplicit-fallthrough")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wmissing-field-initializers")
|
||||
|
|
@ -50,6 +55,11 @@ GODOT_CLANG_WARNING_IGNORE("-Wnon-virtual-dtor")
|
|||
GODOT_CLANG_WARNING_IGNORE("-Wstring-plus-int")
|
||||
GODOT_CLANG_WARNING_IGNORE("-Wswitch")
|
||||
|
||||
#include <thirdparty/directx_headers/include/directx/d3dx12.h>
|
||||
|
||||
GODOT_GCC_WARNING_POP
|
||||
GODOT_CLANG_WARNING_POP
|
||||
|
||||
#if defined(AS)
|
||||
#undef AS
|
||||
#endif
|
||||
|
|
@ -58,21 +68,13 @@ GODOT_CLANG_WARNING_IGNORE("-Wswitch")
|
|||
#include <dcomp.h>
|
||||
#endif
|
||||
|
||||
#include <d3dx12.h>
|
||||
#include <dxgi1_6.h>
|
||||
|
||||
#include <wrl/client.h>
|
||||
|
||||
GODOT_GCC_WARNING_POP
|
||||
GODOT_CLANG_WARNING_POP
|
||||
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
#define ARRAY_SIZE(a) std_size(a)
|
||||
|
||||
class RenderingContextDriverD3D12 : public RenderingContextDriver {
|
||||
ComPtr<ID3D12DeviceFactory> device_factory;
|
||||
ComPtr<IDXGIFactory2> dxgi_factory;
|
||||
Microsoft::WRL::ComPtr<ID3D12DeviceFactory> device_factory;
|
||||
Microsoft::WRL::ComPtr<IDXGIFactory2> dxgi_factory;
|
||||
TightLocalVector<Device> driver_devices;
|
||||
bool tearing_supported = false;
|
||||
|
||||
|
|
@ -111,9 +113,9 @@ public:
|
|||
DisplayServer::VSyncMode vsync_mode = DisplayServer::VSYNC_ENABLED;
|
||||
bool needs_resize = false;
|
||||
#ifdef DCOMP_ENABLED
|
||||
ComPtr<IDCompositionDevice> composition_device;
|
||||
ComPtr<IDCompositionTarget> composition_target;
|
||||
ComPtr<IDCompositionVisual> composition_visual;
|
||||
Microsoft::WRL::ComPtr<IDCompositionDevice> composition_device;
|
||||
Microsoft::WRL::ComPtr<IDCompositionTarget> composition_target;
|
||||
Microsoft::WRL::ComPtr<IDCompositionVisual> composition_visual;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@ GODOT_MSVC_WARNING_PUSH
|
|||
GODOT_MSVC_WARNING_IGNORE(4200) // "nonstandard extension used: zero-sized array in struct/union".
|
||||
GODOT_MSVC_WARNING_IGNORE(4806) // "'&': unsafe operation: no value of type 'bool' promoted to type 'uint32_t' can equal the given constant".
|
||||
|
||||
#include <dxgi1_6.h>
|
||||
#define D3D12MA_D3D12_HEADERS_ALREADY_INCLUDED
|
||||
#include <thirdparty/d3d12ma/D3D12MemAlloc.h>
|
||||
|
||||
#include <nir_spirv.h>
|
||||
#include <nir_to_dxil.h>
|
||||
#include <spirv_to_dxil.h>
|
||||
|
|
@ -72,9 +76,11 @@ GODOT_MSVC_WARNING_POP
|
|||
#if !defined(_MSC_VER)
|
||||
#include <guiddef.h>
|
||||
|
||||
#include <dxguids.h>
|
||||
#include <thirdparty/directx_headers/include/dxguids/dxguids.h>
|
||||
#endif
|
||||
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
// Mesa may define this.
|
||||
#ifdef UNUSED
|
||||
#undef UNUSED
|
||||
|
|
@ -85,7 +91,7 @@ GODOT_MSVC_WARNING_POP
|
|||
#define _MSC_VER 1800
|
||||
#endif
|
||||
#define USE_PIX
|
||||
#include "WinPixEventRuntime/pix3.h"
|
||||
#include <WinPixEventRuntime/pix3.h>
|
||||
#if defined(__GNUC__)
|
||||
#undef _MSC_VER
|
||||
#endif
|
||||
|
|
@ -6611,6 +6617,7 @@ Error RenderingDeviceDriverD3D12::initialize(uint32_t p_device_index, uint32_t p
|
|||
adapter.Attach(context_driver->create_adapter(p_device_index));
|
||||
ERR_FAIL_NULL_V(adapter, ERR_CANT_CREATE);
|
||||
|
||||
DXGI_ADAPTER_DESC adapter_desc;
|
||||
HRESULT res = adapter->GetDesc(&adapter_desc);
|
||||
ERR_FAIL_COND_V(!SUCCEEDED(res), ERR_CANT_CREATE);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@
|
|||
#include "rendering_shader_container_d3d12.h"
|
||||
#include "servers/rendering/rendering_device_driver.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#if !defined(_MSC_VER) && !defined(__REQUIRED_RPCNDR_H_VERSION__)
|
||||
// Match current version used by MinGW, MSVC and Direct3D 12 headers use 500.
|
||||
#define __REQUIRED_RPCNDR_H_VERSION__ 475
|
||||
#endif
|
||||
#endif // !defined(_MSC_VER) && !defined(__REQUIRED_RPCNDR_H_VERSION__)
|
||||
|
||||
GODOT_GCC_WARNING_PUSH
|
||||
GODOT_GCC_WARNING_IGNORE("-Wimplicit-fallthrough")
|
||||
|
|
@ -55,17 +55,12 @@ GODOT_CLANG_WARNING_IGNORE("-Wnon-virtual-dtor")
|
|||
GODOT_CLANG_WARNING_IGNORE("-Wstring-plus-int")
|
||||
GODOT_CLANG_WARNING_IGNORE("-Wswitch")
|
||||
|
||||
#include <d3dx12.h>
|
||||
#include <dxgi1_6.h>
|
||||
#define D3D12MA_D3D12_HEADERS_ALREADY_INCLUDED
|
||||
#include <D3D12MemAlloc.h>
|
||||
|
||||
#include <wrl/client.h>
|
||||
#include <thirdparty/directx_headers/include/directx/d3dx12.h>
|
||||
|
||||
GODOT_GCC_WARNING_POP
|
||||
GODOT_CLANG_WARNING_POP
|
||||
|
||||
using Microsoft::WRL::ComPtr;
|
||||
#include <wrl/client.h>
|
||||
|
||||
#ifdef DEV_ENABLED
|
||||
#define CUSTOM_INFO_QUEUE_ENABLED 0
|
||||
|
|
@ -73,6 +68,14 @@ using Microsoft::WRL::ComPtr;
|
|||
|
||||
class RenderingContextDriverD3D12;
|
||||
|
||||
namespace D3D12MA {
|
||||
class Allocation;
|
||||
class Allocator;
|
||||
}; // namespace D3D12MA
|
||||
|
||||
struct IDXGIAdapter;
|
||||
struct IDXGISwapChain3;
|
||||
|
||||
// Design principles:
|
||||
// - D3D12 structs are zero-initialized and fields not requiring a non-zero value are omitted (except in cases where expresivity reasons apply).
|
||||
class RenderingDeviceDriverD3D12 : public RenderingDeviceDriver {
|
||||
|
|
@ -123,9 +126,8 @@ class RenderingDeviceDriverD3D12 : public RenderingDeviceDriver {
|
|||
|
||||
RenderingContextDriverD3D12 *context_driver = nullptr;
|
||||
RenderingContextDriver::Device context_device;
|
||||
ComPtr<IDXGIAdapter> adapter;
|
||||
DXGI_ADAPTER_DESC adapter_desc;
|
||||
ComPtr<ID3D12Device> device;
|
||||
Microsoft::WRL::ComPtr<IDXGIAdapter> adapter;
|
||||
Microsoft::WRL::ComPtr<ID3D12Device> device;
|
||||
DeviceLimits device_limits;
|
||||
RDD::Capabilities device_capabilities;
|
||||
uint32_t feature_level = 0; // Major * 10 + minor.
|
||||
|
|
@ -144,7 +146,7 @@ class RenderingDeviceDriverD3D12 : public RenderingDeviceDriver {
|
|||
class CPUDescriptorsHeapPool;
|
||||
|
||||
struct CPUDescriptorsHeapHandle {
|
||||
ComPtr<ID3D12DescriptorHeap> heap;
|
||||
Microsoft::WRL::ComPtr<ID3D12DescriptorHeap> heap;
|
||||
CPUDescriptorsHeapPool *pool = nullptr;
|
||||
uint32_t offset = 0;
|
||||
uint32_t base_offset = 0;
|
||||
|
|
@ -158,7 +160,7 @@ class RenderingDeviceDriverD3D12 : public RenderingDeviceDriver {
|
|||
Mutex mutex;
|
||||
|
||||
struct FreeBlockInfo {
|
||||
ComPtr<ID3D12DescriptorHeap> heap;
|
||||
Microsoft::WRL::ComPtr<ID3D12DescriptorHeap> heap;
|
||||
uint32_t global_offset = 0; // Global offset in an address space shared by all the heaps.
|
||||
uint32_t base_offset = 0; // The offset inside the space of this heap.
|
||||
uint32_t size = 0;
|
||||
|
|
@ -230,7 +232,7 @@ class RenderingDeviceDriverD3D12 : public RenderingDeviceDriver {
|
|||
|
||||
class GPUDescriptorsHeap {
|
||||
D3D12_DESCRIPTOR_HEAP_DESC desc = {};
|
||||
ComPtr<ID3D12DescriptorHeap> heap;
|
||||
Microsoft::WRL::ComPtr<ID3D12DescriptorHeap> heap;
|
||||
uint32_t handle_size = 0;
|
||||
|
||||
public:
|
||||
|
|
@ -243,9 +245,9 @@ class RenderingDeviceDriverD3D12 : public RenderingDeviceDriver {
|
|||
CPUDescriptorsHeapPools cpu_descriptor_pool;
|
||||
|
||||
struct {
|
||||
ComPtr<ID3D12CommandSignature> draw;
|
||||
ComPtr<ID3D12CommandSignature> draw_indexed;
|
||||
ComPtr<ID3D12CommandSignature> dispatch;
|
||||
Microsoft::WRL::ComPtr<ID3D12CommandSignature> draw;
|
||||
Microsoft::WRL::ComPtr<ID3D12CommandSignature> draw_indexed;
|
||||
Microsoft::WRL::ComPtr<ID3D12CommandSignature> dispatch;
|
||||
} indirect_cmd_signatures;
|
||||
|
||||
static void STDMETHODCALLTYPE _debug_message_func(D3D12_MESSAGE_CATEGORY p_category, D3D12_MESSAGE_SEVERITY p_severity, D3D12_MESSAGE_ID p_id, LPCSTR p_description, void *p_context);
|
||||
|
|
@ -265,7 +267,7 @@ private:
|
|||
/**** MEMORY ****/
|
||||
/****************/
|
||||
|
||||
ComPtr<D3D12MA::Allocator> allocator;
|
||||
Microsoft::WRL::ComPtr<D3D12MA::Allocator> allocator;
|
||||
|
||||
/******************/
|
||||
/**** RESOURCE ****/
|
||||
|
|
@ -280,8 +282,8 @@ private:
|
|||
|
||||
ID3D12Resource *resource = nullptr; // Non-null even if not owned.
|
||||
struct {
|
||||
ComPtr<ID3D12Resource> resource;
|
||||
ComPtr<D3D12MA::Allocation> allocation;
|
||||
Microsoft::WRL::ComPtr<ID3D12Resource> resource;
|
||||
Microsoft::WRL::ComPtr<D3D12MA::Allocation> allocation;
|
||||
States states;
|
||||
} owner_info; // All empty if the resource is not owned.
|
||||
States *states_ptr = nullptr; // Own or from another if it doesn't own the D3D12 resource.
|
||||
|
|
@ -441,7 +443,7 @@ private:
|
|||
/****************/
|
||||
|
||||
struct FenceInfo {
|
||||
ComPtr<ID3D12Fence> d3d_fence = nullptr;
|
||||
Microsoft::WRL::ComPtr<ID3D12Fence> d3d_fence = nullptr;
|
||||
HANDLE event_handle = nullptr;
|
||||
UINT64 fence_value = 0;
|
||||
};
|
||||
|
|
@ -457,7 +459,7 @@ private:
|
|||
/********************/
|
||||
|
||||
struct SemaphoreInfo {
|
||||
ComPtr<ID3D12Fence> d3d_fence = nullptr;
|
||||
Microsoft::WRL::ComPtr<ID3D12Fence> d3d_fence = nullptr;
|
||||
UINT64 fence_value = 0;
|
||||
};
|
||||
|
||||
|
|
@ -476,7 +478,7 @@ private:
|
|||
// ----- QUEUE -----
|
||||
|
||||
struct CommandQueueInfo {
|
||||
ComPtr<ID3D12CommandQueue> d3d_queue;
|
||||
Microsoft::WRL::ComPtr<ID3D12CommandQueue> d3d_queue;
|
||||
};
|
||||
|
||||
public:
|
||||
|
|
@ -533,8 +535,8 @@ private:
|
|||
// Store a self list reference to be used by the command pool.
|
||||
SelfList<CommandBufferInfo> command_buffer_info_elem{ this };
|
||||
|
||||
ComPtr<ID3D12CommandAllocator> cmd_allocator;
|
||||
ComPtr<ID3D12GraphicsCommandList> cmd_list;
|
||||
Microsoft::WRL::ComPtr<ID3D12CommandAllocator> cmd_allocator;
|
||||
Microsoft::WRL::ComPtr<ID3D12GraphicsCommandList> cmd_list;
|
||||
|
||||
ID3D12PipelineState *graphics_pso = nullptr;
|
||||
ID3D12PipelineState *compute_pso = nullptr;
|
||||
|
|
@ -564,7 +566,7 @@ private:
|
|||
/********************/
|
||||
|
||||
struct SwapChain {
|
||||
ComPtr<IDXGISwapChain3> d3d_swap_chain;
|
||||
Microsoft::WRL::ComPtr<IDXGISwapChain3> d3d_swap_chain;
|
||||
RenderingContextDriver::SurfaceID surface = RenderingContextDriver::SurfaceID();
|
||||
UINT present_flags = 0;
|
||||
UINT sync_interval = 1;
|
||||
|
|
@ -677,8 +679,8 @@ private:
|
|||
|
||||
HashMap<ShaderStage, Vector<uint8_t>> stages_bytecode;
|
||||
|
||||
ComPtr<ID3D12RootSignature> root_signature;
|
||||
ComPtr<ID3D12RootSignatureDeserializer> root_signature_deserializer;
|
||||
Microsoft::WRL::ComPtr<ID3D12RootSignature> root_signature;
|
||||
Microsoft::WRL::ComPtr<ID3D12RootSignatureDeserializer> root_signature_deserializer;
|
||||
const D3D12_ROOT_SIGNATURE_DESC *root_signature_desc = nullptr; // Owned by the deserializer.
|
||||
uint32_t root_signature_crc = 0;
|
||||
};
|
||||
|
|
@ -787,7 +789,7 @@ public:
|
|||
};
|
||||
|
||||
struct PipelineInfo {
|
||||
ComPtr<ID3D12PipelineState> pso;
|
||||
Microsoft::WRL::ComPtr<ID3D12PipelineState> pso;
|
||||
const ShaderInfo *shader_info = nullptr;
|
||||
RenderPipelineInfo render_info;
|
||||
};
|
||||
|
|
@ -907,9 +909,9 @@ public:
|
|||
|
||||
private:
|
||||
struct TimestampQueryPoolInfo {
|
||||
ComPtr<ID3D12QueryHeap> query_heap;
|
||||
Microsoft::WRL::ComPtr<ID3D12QueryHeap> query_heap;
|
||||
uint32_t query_count = 0;
|
||||
ComPtr<D3D12MA::Allocation> results_buffer_allocation;
|
||||
Microsoft::WRL::ComPtr<D3D12MA::Allocation> results_buffer_allocation;
|
||||
};
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -36,11 +36,6 @@
|
|||
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
// Match current version used by MinGW, MSVC and Direct3D 12 headers use 500.
|
||||
#define __REQUIRED_RPCNDR_H_VERSION__ 475
|
||||
#endif
|
||||
|
||||
GODOT_GCC_WARNING_PUSH
|
||||
GODOT_GCC_WARNING_IGNORE("-Wimplicit-fallthrough")
|
||||
GODOT_GCC_WARNING_IGNORE("-Wlogical-not-parentheses")
|
||||
|
|
@ -59,10 +54,10 @@ GODOT_MSVC_WARNING_PUSH
|
|||
GODOT_MSVC_WARNING_IGNORE(4200) // "nonstandard extension used: zero-sized array in struct/union".
|
||||
GODOT_MSVC_WARNING_IGNORE(4806) // "'&': unsafe operation: no value of type 'bool' promoted to type 'uint32_t' can equal the given constant".
|
||||
|
||||
#include <d3dx12.h>
|
||||
#include <dxgi1_6.h>
|
||||
#include <thirdparty/directx_headers/include/directx/d3dx12.h>
|
||||
#define D3D12MA_D3D12_HEADERS_ALREADY_INCLUDED
|
||||
#include <D3D12MemAlloc.h>
|
||||
#include <thirdparty/d3d12ma/D3D12MemAlloc.h>
|
||||
|
||||
#include <wrl/client.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ private:
|
|||
EXT_PROTO_XRRESULT_FUNC3(xrGetD3D12GraphicsRequirementsKHR, (XrInstance), p_instance, (XrSystemId), p_system_id, (XrGraphicsRequirementsD3D12KHR *), p_graphics_requirements)
|
||||
EXT_PROTO_XRRESULT_FUNC4(xrEnumerateSwapchainImages, (XrSwapchain), p_swapchain, (uint32_t), p_image_capacity_input, (uint32_t *), p_image_count_output, (XrSwapchainImageBaseHeader *), p_images)
|
||||
|
||||
ComPtr<ID3D12Device> graphics_device;
|
||||
ComPtr<ID3D12CommandQueue> command_queue;
|
||||
Microsoft::WRL::ComPtr<ID3D12Device> graphics_device;
|
||||
Microsoft::WRL::ComPtr<ID3D12CommandQueue> command_queue;
|
||||
};
|
||||
|
||||
#endif // D3D12_ENABLED
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue