Fixed UWP build.

This commit is contained in:
Branimir Karadžić
2017-12-13 23:40:39 -08:00
parent 48abf7e04d
commit 0d1cf61bb1
10 changed files with 45 additions and 22 deletions

View File

@@ -676,7 +676,7 @@ Args::Args(int _argc, const char* const* _argv)
{
m_type = bgfx::RendererType::Noop;
}
else if (BX_ENABLED(BX_PLATFORM_WINDOWS) )
else if (BX_ENABLED(BX_PLATFORM_WINDOWS|BX_PLATFORM_WINRT|BX_PLATFORM_XBOXONE) )
{
if (cmdLine.hasArg("d3d9") )
{

View File

@@ -127,7 +127,7 @@ function bgfxProjectBase(_kind, _defines)
"GLESv2",
}
configuration { "winphone8* or winstore8*" }
configuration { "winphone* or winstore*" }
linkoptions {
"/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata
}

View File

@@ -90,7 +90,7 @@ project ("example-common")
path.join(BGFX_DIR, "examples/common/**.mm"),
}
configuration { "winphone8* or winstore8* or durango"}
configuration { "winphone* or winstore* or durango"}
files {
path.join(BGFX_DIR, "examples/common/**.cx"),
}

View File

@@ -232,7 +232,7 @@ function exampleProjectDefaults()
"kernelx",
}
configuration { "winphone8* or winstore8*" }
configuration { "winphone* or winstore*" }
removelinks {
"DelayImp",
"gdi32",
@@ -240,6 +240,7 @@ function exampleProjectDefaults()
}
links {
"d3d11",
"d3d12",
"dxgi"
}
linkoptions {
@@ -247,15 +248,15 @@ function exampleProjectDefaults()
}
-- WinRT targets need their own output directories or build files stomp over each other
configuration { "x32", "winphone8* or winstore8*" }
configuration { "x32", "winphone* or winstore*" }
targetdir (path.join(BGFX_BUILD_DIR, "win32_" .. _ACTION, "bin", _name))
objdir (path.join(BGFX_BUILD_DIR, "win32_" .. _ACTION, "obj", _name))
configuration { "x64", "winphone8* or winstore8*" }
configuration { "x64", "winphone* or winstore*" }
targetdir (path.join(BGFX_BUILD_DIR, "win64_" .. _ACTION, "bin", _name))
objdir (path.join(BGFX_BUILD_DIR, "win64_" .. _ACTION, "obj", _name))
configuration { "ARM", "winphone8* or winstore8*" }
configuration { "ARM", "winphone* or winstore*" }
targetdir (path.join(BGFX_BUILD_DIR, "arm_" .. _ACTION, "bin", _name))
objdir (path.join(BGFX_BUILD_DIR, "arm_" .. _ACTION, "obj", _name))

View File

@@ -132,7 +132,7 @@ project ("texturev")
"psapi",
}
configuration { "winphone8*"}
configuration { "winphone* or winstore*" }
removelinks {
"DelayImp",
"gdi32",
@@ -140,6 +140,7 @@ project ("texturev")
}
links {
"d3d11",
"d3d12",
"dxgi"
}
linkoptions {

View File

@@ -38,6 +38,7 @@
# ifndef BGFX_CONFIG_RENDERER_DIRECT3D12
# define BGFX_CONFIG_RENDERER_DIRECT3D12 (0 \
|| BX_PLATFORM_WINDOWS \
|| BX_PLATFORM_WINRT \
|| BX_PLATFORM_XBOXONE \
? 1 : 0)
# endif // BGFX_CONFIG_RENDERER_DIRECT3D12

View File

@@ -402,6 +402,7 @@ namespace bgfx { namespace d3d11
static const GUID WKPDID_D3DDebugObjectName = { 0x429b8c22, 0x9188, 0x4b0c, { 0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00 } };
static const GUID IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } };
static const GUID IID_IDXGIFactory = { 0x7b7166ec, 0x21c7, 0x44ae, { 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69 } };
static const GUID IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } };
static const GUID IID_IDXGIDevice0 = { 0x54ec77fa, 0x1377, 0x44e6, { 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c } };
static const GUID IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } };
static const GUID IID_IDXGIDevice2 = { 0x05008617, 0xfbfd, 0x4051, { 0xa7, 0x90, 0x14, 0x48, 0x84, 0xb4, 0xf6, 0xa9 } };
@@ -954,7 +955,7 @@ namespace bgfx { namespace d3d11
IDXGIFactory* factory;
#if BX_PLATFORM_WINRT
// WinRT requires the IDXGIFactory2 interface, which isn't supported on older platforms
hr = CreateDXGIFactory1(__uuidof(IDXGIFactory2), (void**)&factory);
hr = CreateDXGIFactory1(IID_IDXGIFactory2, (void**)&factory);
#elif BX_PLATFORM_WINDOWS
hr = CreateDXGIFactory(IID_IDXGIFactory, (void**)&factory);
#else
@@ -1282,7 +1283,12 @@ BX_PRAGMA_DIAGNOSTIC_POP();
, NULL
, &m_swapChain
);
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 swap chain.");
if (FAILED(hr) )
{
BX_TRACE("Init error: Unable to create Direct3D11 swap chain.");
goto error;
}
}
else
{

View File

@@ -24,6 +24,7 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4005) // warning C4005: '' : macro redefinitio
# include <d3d11_3.h>
# include <dxgi1_6.h>
#elif BX_PLATFORM_WINRT
# define __D3D10_1SHADER_H__ // BK - not used keep quiet!
# include <d3d11_3.h>
#else
# include <d3d11_x.h>

View File

@@ -8,6 +8,13 @@
#if BGFX_CONFIG_RENDERER_DIRECT3D12
# include "renderer_d3d12.h"
#if !BX_PLATFORM_WINDOWS
# include <inspectable.h>
# if BX_PLATFORM_WINRT
# include <windows.ui.xaml.media.dxinterop.h>
# endif // BX_PLATFORM_WINRT
#endif // !BX_PLATFORM_WINDOWS
namespace bgfx { namespace d3d12
{
static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
@@ -357,7 +364,6 @@ namespace bgfx { namespace d3d12
_commandList->ResourceBarrier(1, &barrier);
}
#if USE_D3D12_DYNAMIC_LIB
static const GUID IID_ID3D12CommandAllocator = { 0x6102dee4, 0xaf59, 0x4b09, { 0xb9, 0x99, 0xb4, 0x4d, 0x73, 0xf0, 0x9b, 0x24 } };
static const GUID IID_ID3D12CommandQueue = { 0x0ec870a6, 0x5d7e, 0x4c22, { 0x8c, 0xfc, 0x5b, 0xaa, 0xe0, 0x76, 0x16, 0xed } };
static const GUID IID_ID3D12CommandSignature = { 0xc36a797c, 0xec80, 0x4f0a, { 0x89, 0x85, 0xa7, 0xb2, 0x47, 0x50, 0x82, 0xd1 } };
@@ -372,11 +378,12 @@ namespace bgfx { namespace d3d12
static const GUID IID_ID3D12Resource = { 0x696442be, 0xa72e, 0x4059, { 0xbc, 0x79, 0x5b, 0x5c, 0x98, 0x04, 0x0f, 0xad } };
static const GUID IID_ID3D12RootSignature = { 0xc54a6b66, 0x72df, 0x4ee8, { 0x8b, 0xe5, 0xa9, 0x46, 0xa1, 0x42, 0x92, 0x14 } };
static const GUID IID_ID3D12QueryHeap = { 0x0d9658ae, 0xed45, 0x469e, { 0xa6, 0x1d, 0x97, 0x0e, 0xc5, 0x83, 0xca, 0xb4 } };
static const GUID IID_IDXGIDevice0 = { 0x54ec77fa, 0x1377, 0x44e6, { 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c } };
static const GUID IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } };
static const GUID IID_IDXGIDevice2 = { 0x05008617, 0xfbfd, 0x4051, { 0xa7, 0x90, 0x14, 0x48, 0x84, 0xb4, 0xf6, 0xa9 } };
static const GUID IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } };
static const GUID IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } };
static const GUID IID_IDXGIFactory4 = { 0x1bc6ea02, 0xef36, 0x464f, { 0xbf, 0x0c, 0x21, 0xca, 0x39, 0xe5, 0x16, 0x8a } };
#else
static const GUID IID_ID3D12CommandSignature = { 0xc36a797c, 0xec80, 0x4f0a, { 0x89, 0x85, 0xa7, 0xb2, 0x47, 0x50, 0x82, 0xd1 } };
static const GUID IID_ID3D12QueryHeap = { 0x0d9658ae, 0xed45, 0x469e, { 0xa6, 0x1d, 0x97, 0x0e, 0xc5, 0x83, 0xca, 0xb4 } };
#endif // USE_D3D12_DYNAMIC_LIB
struct HeapProperty
{
@@ -670,7 +677,7 @@ namespace bgfx { namespace d3d12
HRESULT hr;
#if BX_PLATFORM_WINDOWS
#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
hr = CreateDXGIFactory1(IID_IDXGIFactory4, (void**)&m_factory);
#else
hr = S_OK;
@@ -690,7 +697,7 @@ namespace bgfx { namespace d3d12
if (NULL != m_factory)
{
#if BX_PLATFORM_WINDOWS
#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
IDXGIAdapter3* adapter;
#else
IDXGIAdapter* adapter;
@@ -875,7 +882,7 @@ namespace bgfx { namespace d3d12
goto error;
}
hr = m_adapter->GetParent(IID_IDXGIFactory2, (void**)&m_factory);
hr = m_adapter->GetParent(IID_IDXGIFactory4, (void**)&m_factory);
if (FAILED(hr) )
{
@@ -903,7 +910,7 @@ namespace bgfx { namespace d3d12
{
#if !BX_PLATFORM_WINDOWS
hr = m_adapter->GetParent(__uuidof(IDXGIFactory2), (void**)&m_factory);
DX_RELEASE(m_adapter, 1);
DX_RELEASE(m_adapter, 0);
if (FAILED(hr) )
{
BX_TRACE("Init error: Unable to create Direct3D11 device.");
@@ -924,13 +931,18 @@ namespace bgfx { namespace d3d12
if (NULL == g_platformData.ndt)
{
hr = m_factory->CreateSwapChainForCoreWindow(m_device
hr = m_factory->CreateSwapChainForCoreWindow(m_cmd.m_commandQueue
, (::IUnknown*)g_platformData.nwh
, &m_scd
, NULL
, &m_swapChain
);
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 swap chain.");
if (FAILED(hr) )
{
BX_TRACE("Init error: Unable to create Direct3D12 swap chain.");
goto error;
}
}
else
{
@@ -3016,7 +3028,7 @@ data.NumQualityLevels = 0;
ID3D12InfoQueue* m_infoQueue;
#else
IDXGIAdapter* m_adapter;
IDXGIFactory2* m_factory;
IDXGIFactory4* m_factory;
IDXGISwapChain1* m_swapChain;
#endif // BX_PLATFORM_WINDOWS

View File

@@ -13,6 +13,7 @@
# include <d3d12_x.h>
#else
# include <d3d12.h>
# include <dxgi1_6.h>
#endif // BX_PLATFORM_XBOXONE
#if defined(__MINGW32__) // BK - temp workaround for MinGW until I nuke d3dx12 usage.