diff --git a/src/common/windows_with_undefs.h b/src/common/windows_with_undefs.h index 381116a024..6d8649ca8d 100644 --- a/src/common/windows_with_undefs.h +++ b/src/common/windows_with_undefs.h @@ -15,7 +15,7 @@ #ifndef COMMON_WINDOWS_WITH_UNDEFS_H_ #define COMMON_WINDOWS_WITH_UNDEFS_H_ -#include "common/Compiler.h" +#include "common/Platform.h" #if !defined(DAWN_PLATFORM_WINDOWS) # error "windows_with_undefs.h included on non-Windows" diff --git a/src/dawn_native/d3d12/DeviceD3D12.cpp b/src/dawn_native/d3d12/DeviceD3D12.cpp index aea4acae88..efacac3f81 100644 --- a/src/dawn_native/d3d12/DeviceD3D12.cpp +++ b/src/dawn_native/d3d12/DeviceD3D12.cpp @@ -488,17 +488,17 @@ namespace dawn_native { namespace d3d12 { uint64_t errorsToPrint = std::min(kMaxDebugMessagesToPrint, totalErrors); for (uint64_t i = 0; i < errorsToPrint; ++i) { SIZE_T messageLength = 0; - HRESULT hr = infoQueue->GetMessageW(i, nullptr, &messageLength); + HRESULT hr = infoQueue->GetMessage(i, nullptr, &messageLength); if (FAILED(hr)) { - messages << " ID3D12InfoQueue::GetMessageW failed with " << hr << '\n'; + messages << " ID3D12InfoQueue::GetMessagefailed with " << hr << '\n'; continue; } std::unique_ptr messageData(new uint8_t[messageLength]); D3D12_MESSAGE* message = reinterpret_cast(messageData.get()); - hr = infoQueue->GetMessageW(i, message, &messageLength); + hr = infoQueue->GetMessage(i, message, &messageLength); if (FAILED(hr)) { - messages << " ID3D12InfoQueue::GetMessageW failed with " << hr << '\n'; + messages << " ID3D12InfoQueue::GetMessage failed with " << hr << '\n'; continue; } diff --git a/src/dawn_native/d3d12/d3d12_platform.h b/src/dawn_native/d3d12/d3d12_platform.h index 1962468c44..1c733c8256 100644 --- a/src/dawn_native/d3d12/d3d12_platform.h +++ b/src/dawn_native/d3d12/d3d12_platform.h @@ -15,6 +15,11 @@ #ifndef DAWNNATIVE_D3D12_D3D12PLATFORM_H_ #define DAWNNATIVE_D3D12_D3D12PLATFORM_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. +#include "common/windows_with_undefs.h" + #include #include #include @@ -29,10 +34,4 @@ using Microsoft::WRL::ComPtr; -// Remove windows.h macros after d3d12's include of windows.h -#include "common/Platform.h" -#if defined(DAWN_PLATFORM_WINDOWS) -# include "common/windows_with_undefs.h" -#endif - #endif // DAWNNATIVE_D3D12_D3D12PLATFORM_H_