Merge pull request #70315 from RandomShaper/d3d12_mesa

Direct3D 12 Rendering Driver (Mesa NIR approach)
This commit is contained in:
Rémi Verschelde 2023-12-12 21:58:57 +01:00 committed by GitHub
commit 41365c6c8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 75735 additions and 19 deletions

View File

@ -7,7 +7,7 @@ on:
env:
# Used for the cache key. Add version suffix to force clean build.
GODOT_BASE_BRANCH: master
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes d3d12=yes "dxc_path=${{github.workspace}}/dxc" "mesa_libs=${{github.workspace}}/godot-nir-static"
SCONS_CACHE_MSVC_CONFIG: true
concurrency:
@ -49,6 +49,28 @@ jobs:
- name: Setup python and scons
uses: ./.github/actions/godot-deps
- name: Download pre-built DirectX Shader Compiler
uses: dsaltares/fetch-gh-release-asset@1.0.0
with:
repo: Microsoft/DirectXShaderCompiler
version: tags/v1.7.2308
file: dxc_2023_08_14.zip
target: dxc.zip
- name: Extract pre-built DirectX Shader Compiler
run: 7z x dxc.zip -o${{github.workspace}}/dxc
- name: Download pre-built Mesa-NIR
uses: dsaltares/fetch-gh-release-asset@1.0.0
with:
repo: godotengine/godot-nir-static
version: tags/23.1.0-devel
file: godot-nir-23.1.0-1-devel.zip
target: godot-nir-static.zip
- name: Extract pre-built Mesa-NIR
run: 7z x godot-nir-static.zip -o${{github.workspace}}/godot-nir-static
- name: Setup MSVC problem matcher
uses: ammaraskar/msvc-problem-matcher@master

View File

@ -194,6 +194,16 @@ Copyright: 2018, Eric Lasota
2018, Microsoft Corp.
License: Expat
Files: ./thirdparty/d3d12ma/
Comment: D3D12 Memory Allocator
Copyright: 2019-2022 Advanced Micro Devices, Inc.
License: Expat
Files: ./thirdparty/directx_headers/
Comment: DirectX Headers
Copyright: Microsoft Corporation
License: Expat
Files: ./thirdparty/doctest/
Comment: doctest
Copyright: 2016-2023, Viktor Kirilov

View File

@ -191,6 +191,7 @@ opts.Add(BoolVariable("brotli", "Enable Brotli for decompresson and WOFF2 fonts
opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False))
opts.Add(BoolVariable("vulkan", "Enable the vulkan rendering driver", True))
opts.Add(BoolVariable("opengl3", "Enable the OpenGL/GLES3 rendering driver", True))
opts.Add(BoolVariable("d3d12", "Enable the Direct3D 12 rendering driver (Windows only)", False))
opts.Add(BoolVariable("openxr", "Enable the OpenXR driver", True))
opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loader dynamically", True))
opts.Add(BoolVariable("disable_exceptions", "Force disabling exception handling code", True))

View File

@ -95,7 +95,7 @@ const PackedStringArray ProjectSettings::_get_supported_features() {
features.append(VERSION_FULL_CONFIG);
features.append(VERSION_FULL_BUILD);
#ifdef VULKAN_ENABLED
#if defined(VULKAN_ENABLED) || defined(D3D12_ENABLED)
features.append("Forward Plus");
features.append("Mobile");
#endif
@ -1399,6 +1399,12 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF("rendering/rendering_device/staging_buffer/texture_upload_region_size_px", 64);
GLOBAL_DEF("rendering/rendering_device/pipeline_cache/save_chunk_size_mb", 3.0);
GLOBAL_DEF("rendering/rendering_device/vulkan/max_descriptors_per_pool", 64);
GLOBAL_DEF_RST("rendering/rendering_device/d3d12/max_resource_descriptors_per_frame", 16384);
custom_prop_info["rendering/rendering_device/d3d12/max_resource_descriptors_per_frame"] = PropertyInfo(Variant::INT, "rendering/rendering_device/d3d12/max_resource_descriptors_per_frame", PROPERTY_HINT_RANGE, "512,262144");
GLOBAL_DEF_RST("rendering/rendering_device/d3d12/max_sampler_descriptors_per_frame", 1024);
custom_prop_info["rendering/rendering_device/d3d12/max_sampler_descriptors_per_frame"] = PropertyInfo(Variant::INT, "rendering/rendering_device/d3d12/max_sampler_descriptors_per_frame", PROPERTY_HINT_RANGE, "256,2048");
GLOBAL_DEF_RST("rendering/rendering_device/d3d12/max_misc_descriptors_per_frame", 512);
custom_prop_info["rendering/rendering_device/d3d12/max_misc_descriptors_per_frame"] = PropertyInfo(Variant::INT, "rendering/rendering_device/d3d12/max_misc_descriptors_per_frame", PROPERTY_HINT_RANGE, "32,4096");
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), 1);
GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM, "Disable,Enable,Mirror"), 0);

View File

@ -662,6 +662,7 @@ void OS::_bind_methods() {
BIND_ENUM_CONSTANT(RENDERING_DRIVER_VULKAN);
BIND_ENUM_CONSTANT(RENDERING_DRIVER_OPENGL3);
BIND_ENUM_CONSTANT(RENDERING_DRIVER_D3D12);
BIND_ENUM_CONSTANT(SYSTEM_DIR_DESKTOP);
BIND_ENUM_CONSTANT(SYSTEM_DIR_DCIM);

View File

@ -129,6 +129,7 @@ public:
enum RenderingDriver {
RENDERING_DRIVER_VULKAN,
RENDERING_DRIVER_OPENGL3,
RENDERING_DRIVER_D3D12,
};
virtual PackedStringArray get_connected_midi_inputs();

View File

@ -535,6 +535,11 @@ void WorkerThreadPool::wait_for_group_task_completion(GroupID p_group) {
task_mutex.unlock();
}
int WorkerThreadPool::get_thread_index() {
Thread::ID tid = Thread::get_caller_id();
return singleton->thread_ids.has(tid) ? singleton->thread_ids[tid] : -1;
}
void WorkerThreadPool::init(int p_thread_count, bool p_use_native_threads_low_priority, float p_low_priority_task_ratio) {
ERR_FAIL_COND(threads.size() > 0);
if (p_thread_count < 0) {

View File

@ -197,6 +197,8 @@ public:
_FORCE_INLINE_ int get_thread_count() const { return threads.size(); }
static WorkerThreadPool *get_singleton() { return singleton; }
static int get_thread_index();
void init(int p_thread_count = -1, bool p_use_native_threads_low_priority = true, float p_low_priority_task_ratio = 0.3);
void finish();
WorkerThreadPool();

View File

@ -4842,6 +4842,7 @@ String String::sprintf(const Array &values, bool *error) const {
bool pad_with_zeros = false;
bool left_justified = false;
bool show_sign = false;
bool as_unsigned = false;
if (error) {
*error = true;
@ -4882,16 +4883,27 @@ String String::sprintf(const Array &values, bool *error) const {
case 'x':
break;
case 'X':
base = 16;
capitalize = true;
break;
}
// Get basic number.
String str = String::num_int64(ABS(value), base, capitalize);
String str;
if (!as_unsigned) {
str = String::num_int64(ABS(value), base, capitalize);
} else {
uint64_t uvalue = *((uint64_t *)&value);
// In unsigned hex, if the value fits in 32 bits, trim it down to that.
if (base == 16 && value < 0 && value >= INT32_MIN) {
uvalue &= 0xffffffff;
}
str = String::num_uint64(uvalue, base, capitalize);
}
int number_len = str.length();
bool negative = value < 0 && !as_unsigned;
// Padding.
int pad_chars_count = (value < 0 || show_sign) ? min_chars - 1 : min_chars;
int pad_chars_count = (negative || show_sign) ? min_chars - 1 : min_chars;
String pad_char = pad_with_zeros ? String("0") : String(" ");
if (left_justified) {
str = str.rpad(pad_chars_count, pad_char);
@ -4900,8 +4912,8 @@ String String::sprintf(const Array &values, bool *error) const {
}
// Sign.
if (show_sign || value < 0) {
String sign_char = value < 0 ? "-" : "+";
if (show_sign || negative) {
String sign_char = negative ? "-" : "+";
if (left_justified) {
str = str.insert(0, sign_char);
} else {
@ -5094,6 +5106,10 @@ String String::sprintf(const Array &values, bool *error) const {
show_sign = true;
break;
}
case 'u': { // Treat as unsigned (for int/hex).
as_unsigned = true;
break;
}
case '0':
case '1':
case '2':

View File

@ -699,6 +699,9 @@
<constant name="RENDERING_DRIVER_OPENGL3" value="1" enum="RenderingDriver">
The OpenGL 3 rendering driver. It uses OpenGL 3.3 Core Profile on desktop platforms, OpenGL ES 3.0 on mobile devices, and WebGL 2.0 on Web.
</constant>
<constant name="RENDERING_DRIVER_D3D12" value="2" enum="RenderingDriver">
The Direct3D 12 rendering driver.
</constant>
<constant name="SYSTEM_DIR_DESKTOP" value="0" enum="SystemDir">
Desktop directory path.
</constant>

View File

@ -2616,6 +2616,18 @@
<member name="rendering/renderer/rendering_method.web" type="String" setter="" getter="" default="&quot;gl_compatibility&quot;">
Override for [member rendering/renderer/rendering_method] on web.
</member>
<member name="rendering/rendering_device/d3d12/max_misc_descriptors_per_frame" type="int" setter="" getter="" default="512">
The number of entries in the miscellaneous descriptors heap the Direct3D 12 rendering driver uses each frame, used for various operations like clearing a texture.
Depending on the complexity of scenes, this value may be lowered or may need to be raised.
</member>
<member name="rendering/rendering_device/d3d12/max_resource_descriptors_per_frame" type="int" setter="" getter="" default="16384">
The number of entries in the resource descriptors heap the Direct3D 12 rendering driver uses each frame, used for most rendering operations.
Depending on the complexity of scenes, this value may be lowered or may need to be raised.
</member>
<member name="rendering/rendering_device/d3d12/max_sampler_descriptors_per_frame" type="int" setter="" getter="" default="1024">
The number of entries in the sampler descriptors heap the Direct3D 12 rendering driver uses each frame, used for most rendering operations.
Depending on the complexity of scenes, this value may be lowered or may need to be raised.
</member>
<member name="rendering/rendering_device/driver" type="String" setter="" getter="">
Sets the driver to be used by the renderer when using a RenderingDevice-based renderer like the clustered renderer or the mobile renderer. This property can not be edited directly, instead, set the driver using the platform-specific overrides.
</member>

View File

@ -25,6 +25,8 @@ SConscript("winmidi/SCsub")
# Graphics drivers
if env["vulkan"]:
SConscript("vulkan/SCsub")
if env["d3d12"]:
SConscript("d3d12/SCsub")
if env["opengl3"]:
SConscript("gl_context/SCsub")
SConscript("gles3/SCsub")

151
drivers/d3d12/SCsub Normal file
View File

@ -0,0 +1,151 @@
#!/usr/bin/env python
import os
from pathlib import Path
Import("env")
env_d3d12_rd = env.Clone()
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"])
# Agility SDK.
if env["agility_sdk_path"] != "":
env_d3d12_rd.Append(CPPDEFINES=["AGILITY_SDK_ENABLED"])
if env["agility_sdk_multiarch"]:
env_d3d12_rd.Append(CPPDEFINES=["AGILITY_SDK_MULTIARCH_ENABLED"])
# PIX.
if env["pix_path"] != "":
env_d3d12_rd.Append(CPPDEFINES=["PIX_ENABLED"])
env_d3d12_rd.Append(CPPPATH=[env["pix_path"] + "/Include"])
# Mesa (SPIR-V to DXIL functionality).
mesa_dir = (env["mesa_libs"] + "/godot-mesa").replace("\\", "/")
mesa_gen_dir = (env["mesa_libs"] + "/godot-mesa/generated").replace("\\", "/")
mesa_absdir = Dir(mesa_dir).abspath
mesa_gen_absdir = Dir(mesa_dir + "/generated").abspath
custom_build_steps = [
[
"src/compiler",
"glsl/ir_expression_operation.py enum > %s/ir_expression_operation.h",
"ir_expression_operation.h",
],
["src/compiler/nir", "nir_builder_opcodes_h.py > %s/nir_builder_opcodes.h", "nir_builder_opcodes.h"],
["src/compiler/nir", "nir_constant_expressions.py > %s/nir_constant_expressions.c", "nir_constant_expressions.c"],
["src/compiler/nir", "nir_intrinsics_h.py --outdir %s", "nir_intrinsics.h"],
["src/compiler/nir", "nir_intrinsics_c.py --outdir %s", "nir_intrinsics.c"],
["src/compiler/nir", "nir_intrinsics_indices_h.py --outdir %s", "nir_intrinsics_indices.h"],
["src/compiler/nir", "nir_opcodes_h.py > %s/nir_opcodes.h", "nir_opcodes.h"],
["src/compiler/nir", "nir_opcodes_c.py > %s/nir_opcodes.c", "nir_opcodes.c"],
["src/compiler/nir", "nir_opt_algebraic.py > %s/nir_opt_algebraic.c", "nir_opt_algebraic.c"],
["src/compiler/spirv", "vtn_generator_ids_h.py spir-v.xml %s/vtn_generator_ids.h", "vtn_generator_ids.h"],
[
"src/microsoft/compiler",
"dxil_nir_algebraic.py -p ../../../src/compiler/nir > %s/dxil_nir_algebraic.c",
"dxil_nir_algebraic.c",
],
["src/util", "format_srgb.py > %s/format_srgb.c", "format_srgb.c"],
["src/util/format", "u_format_table.py u_format.csv --header > %s/u_format_pack.h", "u_format_pack.h"],
["src/util/format", "u_format_table.py u_format.csv > %s/u_format_table.c", "u_format_table.c"],
]
mesa_gen_include_paths = [mesa_gen_dir + "/src"]
# See update_mesa.sh for explanation.
for v in custom_build_steps:
subdir = v[0]
cmd = v[1]
gen_filename = v[2]
in_dir = str(Path(mesa_absdir + "/" + subdir))
out_full_path = mesa_dir + "/generated/" + subdir
out_file_full_path = out_full_path + "/" + gen_filename
if gen_filename.endswith(".h"):
mesa_gen_include_paths += [out_full_path.replace("\\", "/")]
mesa_private_inc_paths = [v[0] for v in os.walk(mesa_absdir)]
mesa_private_inc_paths = [v.replace(mesa_absdir, mesa_dir) for v in mesa_private_inc_paths]
mesa_private_inc_paths = [v.replace("\\", "/") for v in mesa_private_inc_paths]
# Avoid build results depending on if generated files already exist.
mesa_private_inc_paths = [v for v in mesa_private_inc_paths if not v.startswith(mesa_gen_dir)]
mesa_private_inc_paths.sort()
# Include the list of the generated ones now, so out-of-the-box sources can include generated headers.
mesa_private_inc_paths += mesa_gen_include_paths
# We have to blacklist some because we are bindly adding every Mesa directory
# to the include path and in some cases that causes the wrong header to be included.
mesa_blacklist_inc_paths = [
"src/c11",
]
mesa_blacklist_inc_paths = [mesa_dir + "/" + v for v in mesa_blacklist_inc_paths]
mesa_private_inc_paths = [v for v in mesa_private_inc_paths if v not in mesa_blacklist_inc_paths]
# Added by ourselves.
extra_defines = [
"WINDOWS_NO_FUTEX",
]
# These defines are inspired by the Meson build scripts in the original repo.
extra_defines += [
"__STDC_CONSTANT_MACROS",
"__STDC_FORMAT_MACROS",
"__STDC_LIMIT_MACROS",
("PACKAGE_VERSION", '\\"' + Path(mesa_absdir + "/VERSION").read_text().strip() + '\\"'),
("PACKAGE_BUGREPORT", '\\"https://gitlab.freedesktop.org/mesa/mesa/-/issues\\"'),
"PIPE_SUBSYSTEM_WINDOWS_USER",
("_Static_assert", "static_assert"),
]
if env.msvc:
extra_defines += [
"_USE_MATH_DEFINES",
"VC_EXTRALEAN",
"_CRT_SECURE_NO_WARNINGS",
"_CRT_SECURE_NO_DEPRECATE",
"_SCL_SECURE_NO_WARNINGS",
"_SCL_SECURE_NO_DEPRECATE",
"_ALLOW_KEYWORD_MACROS",
("_HAS_EXCEPTIONS", 0),
"NOMINMAX",
"HAVE_STRUCT_TIMESPEC",
]
# This is needed since rendering_device_d3d12.cpp needs to include some Mesa internals.
env_d3d12_rd.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_rd.Append(CPPDEFINES=extra_defines)
# Add all.
env.drivers_sources += thirdparty_obj
# Godot source files.
driver_obj = []
env_d3d12_rd.add_source_files(driver_obj, "*.cpp")
env.drivers_sources += driver_obj
# Needed to force rebuilding the driver files when the thirdparty code is updated.
env.Depends(driver_obj, thirdparty_obj)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,248 @@
/**************************************************************************/
/* d3d12_context.h */
/**************************************************************************/
/* 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. */
/**************************************************************************/
#ifndef D3D12_CONTEXT_H
#define D3D12_CONTEXT_H
#include "core/error/error_list.h"
#include "core/os/mutex.h"
#include "core/string/ustring.h"
#include "core/templates/rb_map.h"
#include "core/templates/rid_owner.h"
#include "servers/display_server.h"
#include "servers/rendering/rendering_device.h"
#include "d3dx12.h"
#include <dxgi1_6.h>
#define D3D12MA_D3D12_HEADERS_ALREADY_INCLUDED
#include "D3D12MemAlloc.h"
#include <wrl/client.h>
using Microsoft::WRL::ComPtr;
class D3D12Context {
public:
struct DeviceLimits {
uint64_t max_srvs_per_shader_stage;
uint64_t max_cbvs_per_shader_stage;
uint64_t max_samplers_across_all_stages;
uint64_t max_uavs_across_all_stages;
uint64_t timestamp_frequency;
};
struct SubgroupCapabilities {
uint32_t size;
bool wave_ops_supported;
uint32_t supported_stages_flags_rd() const;
uint32_t supported_operations_flags_rd() const;
};
// Following VulkanContext definition.
struct MultiviewCapabilities {
bool is_supported;
bool geometry_shader_is_supported;
bool tessellation_shader_is_supported;
uint32_t max_view_count;
uint32_t max_instance_count;
};
struct VRSCapabilities {
bool draw_call_supported; // We can specify our fragment rate on a draw call level.
bool primitive_supported; // We can specify our fragment rate on each drawcall.
bool primitive_in_multiviewport;
bool ss_image_supported; // We can provide a density map attachment on our framebuffer.
uint32_t ss_image_tile_size;
bool additional_rates_supported;
};
struct ShaderCapabilities {
D3D_SHADER_MODEL shader_model;
bool native_16bit_ops;
};
struct StorageBufferCapabilities {
bool storage_buffer_16_bit_access_is_supported;
};
struct FormatCapabilities {
bool relaxed_casting_supported;
};
private:
enum {
FRAME_LAG = 2,
IMAGE_COUNT = FRAME_LAG + 1,
};
ComPtr<IDXGIFactory2> dxgi_factory;
ComPtr<IDXGIAdapter> gpu;
DeviceLimits gpu_limits = {};
struct DeviceBasics {
ComPtr<ID3D12Device> device;
ComPtr<ID3D12CommandQueue> queue;
ComPtr<ID3D12Fence> fence;
HANDLE fence_event = nullptr;
UINT64 fence_value = 0;
} md; // 'Main device', as opposed to local device.
uint32_t feature_level = 0; // Major * 10 + minor.
bool tearing_supported = false;
SubgroupCapabilities subgroup_capabilities;
MultiviewCapabilities multiview_capabilities;
VRSCapabilities vrs_capabilities;
ShaderCapabilities shader_capabilities;
StorageBufferCapabilities storage_buffer_capabilities;
FormatCapabilities format_capabilities;
String adapter_vendor;
String adapter_name;
RenderingDevice::DeviceType adapter_type = {};
String pipeline_cache_id;
ComPtr<D3D12MA::Allocator> allocator;
bool buffers_prepared = false;
DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
uint32_t frame = 0;
ComPtr<ID3D12Fence> frame_fence;
HANDLE frame_fence_event = nullptr;
struct Window {
HWND hwnd = nullptr;
ComPtr<IDXGISwapChain3> swapchain;
UINT swapchain_flags = 0;
UINT sync_interval = 1;
UINT present_flags = 0;
ComPtr<ID3D12Resource> render_targets[IMAGE_COUNT];
uint32_t current_buffer = 0;
int width = 0;
int height = 0;
DisplayServer::VSyncMode vsync_mode = DisplayServer::VSYNC_ENABLED;
ComPtr<ID3D12DescriptorHeap> rtv_heap;
};
struct LocalDevice : public DeviceBasics {
bool waiting = false;
HANDLE fence_event = nullptr;
UINT64 fence_value = 0;
};
RID_Owner<LocalDevice, true> local_device_owner;
HashMap<DisplayServer::WindowID, Window> windows;
// Commands.
Vector<ID3D12CommandList *> command_list_queue;
int command_list_count = 1;
static void _debug_message_func(
D3D12_MESSAGE_CATEGORY p_category,
D3D12_MESSAGE_SEVERITY p_severity,
D3D12_MESSAGE_ID p_id,
LPCSTR p_description,
void *p_context);
Error _initialize_debug_layers();
Error _select_adapter(int &r_index);
void _dump_adapter_info(int p_index);
Error _create_device(DeviceBasics &r_basics);
Error _get_device_limits();
Error _check_capabilities();
Error _update_swap_chain(Window *window);
void _wait_for_idle_queue(ID3D12CommandQueue *p_queue);
protected:
virtual bool _use_validation_layers();
public:
uint32_t get_feat_level_major() const { return feature_level / 10; };
uint32_t get_feat_level_minor() const { return feature_level % 10; };
const SubgroupCapabilities &get_subgroup_capabilities() const { return subgroup_capabilities; };
const MultiviewCapabilities &get_multiview_capabilities() const { return multiview_capabilities; };
const VRSCapabilities &get_vrs_capabilities() const { return vrs_capabilities; };
const ShaderCapabilities &get_shader_capabilities() const { return shader_capabilities; };
const StorageBufferCapabilities &get_storage_buffer_capabilities() const { return storage_buffer_capabilities; };
const FormatCapabilities &get_format_capabilities() const { return format_capabilities; };
ComPtr<ID3D12Device> get_device();
ComPtr<IDXGIAdapter> get_adapter();
D3D12MA::Allocator *get_allocator();
int get_swapchain_image_count() const;
Error window_create(DisplayServer::WindowID p_window_id, DisplayServer::VSyncMode p_vsync_mode, HWND p_window, HINSTANCE p_instance, int p_width, int p_height);
void window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height);
int window_get_width(DisplayServer::WindowID p_window = 0);
int window_get_height(DisplayServer::WindowID p_window = 0);
bool window_is_valid_swapchain(DisplayServer::WindowID p_window = 0);
void window_destroy(DisplayServer::WindowID p_window_id);
CD3DX12_CPU_DESCRIPTOR_HANDLE window_get_framebuffer_rtv_handle(DisplayServer::WindowID p_window = 0);
ID3D12Resource *window_get_framebuffer_texture(DisplayServer::WindowID p_window = 0);
RID local_device_create();
ComPtr<ID3D12Device> local_device_get_d3d12_device(RID p_local_device);
void local_device_push_command_lists(RID p_local_device, ID3D12CommandList *const *p_lists, int p_count);
void local_device_sync(RID p_local_device);
void local_device_free(RID p_local_device);
DXGI_FORMAT get_screen_format() const;
DeviceLimits get_device_limits() const;
void set_setup_list(ID3D12CommandList *p_command_list);
void append_command_list(ID3D12CommandList *p_command_list);
void resize_notify();
void flush(bool p_flush_setup = false, bool p_flush_pending = false);
void prepare_buffers(ID3D12GraphicsCommandList *p_command_list);
void postpare_buffers(ID3D12GraphicsCommandList *p_command_list);
Error swap_buffers();
Error initialize();
void command_begin_label(ID3D12GraphicsCommandList *p_command_list, String p_label_name, const Color p_color);
void command_insert_label(ID3D12GraphicsCommandList *p_command_list, String p_label_name, const Color p_color);
void command_end_label(ID3D12GraphicsCommandList *p_command_list);
void set_object_name(ID3D12Object *p_object, String p_object_name);
String get_device_vendor_name() const;
String get_device_name() const;
RenderingDevice::DeviceType get_device_type() const;
String get_device_api_version() const;
String get_device_pipeline_cache_uuid() const;
void set_vsync_mode(DisplayServer::WindowID p_window, DisplayServer::VSyncMode p_mode);
DisplayServer::VSyncMode get_vsync_mode(DisplayServer::WindowID p_window = 0) const;
D3D12Context();
virtual ~D3D12Context();
};
#endif // D3D12_CONTEXT_H

View File

@ -0,0 +1,60 @@
/**************************************************************************/
/* d3d12_godot_nir_bridge.h */
/**************************************************************************/
/* 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. */
/**************************************************************************/
#ifndef D3D12_GODOT_NIR_BRIDGE_H
#define D3D12_GODOT_NIR_BRIDGE_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
// This one leaves room for potentially extremely copious bindings in a set.
static const uint32_t GODOT_NIR_DESCRIPTOR_SET_MULTIPLIER = 100000000;
// This one leaves room for potentially big sized arrays.
static const uint32_t GODOT_NIR_BINDING_MULTIPLIER = 100000;
static const uint64_t GODOT_NIR_SC_SENTINEL_MAGIC = 0x45678900; // This must be as big as to be VBR-ed as a 32 bits number.
static const uint64_t GODOT_NIR_SC_SENTINEL_MAGIC_MASK = 0xffffffffffffff00;
static const uint64_t GODOT_NIR_SC_SENTINEL_ID_MASK = 0x00000000000000ff;
typedef struct GodotNirCallbacks {
void *data;
void (*report_resource)(uint32_t p_register, uint32_t p_space, uint32_t p_dxil_type, void *p_data);
void (*report_sc_bit_offset_fn)(uint32_t p_sc_id, uint64_t p_bit_offset, void *p_data);
void (*report_bitcode_bit_offset_fn)(uint64_t p_bit_offset, void *p_data);
} GodotNirCallbacks;
#ifdef __cplusplus
}
#endif
#endif // D3D12_GODOT_NIR_BRIDGE_H

34
drivers/d3d12/d3d12ma.cpp Normal file
View File

@ -0,0 +1,34 @@
/**************************************************************************/
/* 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. */
/**************************************************************************/
#include "d3d12_context.h"
#pragma warning(disable : 4189 4324 4505)
#include "thirdparty/d3d12ma/D3D12MemAlloc.cpp"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1734,15 +1734,27 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
{
String driver_hints = "";
String driver_hints_with_d3d12 = "";
{
Vector<String> driver_hints_arr;
#ifdef VULKAN_ENABLED
driver_hints = "vulkan";
driver_hints_arr.push_back("vulkan");
#endif
driver_hints = String(",").join(driver_hints_arr);
#ifdef D3D12_ENABLED
driver_hints_arr.push_back("d3d12");
#endif
driver_hints_with_d3d12 = String(",").join(driver_hints_arr);
}
String default_driver = driver_hints.get_slice(",", 0);
String default_driver_with_d3d12 = driver_hints_with_d3d12.get_slice(",", 0);
// For now everything defaults to vulkan when available. This can change in future updates.
GLOBAL_DEF_RST_NOVAL("rendering/rendering_device/driver", default_driver);
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.windows", PROPERTY_HINT_ENUM, driver_hints), default_driver);
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.windows", PROPERTY_HINT_ENUM, driver_hints_with_d3d12), default_driver_with_d3d12);
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.linuxbsd", PROPERTY_HINT_ENUM, driver_hints), default_driver);
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.android", PROPERTY_HINT_ENUM, driver_hints), default_driver);
GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.ios", PROPERTY_HINT_ENUM, driver_hints), default_driver);
@ -1833,7 +1845,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
// Start with RenderingDevice-based backends. Should be included if any RD driver present.
#ifdef VULKAN_ENABLED
#if defined(VULKAN_ENABLED) || defined(D3D12_ENABLED)
renderer_hints = "forward_plus,mobile";
default_renderer_mobile = "mobile";
#endif
@ -1913,11 +1925,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// Now validate whether the selected driver matches with the renderer.
bool valid_combination = false;
Vector<String> available_drivers;
#ifdef VULKAN_ENABLED
if (rendering_method == "forward_plus" || rendering_method == "mobile") {
#ifdef VULKAN_ENABLED
available_drivers.push_back("vulkan");
}
#endif
#ifdef D3D12_ENABLED
available_drivers.push_back("d3d12");
#endif
}
#ifdef GLES3_ENABLED
if (rendering_method == "gl_compatibility") {
available_drivers.push_back("opengl3");

View File

@ -67,6 +67,13 @@ static Vector<uint8_t> _compile_shader_glsl(RenderingDevice::ShaderStage p_stage
} else {
// use defaults
}
} else if (capabilities->device_family == RenderingDevice::DeviceFamily::DEVICE_DIRECTX) {
// NIR-DXIL is Vulkan 1.1-conformant.
ClientVersion = glslang::EShTargetVulkan_1_1;
// The SPIR-V part of Mesa supports 1.6, but:
// - SPIRV-Reflect won't be able to parse the compute workgroup size.
// - We want to play it safe with NIR-DXIL.
TargetVersion = glslang::EShTargetSpv_1_3;
} else {
// once we support other backends we'll need to do something here
if (r_error) {

View File

@ -486,6 +486,9 @@ Vector<String> DisplayServerAndroid::get_rendering_drivers_func() {
#ifdef GLES3_ENABLED
drivers.push_back("opengl3");
#endif
#ifdef D3D12_ENABLED
drivers.push_back("d3d12");
#endif
#ifdef VULKAN_ENABLED
drivers.push_back("vulkan");
#endif

View File

@ -29,7 +29,9 @@ res_file = "godot_res.rc"
res_target = "godot_res" + env["OBJSUFFIX"]
res_obj = env.RES(res_target, res_file)
prog = env.add_program("#bin/godot", common_win + res_obj, PROGSUFFIX=env["PROGSUFFIX"])
sources = common_win + res_obj
prog = env.add_program("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"])
# Build console wrapper app.
if env["windows_subsystem"] == "gui":
@ -58,6 +60,40 @@ if env["vsproj"]:
for x in common_win_wrap:
env.vs_srcs += ["platform/windows/" + str(x)]
if env["d3d12"]:
arch_subdir = "arm64" if env["arch"] == "arm64" else "x64"
# Used in cases where we can have multiple archs side-by-side.
arch_bin_dir = "#bin/arm64" if env["arch"] == "arm64" else "#bin/x86_64"
# DXC
if env["dxc_path"] != "":
dxc_dll = "dxil.dll"
# Whether this one is loaded from arch-specific directory or not can be determined at runtime.
# Let's copy to both and let the user decide the distribution model.
for v in ["#bin", arch_bin_dir]:
env.Command(
v + "/" + dxc_dll, env["dxc_path"] + "/bin/" + arch_subdir + "/" + dxc_dll, Copy("$TARGET", "$SOURCE")
)
# Agility SDK
if env["agility_sdk_path"] != "":
agility_dlls = ["D3D12Core.dll", "d3d12SDKLayers.dll"]
# Whether these are loaded from arch-specific directory or not has to be known at build time.
target_dir = arch_bin_dir if env["agility_sdk_multiarch"] else "#bin"
for dll in agility_dlls:
env.Command(
target_dir + "/" + dll,
env["agility_sdk_path"] + "/build/native/bin/" + arch_subdir + "/" + dll,
Copy("$TARGET", "$SOURCE"),
)
# PIX
if env["pix_path"] != "":
pix_dll = "WinPixEventRuntime.dll"
env.Command(
"#bin/" + pix_dll, env["pix_path"] + "/bin/" + arch_subdir + "/" + pix_dll, Copy("$TARGET", "$SOURCE")
)
if not os.getenv("VCINSTALLDIR"):
if env["debug_symbols"] and env["separate_debug_symbols"]:
env.AddPostAction(prog, run_in_subprocess(platform_windows_builders.make_debug_mingw))

View File

@ -187,6 +187,12 @@ def get_opts():
BoolVariable("debug_crt", "Compile with MSVC's debug CRT (/MDd)", False),
BoolVariable("incremental_link", "Use MSVC incremental linking. May increase or decrease build times.", False),
("angle_libs", "Path to the ANGLE static libraries", ""),
# Direct3D 12 support.
("mesa_libs", "Path to the MESA/NIR static libraries (required for D3D12)", ""),
("dxc_path", "Path to the DirectX Shader Compiler distribution (required for D3D12)", ""),
("agility_sdk_path", "Path to the Agility SDK distribution (optional for D3D12)", ""),
("agility_sdk_multiarch", "Whether the Agility SDK DLLs will be stored in arch-specific subdirectories", False),
("pix_path", "Path to the PIX runtime distribution (optional for D3D12)", ""),
]
@ -430,6 +436,34 @@ def configure_msvc(env, vcvars_msvc_config):
if not env["use_volk"]:
LIBS += ["vulkan"]
if env["d3d12"]:
if env["dxc_path"] == "":
print("The Direct3D 12 rendering driver requires dxc_path to be set.")
sys.exit(255)
env.AppendUnique(CPPDEFINES=["D3D12_ENABLED"])
LIBS += ["d3d12", "dxgi", "dxguid"]
LIBS += ["version"] # Mesa dependency.
# Needed for avoiding C1128.
if env["target"] == "release_debug":
env.Append(CXXFLAGS=["/bigobj"])
arch_subdir = "arm64" if env["arch"] == "arm64" else "x64"
# PIX
if env["pix_path"] != "":
env.Append(LIBPATH=[env["pix_path"] + "/bin/" + arch_subdir])
LIBS += ["WinPixEventRuntime"]
# Mesa
if env["mesa_libs"] == "":
print("The Direct3D 12 rendering driver requires mesa_libs to be set.")
sys.exit(255)
env.Append(LIBPATH=[env["mesa_libs"] + "/bin"])
LIBS += ["libNIR.windows." + env["arch"]]
if env["opengl3"]:
env.AppendUnique(CPPDEFINES=["GLES3_ENABLED"])
if env["angle_libs"] != "":
@ -623,6 +657,26 @@ def configure_mingw(env):
if not env["use_volk"]:
env.Append(LIBS=["vulkan"])
if env["d3d12"]:
env.AppendUnique(CPPDEFINES=["D3D12_ENABLED"])
env.Append(LIBS=["d3d12", "dxgi", "dxguid"])
env.Append(LIBS=["version"]) # Mesa dependency.
arch_subdir = "arm64" if env["arch"] == "arm64" else "x64"
# PIX
if env["pix_path"] != "":
print("PIX runtime is not supported with MinGW.")
sys.exit(255)
# Mesa
if env["mesa_libs"] == "":
print("The Direct3D 12 rendering driver requires mesa_libs to be set.")
sys.exit(255)
env.Append(LIBPATH=[env["mesa_libs"] + "/bin"])
env.Append(LIBS=["libNIR.windows." + env["arch"]])
if env["opengl3"]:
env.Append(CPPDEFINES=["GLES3_ENABLED"])
if env["angle_libs"] != "":

View File

@ -1107,6 +1107,11 @@ void DisplayServerWindows::delete_sub_window(WindowID p_window) {
context_vulkan->window_destroy(p_window);
}
#endif
#ifdef D3D12_ENABLED
if (context_d3d12) {
context_d3d12->window_destroy(p_window);
}
#endif
#ifdef GLES3_ENABLED
if (gl_manager_angle) {
gl_manager_angle->window_destroy(p_window);
@ -1539,6 +1544,11 @@ void DisplayServerWindows::window_set_size(const Size2i p_size, WindowID p_windo
context_vulkan->window_resize(p_window, w, h);
}
#endif
#if defined(D3D12_ENABLED)
if (context_d3d12) {
context_d3d12->window_resize(p_window, w, h);
}
#endif
#if defined(GLES3_ENABLED)
if (gl_manager_native) {
gl_manager_native->window_resize(p_window, w, h);
@ -2590,6 +2600,12 @@ void DisplayServerWindows::window_set_vsync_mode(DisplayServer::VSyncMode p_vsyn
}
#endif
#if defined(D3D12_ENABLED)
if (context_d3d12) {
context_d3d12->set_vsync_mode(p_window, p_vsync_mode);
}
#endif
#if defined(GLES3_ENABLED)
if (gl_manager_native) {
gl_manager_native->set_use_vsync(p_window, p_vsync_mode != DisplayServer::VSYNC_DISABLED);
@ -2608,6 +2624,12 @@ DisplayServer::VSyncMode DisplayServerWindows::window_get_vsync_mode(WindowID p_
}
#endif
#if defined(D3D12_ENABLED)
if (context_d3d12) {
return context_d3d12->get_vsync_mode(p_window);
}
#endif
#if defined(GLES3_ENABLED)
if (gl_manager_native) {
return gl_manager_native->is_using_vsync(p_window) ? DisplayServer::VSYNC_ENABLED : DisplayServer::VSYNC_DISABLED;
@ -2616,7 +2638,6 @@ DisplayServer::VSyncMode DisplayServerWindows::window_get_vsync_mode(WindowID p_
return gl_manager_angle->is_using_vsync() ? DisplayServer::VSYNC_ENABLED : DisplayServer::VSYNC_DISABLED;
}
#endif
return DisplayServer::VSYNC_ENABLED;
}
@ -3767,12 +3788,19 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
rect_changed = true;
}
// Note: Trigger resize event to update swapchains when window is minimized/restored, even if size is not changed.
if (window_created && window.context_created) {
#if defined(VULKAN_ENABLED)
if (context_vulkan && window.context_created) {
// Note: Trigger resize event to update swapchains when window is minimized/restored, even if size is not changed.
context_vulkan->window_resize(window_id, window.width, window.height);
}
if (context_vulkan) {
context_vulkan->window_resize(window_id, window.width, window.height);
}
#endif
#if defined(D3D12_ENABLED)
if (context_d3d12) {
context_d3d12->window_resize(window_id, window.width, window.height);
}
#endif
}
}
if (!window.minimized && (!(window_pos_params->flags & SWP_NOMOVE) || window_pos_params->flags & SWP_FRAMECHANGED)) {
@ -4336,6 +4364,18 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode,
}
#endif
#ifdef D3D12_ENABLED
if (context_d3d12) {
if (context_d3d12->window_create(id, p_vsync_mode, wd.hWnd, hInstance, WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top) != OK) {
memdelete(context_d3d12);
context_d3d12 = nullptr;
windows.erase(id);
ERR_FAIL_V_MSG(INVALID_WINDOW_ID, "Failed to create D3D12 Window.");
}
wd.context_created = true;
}
#endif
#ifdef GLES3_ENABLED
if (gl_manager_native) {
if (gl_manager_native->window_create(id, wd.hWnd, hInstance, WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top) != OK) {
@ -4643,6 +4683,17 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
return;
}
}
#endif
#if defined(D3D12_ENABLED)
if (rendering_driver == "d3d12") {
context_d3d12 = memnew(D3D12Context);
if (context_d3d12->initialize() != OK) {
memdelete(context_d3d12);
context_d3d12 = nullptr;
r_error = ERR_UNAVAILABLE;
return;
}
}
#endif
// Init context and rendering device
#if defined(GLES3_ENABLED)
@ -4727,7 +4778,6 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
show_window(MAIN_WINDOW_ID);
#if defined(VULKAN_ENABLED)
if (rendering_driver == "vulkan") {
rendering_device_vulkan = memnew(RenderingDeviceVulkan);
rendering_device_vulkan->initialize(context_vulkan);
@ -4735,6 +4785,14 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
RendererCompositorRD::make_current();
}
#endif
#if defined(D3D12_ENABLED)
if (rendering_driver == "d3d12") {
rendering_device_d3d12 = memnew(RenderingDeviceD3D12);
rendering_device_d3d12->initialize(context_d3d12);
RendererCompositorRD::make_current();
}
#endif
if (!Engine::get_singleton()->is_editor_hint() && !OS::get_singleton()->is_in_low_processor_usage_mode()) {
// Increase priority for projects that are not in low-processor mode (typically games)
@ -4769,6 +4827,9 @@ Vector<String> DisplayServerWindows::get_rendering_drivers_func() {
#ifdef VULKAN_ENABLED
drivers.push_back("vulkan");
#endif
#ifdef D3D12_ENABLED
drivers.push_back("d3d12");
#endif
#ifdef GLES3_ENABLED
drivers.push_back("opengl3");
drivers.push_back("opengl3_angle");
@ -4832,6 +4893,11 @@ DisplayServerWindows::~DisplayServerWindows() {
if (context_vulkan) {
context_vulkan->window_destroy(MAIN_WINDOW_ID);
}
#endif
#ifdef D3D12_ENABLED
if (context_d3d12) {
context_d3d12->window_destroy(MAIN_WINDOW_ID);
}
#endif
if (wintab_available && windows[MAIN_WINDOW_ID].wtctx) {
wintab_WTClose(windows[MAIN_WINDOW_ID].wtctx);
@ -4853,6 +4919,19 @@ DisplayServerWindows::~DisplayServerWindows() {
}
#endif
#if defined(D3D12_ENABLED)
if (rendering_device_d3d12) {
rendering_device_d3d12->finalize();
memdelete(rendering_device_d3d12);
rendering_device_d3d12 = nullptr;
}
if (context_d3d12) {
memdelete(context_d3d12);
context_d3d12 = nullptr;
}
#endif
if (restore_mouse_trails > 1) {
SystemParametersInfoA(SPI_SETMOUSETRAILS, restore_mouse_trails, 0, 0);
}

View File

@ -58,6 +58,10 @@
#include "drivers/vulkan/rendering_device_vulkan.h"
#endif
#if defined(D3D12_ENABLED)
#include "drivers/d3d12/rendering_device_d3d12.h"
#endif
#if defined(GLES3_ENABLED)
#include "gl_manager_windows_angle.h"
#include "gl_manager_windows_native.h"
@ -347,6 +351,11 @@ class DisplayServerWindows : public DisplayServer {
RenderingDeviceVulkan *rendering_device_vulkan = nullptr;
#endif
#if defined(D3D12_ENABLED)
D3D12Context *context_d3d12 = nullptr;
RenderingDeviceD3D12 *rendering_device_d3d12 = nullptr;
#endif
RBMap<int, Vector2> touch_state;
int pressrc;

View File

@ -52,6 +52,10 @@
#include "drivers/vulkan/rendering_device_vulkan.h"
#endif
#if defined(D3D12_ENABLED)
#include "drivers/d3d12/rendering_device_d3d12.h"
#endif
#include <io.h>
#include <shellapi.h>
#include <stdio.h>

25
thirdparty/README.md vendored
View File

@ -120,6 +120,31 @@ have been removed as they caused massive quality regressions. Apply the patches
in the `patches/` folder when syncing on newer upstream commits.
## d3d12ma
- Upstream: https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator
- Version: 2.1.0-development (4d16e802e0b9451c9d3c27cd308928c13b73acd6, 2023)
- License: MIT
Files extracted from upstream source:
- `src/D3D12MemAlloc.cpp`, `src/D3D12MemAlloc.natvis`
- `include/D3D12MemAlloc.h`
- `LICENSE.txt`, `NOTICES.txt`
## directx_headers
- Upstream: https://github.com/microsoft/DirectX-Headers
- Version: 1.606.3 (fd329244e62201bf959331d28514928fc1d45005, 2022)
- License: MIT
Files extracted from upstream source:
- `include/directx/*.h`
- `LICENSE`
## doctest
- Upstream: https://github.com/onqtam/doctest

10544
thirdparty/d3d12ma/D3D12MemAlloc.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

2632
thirdparty/d3d12ma/D3D12MemAlloc.h vendored Normal file

File diff suppressed because it is too large Load Diff

58
thirdparty/d3d12ma/D3D12MemAlloc.natvis vendored Normal file
View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="D3D12MA::Vector&lt;*&gt;">
<DisplayString>{{ Count={m_Count} }}</DisplayString>
<Expand>
<Item Name="[Count]">m_Count</Item>
<Item Name="[Capacity]">m_Capacity</Item>
<ArrayItems>
<Size>m_Count</Size>
<ValuePointer>m_pArray</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="D3D12MA::List&lt;*&gt;">
<DisplayString>{{ Count={m_Count} }}</DisplayString>
<Expand>
<Item Name="[Count]">m_Count</Item>
<LinkedListItems>
<Size>m_Count</Size>
<HeadPointer>m_pFront</HeadPointer>
<NextPointer>pNext</NextPointer>
<ValueNode>Value</ValueNode>
</LinkedListItems>
</Expand>
</Type>
<!--
Due to custom way of accesing next items in
D3D12MA::IntrusiveLinkedList via methods in provided type traits,
every specialization must be manually added with
custom <NextPointer> field describing proper way of iterating the list.
-->
<Type Name="D3D12MA::IntrusiveLinkedList&lt;D3D12MA::CommittedAllocationListItemTraits&gt;">
<DisplayString>{{ Count={m_Count} }}</DisplayString>
<Expand>
<Item Name="[Count]">m_Count</Item>
<LinkedListItems>
<Size>m_Count</Size>
<HeadPointer>m_Front</HeadPointer>
<NextPointer>m_Committed.next</NextPointer>
<ValueNode>*this</ValueNode>
</LinkedListItems>
</Expand>
</Type>
<Type Name="D3D12MA::IntrusiveLinkedList&lt;D3D12MA::PoolListItemTraits&gt;">
<DisplayString>{{ Count={m_Count} }}</DisplayString>
<Expand>
<Item Name="[Count]">m_Count</Item>
<LinkedListItems>
<Size>m_Count</Size>
<HeadPointer>m_Front</HeadPointer>
<NextPointer>m_NextPool</NextPointer>
<ValueNode>*this</ValueNode>
</LinkedListItems>
</Expand>
</Type>
</AutoVisualizer>

19
thirdparty/d3d12ma/LICENSE.txt vendored Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2019-2022 Advanced Micro Devices, Inc. All rights reserved.
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.

52
thirdparty/d3d12ma/NOTICES.txt vendored Normal file
View File

@ -0,0 +1,52 @@
Notices and licenses file
_________________________
AMD copyrighted code (MIT)
Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
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.
Dependecnies on microsoft-directx-graphics-samples v-u (MIT)
Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
Copyright (c) Microsoft. All rights reserved.
This code is licensed under the MIT License (MIT).
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
gpuopen-librariesandsdks-vulkanmemoryallocator v-u (MIT)
Copyright (c) 2019-2022 Advanced Micro Devices, Inc. All rights reserved.
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.

21
thirdparty/directx_headers/LICENSE vendored Normal file
View File

@ -0,0 +1,21 @@
Copyright (c) Microsoft Corporation.
MIT License
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.

28706
thirdparty/directx_headers/d3d12.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,739 @@
/*-------------------------------------------------------------------------------------
*
* Copyright (c) Microsoft Corporation
* Licensed under the MIT license
*
*-------------------------------------------------------------------------------------*/
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.01.0628 */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif
/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif /* __RPCNDR_H_VERSION__ */
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __d3d12compatibility_h__
#define __d3d12compatibility_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
#ifndef DECLSPEC_XFGVIRT
#if defined(_CONTROL_FLOW_GUARD_XFG)
#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func))
#else
#define DECLSPEC_XFGVIRT(base, func)
#endif
#endif
/* Forward Declarations */
#ifndef __ID3D12CompatibilityDevice_FWD_DEFINED__
#define __ID3D12CompatibilityDevice_FWD_DEFINED__
typedef interface ID3D12CompatibilityDevice ID3D12CompatibilityDevice;
#endif /* __ID3D12CompatibilityDevice_FWD_DEFINED__ */
#ifndef __D3D11On12CreatorID_FWD_DEFINED__
#define __D3D11On12CreatorID_FWD_DEFINED__
typedef interface D3D11On12CreatorID D3D11On12CreatorID;
#endif /* __D3D11On12CreatorID_FWD_DEFINED__ */
#ifndef __D3D9On12CreatorID_FWD_DEFINED__
#define __D3D9On12CreatorID_FWD_DEFINED__
typedef interface D3D9On12CreatorID D3D9On12CreatorID;
#endif /* __D3D9On12CreatorID_FWD_DEFINED__ */
#ifndef __OpenGLOn12CreatorID_FWD_DEFINED__
#define __OpenGLOn12CreatorID_FWD_DEFINED__
typedef interface OpenGLOn12CreatorID OpenGLOn12CreatorID;
#endif /* __OpenGLOn12CreatorID_FWD_DEFINED__ */
#ifndef __OpenCLOn12CreatorID_FWD_DEFINED__
#define __OpenCLOn12CreatorID_FWD_DEFINED__
typedef interface OpenCLOn12CreatorID OpenCLOn12CreatorID;
#endif /* __OpenCLOn12CreatorID_FWD_DEFINED__ */
#ifndef __DirectMLTensorFlowCreatorID_FWD_DEFINED__
#define __DirectMLTensorFlowCreatorID_FWD_DEFINED__
typedef interface DirectMLTensorFlowCreatorID DirectMLTensorFlowCreatorID;
#endif /* __DirectMLTensorFlowCreatorID_FWD_DEFINED__ */
#ifndef __DirectMLPyTorchCreatorID_FWD_DEFINED__
#define __DirectMLPyTorchCreatorID_FWD_DEFINED__
typedef interface DirectMLPyTorchCreatorID DirectMLPyTorchCreatorID;
#endif /* __DirectMLPyTorchCreatorID_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
#include "d3d11on12.h"
#ifdef __cplusplus
extern "C"{
#endif
/* interface __MIDL_itf_d3d12compatibility_0000_0000 */
/* [local] */
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES)
typedef
enum D3D12_COMPATIBILITY_SHARED_FLAGS
{
D3D12_COMPATIBILITY_SHARED_FLAG_NONE = 0,
D3D12_COMPATIBILITY_SHARED_FLAG_NON_NT_HANDLE = 0x1,
D3D12_COMPATIBILITY_SHARED_FLAG_KEYED_MUTEX = 0x2,
D3D12_COMPATIBILITY_SHARED_FLAG_9_ON_12 = 0x4
} D3D12_COMPATIBILITY_SHARED_FLAGS;
DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMPATIBILITY_SHARED_FLAGS );
typedef
enum D3D12_REFLECT_SHARED_PROPERTY
{
D3D12_REFLECT_SHARED_PROPERTY_D3D11_RESOURCE_FLAGS = 0,
D3D12_REFELCT_SHARED_PROPERTY_COMPATIBILITY_SHARED_FLAGS = ( D3D12_REFLECT_SHARED_PROPERTY_D3D11_RESOURCE_FLAGS + 1 ) ,
D3D12_REFLECT_SHARED_PROPERTY_NON_NT_SHARED_HANDLE = ( D3D12_REFELCT_SHARED_PROPERTY_COMPATIBILITY_SHARED_FLAGS + 1 )
} D3D12_REFLECT_SHARED_PROPERTY;
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0000_v0_0_s_ifspec;
#ifndef __ID3D12CompatibilityDevice_INTERFACE_DEFINED__
#define __ID3D12CompatibilityDevice_INTERFACE_DEFINED__
/* interface ID3D12CompatibilityDevice */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_ID3D12CompatibilityDevice;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("8f1c0e3c-fae3-4a82-b098-bfe1708207ff")
ID3D12CompatibilityDevice : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE CreateSharedResource(
_In_ const D3D12_HEAP_PROPERTIES *pHeapProperties,
D3D12_HEAP_FLAGS HeapFlags,
_In_ const D3D12_RESOURCE_DESC *pDesc,
D3D12_RESOURCE_STATES InitialResourceState,
_In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue,
_In_opt_ const D3D11_RESOURCE_FLAGS *pFlags11,
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
_In_opt_ ID3D12LifetimeTracker *pLifetimeTracker,
_In_opt_ ID3D12SwapChainAssistant *pOwningSwapchain,
REFIID riid,
_COM_Outptr_opt_ void **ppResource) = 0;
virtual HRESULT STDMETHODCALLTYPE CreateSharedHeap(
_In_ const D3D12_HEAP_DESC *pHeapDesc,
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
REFIID riid,
_COM_Outptr_opt_ void **ppHeap) = 0;
virtual HRESULT STDMETHODCALLTYPE ReflectSharedProperties(
_In_ ID3D12Object *pHeapOrResource,
D3D12_REFLECT_SHARED_PROPERTY ReflectType,
_Out_writes_bytes_(DataSize) void *pData,
UINT DataSize) = 0;
};
#else /* C style interface */
typedef struct ID3D12CompatibilityDeviceVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ID3D12CompatibilityDevice * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
ID3D12CompatibilityDevice * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
ID3D12CompatibilityDevice * This);
DECLSPEC_XFGVIRT(ID3D12CompatibilityDevice, CreateSharedResource)
HRESULT ( STDMETHODCALLTYPE *CreateSharedResource )(
ID3D12CompatibilityDevice * This,
_In_ const D3D12_HEAP_PROPERTIES *pHeapProperties,
D3D12_HEAP_FLAGS HeapFlags,
_In_ const D3D12_RESOURCE_DESC *pDesc,
D3D12_RESOURCE_STATES InitialResourceState,
_In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue,
_In_opt_ const D3D11_RESOURCE_FLAGS *pFlags11,
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
_In_opt_ ID3D12LifetimeTracker *pLifetimeTracker,
_In_opt_ ID3D12SwapChainAssistant *pOwningSwapchain,
REFIID riid,
_COM_Outptr_opt_ void **ppResource);
DECLSPEC_XFGVIRT(ID3D12CompatibilityDevice, CreateSharedHeap)
HRESULT ( STDMETHODCALLTYPE *CreateSharedHeap )(
ID3D12CompatibilityDevice * This,
_In_ const D3D12_HEAP_DESC *pHeapDesc,
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
REFIID riid,
_COM_Outptr_opt_ void **ppHeap);
DECLSPEC_XFGVIRT(ID3D12CompatibilityDevice, ReflectSharedProperties)
HRESULT ( STDMETHODCALLTYPE *ReflectSharedProperties )(
ID3D12CompatibilityDevice * This,
_In_ ID3D12Object *pHeapOrResource,
D3D12_REFLECT_SHARED_PROPERTY ReflectType,
_Out_writes_bytes_(DataSize) void *pData,
UINT DataSize);
END_INTERFACE
} ID3D12CompatibilityDeviceVtbl;
interface ID3D12CompatibilityDevice
{
CONST_VTBL struct ID3D12CompatibilityDeviceVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ID3D12CompatibilityDevice_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ID3D12CompatibilityDevice_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ID3D12CompatibilityDevice_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ID3D12CompatibilityDevice_CreateSharedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pFlags11,CompatibilityFlags,pLifetimeTracker,pOwningSwapchain,riid,ppResource) \
( (This)->lpVtbl -> CreateSharedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pFlags11,CompatibilityFlags,pLifetimeTracker,pOwningSwapchain,riid,ppResource) )
#define ID3D12CompatibilityDevice_CreateSharedHeap(This,pHeapDesc,CompatibilityFlags,riid,ppHeap) \
( (This)->lpVtbl -> CreateSharedHeap(This,pHeapDesc,CompatibilityFlags,riid,ppHeap) )
#define ID3D12CompatibilityDevice_ReflectSharedProperties(This,pHeapOrResource,ReflectType,pData,DataSize) \
( (This)->lpVtbl -> ReflectSharedProperties(This,pHeapOrResource,ReflectType,pData,DataSize) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ID3D12CompatibilityDevice_INTERFACE_DEFINED__ */
#ifndef __D3D11On12CreatorID_INTERFACE_DEFINED__
#define __D3D11On12CreatorID_INTERFACE_DEFINED__
/* interface D3D11On12CreatorID */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_D3D11On12CreatorID;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("edbf5678-2960-4e81-8429-99d4b2630c4e")
D3D11On12CreatorID : public IUnknown
{
public:
};
#else /* C style interface */
typedef struct D3D11On12CreatorIDVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
D3D11On12CreatorID * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
D3D11On12CreatorID * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
D3D11On12CreatorID * This);
END_INTERFACE
} D3D11On12CreatorIDVtbl;
interface D3D11On12CreatorID
{
CONST_VTBL struct D3D11On12CreatorIDVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define D3D11On12CreatorID_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define D3D11On12CreatorID_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define D3D11On12CreatorID_Release(This) \
( (This)->lpVtbl -> Release(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __D3D11On12CreatorID_INTERFACE_DEFINED__ */
#ifndef __D3D9On12CreatorID_INTERFACE_DEFINED__
#define __D3D9On12CreatorID_INTERFACE_DEFINED__
/* interface D3D9On12CreatorID */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_D3D9On12CreatorID;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("fffcbb7f-15d3-42a2-841e-9d8d32f37ddd")
D3D9On12CreatorID : public IUnknown
{
public:
};
#else /* C style interface */
typedef struct D3D9On12CreatorIDVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
D3D9On12CreatorID * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
D3D9On12CreatorID * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
D3D9On12CreatorID * This);
END_INTERFACE
} D3D9On12CreatorIDVtbl;
interface D3D9On12CreatorID
{
CONST_VTBL struct D3D9On12CreatorIDVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define D3D9On12CreatorID_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define D3D9On12CreatorID_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define D3D9On12CreatorID_Release(This) \
( (This)->lpVtbl -> Release(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __D3D9On12CreatorID_INTERFACE_DEFINED__ */
#ifndef __OpenGLOn12CreatorID_INTERFACE_DEFINED__
#define __OpenGLOn12CreatorID_INTERFACE_DEFINED__
/* interface OpenGLOn12CreatorID */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_OpenGLOn12CreatorID;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("6bb3cd34-0d19-45ab-97ed-d720ba3dfc80")
OpenGLOn12CreatorID : public IUnknown
{
public:
};
#else /* C style interface */
typedef struct OpenGLOn12CreatorIDVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
OpenGLOn12CreatorID * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
OpenGLOn12CreatorID * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
OpenGLOn12CreatorID * This);
END_INTERFACE
} OpenGLOn12CreatorIDVtbl;
interface OpenGLOn12CreatorID
{
CONST_VTBL struct OpenGLOn12CreatorIDVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define OpenGLOn12CreatorID_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define OpenGLOn12CreatorID_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define OpenGLOn12CreatorID_Release(This) \
( (This)->lpVtbl -> Release(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __OpenGLOn12CreatorID_INTERFACE_DEFINED__ */
#ifndef __OpenCLOn12CreatorID_INTERFACE_DEFINED__
#define __OpenCLOn12CreatorID_INTERFACE_DEFINED__
/* interface OpenCLOn12CreatorID */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_OpenCLOn12CreatorID;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("3f76bb74-91b5-4a88-b126-20ca0331cd60")
OpenCLOn12CreatorID : public IUnknown
{
public:
};
#else /* C style interface */
typedef struct OpenCLOn12CreatorIDVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
OpenCLOn12CreatorID * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
OpenCLOn12CreatorID * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
OpenCLOn12CreatorID * This);
END_INTERFACE
} OpenCLOn12CreatorIDVtbl;
interface OpenCLOn12CreatorID
{
CONST_VTBL struct OpenCLOn12CreatorIDVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define OpenCLOn12CreatorID_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define OpenCLOn12CreatorID_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define OpenCLOn12CreatorID_Release(This) \
( (This)->lpVtbl -> Release(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __OpenCLOn12CreatorID_INTERFACE_DEFINED__ */
#ifndef __DirectMLTensorFlowCreatorID_INTERFACE_DEFINED__
#define __DirectMLTensorFlowCreatorID_INTERFACE_DEFINED__
/* interface DirectMLTensorFlowCreatorID */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_DirectMLTensorFlowCreatorID;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("cb7490ac-8a0f-44ec-9b7b-6f4cafe8e9ab")
DirectMLTensorFlowCreatorID : public IUnknown
{
public:
};
#else /* C style interface */
typedef struct DirectMLTensorFlowCreatorIDVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
DirectMLTensorFlowCreatorID * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
DirectMLTensorFlowCreatorID * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
DirectMLTensorFlowCreatorID * This);
END_INTERFACE
} DirectMLTensorFlowCreatorIDVtbl;
interface DirectMLTensorFlowCreatorID
{
CONST_VTBL struct DirectMLTensorFlowCreatorIDVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define DirectMLTensorFlowCreatorID_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define DirectMLTensorFlowCreatorID_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define DirectMLTensorFlowCreatorID_Release(This) \
( (This)->lpVtbl -> Release(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __DirectMLTensorFlowCreatorID_INTERFACE_DEFINED__ */
#ifndef __DirectMLPyTorchCreatorID_INTERFACE_DEFINED__
#define __DirectMLPyTorchCreatorID_INTERFACE_DEFINED__
/* interface DirectMLPyTorchCreatorID */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_DirectMLPyTorchCreatorID;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("af029192-fba1-4b05-9116-235e06560354")
DirectMLPyTorchCreatorID : public IUnknown
{
public:
};
#else /* C style interface */
typedef struct DirectMLPyTorchCreatorIDVtbl
{
BEGIN_INTERFACE
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
DirectMLPyTorchCreatorID * This,
REFIID riid,
_COM_Outptr_ void **ppvObject);
DECLSPEC_XFGVIRT(IUnknown, AddRef)
ULONG ( STDMETHODCALLTYPE *AddRef )(
DirectMLPyTorchCreatorID * This);
DECLSPEC_XFGVIRT(IUnknown, Release)
ULONG ( STDMETHODCALLTYPE *Release )(
DirectMLPyTorchCreatorID * This);
END_INTERFACE
} DirectMLPyTorchCreatorIDVtbl;
interface DirectMLPyTorchCreatorID
{
CONST_VTBL struct DirectMLPyTorchCreatorIDVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define DirectMLPyTorchCreatorID_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define DirectMLPyTorchCreatorID_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define DirectMLPyTorchCreatorID_Release(This) \
( (This)->lpVtbl -> Release(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __DirectMLPyTorchCreatorID_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3d12compatibility_0000_0007 */
/* [local] */
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */
#pragma endregion
DEFINE_GUID(IID_ID3D12CompatibilityDevice,0x8f1c0e3c,0xfae3,0x4a82,0xb0,0x98,0xbf,0xe1,0x70,0x82,0x07,0xff);
DEFINE_GUID(IID_D3D11On12CreatorID,0xedbf5678,0x2960,0x4e81,0x84,0x29,0x99,0xd4,0xb2,0x63,0x0c,0x4e);
DEFINE_GUID(IID_D3D9On12CreatorID,0xfffcbb7f,0x15d3,0x42a2,0x84,0x1e,0x9d,0x8d,0x32,0xf3,0x7d,0xdd);
DEFINE_GUID(IID_OpenGLOn12CreatorID,0x6bb3cd34,0x0d19,0x45ab,0x97,0xed,0xd7,0x20,0xba,0x3d,0xfc,0x80);
DEFINE_GUID(IID_OpenCLOn12CreatorID,0x3f76bb74,0x91b5,0x4a88,0xb1,0x26,0x20,0xca,0x03,0x31,0xcd,0x60);
DEFINE_GUID(IID_DirectMLTensorFlowCreatorID,0xcb7490ac,0x8a0f,0x44ec,0x9b,0x7b,0x6f,0x4c,0xaf,0xe8,0xe9,0xab);
DEFINE_GUID(IID_DirectMLPyTorchCreatorID,0xaf029192,0xfba1,0x4b05,0x91,0x16,0x23,0x5e,0x06,0x56,0x03,0x54);
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0007_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0007_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

490
thirdparty/directx_headers/d3d12shader.h vendored Normal file
View File

@ -0,0 +1,490 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
// File: D3D12Shader.h
// Content: D3D12 Shader Types and APIs
//
//////////////////////////////////////////////////////////////////////////////
#ifndef __D3D12SHADER_H__
#define __D3D12SHADER_H__
#include "d3dcommon.h"
typedef enum D3D12_SHADER_VERSION_TYPE
{
D3D12_SHVER_PIXEL_SHADER = 0,
D3D12_SHVER_VERTEX_SHADER = 1,
D3D12_SHVER_GEOMETRY_SHADER = 2,
// D3D11 Shaders
D3D12_SHVER_HULL_SHADER = 3,
D3D12_SHVER_DOMAIN_SHADER = 4,
D3D12_SHVER_COMPUTE_SHADER = 5,
// D3D12 Shaders
D3D12_SHVER_LIBRARY = 6,
D3D12_SHVER_RAY_GENERATION_SHADER = 7,
D3D12_SHVER_INTERSECTION_SHADER = 8,
D3D12_SHVER_ANY_HIT_SHADER = 9,
D3D12_SHVER_CLOSEST_HIT_SHADER = 10,
D3D12_SHVER_MISS_SHADER = 11,
D3D12_SHVER_CALLABLE_SHADER = 12,
D3D12_SHVER_MESH_SHADER = 13,
D3D12_SHVER_AMPLIFICATION_SHADER = 14,
D3D12_SHVER_RESERVED0 = 0xFFF0,
} D3D12_SHADER_VERSION_TYPE;
#define D3D12_SHVER_GET_TYPE(_Version) \
(((_Version) >> 16) & 0xffff)
#define D3D12_SHVER_GET_MAJOR(_Version) \
(((_Version) >> 4) & 0xf)
#define D3D12_SHVER_GET_MINOR(_Version) \
(((_Version) >> 0) & 0xf)
// Slot ID for library function return
#define D3D_RETURN_PARAMETER_INDEX (-1)
typedef D3D_RESOURCE_RETURN_TYPE D3D12_RESOURCE_RETURN_TYPE;
typedef D3D_CBUFFER_TYPE D3D12_CBUFFER_TYPE;
typedef struct _D3D12_SIGNATURE_PARAMETER_DESC
{
LPCSTR SemanticName; // Name of the semantic
UINT SemanticIndex; // Index of the semantic
UINT Register; // Number of member variables
D3D_NAME SystemValueType;// A predefined system value, or D3D_NAME_UNDEFINED if not applicable
D3D_REGISTER_COMPONENT_TYPE ComponentType; // Scalar type (e.g. uint, float, etc.)
BYTE Mask; // Mask to indicate which components of the register
// are used (combination of D3D10_COMPONENT_MASK values)
BYTE ReadWriteMask; // Mask to indicate whether a given component is
// never written (if this is an output signature) or
// always read (if this is an input signature).
// (combination of D3D_MASK_* values)
UINT Stream; // Stream index
D3D_MIN_PRECISION MinPrecision; // Minimum desired interpolation precision
} D3D12_SIGNATURE_PARAMETER_DESC;
typedef struct _D3D12_SHADER_BUFFER_DESC
{
LPCSTR Name; // Name of the constant buffer
D3D_CBUFFER_TYPE Type; // Indicates type of buffer content
UINT Variables; // Number of member variables
UINT Size; // Size of CB (in bytes)
UINT uFlags; // Buffer description flags
} D3D12_SHADER_BUFFER_DESC;
typedef struct _D3D12_SHADER_VARIABLE_DESC
{
LPCSTR Name; // Name of the variable
UINT StartOffset; // Offset in constant buffer's backing store
UINT Size; // Size of variable (in bytes)
UINT uFlags; // Variable flags
LPVOID DefaultValue; // Raw pointer to default value
UINT StartTexture; // First texture index (or -1 if no textures used)
UINT TextureSize; // Number of texture slots possibly used.
UINT StartSampler; // First sampler index (or -1 if no textures used)
UINT SamplerSize; // Number of sampler slots possibly used.
} D3D12_SHADER_VARIABLE_DESC;
typedef struct _D3D12_SHADER_TYPE_DESC
{
D3D_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.)
D3D_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.)
UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable)
UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable)
UINT Elements; // Number of elements (0 if not an array)
UINT Members; // Number of members (0 if not a structure)
UINT Offset; // Offset from the start of structure (0 if not a structure member)
LPCSTR Name; // Name of type, can be NULL
} D3D12_SHADER_TYPE_DESC;
typedef D3D_TESSELLATOR_DOMAIN D3D12_TESSELLATOR_DOMAIN;
typedef D3D_TESSELLATOR_PARTITIONING D3D12_TESSELLATOR_PARTITIONING;
typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D12_TESSELLATOR_OUTPUT_PRIMITIVE;
typedef struct _D3D12_SHADER_DESC
{
UINT Version; // Shader version
LPCSTR Creator; // Creator string
UINT Flags; // Shader compilation/parse flags
UINT ConstantBuffers; // Number of constant buffers
UINT BoundResources; // Number of bound resources
UINT InputParameters; // Number of parameters in the input signature
UINT OutputParameters; // Number of parameters in the output signature
UINT InstructionCount; // Number of emitted instructions
UINT TempRegisterCount; // Number of temporary registers used
UINT TempArrayCount; // Number of temporary arrays used
UINT DefCount; // Number of constant defines
UINT DclCount; // Number of declarations (input + output)
UINT TextureNormalInstructions; // Number of non-categorized texture instructions
UINT TextureLoadInstructions; // Number of texture load instructions
UINT TextureCompInstructions; // Number of texture comparison instructions
UINT TextureBiasInstructions; // Number of texture bias instructions
UINT TextureGradientInstructions; // Number of texture gradient instructions
UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
UINT StaticFlowControlCount; // Number of static flow control instructions used
UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
UINT MacroInstructionCount; // Number of macro instructions used
UINT ArrayInstructionCount; // Number of array instructions used
UINT CutInstructionCount; // Number of cut instructions used
UINT EmitInstructionCount; // Number of emit instructions used
D3D_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology
UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count
D3D_PRIMITIVE InputPrimitive; // GS/HS input primitive
UINT PatchConstantParameters; // Number of parameters in the patch constant signature
UINT cGSInstanceCount; // Number of Geometry shader instances
UINT cControlPoints; // Number of control points in the HS->DS stage
D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive; // Primitive output by the tessellator
D3D_TESSELLATOR_PARTITIONING HSPartitioning; // Partitioning mode of the tessellator
D3D_TESSELLATOR_DOMAIN TessellatorDomain; // Domain of the tessellator (quad, tri, isoline)
// instruction counts
UINT cBarrierInstructions; // Number of barrier instructions in a compute shader
UINT cInterlockedInstructions; // Number of interlocked instructions
UINT cTextureStoreInstructions; // Number of texture writes
} D3D12_SHADER_DESC;
typedef struct _D3D12_SHADER_INPUT_BIND_DESC
{
LPCSTR Name; // Name of the resource
D3D_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.)
UINT BindPoint; // Starting bind point
UINT BindCount; // Number of contiguous bind points (for arrays)
UINT uFlags; // Input binding flags
D3D_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture)
D3D_SRV_DIMENSION Dimension; // Dimension (if texture)
UINT NumSamples; // Number of samples (0 if not MS texture)
UINT Space; // Register space
UINT uID; // Range ID in the bytecode
} D3D12_SHADER_INPUT_BIND_DESC;
#define D3D_SHADER_REQUIRES_DOUBLES 0x00000001
#define D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL 0x00000002
#define D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE 0x00000004
#define D3D_SHADER_REQUIRES_64_UAVS 0x00000008
#define D3D_SHADER_REQUIRES_MINIMUM_PRECISION 0x00000010
#define D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS 0x00000020
#define D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS 0x00000040
#define D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING 0x00000080
#define D3D_SHADER_REQUIRES_TILED_RESOURCES 0x00000100
#define D3D_SHADER_REQUIRES_STENCIL_REF 0x00000200
#define D3D_SHADER_REQUIRES_INNER_COVERAGE 0x00000400
#define D3D_SHADER_REQUIRES_TYPED_UAV_LOAD_ADDITIONAL_FORMATS 0x00000800
#define D3D_SHADER_REQUIRES_ROVS 0x00001000
#define D3D_SHADER_REQUIRES_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER 0x00002000
#define D3D_SHADER_REQUIRES_WAVE_OPS 0x00004000
#define D3D_SHADER_REQUIRES_INT64_OPS 0x00008000
#define D3D_SHADER_REQUIRES_VIEW_ID 0x00010000
#define D3D_SHADER_REQUIRES_BARYCENTRICS 0x00020000
#define D3D_SHADER_REQUIRES_NATIVE_16BIT_OPS 0x00040000
#define D3D_SHADER_REQUIRES_SHADING_RATE 0x00080000
#define D3D_SHADER_REQUIRES_RAYTRACING_TIER_1_1 0x00100000
#define D3D_SHADER_REQUIRES_SAMPLER_FEEDBACK 0x00200000
#define D3D_SHADER_REQUIRES_ATOMIC_INT64_ON_TYPED_RESOURCE 0x00400000
#define D3D_SHADER_REQUIRES_ATOMIC_INT64_ON_GROUP_SHARED 0x00800000
#define D3D_SHADER_REQUIRES_DERIVATIVES_IN_MESH_AND_AMPLIFICATION_SHADERS 0x01000000
#define D3D_SHADER_REQUIRES_RESOURCE_DESCRIPTOR_HEAP_INDEXING 0x02000000
#define D3D_SHADER_REQUIRES_SAMPLER_DESCRIPTOR_HEAP_INDEXING 0x04000000
#define D3D_SHADER_REQUIRES_WAVE_MMA 0x08000000
#define D3D_SHADER_REQUIRES_ATOMIC_INT64_ON_DESCRIPTOR_HEAP_RESOURCE 0x10000000
#define D3D_SHADER_FEATURE_ADVANCED_TEXTURE_OPS 0x20000000
#define D3D_SHADER_FEATURE_WRITEABLE_MSAA_TEXTURES 0x40000000
typedef struct _D3D12_LIBRARY_DESC
{
LPCSTR Creator; // The name of the originator of the library.
UINT Flags; // Compilation flags.
UINT FunctionCount; // Number of functions exported from the library.
} D3D12_LIBRARY_DESC;
typedef struct _D3D12_FUNCTION_DESC
{
UINT Version; // Shader version
LPCSTR Creator; // Creator string
UINT Flags; // Shader compilation/parse flags
UINT ConstantBuffers; // Number of constant buffers
UINT BoundResources; // Number of bound resources
UINT InstructionCount; // Number of emitted instructions
UINT TempRegisterCount; // Number of temporary registers used
UINT TempArrayCount; // Number of temporary arrays used
UINT DefCount; // Number of constant defines
UINT DclCount; // Number of declarations (input + output)
UINT TextureNormalInstructions; // Number of non-categorized texture instructions
UINT TextureLoadInstructions; // Number of texture load instructions
UINT TextureCompInstructions; // Number of texture comparison instructions
UINT TextureBiasInstructions; // Number of texture bias instructions
UINT TextureGradientInstructions; // Number of texture gradient instructions
UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
UINT StaticFlowControlCount; // Number of static flow control instructions used
UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
UINT MacroInstructionCount; // Number of macro instructions used
UINT ArrayInstructionCount; // Number of array instructions used
UINT MovInstructionCount; // Number of mov instructions used
UINT MovcInstructionCount; // Number of movc instructions used
UINT ConversionInstructionCount; // Number of type conversion instructions used
UINT BitwiseInstructionCount; // Number of bitwise arithmetic instructions used
D3D_FEATURE_LEVEL MinFeatureLevel; // Min target of the function byte code
UINT64 RequiredFeatureFlags; // Required feature flags
LPCSTR Name; // Function name
INT FunctionParameterCount; // Number of logical parameters in the function signature (not including return)
BOOL HasReturn; // TRUE, if function returns a value, false - it is a subroutine
BOOL Has10Level9VertexShader; // TRUE, if there is a 10L9 VS blob
BOOL Has10Level9PixelShader; // TRUE, if there is a 10L9 PS blob
} D3D12_FUNCTION_DESC;
typedef struct _D3D12_PARAMETER_DESC
{
LPCSTR Name; // Parameter name.
LPCSTR SemanticName; // Parameter semantic name (+index).
D3D_SHADER_VARIABLE_TYPE Type; // Element type.
D3D_SHADER_VARIABLE_CLASS Class; // Scalar/Vector/Matrix.
UINT Rows; // Rows are for matrix parameters.
UINT Columns; // Components or Columns in matrix.
D3D_INTERPOLATION_MODE InterpolationMode; // Interpolation mode.
D3D_PARAMETER_FLAGS Flags; // Parameter modifiers.
UINT FirstInRegister; // The first input register for this parameter.
UINT FirstInComponent; // The first input register component for this parameter.
UINT FirstOutRegister; // The first output register for this parameter.
UINT FirstOutComponent; // The first output register component for this parameter.
} D3D12_PARAMETER_DESC;
//////////////////////////////////////////////////////////////////////////////
// Interfaces ////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
typedef interface ID3D12ShaderReflectionType ID3D12ShaderReflectionType;
typedef interface ID3D12ShaderReflectionType *LPD3D12SHADERREFLECTIONTYPE;
typedef interface ID3D12ShaderReflectionVariable ID3D12ShaderReflectionVariable;
typedef interface ID3D12ShaderReflectionVariable *LPD3D12SHADERREFLECTIONVARIABLE;
typedef interface ID3D12ShaderReflectionConstantBuffer ID3D12ShaderReflectionConstantBuffer;
typedef interface ID3D12ShaderReflectionConstantBuffer *LPD3D12SHADERREFLECTIONCONSTANTBUFFER;
typedef interface ID3D12ShaderReflection ID3D12ShaderReflection;
typedef interface ID3D12ShaderReflection *LPD3D12SHADERREFLECTION;
typedef interface ID3D12LibraryReflection ID3D12LibraryReflection;
typedef interface ID3D12LibraryReflection *LPD3D12LIBRARYREFLECTION;
typedef interface ID3D12FunctionReflection ID3D12FunctionReflection;
typedef interface ID3D12FunctionReflection *LPD3D12FUNCTIONREFLECTION;
typedef interface ID3D12FunctionParameterReflection ID3D12FunctionParameterReflection;
typedef interface ID3D12FunctionParameterReflection *LPD3D12FUNCTIONPARAMETERREFLECTION;
// {E913C351-783D-48CA-A1D1-4F306284AD56}
interface DECLSPEC_UUID("E913C351-783D-48CA-A1D1-4F306284AD56") ID3D12ShaderReflectionType;
DEFINE_GUID(IID_ID3D12ShaderReflectionType,
0xe913c351, 0x783d, 0x48ca, 0xa1, 0xd1, 0x4f, 0x30, 0x62, 0x84, 0xad, 0x56);
#undef INTERFACE
#define INTERFACE ID3D12ShaderReflectionType
DECLARE_INTERFACE(ID3D12ShaderReflectionType)
{
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_SHADER_TYPE_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ _In_ UINT Index) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetMemberTypeByName)(THIS_ _In_ LPCSTR Name) PURE;
STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ _In_ UINT Index) PURE;
STDMETHOD(IsEqual)(THIS_ _In_ ID3D12ShaderReflectionType* pType) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetSubType)(THIS) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetBaseClass)(THIS) PURE;
STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetInterfaceByIndex)(THIS_ _In_ UINT uIndex) PURE;
STDMETHOD(IsOfType)(THIS_ _In_ ID3D12ShaderReflectionType* pType) PURE;
STDMETHOD(ImplementsInterface)(THIS_ _In_ ID3D12ShaderReflectionType* pBase) PURE;
};
// {8337A8A6-A216-444A-B2F4-314733A73AEA}
interface DECLSPEC_UUID("8337A8A6-A216-444A-B2F4-314733A73AEA") ID3D12ShaderReflectionVariable;
DEFINE_GUID(IID_ID3D12ShaderReflectionVariable,
0x8337a8a6, 0xa216, 0x444a, 0xb2, 0xf4, 0x31, 0x47, 0x33, 0xa7, 0x3a, 0xea);
#undef INTERFACE
#define INTERFACE ID3D12ShaderReflectionVariable
DECLARE_INTERFACE(ID3D12ShaderReflectionVariable)
{
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_SHADER_VARIABLE_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionType*, GetType)(THIS) PURE;
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetBuffer)(THIS) PURE;
STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ _In_ UINT uArrayIndex) PURE;
};
// {C59598B4-48B3-4869-B9B1-B1618B14A8B7}
interface DECLSPEC_UUID("C59598B4-48B3-4869-B9B1-B1618B14A8B7") ID3D12ShaderReflectionConstantBuffer;
DEFINE_GUID(IID_ID3D12ShaderReflectionConstantBuffer,
0xc59598b4, 0x48b3, 0x4869, 0xb9, 0xb1, 0xb1, 0x61, 0x8b, 0x14, 0xa8, 0xb7);
#undef INTERFACE
#define INTERFACE ID3D12ShaderReflectionConstantBuffer
DECLARE_INTERFACE(ID3D12ShaderReflectionConstantBuffer)
{
STDMETHOD(GetDesc)(THIS_ D3D12_SHADER_BUFFER_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionVariable*, GetVariableByIndex)(THIS_ _In_ UINT Index) PURE;
STDMETHOD_(ID3D12ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
};
// The ID3D12ShaderReflection IID may change from SDK version to SDK version
// if the reflection API changes. This prevents new code with the new API
// from working with an old binary. Recompiling with the new header
// will pick up the new IID.
// {5A58797D-A72C-478D-8BA2-EFC6B0EFE88E}
interface DECLSPEC_UUID("5A58797D-A72C-478D-8BA2-EFC6B0EFE88E") ID3D12ShaderReflection;
DEFINE_GUID(IID_ID3D12ShaderReflection,
0x5a58797d, 0xa72c, 0x478d, 0x8b, 0xa2, 0xef, 0xc6, 0xb0, 0xef, 0xe8, 0x8e);
#undef INTERFACE
#define INTERFACE ID3D12ShaderReflection
DECLARE_INTERFACE_(ID3D12ShaderReflection, IUnknown)
{
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid,
_Out_ LPVOID *ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_SHADER_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ _In_ UINT Index) PURE;
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
_Out_ D3D12_SHADER_INPUT_BIND_DESC *pDesc) PURE;
STDMETHOD(GetInputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
_Out_ D3D12_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
STDMETHOD(GetOutputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
_Out_ D3D12_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
STDMETHOD(GetPatchConstantParameterDesc)(THIS_ _In_ UINT ParameterIndex,
_Out_ D3D12_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
_Out_ D3D12_SHADER_INPUT_BIND_DESC *pDesc) PURE;
STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE;
STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE;
STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE;
STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE;
STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE;
STDMETHOD_(BOOL, IsSampleFrequencyShader)(THIS) PURE;
STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE;
STDMETHOD(GetMinFeatureLevel)(THIS_ _Out_ enum D3D_FEATURE_LEVEL* pLevel) PURE;
STDMETHOD_(UINT, GetThreadGroupSize)(THIS_
_Out_opt_ UINT* pSizeX,
_Out_opt_ UINT* pSizeY,
_Out_opt_ UINT* pSizeZ) PURE;
STDMETHOD_(UINT64, GetRequiresFlags)(THIS) PURE;
};
// {8E349D19-54DB-4A56-9DC9-119D87BDB804}
interface DECLSPEC_UUID("8E349D19-54DB-4A56-9DC9-119D87BDB804") ID3D12LibraryReflection;
DEFINE_GUID(IID_ID3D12LibraryReflection,
0x8e349d19, 0x54db, 0x4a56, 0x9d, 0xc9, 0x11, 0x9d, 0x87, 0xbd, 0xb8, 0x4);
#undef INTERFACE
#define INTERFACE ID3D12LibraryReflection
DECLARE_INTERFACE_(ID3D12LibraryReflection, IUnknown)
{
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
STDMETHOD_(ULONG, Release)(THIS) PURE;
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_LIBRARY_DESC * pDesc) PURE;
STDMETHOD_(ID3D12FunctionReflection *, GetFunctionByIndex)(THIS_ _In_ INT FunctionIndex) PURE;
};
// {1108795C-2772-4BA9-B2A8-D464DC7E2799}
interface DECLSPEC_UUID("1108795C-2772-4BA9-B2A8-D464DC7E2799") ID3D12FunctionReflection;
DEFINE_GUID(IID_ID3D12FunctionReflection,
0x1108795c, 0x2772, 0x4ba9, 0xb2, 0xa8, 0xd4, 0x64, 0xdc, 0x7e, 0x27, 0x99);
#undef INTERFACE
#define INTERFACE ID3D12FunctionReflection
DECLARE_INTERFACE(ID3D12FunctionReflection)
{
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_FUNCTION_DESC * pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ _In_ UINT BufferIndex) PURE;
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
_Out_ D3D12_SHADER_INPUT_BIND_DESC * pDesc) PURE;
STDMETHOD_(ID3D12ShaderReflectionVariable *, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
_Out_ D3D12_SHADER_INPUT_BIND_DESC * pDesc) PURE;
// Use D3D_RETURN_PARAMETER_INDEX to get description of the return value.
STDMETHOD_(ID3D12FunctionParameterReflection *, GetFunctionParameter)(THIS_ _In_ INT ParameterIndex) PURE;
};
// {EC25F42D-7006-4F2B-B33E-02CC3375733F}
interface DECLSPEC_UUID("EC25F42D-7006-4F2B-B33E-02CC3375733F") ID3D12FunctionParameterReflection;
DEFINE_GUID(IID_ID3D12FunctionParameterReflection,
0xec25f42d, 0x7006, 0x4f2b, 0xb3, 0x3e, 0x2, 0xcc, 0x33, 0x75, 0x73, 0x3f);
#undef INTERFACE
#define INTERFACE ID3D12FunctionParameterReflection
DECLARE_INTERFACE(ID3D12FunctionParameterReflection)
{
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_PARAMETER_DESC * pDesc) PURE;
};
//////////////////////////////////////////////////////////////////////////////
// APIs //////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
#ifdef __cplusplus
}
#endif //__cplusplus
#endif //__D3D12SHADER_H__

8584
thirdparty/directx_headers/d3d12video.h vendored Normal file

File diff suppressed because it is too large Load Diff

1116
thirdparty/directx_headers/d3dcommon.h vendored Normal file

File diff suppressed because it is too large Load Diff

5459
thirdparty/directx_headers/d3dx12.h vendored Normal file

File diff suppressed because it is too large Load Diff

41
thirdparty/directx_headers/dxcore.h vendored Normal file
View File

@ -0,0 +1,41 @@
/************************************************************
* *
* Copyright (c) Microsoft Corporation. *
* Licensed under the MIT license. *
* *
************************************************************/
#ifndef _DXCOREEXTMODULE_H_
#define _DXCOREEXTMODULE_H_
#include <winapifamily.h>
#include "dxcore_interface.h"
#pragma region Application Family or OneCore Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
STDAPI
DXCoreCreateAdapterFactory(
REFIID riid,
_COM_Outptr_ void** ppvFactory
);
template <class T>
HRESULT
DXCoreCreateAdapterFactory(
_COM_Outptr_ T** ppvFactory
)
{
return DXCoreCreateAdapterFactory(IID_PPV_ARGS(ppvFactory));
}
#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) */
#pragma endregion
#endif // _DXCOREEXTMODULE_H_

View File

@ -0,0 +1,316 @@
//
// DXCore Interface
// Copyright (C) Microsoft Corporation.
// Licensed under the MIT license.
//
#ifndef __dxcore_interface_h__
#define __dxcore_interface_h__
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#include <stdint.h>
#ifdef __cplusplus
#define _FACDXCORE 0x880
#define MAKE_DXCORE_HRESULT( code ) MAKE_HRESULT( 1, _FACDXCORE, code )
enum class DXCoreAdapterProperty : uint32_t
{
InstanceLuid = 0,
DriverVersion = 1,
DriverDescription = 2,
HardwareID = 3, // Use HardwareIDParts instead, if available.
KmdModelVersion = 4,
ComputePreemptionGranularity = 5,
GraphicsPreemptionGranularity = 6,
DedicatedAdapterMemory = 7,
DedicatedSystemMemory = 8,
SharedSystemMemory = 9,
AcgCompatible = 10,
IsHardware = 11,
IsIntegrated = 12,
IsDetachable = 13,
HardwareIDParts = 14
};
enum class DXCoreAdapterState : uint32_t
{
IsDriverUpdateInProgress = 0,
AdapterMemoryBudget = 1
};
enum class DXCoreSegmentGroup : uint32_t
{
Local = 0,
NonLocal = 1
};
enum class DXCoreNotificationType : uint32_t
{
AdapterListStale = 0,
AdapterNoLongerValid = 1,
AdapterBudgetChange = 2,
AdapterHardwareContentProtectionTeardown = 3
};
enum class DXCoreAdapterPreference : uint32_t
{
Hardware = 0,
MinimumPower = 1,
HighPerformance = 2
};
struct DXCoreHardwareID
{
uint32_t vendorID;
uint32_t deviceID;
uint32_t subSysID;
uint32_t revision;
};
struct DXCoreHardwareIDParts
{
uint32_t vendorID;
uint32_t deviceID;
uint32_t subSystemID;
uint32_t subVendorID;
uint32_t revisionID;
};
struct DXCoreAdapterMemoryBudgetNodeSegmentGroup
{
uint32_t nodeIndex;
DXCoreSegmentGroup segmentGroup;
};
struct DXCoreAdapterMemoryBudget
{
uint64_t budget;
uint64_t currentUsage;
uint64_t availableForReservation;
uint64_t currentReservation;
};
typedef void (STDMETHODCALLTYPE *PFN_DXCORE_NOTIFICATION_CALLBACK)(
DXCoreNotificationType notificationType,
_In_ IUnknown *object,
_In_opt_ void *context);
static_assert(sizeof(bool) == 1, "bool assumed as one byte");
DEFINE_GUID(IID_IDXCoreAdapterFactory, 0x78ee5945, 0xc36e, 0x4b13, 0xa6, 0x69, 0x00, 0x5d, 0xd1, 0x1c, 0x0f, 0x06);
DEFINE_GUID(IID_IDXCoreAdapterList, 0x526c7776, 0x40e9, 0x459b, 0xb7, 0x11, 0xf3, 0x2a, 0xd7, 0x6d, 0xfc, 0x28);
DEFINE_GUID(IID_IDXCoreAdapter, 0xf0db4c7f, 0xfe5a, 0x42a2, 0xbd, 0x62, 0xf2, 0xa6, 0xcf, 0x6f, 0xc8, 0x3e);
DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D11_GRAPHICS, 0x8c47866b, 0x7583, 0x450d, 0xf0, 0xf0, 0x6b, 0xad, 0xa8, 0x95, 0xaf, 0x4b);
DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS, 0x0c9ece4d, 0x2f6e, 0x4f01, 0x8c, 0x96, 0xe8, 0x9e, 0x33, 0x1b, 0x47, 0xb1);
DEFINE_GUID(DXCORE_ADAPTER_ATTRIBUTE_D3D12_CORE_COMPUTE, 0x248e2800, 0xa793, 0x4724, 0xab, 0xaa, 0x23, 0xa6, 0xde, 0x1b, 0xe0, 0x90);
/* interface IDXCoreAdapter */
MIDL_INTERFACE("f0db4c7f-fe5a-42a2-bd62-f2a6cf6fc83e")
IDXCoreAdapter : public IUnknown
{
public:
virtual bool STDMETHODCALLTYPE IsValid() = 0;
virtual bool STDMETHODCALLTYPE IsAttributeSupported(
REFGUID attributeGUID) = 0;
virtual bool STDMETHODCALLTYPE IsPropertySupported(
DXCoreAdapterProperty property) = 0;
virtual HRESULT STDMETHODCALLTYPE GetProperty(
DXCoreAdapterProperty property,
size_t bufferSize,
_Out_writes_bytes_(bufferSize) void *propertyData) = 0;
template <class T>
HRESULT GetProperty(
DXCoreAdapterProperty property,
_Out_writes_bytes_(sizeof(T)) T *propertyData)
{
return GetProperty(property,
sizeof(T),
(void*)propertyData);
}
virtual HRESULT STDMETHODCALLTYPE GetPropertySize(
DXCoreAdapterProperty property,
_Out_ size_t *bufferSize) = 0;
virtual bool STDMETHODCALLTYPE IsQueryStateSupported(
DXCoreAdapterState property) = 0;
virtual HRESULT STDMETHODCALLTYPE QueryState(
DXCoreAdapterState state,
size_t inputStateDetailsSize,
_In_reads_bytes_opt_(inputStateDetailsSize) const void *inputStateDetails,
size_t outputBufferSize,
_Out_writes_bytes_(outputBufferSize) void *outputBuffer) = 0;
template <class T1, class T2>
HRESULT QueryState(
DXCoreAdapterState state,
_In_reads_bytes_opt_(sizeof(T1)) const T1 *inputStateDetails,
_Out_writes_bytes_(sizeof(T2)) T2 *outputBuffer)
{
return QueryState(state,
sizeof(T1),
(const void*)inputStateDetails,
sizeof(T2),
(void*)outputBuffer);
}
template <class T>
HRESULT QueryState(
DXCoreAdapterState state,
_Out_writes_bytes_(sizeof(T)) T *outputBuffer)
{
return QueryState(state,
0,
nullptr,
sizeof(T),
(void*)outputBuffer);
}
virtual bool STDMETHODCALLTYPE IsSetStateSupported(
DXCoreAdapterState property) = 0;
virtual HRESULT STDMETHODCALLTYPE SetState(
DXCoreAdapterState state,
size_t inputStateDetailsSize,
_In_reads_bytes_opt_(inputStateDetailsSize) const void *inputStateDetails,
size_t inputDataSize,
_In_reads_bytes_(inputDataSize) const void *inputData) = 0;
template <class T1, class T2>
HRESULT SetState(
DXCoreAdapterState state,
const T1 *inputStateDetails,
const T2 *inputData)
{
return SetState(state,
sizeof(T1),
(const void*)inputStateDetails,
sizeof(T2),
(const void*)inputData);
}
virtual HRESULT STDMETHODCALLTYPE GetFactory(
REFIID riid,
_COM_Outptr_ void** ppvFactory
) = 0;
template <class T>
HRESULT GetFactory(
_COM_Outptr_ T** ppvFactory
)
{
return GetFactory(IID_PPV_ARGS(ppvFactory));
}
};
/* interface IDXCoreAdapterList */
MIDL_INTERFACE("526c7776-40e9-459b-b711-f32ad76dfc28")
IDXCoreAdapterList : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE GetAdapter(
uint32_t index,
REFIID riid,
_COM_Outptr_ void **ppvAdapter) = 0;
template<class T>
HRESULT STDMETHODCALLTYPE GetAdapter(
uint32_t index,
_COM_Outptr_ T **ppvAdapter)
{
return GetAdapter(index,
IID_PPV_ARGS(ppvAdapter));
}
virtual uint32_t STDMETHODCALLTYPE GetAdapterCount() = 0;
virtual bool STDMETHODCALLTYPE IsStale() = 0;
virtual HRESULT STDMETHODCALLTYPE GetFactory(
REFIID riid,
_COM_Outptr_ void** ppvFactory
) = 0;
template <class T>
HRESULT GetFactory(
_COM_Outptr_ T** ppvFactory
)
{
return GetFactory(IID_PPV_ARGS(ppvFactory));
}
virtual HRESULT STDMETHODCALLTYPE Sort(
uint32_t numPreferences,
_In_reads_(numPreferences) const DXCoreAdapterPreference* preferences) = 0;
virtual bool STDMETHODCALLTYPE IsAdapterPreferenceSupported(
DXCoreAdapterPreference preference) = 0;
};
/* interface IDXCoreAdapterFactory */
MIDL_INTERFACE("78ee5945-c36e-4b13-a669-005dd11c0f06")
IDXCoreAdapterFactory : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE CreateAdapterList(
uint32_t numAttributes,
_In_reads_(numAttributes) const GUID *filterAttributes,
REFIID riid,
_COM_Outptr_ void **ppvAdapterList) = 0;
template<class T>
HRESULT STDMETHODCALLTYPE CreateAdapterList(
uint32_t numAttributes,
_In_reads_(numAttributes) const GUID *filterAttributes,
_COM_Outptr_ T **ppvAdapterList)
{
return CreateAdapterList(numAttributes,
filterAttributes,
IID_PPV_ARGS(ppvAdapterList));
}
virtual HRESULT STDMETHODCALLTYPE GetAdapterByLuid(
const LUID &adapterLUID,
REFIID riid,
_COM_Outptr_ void **ppvAdapter) = 0;
template<class T>
HRESULT STDMETHODCALLTYPE GetAdapterByLuid(
const LUID &adapterLUID,
_COM_Outptr_ T **ppvAdapter)
{
return GetAdapterByLuid(adapterLUID,
IID_PPV_ARGS(ppvAdapter));
}
virtual bool STDMETHODCALLTYPE IsNotificationTypeSupported(
DXCoreNotificationType notificationType) = 0;
virtual HRESULT STDMETHODCALLTYPE RegisterEventNotification(
_In_ IUnknown *dxCoreObject,
DXCoreNotificationType notificationType,
_In_ PFN_DXCORE_NOTIFICATION_CALLBACK callbackFunction,
_In_opt_ void *callbackContext,
_Out_ uint32_t *eventCookie) = 0;
virtual HRESULT STDMETHODCALLTYPE UnregisterEventNotification(
uint32_t eventCookie) = 0;
};
#endif // __cplusplus
#endif // __dxcore_interface_h__

57
thirdparty/directx_headers/dxgicommon.h vendored Normal file
View File

@ -0,0 +1,57 @@
//
// Copyright (C) Microsoft Corporation.
// Licensed under the MIT license
//
#ifndef __dxgicommon_h__
#define __dxgicommon_h__
typedef struct DXGI_RATIONAL
{
UINT Numerator;
UINT Denominator;
} DXGI_RATIONAL;
// The following values are used with DXGI_SAMPLE_DESC::Quality:
#define DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN 0xffffffff
#define DXGI_CENTER_MULTISAMPLE_QUALITY_PATTERN 0xfffffffe
typedef struct DXGI_SAMPLE_DESC
{
UINT Count;
UINT Quality;
} DXGI_SAMPLE_DESC;
typedef enum DXGI_COLOR_SPACE_TYPE
{
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0,
DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 1,
DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 2,
DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 3,
DXGI_COLOR_SPACE_RESERVED = 4,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 5,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 6,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 7,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 8,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 9,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 10,
DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 11,
DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 = 12,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020 = 13,
DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020 = 14,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020 = 15,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020 = 16,
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020 = 17,
DXGI_COLOR_SPACE_YCBCR_STUDIO_GHLG_TOPLEFT_P2020 = 18,
DXGI_COLOR_SPACE_YCBCR_FULL_GHLG_TOPLEFT_P2020 = 19,
DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P709 = 20,
DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P2020 = 21,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P709 = 22,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P2020 = 23,
DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_TOPLEFT_P2020 = 24,
DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF
} DXGI_COLOR_SPACE_TYPE;
#endif // __dxgicommon_h__

142
thirdparty/directx_headers/dxgiformat.h vendored Normal file
View File

@ -0,0 +1,142 @@
//
// Copyright (C) Microsoft Corporation.
// Licensed under the MIT license
//
#ifndef __dxgiformat_h__
#define __dxgiformat_h__
#define DXGI_FORMAT_DEFINED 1
typedef enum DXGI_FORMAT
{
DXGI_FORMAT_UNKNOWN = 0,
DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
DXGI_FORMAT_R32G32B32A32_UINT = 3,
DXGI_FORMAT_R32G32B32A32_SINT = 4,
DXGI_FORMAT_R32G32B32_TYPELESS = 5,
DXGI_FORMAT_R32G32B32_FLOAT = 6,
DXGI_FORMAT_R32G32B32_UINT = 7,
DXGI_FORMAT_R32G32B32_SINT = 8,
DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
DXGI_FORMAT_R16G16B16A16_UNORM = 11,
DXGI_FORMAT_R16G16B16A16_UINT = 12,
DXGI_FORMAT_R16G16B16A16_SNORM = 13,
DXGI_FORMAT_R16G16B16A16_SINT = 14,
DXGI_FORMAT_R32G32_TYPELESS = 15,
DXGI_FORMAT_R32G32_FLOAT = 16,
DXGI_FORMAT_R32G32_UINT = 17,
DXGI_FORMAT_R32G32_SINT = 18,
DXGI_FORMAT_R32G8X24_TYPELESS = 19,
DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
DXGI_FORMAT_R10G10B10A2_UNORM = 24,
DXGI_FORMAT_R10G10B10A2_UINT = 25,
DXGI_FORMAT_R11G11B10_FLOAT = 26,
DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
DXGI_FORMAT_R8G8B8A8_UNORM = 28,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
DXGI_FORMAT_R8G8B8A8_UINT = 30,
DXGI_FORMAT_R8G8B8A8_SNORM = 31,
DXGI_FORMAT_R8G8B8A8_SINT = 32,
DXGI_FORMAT_R16G16_TYPELESS = 33,
DXGI_FORMAT_R16G16_FLOAT = 34,
DXGI_FORMAT_R16G16_UNORM = 35,
DXGI_FORMAT_R16G16_UINT = 36,
DXGI_FORMAT_R16G16_SNORM = 37,
DXGI_FORMAT_R16G16_SINT = 38,
DXGI_FORMAT_R32_TYPELESS = 39,
DXGI_FORMAT_D32_FLOAT = 40,
DXGI_FORMAT_R32_FLOAT = 41,
DXGI_FORMAT_R32_UINT = 42,
DXGI_FORMAT_R32_SINT = 43,
DXGI_FORMAT_R24G8_TYPELESS = 44,
DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
DXGI_FORMAT_R8G8_TYPELESS = 48,
DXGI_FORMAT_R8G8_UNORM = 49,
DXGI_FORMAT_R8G8_UINT = 50,
DXGI_FORMAT_R8G8_SNORM = 51,
DXGI_FORMAT_R8G8_SINT = 52,
DXGI_FORMAT_R16_TYPELESS = 53,
DXGI_FORMAT_R16_FLOAT = 54,
DXGI_FORMAT_D16_UNORM = 55,
DXGI_FORMAT_R16_UNORM = 56,
DXGI_FORMAT_R16_UINT = 57,
DXGI_FORMAT_R16_SNORM = 58,
DXGI_FORMAT_R16_SINT = 59,
DXGI_FORMAT_R8_TYPELESS = 60,
DXGI_FORMAT_R8_UNORM = 61,
DXGI_FORMAT_R8_UINT = 62,
DXGI_FORMAT_R8_SNORM = 63,
DXGI_FORMAT_R8_SINT = 64,
DXGI_FORMAT_A8_UNORM = 65,
DXGI_FORMAT_R1_UNORM = 66,
DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
DXGI_FORMAT_BC1_TYPELESS = 70,
DXGI_FORMAT_BC1_UNORM = 71,
DXGI_FORMAT_BC1_UNORM_SRGB = 72,
DXGI_FORMAT_BC2_TYPELESS = 73,
DXGI_FORMAT_BC2_UNORM = 74,
DXGI_FORMAT_BC2_UNORM_SRGB = 75,
DXGI_FORMAT_BC3_TYPELESS = 76,
DXGI_FORMAT_BC3_UNORM = 77,
DXGI_FORMAT_BC3_UNORM_SRGB = 78,
DXGI_FORMAT_BC4_TYPELESS = 79,
DXGI_FORMAT_BC4_UNORM = 80,
DXGI_FORMAT_BC4_SNORM = 81,
DXGI_FORMAT_BC5_TYPELESS = 82,
DXGI_FORMAT_BC5_UNORM = 83,
DXGI_FORMAT_BC5_SNORM = 84,
DXGI_FORMAT_B5G6R5_UNORM = 85,
DXGI_FORMAT_B5G5R5A1_UNORM = 86,
DXGI_FORMAT_B8G8R8A8_UNORM = 87,
DXGI_FORMAT_B8G8R8X8_UNORM = 88,
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
DXGI_FORMAT_BC6H_TYPELESS = 94,
DXGI_FORMAT_BC6H_UF16 = 95,
DXGI_FORMAT_BC6H_SF16 = 96,
DXGI_FORMAT_BC7_TYPELESS = 97,
DXGI_FORMAT_BC7_UNORM = 98,
DXGI_FORMAT_BC7_UNORM_SRGB = 99,
DXGI_FORMAT_AYUV = 100,
DXGI_FORMAT_Y410 = 101,
DXGI_FORMAT_Y416 = 102,
DXGI_FORMAT_NV12 = 103,
DXGI_FORMAT_P010 = 104,
DXGI_FORMAT_P016 = 105,
DXGI_FORMAT_420_OPAQUE = 106,
DXGI_FORMAT_YUY2 = 107,
DXGI_FORMAT_Y210 = 108,
DXGI_FORMAT_Y216 = 109,
DXGI_FORMAT_NV11 = 110,
DXGI_FORMAT_AI44 = 111,
DXGI_FORMAT_IA44 = 112,
DXGI_FORMAT_P8 = 113,
DXGI_FORMAT_A8P8 = 114,
DXGI_FORMAT_B4G4R4A4_UNORM = 115,
DXGI_FORMAT_P208 = 130,
DXGI_FORMAT_V208 = 131,
DXGI_FORMAT_V408 = 132,
DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE = 189,
DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 190,
DXGI_FORMAT_FORCE_UINT = 0xffffffff
} DXGI_FORMAT;
#endif // __dxgiformat_h__