diff --git a/src/dawn/native/BUILD.gn b/src/dawn/native/BUILD.gn index 9f8f713e22..a7389f983b 100644 --- a/src/dawn/native/BUILD.gn +++ b/src/dawn/native/BUILD.gn @@ -395,6 +395,18 @@ source_set("sources") { # Somehow use dxcompiler.lib makes CoreApp unable to activate # WinPIX should be added as third party tools and linked statically + if (dawn_enable_d3d12) { + sources += [ + "d3d/BlobD3D.cpp", + "d3d/BlobD3D.h", + "d3d/D3DError.cpp", + "d3d/D3DError.h", + "d3d/PlatformFunctions.cpp", + "d3d/PlatformFunctions.h", + "d3d/d3d_platform.h", + ] + } + if (dawn_enable_d3d12) { libs += [ "dxguid.lib" ] sources += [ @@ -406,8 +418,6 @@ source_set("sources") { "d3d12/BindGroupD3D12.h", "d3d12/BindGroupLayoutD3D12.cpp", "d3d12/BindGroupLayoutD3D12.h", - "d3d12/BlobD3D12.cpp", - "d3d12/BlobD3D12.h", "d3d12/BufferD3D12.cpp", "d3d12/BufferD3D12.h", "d3d12/CPUDescriptorHeapAllocationD3D12.cpp", @@ -422,8 +432,6 @@ source_set("sources") { "d3d12/ComputePipelineD3D12.h", "d3d12/D3D11on12Util.cpp", "d3d12/D3D11on12Util.h", - "d3d12/D3D12Error.cpp", - "d3d12/D3D12Error.h", "d3d12/D3D12Info.cpp", "d3d12/D3D12Info.h", "d3d12/DeviceD3D12.cpp", @@ -446,8 +454,8 @@ source_set("sources") { "d3d12/PageableD3D12.h", "d3d12/PipelineLayoutD3D12.cpp", "d3d12/PipelineLayoutD3D12.h", - "d3d12/PlatformFunctions.cpp", - "d3d12/PlatformFunctions.h", + "d3d12/PlatformFunctionsD3D12.cpp", + "d3d12/PlatformFunctionsD3D12.h", "d3d12/QuerySetD3D12.cpp", "d3d12/QuerySetD3D12.h", "d3d12/QueueD3D12.cpp", diff --git a/src/dawn/native/CMakeLists.txt b/src/dawn/native/CMakeLists.txt index 7452b9e858..e6d1ccf599 100644 --- a/src/dawn/native/CMakeLists.txt +++ b/src/dawn/native/CMakeLists.txt @@ -251,6 +251,18 @@ if (WINDOWS_STORE) target_link_libraries(dawn_native PRIVATE debug dxgi.lib) endif() +if (DAWN_ENABLE_D3D12) + target_sources(dawn_native PRIVATE + "d3d/BlobD3D.cpp" + "d3d/BlobD3D.h" + "d3d/D3DError.cpp" + "d3d/D3DError.h" + "d3d/PlatformFunctions.cpp" + "d3d/PlatformFunctions.h" + "d3d/d3d_platform.h" + ) +endif() + if (DAWN_ENABLE_D3D12) target_sources(dawn_native PRIVATE "${DAWN_INCLUDE_DIR}/dawn/native/D3D12Backend.h" @@ -262,8 +274,6 @@ if (DAWN_ENABLE_D3D12) "d3d12/BindGroupD3D12.h" "d3d12/BindGroupLayoutD3D12.cpp" "d3d12/BindGroupLayoutD3D12.h" - "d3d12/BlobD3D12.cpp" - "d3d12/BlobD3D12.h" "d3d12/BufferD3D12.cpp" "d3d12/BufferD3D12.h" "d3d12/CPUDescriptorHeapAllocationD3D12.cpp" @@ -278,8 +288,6 @@ if (DAWN_ENABLE_D3D12) "d3d12/ComputePipelineD3D12.h" "d3d12/D3D11on12Util.cpp" "d3d12/D3D11on12Util.h" - "d3d12/D3D12Error.cpp" - "d3d12/D3D12Error.h" "d3d12/D3D12Info.cpp" "d3d12/D3D12Info.h" "d3d12/DeviceD3D12.cpp" @@ -302,8 +310,8 @@ if (DAWN_ENABLE_D3D12) "d3d12/PageableD3D12.h" "d3d12/PipelineLayoutD3D12.cpp" "d3d12/PipelineLayoutD3D12.h" - "d3d12/PlatformFunctions.cpp" - "d3d12/PlatformFunctions.h" + "d3d12/PlatformFunctionsD3D12.cpp" + "d3d12/PlatformFunctionsD3D12.h" "d3d12/QuerySetD3D12.cpp" "d3d12/QuerySetD3D12.h" "d3d12/QueueD3D12.cpp" diff --git a/src/dawn/native/Surface.h b/src/dawn/native/Surface.h index 96da3c2549..d0ea24b4b5 100644 --- a/src/dawn/native/Surface.h +++ b/src/dawn/native/Surface.h @@ -24,7 +24,7 @@ #include "dawn/common/Platform.h" #if DAWN_PLATFORM_IS(WINDOWS) -#include "dawn/native/d3d12/d3d12_platform.h" +#include "dawn/native/d3d/d3d_platform.h" #endif // DAWN_PLATFORM_IS(WINDOWS) // Forward declare IUnknown diff --git a/src/dawn/native/d3d12/BlobD3D12.cpp b/src/dawn/native/d3d/BlobD3D.cpp similarity index 97% rename from src/dawn/native/d3d12/BlobD3D12.cpp rename to src/dawn/native/d3d/BlobD3D.cpp index 3b5965758d..b57690b43c 100644 --- a/src/dawn/native/d3d12/BlobD3D12.cpp +++ b/src/dawn/native/d3d/BlobD3D.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "dawn/native/d3d12/BlobD3D12.h" +#include "dawn/native/d3d/BlobD3D.h" namespace dawn::native { diff --git a/src/dawn/native/d3d12/BlobD3D12.h b/src/dawn/native/d3d/BlobD3D.h similarity index 82% rename from src/dawn/native/d3d12/BlobD3D12.h rename to src/dawn/native/d3d/BlobD3D.h index cc8c99c902..e0befb6df5 100644 --- a/src/dawn/native/d3d12/BlobD3D12.h +++ b/src/dawn/native/d3d/BlobD3D.h @@ -12,8 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#ifndef SRC_DAWN_NATIVE_D3D_BLOBD3D_H_ +#define SRC_DAWN_NATIVE_D3D_BLOBD3D_H_ + #include "dawn/native/Blob.h" -#include "dawn/native/d3d12/d3d12_platform.h" +#include "dawn/native/d3d/d3d_platform.h" namespace dawn::native { @@ -21,3 +24,5 @@ Blob CreateBlob(ComPtr blob); Blob CreateBlob(ComPtr blob); } // namespace dawn::native + +#endif // SRC_DAWN_NATIVE_D3D_BLOBD3D_H_ diff --git a/src/dawn/native/d3d12/D3D12Error.cpp b/src/dawn/native/d3d/D3DError.cpp similarity index 93% rename from src/dawn/native/d3d12/D3D12Error.cpp rename to src/dawn/native/d3d/D3DError.cpp index 0fda82b599..9b03cef4e6 100644 --- a/src/dawn/native/d3d12/D3D12Error.cpp +++ b/src/dawn/native/d3d/D3DError.cpp @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/D3DError.h" #include #include #include -namespace dawn::native::d3d12 { +namespace dawn::native::d3d { const char* HRESULTAsString(HRESULT result) { // There's a lot of possible HRESULTS, but these ones are the ones specifically listed as - // being returned from D3D12, in addition to fake codes used internally for testing. + // being returned from D3D11 and D3D12, in addition to fake codes used internally for testing. // https://docs.microsoft.com/en-us/windows/win32/direct3d12/d3d12-graphics-reference-returnvalues switch (result) { case S_OK: @@ -83,4 +83,4 @@ MaybeError CheckOutOfMemoryHRESULTImpl(HRESULT result, const char* context) { return CheckHRESULTImpl(result, context); } -} // namespace dawn::native::d3d12 +} // namespace dawn::native::d3d diff --git a/src/dawn/native/d3d12/D3D12Error.h b/src/dawn/native/d3d/D3DError.h similarity index 62% rename from src/dawn/native/d3d12/D3D12Error.h rename to src/dawn/native/d3d/D3DError.h index b058c7c6c0..8cf2630b46 100644 --- a/src/dawn/native/d3d12/D3D12Error.h +++ b/src/dawn/native/d3d/D3DError.h @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef SRC_DAWN_NATIVE_D3D12_D3D12ERROR_H_ -#define SRC_DAWN_NATIVE_D3D12_D3D12ERROR_H_ +#ifndef SRC_DAWN_NATIVE_D3D_D3DERROR_H_ +#define SRC_DAWN_NATIVE_D3D_D3DERROR_H_ -#include +#include #include "dawn/native/Error.h" #include "dawn/native/ErrorInjector.h" -namespace dawn::native::d3d12 { +namespace dawn::native::d3d { constexpr HRESULT E_FAKE_ERROR_FOR_TESTING = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFF); constexpr HRESULT E_FAKE_OUTOFMEMORY_ERROR_FOR_TESTING = @@ -31,15 +31,15 @@ MaybeError CheckHRESULTImpl(HRESULT result, const char* context); // Uses CheckRESULT but returns OOM specific error when recoverable. MaybeError CheckOutOfMemoryHRESULTImpl(HRESULT result, const char* context); -#define CheckHRESULT(resultIn, contextIn) \ - ::dawn::native::d3d12::CheckHRESULTImpl( \ - INJECT_ERROR_OR_RUN(resultIn, E_FAKE_ERROR_FOR_TESTING), contextIn) -#define CheckOutOfMemoryHRESULT(resultIn, contextIn) \ - ::dawn::native::d3d12::CheckOutOfMemoryHRESULTImpl( \ - INJECT_ERROR_OR_RUN(resultIn, E_FAKE_OUTOFMEMORY_ERROR_FOR_TESTING, \ - E_FAKE_ERROR_FOR_TESTING), \ +#define CheckHRESULT(resultIn, contextIn) \ + ::dawn::native::d3d::CheckHRESULTImpl( \ + INJECT_ERROR_OR_RUN(resultIn, ::dawn::native::d3d::E_FAKE_ERROR_FOR_TESTING), contextIn) +#define CheckOutOfMemoryHRESULT(resultIn, contextIn) \ + ::dawn::native::d3d::CheckOutOfMemoryHRESULTImpl( \ + INJECT_ERROR_OR_RUN(resultIn, ::dawn::native::d3d::E_FAKE_OUTOFMEMORY_ERROR_FOR_TESTING, \ + ::dawn::native::d3d::E_FAKE_ERROR_FOR_TESTING), \ contextIn) -} // namespace dawn::native::d3d12 +} // namespace dawn::native::d3d -#endif // SRC_DAWN_NATIVE_D3D12_D3D12ERROR_H_ +#endif // SRC_DAWN_NATIVE_D3D_D3DERROR_H_ diff --git a/src/dawn/native/d3d12/PlatformFunctions.cpp b/src/dawn/native/d3d/PlatformFunctions.cpp similarity index 69% rename from src/dawn/native/d3d12/PlatformFunctions.cpp rename to src/dawn/native/d3d/PlatformFunctions.cpp index 1a3f3fe1da..52bfa0d0e9 100644 --- a/src/dawn/native/d3d12/PlatformFunctions.cpp +++ b/src/dawn/native/d3d/PlatformFunctions.cpp @@ -1,4 +1,4 @@ -// Copyright 2018 The Dawn Authors +// Copyright 2023 The Dawn Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "dawn/native/d3d12/PlatformFunctions.h" +#include "dawn/native/d3d/PlatformFunctions.h" #include @@ -23,7 +23,7 @@ #include "dawn/common/DynamicLib.h" -namespace dawn::native::d3d12 { +namespace dawn::native::d3d { namespace { // Extract Version from "10.0.{Version}.0" if possible, otherwise return 0. uint32_t GetWindowsSDKVersionFromDirectoryName(const char* directoryName) { @@ -101,53 +101,9 @@ PlatformFunctions::PlatformFunctions() = default; PlatformFunctions::~PlatformFunctions() = default; MaybeError PlatformFunctions::LoadFunctions() { - DAWN_TRY(LoadD3D12()); DAWN_TRY(LoadDXGI()); LoadDXCLibraries(); DAWN_TRY(LoadFXCompiler()); - DAWN_TRY(LoadD3D11()); - LoadPIXRuntime(); - return {}; -} - -MaybeError PlatformFunctions::LoadD3D12() { -#if DAWN_PLATFORM_IS(WINUWP) - d3d12CreateDevice = &D3D12CreateDevice; - d3d12GetDebugInterface = &D3D12GetDebugInterface; - d3d12SerializeRootSignature = &D3D12SerializeRootSignature; - d3d12CreateRootSignatureDeserializer = &D3D12CreateRootSignatureDeserializer; - d3d12SerializeVersionedRootSignature = &D3D12SerializeVersionedRootSignature; - d3d12CreateVersionedRootSignatureDeserializer = &D3D12CreateVersionedRootSignatureDeserializer; -#else - std::string error; - if (!mD3D12Lib.Open("d3d12.dll", &error) || - !mD3D12Lib.GetProc(&d3d12CreateDevice, "D3D12CreateDevice", &error) || - !mD3D12Lib.GetProc(&d3d12GetDebugInterface, "D3D12GetDebugInterface", &error) || - !mD3D12Lib.GetProc(&d3d12SerializeRootSignature, "D3D12SerializeRootSignature", &error) || - !mD3D12Lib.GetProc(&d3d12CreateRootSignatureDeserializer, - "D3D12CreateRootSignatureDeserializer", &error) || - !mD3D12Lib.GetProc(&d3d12SerializeVersionedRootSignature, - "D3D12SerializeVersionedRootSignature", &error) || - !mD3D12Lib.GetProc(&d3d12CreateVersionedRootSignatureDeserializer, - "D3D12CreateVersionedRootSignatureDeserializer", &error)) { - return DAWN_INTERNAL_ERROR(error.c_str()); - } -#endif - - return {}; -} - -MaybeError PlatformFunctions::LoadD3D11() { -#if DAWN_PLATFORM_IS(WINUWP) - d3d11on12CreateDevice = &D3D11On12CreateDevice; -#else - std::string error; - if (!mD3D11Lib.Open("d3d11.dll", &error) || - !mD3D11Lib.GetProc(&d3d11on12CreateDevice, "D3D11On12CreateDevice", &error)) { - return DAWN_INTERNAL_ERROR(error.c_str()); - } -#endif - return {}; } @@ -240,28 +196,10 @@ MaybeError PlatformFunctions::LoadFXCompiler() { return {}; } -bool PlatformFunctions::IsPIXEventRuntimeLoaded() const { - return mPIXEventRuntimeLib.Valid(); -} - // Use Backend::IsDXCAvaliable if possible, which also check the DXC is no older than a given // version bool PlatformFunctions::IsDXCBinaryAvailable() const { return mDXILLib.Valid() && mDXCompilerLib.Valid(); } -void PlatformFunctions::LoadPIXRuntime() { - // TODO(dawn:766): - // In UWP PIX should be statically linked WinPixEventRuntime_UAP.lib - // So maybe we should put WinPixEventRuntime as a third party package - // Currently PIX is not going to be loaded in UWP since the following - // mPIXEventRuntimeLib.Open will fail. - if (!mPIXEventRuntimeLib.Open("WinPixEventRuntime.dll") || - !mPIXEventRuntimeLib.GetProc(&pixBeginEventOnCommandList, "PIXBeginEventOnCommandList") || - !mPIXEventRuntimeLib.GetProc(&pixEndEventOnCommandList, "PIXEndEventOnCommandList") || - !mPIXEventRuntimeLib.GetProc(&pixSetMarkerOnCommandList, "PIXSetMarkerOnCommandList")) { - mPIXEventRuntimeLib.Close(); - } -} - -} // namespace dawn::native::d3d12 +} // namespace dawn::native::d3d diff --git a/src/dawn/native/d3d/PlatformFunctions.h b/src/dawn/native/d3d/PlatformFunctions.h new file mode 100644 index 0000000000..59fe910235 --- /dev/null +++ b/src/dawn/native/d3d/PlatformFunctions.h @@ -0,0 +1,78 @@ +// Copyright 2023 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_D3D_PLATFORMFUNCTIONS_H_ +#define SRC_DAWN_NATIVE_D3D_PLATFORMFUNCTIONS_H_ + +#include + +#include + +#include "dawn/native/d3d/d3d_platform.h" + +#include "dawn/common/DynamicLib.h" +#include "dawn/native/Error.h" + +namespace dawn::native::d3d { + +// Loads the functions required from the platform dynamically so that we don't need to rely on +// them being present in the system. For example linking against d3d12.lib would prevent +// dawn_native from loading on Windows 7 system where d3d12.dll doesn't exist. +class PlatformFunctions { + public: + PlatformFunctions(); + virtual ~PlatformFunctions(); + + MaybeError LoadFunctions(); + bool IsPIXEventRuntimeLoaded() const; + bool IsDXCBinaryAvailable() const; + + // Functions from dxgi.dll + using PFN_DXGI_GET_DEBUG_INTERFACE1 = HRESULT(WINAPI*)(UINT Flags, + REFIID riid, + _COM_Outptr_ void** pDebug); + PFN_DXGI_GET_DEBUG_INTERFACE1 dxgiGetDebugInterface1 = nullptr; + + using PFN_CREATE_DXGI_FACTORY2 = HRESULT(WINAPI*)(UINT Flags, + REFIID riid, + _COM_Outptr_ void** ppFactory); + PFN_CREATE_DXGI_FACTORY2 createDxgiFactory2 = nullptr; + + // Functions from dxcompiler.dll + using PFN_DXC_CREATE_INSTANCE = HRESULT(WINAPI*)(REFCLSID rclsid, + REFIID riid, + _COM_Outptr_ void** ppCompiler); + PFN_DXC_CREATE_INSTANCE dxcCreateInstance = nullptr; + + // Functions from d3d3compiler.dll + pD3DCompile d3dCompile = nullptr; + pD3DDisassemble d3dDisassemble = nullptr; + + private: + MaybeError LoadDXGI(); + void LoadDXCLibraries(); + void LoadDXIL(const std::string& baseWindowsSDKPath); + void LoadDXCompiler(const std::string& baseWindowsSDKPath); + MaybeError LoadFXCompiler(); + void LoadPIXRuntime(); + + DynamicLib mDXGILib; + DynamicLib mDXILLib; + DynamicLib mDXCompilerLib; + DynamicLib mFXCompilerLib; +}; + +} // namespace dawn::native::d3d + +#endif // SRC_DAWN_NATIVE_D3D_PLATFORMFUNCTIONS_H_ diff --git a/src/dawn/native/d3d/d3d_platform.h b/src/dawn/native/d3d/d3d_platform.h new file mode 100644 index 0000000000..ac7b9d359e --- /dev/null +++ b/src/dawn/native/d3d/d3d_platform.h @@ -0,0 +1,36 @@ +// Copyright 2023 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SRC_DAWN_NATIVE_D3D_D3D_PLATFORM_H_ +#define SRC_DAWN_NATIVE_D3D_D3D_PLATFORM_H_ + +// Pre-emptively include windows.h but remove its macros so that they aren't set when declaring the +// COM interfaces. Otherwise ID3D12InfoQueue::GetMessage would be either GetMessageA or GetMessageW +// which causes compilation errors. +// NOLINTNEXTLINE(build/include_order) +#include "dawn/common/windows_with_undefs.h" + +#include // NOLINT(build/include_order) +#include // NOLINT(build/include_order) +#include // NOLINT(build/include_order) +#include // NOLINT(build/include_order) + +// DXProgrammableCapture.h takes a dependency on other platform header +// files, so it must be defined after them. +#include // NOLINT(build/include_order) +#include // NOLINT(build/include_order) + +using Microsoft::WRL::ComPtr; + +#endif // SRC_DAWN_NATIVE_D3D_D3D_PLATFORM_H_ diff --git a/src/dawn/native/d3d12/AdapterD3D12.cpp b/src/dawn/native/d3d12/AdapterD3D12.cpp index 2d39752674..4859208004 100644 --- a/src/dawn/native/d3d12/AdapterD3D12.cpp +++ b/src/dawn/native/d3d12/AdapterD3D12.cpp @@ -20,10 +20,10 @@ #include "dawn/common/Platform.h" #include "dawn/common/WindowsUtils.h" #include "dawn/native/Instance.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/BackendD3D12.h" -#include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" -#include "dawn/native/d3d12/PlatformFunctions.h" +#include "dawn/native/d3d12/PlatformFunctionsD3D12.h" #include "dawn/native/d3d12/UtilsD3D12.h" namespace dawn::native::d3d12 { diff --git a/src/dawn/native/d3d12/BackendD3D12.cpp b/src/dawn/native/d3d12/BackendD3D12.cpp index 6e5fff584e..1dca30b87b 100644 --- a/src/dawn/native/d3d12/BackendD3D12.cpp +++ b/src/dawn/native/d3d12/BackendD3D12.cpp @@ -19,9 +19,9 @@ #include "dawn/common/Log.h" #include "dawn/native/D3D12Backend.h" #include "dawn/native/Instance.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/AdapterD3D12.h" -#include "dawn/native/d3d12/D3D12Error.h" -#include "dawn/native/d3d12/PlatformFunctions.h" +#include "dawn/native/d3d12/PlatformFunctionsD3D12.h" #include "dawn/native/d3d12/UtilsD3D12.h" namespace dawn::native::d3d12 { diff --git a/src/dawn/native/d3d12/BufferD3D12.cpp b/src/dawn/native/d3d12/BufferD3D12.cpp index 28a0ea9cc3..82edbde767 100644 --- a/src/dawn/native/d3d12/BufferD3D12.cpp +++ b/src/dawn/native/d3d12/BufferD3D12.cpp @@ -21,8 +21,8 @@ #include "dawn/common/Math.h" #include "dawn/native/CommandBuffer.h" #include "dawn/native/DynamicUploader.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/CommandRecordingContext.h" -#include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/HeapD3D12.h" #include "dawn/native/d3d12/ResidencyManagerD3D12.h" diff --git a/src/dawn/native/d3d12/CommandAllocatorManager.cpp b/src/dawn/native/d3d12/CommandAllocatorManager.cpp index 892cc3277b..03bf3af16f 100644 --- a/src/dawn/native/d3d12/CommandAllocatorManager.cpp +++ b/src/dawn/native/d3d12/CommandAllocatorManager.cpp @@ -14,7 +14,7 @@ #include "dawn/native/d3d12/CommandAllocatorManager.h" -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/common/Assert.h" diff --git a/src/dawn/native/d3d12/CommandBufferD3D12.cpp b/src/dawn/native/d3d12/CommandBufferD3D12.cpp index 53aa85617e..8ebdc73660 100644 --- a/src/dawn/native/d3d12/CommandBufferD3D12.cpp +++ b/src/dawn/native/d3d12/CommandBufferD3D12.cpp @@ -28,7 +28,7 @@ #include "dawn/native/d3d12/ComputePipelineD3D12.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/PipelineLayoutD3D12.h" -#include "dawn/native/d3d12/PlatformFunctions.h" +#include "dawn/native/d3d12/PlatformFunctionsD3D12.h" #include "dawn/native/d3d12/QuerySetD3D12.h" #include "dawn/native/d3d12/RenderPassBuilderD3D12.h" #include "dawn/native/d3d12/RenderPipelineD3D12.h" diff --git a/src/dawn/native/d3d12/CommandRecordingContext.cpp b/src/dawn/native/d3d12/CommandRecordingContext.cpp index 6a368a07b8..72f29b4cf6 100644 --- a/src/dawn/native/d3d12/CommandRecordingContext.cpp +++ b/src/dawn/native/d3d12/CommandRecordingContext.cpp @@ -20,8 +20,8 @@ #include #include +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/CommandAllocatorManager.h" -#include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/HeapD3D12.h" #include "dawn/native/d3d12/ResidencyManagerD3D12.h" diff --git a/src/dawn/native/d3d12/ComputePipelineD3D12.cpp b/src/dawn/native/d3d12/ComputePipelineD3D12.cpp index 8dc05fce3b..e781f0f9c1 100644 --- a/src/dawn/native/d3d12/ComputePipelineD3D12.cpp +++ b/src/dawn/native/d3d12/ComputePipelineD3D12.cpp @@ -18,11 +18,11 @@ #include #include "dawn/native/CreatePipelineAsyncTask.h" -#include "dawn/native/d3d12/BlobD3D12.h" -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/BlobD3D.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/PipelineLayoutD3D12.h" -#include "dawn/native/d3d12/PlatformFunctions.h" +#include "dawn/native/d3d12/PlatformFunctionsD3D12.h" #include "dawn/native/d3d12/ShaderModuleD3D12.h" #include "dawn/native/d3d12/UtilsD3D12.h" diff --git a/src/dawn/native/d3d12/D3D11on12Util.cpp b/src/dawn/native/d3d12/D3D11on12Util.cpp index 0d165a5598..83747f1bdf 100644 --- a/src/dawn/native/d3d12/D3D11on12Util.cpp +++ b/src/dawn/native/d3d12/D3D11on12Util.cpp @@ -22,7 +22,7 @@ #include "dawn/common/HashUtils.h" #include "dawn/common/Log.h" #include "dawn/native/D3D12Backend.h" -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/DeviceD3D12.h" namespace dawn::native::d3d12 { diff --git a/src/dawn/native/d3d12/D3D12Info.cpp b/src/dawn/native/d3d12/D3D12Info.cpp index d6d8dde71a..ee927ef36b 100644 --- a/src/dawn/native/d3d12/D3D12Info.cpp +++ b/src/dawn/native/d3d12/D3D12Info.cpp @@ -17,10 +17,10 @@ #include #include "dawn/common/GPUInfo.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/AdapterD3D12.h" #include "dawn/native/d3d12/BackendD3D12.h" -#include "dawn/native/d3d12/D3D12Error.h" -#include "dawn/native/d3d12/PlatformFunctions.h" +#include "dawn/native/d3d12/PlatformFunctionsD3D12.h" namespace dawn::native::d3d12 { diff --git a/src/dawn/native/d3d12/DeviceD3D12.cpp b/src/dawn/native/d3d12/DeviceD3D12.cpp index 43fa4cf6eb..0e0862a96b 100644 --- a/src/dawn/native/d3d12/DeviceD3D12.cpp +++ b/src/dawn/native/d3d12/DeviceD3D12.cpp @@ -23,6 +23,7 @@ #include "dawn/native/D3D12Backend.h" #include "dawn/native/DynamicUploader.h" #include "dawn/native/Instance.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/AdapterD3D12.h" #include "dawn/native/d3d12/BackendD3D12.h" #include "dawn/native/d3d12/BindGroupD3D12.h" @@ -31,10 +32,9 @@ #include "dawn/native/d3d12/CommandBufferD3D12.h" #include "dawn/native/d3d12/ComputePipelineD3D12.h" #include "dawn/native/d3d12/D3D11on12Util.h" -#include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/ExternalImageDXGIImpl.h" #include "dawn/native/d3d12/PipelineLayoutD3D12.h" -#include "dawn/native/d3d12/PlatformFunctions.h" +#include "dawn/native/d3d12/PlatformFunctionsD3D12.h" #include "dawn/native/d3d12/QuerySetD3D12.h" #include "dawn/native/d3d12/QueueD3D12.h" #include "dawn/native/d3d12/RenderPipelineD3D12.h" diff --git a/src/dawn/native/d3d12/FenceD3D12.cpp b/src/dawn/native/d3d12/FenceD3D12.cpp index 5838ca0ff2..562f8ba8f9 100644 --- a/src/dawn/native/d3d12/FenceD3D12.cpp +++ b/src/dawn/native/d3d12/FenceD3D12.cpp @@ -18,7 +18,7 @@ #include "dawn/common/Log.h" #include "dawn/native/Error.h" -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/DeviceD3D12.h" namespace dawn::native::d3d12 { diff --git a/src/dawn/native/d3d12/HeapAllocatorD3D12.cpp b/src/dawn/native/d3d12/HeapAllocatorD3D12.cpp index 28349817a2..dd712706f9 100644 --- a/src/dawn/native/d3d12/HeapAllocatorD3D12.cpp +++ b/src/dawn/native/d3d12/HeapAllocatorD3D12.cpp @@ -16,7 +16,7 @@ #include -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/HeapD3D12.h" #include "dawn/native/d3d12/ResidencyManagerD3D12.h" diff --git a/src/dawn/native/d3d12/PipelineLayoutD3D12.cpp b/src/dawn/native/d3d12/PipelineLayoutD3D12.cpp index aaab8c6262..1b972f94a8 100644 --- a/src/dawn/native/d3d12/PipelineLayoutD3D12.cpp +++ b/src/dawn/native/d3d12/PipelineLayoutD3D12.cpp @@ -19,10 +19,10 @@ #include "dawn/common/Assert.h" #include "dawn/common/BitSetIterator.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/BindGroupLayoutD3D12.h" -#include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" -#include "dawn/native/d3d12/PlatformFunctions.h" +#include "dawn/native/d3d12/PlatformFunctionsD3D12.h" using Microsoft::WRL::ComPtr; diff --git a/src/dawn/native/d3d12/PlatformFunctionsD3D12.cpp b/src/dawn/native/d3d12/PlatformFunctionsD3D12.cpp new file mode 100644 index 0000000000..a2499976c8 --- /dev/null +++ b/src/dawn/native/d3d12/PlatformFunctionsD3D12.cpp @@ -0,0 +1,99 @@ +// Copyright 2018 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "dawn/native/d3d12/PlatformFunctionsD3D12.h" + +#include + +#include +#include +#include +#include + +#include "dawn/common/DynamicLib.h" + +namespace dawn::native::d3d12 { + +PlatformFunctions::PlatformFunctions() = default; +PlatformFunctions::~PlatformFunctions() = default; + +MaybeError PlatformFunctions::LoadFunctions() { + DAWN_TRY(Base::LoadFunctions()); + + DAWN_TRY(LoadD3D12()); + DAWN_TRY(LoadD3D11()); + LoadPIXRuntime(); + return {}; +} + +MaybeError PlatformFunctions::LoadD3D12() { +#if DAWN_PLATFORM_IS(WINUWP) + d3d12CreateDevice = &D3D12CreateDevice; + d3d12GetDebugInterface = &D3D12GetDebugInterface; + d3d12SerializeRootSignature = &D3D12SerializeRootSignature; + d3d12CreateRootSignatureDeserializer = &D3D12CreateRootSignatureDeserializer; + d3d12SerializeVersionedRootSignature = &D3D12SerializeVersionedRootSignature; + d3d12CreateVersionedRootSignatureDeserializer = &D3D12CreateVersionedRootSignatureDeserializer; +#else + std::string error; + if (!mD3D12Lib.Open("d3d12.dll", &error) || + !mD3D12Lib.GetProc(&d3d12CreateDevice, "D3D12CreateDevice", &error) || + !mD3D12Lib.GetProc(&d3d12GetDebugInterface, "D3D12GetDebugInterface", &error) || + !mD3D12Lib.GetProc(&d3d12SerializeRootSignature, "D3D12SerializeRootSignature", &error) || + !mD3D12Lib.GetProc(&d3d12CreateRootSignatureDeserializer, + "D3D12CreateRootSignatureDeserializer", &error) || + !mD3D12Lib.GetProc(&d3d12SerializeVersionedRootSignature, + "D3D12SerializeVersionedRootSignature", &error) || + !mD3D12Lib.GetProc(&d3d12CreateVersionedRootSignatureDeserializer, + "D3D12CreateVersionedRootSignatureDeserializer", &error)) { + return DAWN_INTERNAL_ERROR(error.c_str()); + } +#endif + + return {}; +} + +MaybeError PlatformFunctions::LoadD3D11() { +#if DAWN_PLATFORM_IS(WINUWP) + d3d11on12CreateDevice = &D3D11On12CreateDevice; +#else + std::string error; + if (!mD3D11Lib.Open("d3d11.dll", &error) || + !mD3D11Lib.GetProc(&d3d11on12CreateDevice, "D3D11On12CreateDevice", &error)) { + return DAWN_INTERNAL_ERROR(error.c_str()); + } +#endif + + return {}; +} + +bool PlatformFunctions::IsPIXEventRuntimeLoaded() const { + return mPIXEventRuntimeLib.Valid(); +} + +void PlatformFunctions::LoadPIXRuntime() { + // TODO(dawn:766): + // In UWP PIX should be statically linked WinPixEventRuntime_UAP.lib + // So maybe we should put WinPixEventRuntime as a third party package + // Currently PIX is not going to be loaded in UWP since the following + // mPIXEventRuntimeLib.Open will fail. + if (!mPIXEventRuntimeLib.Open("WinPixEventRuntime.dll") || + !mPIXEventRuntimeLib.GetProc(&pixBeginEventOnCommandList, "PIXBeginEventOnCommandList") || + !mPIXEventRuntimeLib.GetProc(&pixEndEventOnCommandList, "PIXEndEventOnCommandList") || + !mPIXEventRuntimeLib.GetProc(&pixSetMarkerOnCommandList, "PIXSetMarkerOnCommandList")) { + mPIXEventRuntimeLib.Close(); + } +} + +} // namespace dawn::native::d3d12 diff --git a/src/dawn/native/d3d12/PlatformFunctions.h b/src/dawn/native/d3d12/PlatformFunctionsD3D12.h similarity index 67% rename from src/dawn/native/d3d12/PlatformFunctions.h rename to src/dawn/native/d3d12/PlatformFunctionsD3D12.h index fca1e51ba0..af6ae358af 100644 --- a/src/dawn/native/d3d12/PlatformFunctions.h +++ b/src/dawn/native/d3d12/PlatformFunctionsD3D12.h @@ -19,6 +19,7 @@ #include +#include "dawn/native/d3d/PlatformFunctions.h" #include "dawn/native/d3d12/d3d12_platform.h" #include "dawn/common/DynamicLib.h" @@ -29,14 +30,13 @@ namespace dawn::native::d3d12 { // Loads the functions required from the platform dynamically so that we don't need to rely on // them being present in the system. For example linking against d3d12.lib would prevent // dawn_native from loading on Windows 7 system where d3d12.dll doesn't exist. -class PlatformFunctions { +class PlatformFunctions : public d3d::PlatformFunctions { public: PlatformFunctions(); - ~PlatformFunctions(); + ~PlatformFunctions() override; MaybeError LoadFunctions(); bool IsPIXEventRuntimeLoaded() const; - bool IsDXCBinaryAvailable() const; // Functions from d3d12.dll PFN_D3D12_CREATE_DEVICE d3d12CreateDevice = nullptr; @@ -48,27 +48,6 @@ class PlatformFunctions { PFN_D3D12_CREATE_VERSIONED_ROOT_SIGNATURE_DESERIALIZER d3d12CreateVersionedRootSignatureDeserializer = nullptr; - // Functions from dxgi.dll - using PFN_DXGI_GET_DEBUG_INTERFACE1 = HRESULT(WINAPI*)(UINT Flags, - REFIID riid, - _COM_Outptr_ void** pDebug); - PFN_DXGI_GET_DEBUG_INTERFACE1 dxgiGetDebugInterface1 = nullptr; - - using PFN_CREATE_DXGI_FACTORY2 = HRESULT(WINAPI*)(UINT Flags, - REFIID riid, - _COM_Outptr_ void** ppFactory); - PFN_CREATE_DXGI_FACTORY2 createDxgiFactory2 = nullptr; - - // Functions from dxcompiler.dll - using PFN_DXC_CREATE_INSTANCE = HRESULT(WINAPI*)(REFCLSID rclsid, - REFIID riid, - _COM_Outptr_ void** ppCompiler); - PFN_DXC_CREATE_INSTANCE dxcCreateInstance = nullptr; - - // Functions from d3d3compiler.dll - pD3DCompile d3dCompile = nullptr; - pD3DDisassemble d3dDisassemble = nullptr; - // Functions from WinPixEventRuntime.dll using PFN_PIX_END_EVENT_ON_COMMAND_LIST = HRESULT(WINAPI*)(ID3D12GraphicsCommandList* commandList); @@ -90,21 +69,14 @@ class PlatformFunctions { PFN_D3D11ON12_CREATE_DEVICE d3d11on12CreateDevice = nullptr; private: + using Base = d3d::PlatformFunctions; + MaybeError LoadD3D12(); MaybeError LoadD3D11(); - MaybeError LoadDXGI(); - void LoadDXCLibraries(); - void LoadDXIL(const std::string& baseWindowsSDKPath); - void LoadDXCompiler(const std::string& baseWindowsSDKPath); - MaybeError LoadFXCompiler(); void LoadPIXRuntime(); DynamicLib mD3D12Lib; DynamicLib mD3D11Lib; - DynamicLib mDXGILib; - DynamicLib mDXILLib; - DynamicLib mDXCompilerLib; - DynamicLib mFXCompilerLib; DynamicLib mPIXEventRuntimeLib; }; diff --git a/src/dawn/native/d3d12/QuerySetD3D12.cpp b/src/dawn/native/d3d12/QuerySetD3D12.cpp index 2f8ea05c11..9f7ed07944 100644 --- a/src/dawn/native/d3d12/QuerySetD3D12.cpp +++ b/src/dawn/native/d3d12/QuerySetD3D12.cpp @@ -16,7 +16,7 @@ #include -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/UtilsD3D12.h" diff --git a/src/dawn/native/d3d12/QueueD3D12.cpp b/src/dawn/native/d3d12/QueueD3D12.cpp index 5d4ca0901d..22fea5768a 100644 --- a/src/dawn/native/d3d12/QueueD3D12.cpp +++ b/src/dawn/native/d3d12/QueueD3D12.cpp @@ -18,8 +18,8 @@ #include "dawn/native/CommandValidation.h" #include "dawn/native/Commands.h" #include "dawn/native/DynamicUploader.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/CommandBufferD3D12.h" -#include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/UtilsD3D12.h" #include "dawn/platform/DawnPlatform.h" diff --git a/src/dawn/native/d3d12/RenderPipelineD3D12.cpp b/src/dawn/native/d3d12/RenderPipelineD3D12.cpp index 563dab69a5..6cfa55d614 100644 --- a/src/dawn/native/d3d12/RenderPipelineD3D12.cpp +++ b/src/dawn/native/d3d12/RenderPipelineD3D12.cpp @@ -22,11 +22,11 @@ #include "dawn/common/Assert.h" #include "dawn/common/Log.h" #include "dawn/native/CreatePipelineAsyncTask.h" -#include "dawn/native/d3d12/BlobD3D12.h" -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/BlobD3D.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/PipelineLayoutD3D12.h" -#include "dawn/native/d3d12/PlatformFunctions.h" +#include "dawn/native/d3d12/PlatformFunctionsD3D12.h" #include "dawn/native/d3d12/ShaderModuleD3D12.h" #include "dawn/native/d3d12/TextureD3D12.h" #include "dawn/native/d3d12/UtilsD3D12.h" diff --git a/src/dawn/native/d3d12/ResidencyManagerD3D12.cpp b/src/dawn/native/d3d12/ResidencyManagerD3D12.cpp index 2952505500..f6fb404076 100644 --- a/src/dawn/native/d3d12/ResidencyManagerD3D12.cpp +++ b/src/dawn/native/d3d12/ResidencyManagerD3D12.cpp @@ -17,8 +17,8 @@ #include #include +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/AdapterD3D12.h" -#include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/Forward.h" #include "dawn/native/d3d12/HeapD3D12.h" diff --git a/src/dawn/native/d3d12/ResourceAllocatorManagerD3D12.cpp b/src/dawn/native/d3d12/ResourceAllocatorManagerD3D12.cpp index a4329e6592..2e62d7c2df 100644 --- a/src/dawn/native/d3d12/ResourceAllocatorManagerD3D12.cpp +++ b/src/dawn/native/d3d12/ResourceAllocatorManagerD3D12.cpp @@ -18,7 +18,7 @@ #include #include -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/HeapAllocatorD3D12.h" #include "dawn/native/d3d12/HeapD3D12.h" diff --git a/src/dawn/native/d3d12/ResourceHeapAllocationD3D12.cpp b/src/dawn/native/d3d12/ResourceHeapAllocationD3D12.cpp index 862f87b6dd..77db18448c 100644 --- a/src/dawn/native/d3d12/ResourceHeapAllocationD3D12.cpp +++ b/src/dawn/native/d3d12/ResourceHeapAllocationD3D12.cpp @@ -16,7 +16,7 @@ #include -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/HeapD3D12.h" namespace dawn::native::d3d12 { diff --git a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp index 903ecea9bc..a7047b1aba 100644 --- a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp +++ b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp @@ -32,14 +32,14 @@ #include "dawn/native/CacheRequest.h" #include "dawn/native/Pipeline.h" #include "dawn/native/TintUtils.h" +#include "dawn/native/d3d/BlobD3D.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/AdapterD3D12.h" #include "dawn/native/d3d12/BackendD3D12.h" #include "dawn/native/d3d12/BindGroupLayoutD3D12.h" -#include "dawn/native/d3d12/BlobD3D12.h" -#include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/PipelineLayoutD3D12.h" -#include "dawn/native/d3d12/PlatformFunctions.h" +#include "dawn/native/d3d12/PlatformFunctionsD3D12.h" #include "dawn/native/d3d12/UtilsD3D12.h" #include "dawn/native/stream/BlobSource.h" #include "dawn/native/stream/ByteVectorSink.h" diff --git a/src/dawn/native/d3d12/ShaderVisibleDescriptorAllocatorD3D12.cpp b/src/dawn/native/d3d12/ShaderVisibleDescriptorAllocatorD3D12.cpp index fe99a63ac9..14a117bae5 100644 --- a/src/dawn/native/d3d12/ShaderVisibleDescriptorAllocatorD3D12.cpp +++ b/src/dawn/native/d3d12/ShaderVisibleDescriptorAllocatorD3D12.cpp @@ -18,7 +18,7 @@ #include #include -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/GPUDescriptorHeapAllocationD3D12.h" #include "dawn/native/d3d12/ResidencyManagerD3D12.h" diff --git a/src/dawn/native/d3d12/StagingDescriptorAllocatorD3D12.cpp b/src/dawn/native/d3d12/StagingDescriptorAllocatorD3D12.cpp index f30016a2c3..2960ed00e8 100644 --- a/src/dawn/native/d3d12/StagingDescriptorAllocatorD3D12.cpp +++ b/src/dawn/native/d3d12/StagingDescriptorAllocatorD3D12.cpp @@ -17,7 +17,7 @@ #include #include "dawn/common/Math.h" -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/DeviceD3D12.h" namespace dawn::native::d3d12 { diff --git a/src/dawn/native/d3d12/SwapChainD3D12.cpp b/src/dawn/native/d3d12/SwapChainD3D12.cpp index fa562f20c8..7e814f8aba 100644 --- a/src/dawn/native/d3d12/SwapChainD3D12.cpp +++ b/src/dawn/native/d3d12/SwapChainD3D12.cpp @@ -20,7 +20,7 @@ #include "dawn/dawn_wsi.h" #include "dawn/native/Surface.h" -#include "dawn/native/d3d12/D3D12Error.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/TextureD3D12.h" diff --git a/src/dawn/native/d3d12/TextureD3D12.cpp b/src/dawn/native/d3d12/TextureD3D12.cpp index 2d08a14bfa..3c99d880c9 100644 --- a/src/dawn/native/d3d12/TextureD3D12.cpp +++ b/src/dawn/native/d3d12/TextureD3D12.cpp @@ -25,10 +25,10 @@ #include "dawn/native/IntegerTypes.h" #include "dawn/native/ResourceMemoryAllocation.h" #include "dawn/native/ToBackend.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/BufferD3D12.h" #include "dawn/native/d3d12/CommandRecordingContext.h" #include "dawn/native/d3d12/D3D11on12Util.h" -#include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" #include "dawn/native/d3d12/Forward.h" #include "dawn/native/d3d12/HeapD3D12.h" diff --git a/src/dawn/native/d3d12/UtilsD3D12.cpp b/src/dawn/native/d3d12/UtilsD3D12.cpp index e706d8f658..b508300f8e 100644 --- a/src/dawn/native/d3d12/UtilsD3D12.cpp +++ b/src/dawn/native/d3d12/UtilsD3D12.cpp @@ -21,9 +21,9 @@ #include "dawn/common/Assert.h" #include "dawn/native/CommandValidation.h" #include "dawn/native/Format.h" +#include "dawn/native/d3d/D3DError.h" #include "dawn/native/d3d12/BufferD3D12.h" #include "dawn/native/d3d12/CommandRecordingContext.h" -#include "dawn/native/d3d12/D3D12Error.h" #include "dawn/native/d3d12/DeviceD3D12.h" namespace dawn::native::d3d12 { diff --git a/src/dawn/native/d3d12/d3d12_platform.h b/src/dawn/native/d3d12/d3d12_platform.h index 59542bf883..c0db1b5a8c 100644 --- a/src/dawn/native/d3d12/d3d12_platform.h +++ b/src/dawn/native/d3d12/d3d12_platform.h @@ -15,24 +15,9 @@ #ifndef SRC_DAWN_NATIVE_D3D12_D3D12_PLATFORM_H_ #define SRC_DAWN_NATIVE_D3D12_D3D12_PLATFORM_H_ -// Pre-emptively include windows.h but remove its macros so that they aren't set when declaring the -// COM interfaces. Otherwise ID3D12InfoQueue::GetMessage would be either GetMessageA or GetMessageW -// which causes compilation errors. -// NOLINTNEXTLINE(build/include_order) -#include "dawn/common/windows_with_undefs.h" +#include "dawn/native/d3d/d3d_platform.h" -#include // NOLINT(build/include_order) #include // NOLINT(build/include_order) #include // NOLINT(build/include_order) -#include // NOLINT(build/include_order) -#include // NOLINT(build/include_order) -#include // NOLINT(build/include_order) - -// DXProgrammableCapture.h takes a dependency on other platform header -// files, so it must be defined after them. -#include // NOLINT(build/include_order) -#include // NOLINT(build/include_order) - -using Microsoft::WRL::ComPtr; #endif // SRC_DAWN_NATIVE_D3D12_D3D12_PLATFORM_H_