Skip to content

Commit

Permalink
Merge pull request #95 from microsoft/mingwfix
Browse files Browse the repository at this point in the history
Fixes for build failures when using MinGW
  • Loading branch information
jenatali committed Apr 21, 2023
2 parents 3b0d6f5 + 577fd3f commit 34c9866
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
41 changes: 41 additions & 0 deletions googletest/MockDevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class MockDevice : public ID3D12Device
return;
}

#if defined(_MSC_VER) || !defined(_WIN32)
virtual D3D12_RESOURCE_ALLOCATION_INFO STDMETHODCALLTYPE GetResourceAllocationInfo(
_In_ UINT visibleMask,
_In_ UINT numResourceDescs,
Expand All @@ -206,14 +207,42 @@ class MockDevice : public ID3D12Device
D3D12_RESOURCE_ALLOCATION_INFO mockInfo = {};
return mockInfo;
}
#else
virtual D3D12_RESOURCE_ALLOCATION_INFO *STDMETHODCALLTYPE GetResourceAllocationInfo(
D3D12_RESOURCE_ALLOCATION_INFO * RetVal,
_In_ UINT visibleMask,
_In_ UINT numResourceDescs,
_In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs) override
{
if (RetVal)
{
*RetVal = {};
}
return RetVal;
}
#endif

#if defined(_MSC_VER) || !defined(_WIN32)
virtual D3D12_HEAP_PROPERTIES STDMETHODCALLTYPE GetCustomHeapProperties(
_In_ UINT nodeMask,
D3D12_HEAP_TYPE heapType) override
{
D3D12_HEAP_PROPERTIES mockProps = {};
return mockProps;
}
#else
virtual D3D12_HEAP_PROPERTIES *STDMETHODCALLTYPE GetCustomHeapProperties(
D3D12_HEAP_PROPERTIES * RetVal,
_In_ UINT nodeMask,
D3D12_HEAP_TYPE heapType) override
{
if (RetVal)
{
*RetVal = {};
}
return RetVal;
}
#endif

virtual HRESULT STDMETHODCALLTYPE CreateCommittedResource(
_In_ const D3D12_HEAP_PROPERTIES *pHeapProperties,
Expand Down Expand Up @@ -360,11 +389,23 @@ class MockDevice : public ID3D12Device
return;
}

#if defined(_MSC_VER) || !defined(_WIN32)
virtual LUID STDMETHODCALLTYPE GetAdapterLuid( void) override
{
LUID mockLuid = {};
return mockLuid;
}
#else
virtual LUID *STDMETHODCALLTYPE GetAdapterLuid(
LUID * RetVal) override
{
if (RetVal)
{
*RetVal = {};
}
return RetVal;
}
#endif

public: // ID3D12Object
virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
Expand Down
5 changes: 4 additions & 1 deletion src/d3dx12_property_format_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
#define NOMINMAX
#define NOMINMAX 1
#endif
#ifdef __MINGW32__
#include <unknwn.h>
#endif
#ifndef _WIN32
#include <wsl/winadapter.h>
Expand Down

0 comments on commit 34c9866

Please sign in to comment.