mirror of https://github.com/AxioDL/boo.git
UWP support
This commit is contained in:
parent
598bce028b
commit
f228f23661
|
@ -37,6 +37,7 @@ if(NOT GEKKO AND NOT CAFE AND NOT WINDOWS_STORE)
|
|||
list(APPEND PLAT_SRCS
|
||||
lib/graphicsdev/GL.cpp
|
||||
lib/graphicsdev/glew.c)
|
||||
list(APPEND _BOO_SYS_DEFINES -DBOO_HAS_GL=1)
|
||||
|
||||
list(APPEND PLAT_HDRS
|
||||
include/boo/graphicsdev/GLSLMacros.hpp
|
||||
|
@ -53,8 +54,8 @@ if(WINDOWS_STORE)
|
|||
lib/win/WindowUWP.cpp
|
||||
lib/win/WinCommon.hpp
|
||||
lib/win/UWPCommon.hpp
|
||||
lib/inputdev/HIDListenerWinUSB.cpp
|
||||
lib/inputdev/HIDDeviceWinUSB.cpp
|
||||
lib/inputdev/HIDListenerUWP.cpp
|
||||
lib/inputdev/HIDDeviceUWP.cpp
|
||||
lib/graphicsdev/D3D11.cpp
|
||||
lib/graphicsdev/D3D12.cpp
|
||||
lib/audiodev/WASAPI.cpp)
|
||||
|
|
|
@ -81,11 +81,12 @@ ApplicationRun(IApplication::EPlatformType platform,
|
|||
return ApplicationRun(platform, cb, uniqueName, friendlyName, argv[0], args, singleInstance);
|
||||
}
|
||||
|
||||
#if WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP
|
||||
#if WINDOWS_STORE
|
||||
using namespace Windows::ApplicationModel::Core;
|
||||
|
||||
ref struct ViewProvider sealed : IFrameworkViewSource
|
||||
{
|
||||
internal:
|
||||
ViewProvider(boo::IApplicationCallback& appCb,
|
||||
SystemStringView uniqueName,
|
||||
SystemStringView friendlyName,
|
||||
|
@ -97,13 +98,15 @@ ref struct ViewProvider sealed : IFrameworkViewSource
|
|||
{
|
||||
SystemChar selfPath[1024];
|
||||
GetModuleFileNameW(nullptr, selfPath, 1024);
|
||||
m_args.reserve(params.size() + 1);
|
||||
m_args.reserve(params->Length + 1);
|
||||
m_args.emplace_back(selfPath);
|
||||
for (Platform::String^ str : params)
|
||||
m_args.emplace_back(str.Data());
|
||||
m_args.emplace_back(str->Data());
|
||||
}
|
||||
IFrameworkView^ CreateView();
|
||||
public:
|
||||
virtual IFrameworkView^ CreateView();
|
||||
|
||||
internal:
|
||||
boo::IApplicationCallback& m_appCb;
|
||||
SystemString m_uniqueName;
|
||||
SystemString m_friendlyName;
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
#define BOO_SYSTEM_HPP
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winapifamily.h>
|
||||
#if defined(WINAPI_FAMILY) && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP
|
||||
#define WINDOWS_STORE 1
|
||||
#else
|
||||
#define WINDOWS_STORE 0
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <D3Dcommon.h>
|
||||
#include <wrl/client.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef GDEV_GL_HPP
|
||||
#define GDEV_GL_HPP
|
||||
#if BOO_HAS_GL
|
||||
|
||||
#include "IGraphicsDataFactory.hpp"
|
||||
#include "IGraphicsCommandQueue.hpp"
|
||||
|
@ -62,4 +63,5 @@ public:
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // GDEV_GL_HPP
|
||||
|
|
|
@ -52,7 +52,9 @@ public:
|
|||
|
||||
/* High-Level API */
|
||||
#if _WIN32
|
||||
#if !WINDOWS_STORE
|
||||
const PHIDP_PREPARSED_DATA getReportDescriptor();
|
||||
#endif
|
||||
#else
|
||||
std::vector<uint8_t> getReportDescriptor();
|
||||
#endif
|
||||
|
|
|
@ -181,9 +181,11 @@ private:
|
|||
|
||||
ParserStatus m_status = ParserStatus::OK;
|
||||
#if _WIN32
|
||||
#if !WINDOWS_STORE
|
||||
std::vector<HIDMainItem> m_itemPool;
|
||||
mutable std::vector<HIDP_DATA> m_dataList;
|
||||
PHIDP_PREPARSED_DATA m_descriptorData = nullptr;
|
||||
#endif
|
||||
#else
|
||||
std::unique_ptr<HIDMainItem[]> m_itemPool;
|
||||
using Report = std::pair<uint32_t, std::pair<uint32_t, uint32_t>>;
|
||||
|
@ -201,7 +203,9 @@ private:
|
|||
|
||||
public:
|
||||
#if _WIN32
|
||||
#if !WINDOWS_STORE
|
||||
ParserStatus Parse(const PHIDP_PREPARSED_DATA descriptorData);
|
||||
#endif
|
||||
#else
|
||||
ParserStatus Parse(const uint8_t* descriptorData, size_t len);
|
||||
static size_t CalculateMaxInputReportSize(const uint8_t* descriptorData, size_t len);
|
||||
|
|
|
@ -15,7 +15,7 @@ class DeviceFinder;
|
|||
class IHIDListener
|
||||
{
|
||||
public:
|
||||
virtual ~IHIDListener() {}
|
||||
virtual ~IHIDListener() = default;
|
||||
|
||||
/* Automatic device scanning */
|
||||
virtual bool startScanning()=0;
|
||||
|
@ -24,7 +24,7 @@ public:
|
|||
/* Manual device scanning */
|
||||
virtual bool scanNow()=0;
|
||||
|
||||
#if _WIN32
|
||||
#if _WIN32 && !WINDOWS_STORE
|
||||
/* External listener implementation (for Windows) */
|
||||
virtual bool _extDevConnect(const char* path)=0;
|
||||
virtual bool _extDevDisconnect(const char* path)=0;
|
||||
|
|
|
@ -8,8 +8,12 @@
|
|||
|
||||
#include <iterator>
|
||||
|
||||
#if !WINDOWS_STORE
|
||||
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
|
||||
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
|
||||
#else
|
||||
using namespace Windows::Media::Devices;
|
||||
#endif
|
||||
const IID IID_IAudioClient = __uuidof(IAudioClient);
|
||||
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
|
||||
|
||||
|
@ -23,14 +27,17 @@ static logvisor::Module Log("boo::WASAPI");
|
|||
|
||||
struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
|
||||
{
|
||||
#if !WINDOWS_STORE
|
||||
ComPtr<IMMDeviceEnumerator> m_enumerator;
|
||||
ComPtr<IMMDevice> m_device;
|
||||
#endif
|
||||
ComPtr<IAudioClient> m_audClient;
|
||||
ComPtr<IAudioRenderClient> m_renderClient;
|
||||
|
||||
size_t m_curBufFrame = 0;
|
||||
std::vector<float> m_5msBuffer;
|
||||
|
||||
#if !WINDOWS_STORE
|
||||
struct NotificationClient : public IMMNotificationClient
|
||||
{
|
||||
WASAPIAudioVoiceEngine& m_parent;
|
||||
|
@ -122,9 +129,11 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
|
|||
return S_OK;
|
||||
}
|
||||
} m_notificationClient;
|
||||
#endif
|
||||
|
||||
void _buildAudioRenderClient()
|
||||
{
|
||||
#if !WINDOWS_STORE
|
||||
if (FAILED(m_enumerator->GetDefaultAudioEndpoint(eRender, eConsole, &m_device)))
|
||||
{
|
||||
Log.report(logvisor::Fatal, L"unable to obtain default audio device");
|
||||
|
@ -138,12 +147,15 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
|
|||
m_device.Reset();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
WAVEFORMATEXTENSIBLE* pwfx;
|
||||
if (FAILED(m_audClient->GetMixFormat((WAVEFORMATEX**)&pwfx)))
|
||||
{
|
||||
Log.report(logvisor::Fatal, L"unable to obtain audio mix format from device");
|
||||
#if !WINDOWS_STORE
|
||||
m_device.Reset();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -226,7 +238,9 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
|
|||
nullptr)))
|
||||
{
|
||||
Log.report(logvisor::Fatal, L"unable to initialize audio client");
|
||||
#if !WINDOWS_STORE
|
||||
m_device.Reset();
|
||||
#endif
|
||||
CoTaskMemFree(pwfx);
|
||||
return;
|
||||
}
|
||||
|
@ -251,7 +265,9 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
|
|||
else
|
||||
{
|
||||
Log.report(logvisor::Fatal, L"unsupported bits-per-sample %d", pwfx->Format.wBitsPerSample);
|
||||
#if !WINDOWS_STORE
|
||||
m_device.Reset();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -266,7 +282,9 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
|
|||
else
|
||||
{
|
||||
Log.report(logvisor::Fatal, L"unsupported floating-point bits-per-sample %d", pwfx->Format.wBitsPerSample);
|
||||
#if !WINDOWS_STORE
|
||||
m_device.Reset();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +295,9 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
|
|||
if (FAILED(m_audClient->GetBufferSize(&bufferFrameCount)))
|
||||
{
|
||||
Log.report(logvisor::Fatal, L"unable to get audio buffer frame count");
|
||||
#if !WINDOWS_STORE
|
||||
m_device.Reset();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
m_mixInfo.m_periodFrames = bufferFrameCount;
|
||||
|
@ -285,14 +305,78 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
|
|||
if (FAILED(m_audClient->GetService(IID_IAudioRenderClient, &m_renderClient)))
|
||||
{
|
||||
Log.report(logvisor::Fatal, L"unable to create audio render client");
|
||||
#if !WINDOWS_STORE
|
||||
m_device.Reset();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
WASAPIAudioVoiceEngine()
|
||||
: m_notificationClient(*this)
|
||||
#if WINDOWS_STORE
|
||||
struct CompletionHandler : IActivateAudioInterfaceCompletionHandler
|
||||
{
|
||||
WASAPIAudioVoiceEngine& e;
|
||||
LONG _cRef = 1;
|
||||
|
||||
CompletionHandler(WASAPIAudioVoiceEngine& e) : e(e) {}
|
||||
HRESULT ActivateCompleted(IActivateAudioInterfaceAsyncOperation* operation)
|
||||
{
|
||||
return e.ActivateCompleted(operation);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef()
|
||||
{
|
||||
return InterlockedIncrement(&_cRef);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release()
|
||||
{
|
||||
ULONG ulRef = InterlockedDecrement(&_cRef);
|
||||
if (0 == ulRef)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
return ulRef;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
REFIID riid, VOID **ppvInterface)
|
||||
{
|
||||
if (IID_IUnknown == riid)
|
||||
{
|
||||
AddRef();
|
||||
*ppvInterface = (IUnknown*)this;
|
||||
}
|
||||
else if (__uuidof(IActivateAudioInterfaceCompletionHandler) == riid)
|
||||
{
|
||||
AddRef();
|
||||
*ppvInterface = (IActivateAudioInterfaceCompletionHandler*)this;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppvInterface = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
} m_completion = {*this};
|
||||
HRESULT ActivateCompleted(IActivateAudioInterfaceAsyncOperation* operation)
|
||||
{
|
||||
ComPtr<IUnknown> punkAudioInterface;
|
||||
HRESULT hrActivateResult;
|
||||
operation->GetActivateResult(&hrActivateResult, &punkAudioInterface);
|
||||
punkAudioInterface.As<IAudioClient>(&m_audClient);
|
||||
_buildAudioRenderClient();
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
WASAPIAudioVoiceEngine()
|
||||
#if !WINDOWS_STORE
|
||||
: m_notificationClient(*this)
|
||||
#endif
|
||||
{
|
||||
#if !WINDOWS_STORE
|
||||
/* Enumerate default audio device */
|
||||
if (FAILED(CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr,
|
||||
CLSCTX_ALL, IID_IMMDeviceEnumerator,
|
||||
|
@ -310,6 +394,11 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
|
|||
}
|
||||
|
||||
_buildAudioRenderClient();
|
||||
#else
|
||||
auto deviceIdStr = MediaDevice::GetDefaultAudioRenderId(Windows::Media::Devices::AudioDeviceRole::Default);
|
||||
ComPtr<IActivateAudioInterfaceAsyncOperation> asyncOp;
|
||||
ActivateAudioInterfaceAsync(deviceIdStr->Data(), __uuidof(IAudioClient3), nullptr, &m_completion, &asyncOp);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool m_started = false;
|
||||
|
@ -411,6 +500,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
|
|||
}
|
||||
}
|
||||
|
||||
#if !WINDOWS_STORE
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIDevices() const
|
||||
{
|
||||
std::vector<std::pair<std::string, std::string>> ret;
|
||||
|
@ -681,13 +771,53 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
|
|||
}
|
||||
|
||||
bool useMIDILock() const {return true;}
|
||||
#else
|
||||
std::vector<std::pair<std::string, std::string>> enumerateMIDIDevices() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIIn> newVirtualMIDIIn(ReceiveFunctor&& receiver)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIOut> newVirtualMIDIOut()
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newVirtualMIDIInOut(ReceiveFunctor&& receiver)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIIn> newRealMIDIIn(const char* name, ReceiveFunctor&& receiver)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIOut> newRealMIDIOut(const char* name)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
std::unique_ptr<IMIDIInOut> newRealMIDIInOut(const char* name, ReceiveFunctor&& receiver)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
bool useMIDILock() const {return false;}
|
||||
#endif
|
||||
};
|
||||
|
||||
std::unique_ptr<IAudioVoiceEngine> NewAudioVoiceEngine()
|
||||
{
|
||||
std::unique_ptr<IAudioVoiceEngine> ret = std::make_unique<WASAPIAudioVoiceEngine>();
|
||||
#if !WINDOWS_STORE
|
||||
if (!static_cast<WASAPIAudioVoiceEngine&>(*ret).m_device)
|
||||
return {};
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,11 @@ static inline void ThrowIfFailed(HRESULT hr)
|
|||
if (FAILED(hr))
|
||||
{
|
||||
// Set a breakpoint on this line to catch Win32 API errors.
|
||||
#if !WINDOWS_STORE
|
||||
_com_error err(hr);
|
||||
#else
|
||||
_com_error err(hr, L"D3D11 fail");
|
||||
#endif
|
||||
LPCTSTR errMsg = err.ErrorMessage();
|
||||
Log.report(logvisor::Fatal, errMsg);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,11 @@ static inline void ThrowIfFailed(HRESULT hr)
|
|||
if (FAILED(hr))
|
||||
{
|
||||
// Set a breakpoint on this line to catch Win32 API errors.
|
||||
#if !WINDOWS_STORE
|
||||
_com_error err(hr);
|
||||
#else
|
||||
_com_error err(hr, L"D3D12 fail");
|
||||
#endif
|
||||
LPCTSTR errMsg = err.ErrorMessage();
|
||||
Log.report(logvisor::Fatal, errMsg);
|
||||
}
|
||||
|
|
|
@ -55,12 +55,14 @@ size_t DeviceBase::receiveUSBInterruptTransfer(uint8_t* data, size_t length)
|
|||
}
|
||||
|
||||
#if _WIN32
|
||||
#if !WINDOWS_STORE
|
||||
const PHIDP_PREPARSED_DATA DeviceBase::getReportDescriptor()
|
||||
{
|
||||
if (m_hidDev)
|
||||
return m_hidDev->_getReportDescriptor();
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
std::vector<uint8_t> DeviceBase::getReportDescriptor()
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace boo
|
|||
|
||||
DeviceFinder* DeviceFinder::skDevFinder = nullptr;
|
||||
|
||||
#if _WIN32
|
||||
#if _WIN32 && !WINDOWS_STORE
|
||||
/* Windows-specific WM_DEVICECHANGED handler */
|
||||
LRESULT DeviceFinder::winDevChangedHandler(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
|
|
@ -21,8 +21,10 @@ void GenericPad::deviceDisconnected()
|
|||
void GenericPad::initialCycle()
|
||||
{
|
||||
#if _WIN32
|
||||
#if !WINDOWS_STORE
|
||||
const PHIDP_PREPARSED_DATA reportDesc = getReportDescriptor();
|
||||
m_parser.Parse(reportDesc);
|
||||
#endif
|
||||
#else
|
||||
std::vector<uint8_t> reportDesc = getReportDescriptor();
|
||||
m_parser.Parse(reportDesc.data(), reportDesc.size());
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#define _CRT_SECURE_NO_WARNINGS 1 /* STFU MSVC */
|
||||
#include "IHIDDevice.hpp"
|
||||
#include "boo/inputdev/DeviceToken.hpp"
|
||||
#include "boo/inputdev/DeviceBase.hpp"
|
||||
|
||||
namespace boo
|
||||
{
|
||||
|
||||
class HIDDeviceUWP : public IHIDDevice
|
||||
{
|
||||
public:
|
||||
HIDDeviceUWP(DeviceToken& token, const std::shared_ptr<DeviceBase>& devImp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void _deviceDisconnected() {}
|
||||
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) { return false; }
|
||||
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) { return 0; }
|
||||
bool _sendHIDReport(const uint8_t* data, size_t length, HIDReportType tp, uint32_t message) { return false; }
|
||||
size_t _receiveHIDReport(uint8_t* data, size_t length, HIDReportType tp, uint32_t message) { return false; }
|
||||
void _startThread() {}
|
||||
};
|
||||
|
||||
std::shared_ptr<IHIDDevice> IHIDDeviceNew(DeviceToken& token, const std::shared_ptr<DeviceBase>& devImp)
|
||||
{
|
||||
return std::make_shared<HIDDeviceUWP>(token, devImp);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
#define _CRT_SECURE_NO_WARNINGS 1 /* STFU MSVC */
|
||||
#include "boo/inputdev/IHIDListener.hpp"
|
||||
#include "boo/inputdev/DeviceFinder.hpp"
|
||||
|
||||
namespace boo
|
||||
{
|
||||
|
||||
class HIDListenerUWP : public IHIDListener
|
||||
{
|
||||
public:
|
||||
HIDListenerUWP(DeviceFinder& finder) {}
|
||||
|
||||
/* Automatic device scanning */
|
||||
bool startScanning() { return false; }
|
||||
bool stopScanning() { return false; }
|
||||
|
||||
/* Manual device scanning */
|
||||
bool scanNow() { return false; }
|
||||
};
|
||||
|
||||
std::unique_ptr<IHIDListener> IHIDListenerNew(DeviceFinder& finder)
|
||||
{
|
||||
return std::make_unique<HIDListenerUWP>(finder);
|
||||
}
|
||||
|
||||
}
|
|
@ -396,6 +396,7 @@ struct HIDReports
|
|||
};
|
||||
|
||||
#if _WIN32
|
||||
#if !WINDOWS_STORE
|
||||
HIDParser::ParserStatus HIDParser::Parse(const PHIDP_PREPARSED_DATA descriptorData)
|
||||
{
|
||||
/* User mode HID report descriptor isn't available on Win32.
|
||||
|
@ -475,6 +476,7 @@ HIDParser::ParserStatus HIDParser::Parse(const PHIDP_PREPARSED_DATA descriptorDa
|
|||
m_status = ParserStatus::Done;
|
||||
return ParserStatus::Done;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
|
||||
HIDParser::ParserStatus
|
||||
|
@ -721,6 +723,7 @@ std::pair<HIDUsagePage, HIDUsage> HIDParser::GetApplicationUsage(const uint8_t*
|
|||
#if _WIN32
|
||||
void HIDParser::EnumerateValues(const std::function<bool(const HIDMainItem& item)>& valueCB) const
|
||||
{
|
||||
#if !WINDOWS_STORE
|
||||
if (m_status != ParserStatus::Done)
|
||||
return;
|
||||
|
||||
|
@ -731,6 +734,7 @@ void HIDParser::EnumerateValues(const std::function<bool(const HIDMainItem& item
|
|||
if (!valueCB(item))
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
void HIDParser::EnumerateValues(const std::function<bool(const HIDMainItem& item)>& valueCB) const
|
||||
|
@ -757,6 +761,7 @@ void HIDParser::EnumerateValues(const std::function<bool(const HIDMainItem& item
|
|||
void HIDParser::ScanValues(const std::function<bool(const HIDMainItem& item, int32_t value)>& valueCB,
|
||||
const uint8_t* data, size_t len) const
|
||||
{
|
||||
#if !WINDOWS_STORE
|
||||
if (m_status != ParserStatus::Done)
|
||||
return;
|
||||
|
||||
|
@ -786,6 +791,7 @@ void HIDParser::ScanValues(const std::function<bool(const HIDMainItem& item, int
|
|||
return;
|
||||
++idx;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
|
||||
|
|
|
@ -20,7 +20,9 @@ class IHIDDevice : public std::enable_shared_from_this<IHIDDevice>
|
|||
virtual bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length)=0;
|
||||
virtual size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length)=0;
|
||||
#if _WIN32
|
||||
#if !WINDOWS_STORE
|
||||
virtual const PHIDP_PREPARSED_DATA _getReportDescriptor()=0;
|
||||
#endif
|
||||
#else
|
||||
virtual std::vector<uint8_t> _getReportDescriptor()=0;
|
||||
#endif
|
||||
|
|
|
@ -25,31 +25,10 @@ pD3DCreateBlob D3DCreateBlobPROC = nullptr;
|
|||
|
||||
static bool FindBestD3DCompile()
|
||||
{
|
||||
HMODULE d3dCompilelib = LoadLibraryW(L"D3DCompiler_47.dll");
|
||||
if (!d3dCompilelib)
|
||||
{
|
||||
d3dCompilelib = LoadLibraryW(L"D3DCompiler_46.dll");
|
||||
if (!d3dCompilelib)
|
||||
{
|
||||
d3dCompilelib = LoadLibraryW(L"D3DCompiler_45.dll");
|
||||
if (!d3dCompilelib)
|
||||
{
|
||||
d3dCompilelib = LoadLibraryW(L"D3DCompiler_44.dll");
|
||||
if (!d3dCompilelib)
|
||||
{
|
||||
d3dCompilelib = LoadLibraryW(L"D3DCompiler_43.dll");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (d3dCompilelib)
|
||||
{
|
||||
D3DCompilePROC = (pD3DCompile)GetProcAddress(d3dCompilelib, "D3DCompile");
|
||||
D3DCreateBlobPROC = (pD3DCreateBlob)GetProcAddress(d3dCompilelib, "D3DCreateBlob");
|
||||
D3DCompilePROC = D3DCompile;
|
||||
D3DCreateBlobPROC = D3DCreateBlob;
|
||||
return D3DCompilePROC != nullptr && D3DCreateBlobPROC != nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace boo
|
||||
{
|
||||
|
@ -91,14 +70,8 @@ public:
|
|||
m_args(args),
|
||||
m_singleInstance(singleInstance)
|
||||
{
|
||||
HMODULE dxgilib = LoadLibraryW(L"dxgi.dll");
|
||||
if (!dxgilib)
|
||||
Log.report(logvisor::Fatal, "unable to load dxgi.dll");
|
||||
|
||||
typedef HRESULT(WINAPI*CreateDXGIFactory1PROC)(REFIID riid, _COM_Outptr_ void **ppFactory);
|
||||
CreateDXGIFactory1PROC MyCreateDXGIFactory1 = (CreateDXGIFactory1PROC)GetProcAddress(dxgilib, "CreateDXGIFactory1");
|
||||
if (!MyCreateDXGIFactory1)
|
||||
Log.report(logvisor::Fatal, "unable to find CreateDXGIFactory1 in DXGI.dll\n");
|
||||
CreateDXGIFactory1PROC MyCreateDXGIFactory1 = CreateDXGIFactory1;
|
||||
|
||||
bool no12 = false;
|
||||
for (const SystemString& arg : args)
|
||||
|
@ -106,30 +79,15 @@ public:
|
|||
no12 = true;
|
||||
|
||||
#if _WIN32_WINNT_WIN10
|
||||
HMODULE d3d12lib = LoadLibraryW(L"D3D12.dll");
|
||||
if (!no12 && d3d12lib)
|
||||
if (!no12)
|
||||
{
|
||||
#if _DEBUG
|
||||
{
|
||||
PFN_D3D12_GET_DEBUG_INTERFACE MyD3D12GetDebugInterface =
|
||||
(PFN_D3D12_GET_DEBUG_INTERFACE)GetProcAddress(d3d12lib, "D3D12GetDebugInterface");
|
||||
ComPtr<ID3D12Debug> debugController;
|
||||
if (SUCCEEDED(MyD3D12GetDebugInterface(IID_PPV_ARGS(&debugController))))
|
||||
{
|
||||
debugController->EnableDebugLayer();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!FindBestD3DCompile())
|
||||
Log.report(logvisor::Fatal, "unable to find D3DCompile_[43-47].dll");
|
||||
|
||||
D3D12SerializeRootSignaturePROC =
|
||||
(PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)GetProcAddress(d3d12lib, "D3D12SerializeRootSignature");
|
||||
D3D12SerializeRootSignaturePROC = D3D12SerializeRootSignature;
|
||||
|
||||
/* Create device */
|
||||
PFN_D3D12_CREATE_DEVICE MyD3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)GetProcAddress(d3d12lib, "D3D12CreateDevice");
|
||||
if (!MyD3D12CreateDevice)
|
||||
Log.report(logvisor::Fatal, "unable to find D3D12CreateDevice in D3D12.dll");
|
||||
PFN_D3D12_CREATE_DEVICE MyD3D12CreateDevice = D3D12CreateDevice;
|
||||
|
||||
/* Obtain DXGI Factory */
|
||||
HRESULT hr = MyCreateDXGIFactory1(__uuidof(IDXGIFactory2), &m_3dCtx.m_ctx12.m_dxFactory);
|
||||
|
@ -191,16 +149,12 @@ public:
|
|||
}
|
||||
}
|
||||
#endif
|
||||
HMODULE d3d11lib = LoadLibraryW(L"D3D11.dll");
|
||||
if (d3d11lib)
|
||||
{
|
||||
if (!FindBestD3DCompile())
|
||||
Log.report(logvisor::Fatal, "unable to find D3DCompile_[43-47].dll");
|
||||
|
||||
/* Create device proc */
|
||||
PFN_D3D11_CREATE_DEVICE MyD3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(d3d11lib, "D3D11CreateDevice");
|
||||
if (!MyD3D11CreateDevice)
|
||||
Log.report(logvisor::Fatal, "unable to find D3D11CreateDevice in D3D11.dll");
|
||||
PFN_D3D11_CREATE_DEVICE MyD3D11CreateDevice = D3D11CreateDevice;
|
||||
|
||||
/* Create device */
|
||||
D3D_FEATURE_LEVEL level = D3D_FEATURE_LEVEL_11_0;
|
||||
|
@ -215,9 +169,6 @@ public:
|
|||
FAILED(tempCtx.As<ID3D11DeviceContext1>(&m_3dCtx.m_ctx11.m_devCtx)) || !m_3dCtx.m_ctx11.m_devCtx ||
|
||||
FAILED(m_3dCtx.m_ctx11.m_dev.As<IDXGIDevice2>(&device)) || !device)
|
||||
{
|
||||
MessageBoxW(nullptr, L"Windows 7 users should install 'Platform Update for Windows 7':\n"
|
||||
L"https://www.microsoft.com/en-us/download/details.aspx?id=36805",
|
||||
L"IDXGIDevice2 interface error", MB_OK | MB_ICONERROR);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -256,7 +207,7 @@ public:
|
|||
int clientReturn = 0;
|
||||
std::thread clientThread([&]()
|
||||
{
|
||||
std::string thrName = WCSTMBS(getFriendlyName().c_str()) + " Client Thread";
|
||||
std::string thrName = WCSTMBS(getFriendlyName().data()) + " Client Thread";
|
||||
logvisor::RegisterThreadName(thrName.c_str());
|
||||
clientReturn = m_callback.appMain(this);
|
||||
});
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
#include "WinCommon.hpp"
|
||||
|
||||
using namespace Windows::ApplicationModel::Core;
|
||||
|
||||
struct Boo3DAppContextUWP : Boo3DAppContext
|
||||
{
|
||||
bool isFullscreen(const boo::IWindow* window)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
extern DWORD g_mainThreadId;
|
||||
|
||||
#if _WIN32_WINNT_WINBLUE
|
||||
#if _WIN32_WINNT_WINBLUE && !WINDOWS_STORE
|
||||
#include <ShellScalingApi.h>
|
||||
typedef HRESULT (WINAPI* PFN_SetProcessDpiAwareness)( _In_ PROCESS_DPI_AWARENESS );
|
||||
typedef HRESULT (WINAPI* PFN_GetScaleFactorForMonitor)( _In_ HMONITOR, _Out_ DEVICE_SCALE_FACTOR *);
|
||||
|
@ -187,12 +187,14 @@ struct Boo3DAppContextWin32 : Boo3DAppContext
|
|||
return true;
|
||||
}
|
||||
|
||||
#if !WINDOWS_STORE
|
||||
OGLContext::Window& win = m_ctxOgl.m_windows[window];
|
||||
if (fs && win.m_fs)
|
||||
return false;
|
||||
else if (!fs && !win.m_fs)
|
||||
return false;
|
||||
SetFullscreen(win, fs);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
#include "boo/audiodev/IAudioVoiceEngine.hpp"
|
||||
|
||||
using namespace Windows::UI::Core;
|
||||
using namespace Windows::UI::ViewManagement;
|
||||
using namespace Windows::System;
|
||||
using namespace Windows::Graphics::Display;
|
||||
using namespace Windows::Foundation;
|
||||
|
||||
namespace boo
|
||||
{
|
||||
|
@ -178,67 +181,59 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
static void genFrameDefault(MONITORINFO* screen, int& xOut, int& yOut, int& wOut, int& hOut)
|
||||
{
|
||||
float width = screen->rcMonitor.right * 2.0 / 3.0;
|
||||
float height = screen->rcMonitor.bottom * 2.0 / 3.0;
|
||||
xOut = (screen->rcMonitor.right - width) / 2.0;
|
||||
yOut = (screen->rcMonitor.bottom - height) / 2.0;
|
||||
wOut = width;
|
||||
hOut = height;
|
||||
}
|
||||
|
||||
static uint32_t translateKeysym(VirtualKey sym, ESpecialKey& specialSym, EModifierKey& modifierSym)
|
||||
static uint32_t translateKeysym(CoreWindow^ window, VirtualKey sym,
|
||||
ESpecialKey& specialSym, EModifierKey& modifierSym)
|
||||
{
|
||||
specialSym = ESpecialKey::None;
|
||||
modifierSym = EModifierKey::None;
|
||||
if (sym >= VirtualKey_F1 && sym <= VirtualKey_F12)
|
||||
specialSym = ESpecialKey(uint32_t(ESpecialKey::F1) + sym - VirtualKey_F1);
|
||||
else if (sym == VirtualKey_Escape)
|
||||
if (sym >= VirtualKey::F1 && sym <= VirtualKey::F12)
|
||||
specialSym = ESpecialKey(uint32_t(ESpecialKey::F1) + uint32_t(sym - VirtualKey::F1));
|
||||
else if (sym == VirtualKey::Escape)
|
||||
specialSym = ESpecialKey::Esc;
|
||||
else if (sym == VirtualKey_Enter)
|
||||
else if (sym == VirtualKey::Enter)
|
||||
specialSym = ESpecialKey::Enter;
|
||||
else if (sym == VirtualKey_Back)
|
||||
else if (sym == VirtualKey::Back)
|
||||
specialSym = ESpecialKey::Backspace;
|
||||
else if (sym == VirtualKey_Insert)
|
||||
else if (sym == VirtualKey::Insert)
|
||||
specialSym = ESpecialKey::Insert;
|
||||
else if (sym == VirtualKey_Delete)
|
||||
else if (sym == VirtualKey::Delete)
|
||||
specialSym = ESpecialKey::Delete;
|
||||
else if (sym == VirtualKey_Home)
|
||||
else if (sym == VirtualKey::Home)
|
||||
specialSym = ESpecialKey::Home;
|
||||
else if (sym == VirtualKey_End)
|
||||
else if (sym == VirtualKey::End)
|
||||
specialSym = ESpecialKey::End;
|
||||
else if (sym == VirtualKey_PageUp)
|
||||
else if (sym == VirtualKey::PageUp)
|
||||
specialSym = ESpecialKey::PgUp;
|
||||
else if (sym == VirtualKey_PageDown)
|
||||
else if (sym == VirtualKey::PageDown)
|
||||
specialSym = ESpecialKey::PgDown;
|
||||
else if (sym == VirtualKey_Left)
|
||||
else if (sym == VirtualKey::Left)
|
||||
specialSym = ESpecialKey::Left;
|
||||
else if (sym == VirtualKey_Right)
|
||||
else if (sym == VirtualKey::Right)
|
||||
specialSym = ESpecialKey::Right;
|
||||
else if (sym == VirtualKey_Up)
|
||||
else if (sym == VirtualKey::Up)
|
||||
specialSym = ESpecialKey::Up;
|
||||
else if (sym == VirtualKey_Down)
|
||||
else if (sym == VirtualKey::Down)
|
||||
specialSym = ESpecialKey::Down;
|
||||
else if (sym == VirtualKey_Shift)
|
||||
else if (sym == VirtualKey::Shift)
|
||||
modifierSym = EModifierKey::Shift;
|
||||
else if (sym == VirtualKey_Control)
|
||||
else if (sym == VirtualKey::Control)
|
||||
modifierSym = EModifierKey::Ctrl;
|
||||
else if (sym == VirtualKey_Menu)
|
||||
else if (sym == VirtualKey::Menu)
|
||||
modifierSym = EModifierKey::Alt;
|
||||
else if (sym >= VirtualKey_A && sym <= VirtualKey_Z)
|
||||
return sym - VirtualKey_A + window->GetKeyState(VirtualKey_Shift) ? 'A' : 'a'
|
||||
else if (sym >= VirtualKey::A && sym <= VirtualKey::Z)
|
||||
return uint32_t(sym - VirtualKey::A) +
|
||||
(window->GetKeyState(VirtualKey::Shift) != CoreVirtualKeyStates::None) ? 'A' : 'a';
|
||||
return 0;
|
||||
}
|
||||
|
||||
static EModifierKey translateModifiers(CoreWindow^ window)
|
||||
{
|
||||
EModifierKey retval = EModifierKey::None;
|
||||
if (window->GetKeyState(VirtualKey_Shift) != None)
|
||||
if (window->GetKeyState(VirtualKey::Shift) != CoreVirtualKeyStates::None)
|
||||
retval |= EModifierKey::Shift;
|
||||
if (window->GetKeyState(VirtualKey_Control) != None)
|
||||
if (window->GetKeyState(VirtualKey::Control) != CoreVirtualKeyStates::None)
|
||||
retval |= EModifierKey::Ctrl;
|
||||
if (window->GetKeyState(LefVirtualKey_Menu) != None)
|
||||
if (window->GetKeyState(VirtualKey::Menu) != CoreVirtualKeyStates::None)
|
||||
retval |= EModifierKey::Alt;
|
||||
return retval;
|
||||
}
|
||||
|
@ -253,7 +248,36 @@ class WindowUWP : public IWindow
|
|||
|
||||
public:
|
||||
|
||||
WindowUWP(SystemStringView title, Boo3DAppContext& b3dCtx, uint32_t sampleCount)
|
||||
ref struct EventReceiver sealed
|
||||
{
|
||||
void OnKeyDown(CoreWindow^ window, KeyEventArgs^ keyEventArgs)
|
||||
{
|
||||
w.OnKeyDown(window, keyEventArgs);
|
||||
}
|
||||
|
||||
void OnKeyUp(CoreWindow^ window, KeyEventArgs^ keyEventArgs)
|
||||
{
|
||||
w.OnKeyUp(window, keyEventArgs);
|
||||
}
|
||||
|
||||
void OnClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
|
||||
{
|
||||
w.OnClosed(sender, args);
|
||||
}
|
||||
|
||||
internal:
|
||||
WindowUWP& w;
|
||||
EventReceiver(WindowUWP& w) : w(w)
|
||||
{
|
||||
w.m_coreWindow->KeyDown += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &EventReceiver::OnKeyDown);
|
||||
w.m_coreWindow->KeyUp += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &EventReceiver::OnKeyUp);
|
||||
w.m_coreWindow->Closed += ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &EventReceiver::OnClosed);
|
||||
}
|
||||
};
|
||||
EventReceiver^ m_eventReceiver;
|
||||
|
||||
WindowUWP(SystemStringView title, Boo3DAppContextUWP& b3dCtx, uint32_t sampleCount)
|
||||
: m_eventReceiver(ref new EventReceiver(*this))
|
||||
{
|
||||
IGraphicsContext::EGraphicsAPI api = IGraphicsContext::EGraphicsAPI::D3D11;
|
||||
#if _WIN32_WINNT_WIN10
|
||||
|
@ -263,9 +287,6 @@ public:
|
|||
m_gfxCtx.reset(new GraphicsContextUWPD3D(api, this, m_coreWindow, b3dCtx, sampleCount));
|
||||
|
||||
setTitle(title);
|
||||
m_coreWindow->KeyDown += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &WindowUWP::OnKeyDown);
|
||||
m_coreWindow->KeyUp += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &WindowUWP::OnKeyUp);
|
||||
m_coreWindow->Closed += ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &WindowUWP::OnClosed);
|
||||
}
|
||||
|
||||
~WindowUWP()
|
||||
|
@ -293,12 +314,12 @@ public:
|
|||
|
||||
SystemString getTitle()
|
||||
{
|
||||
return SystemString(m_appView->Title.Data());
|
||||
return SystemString(m_appView->Title->Data());
|
||||
}
|
||||
|
||||
void setTitle(SystemStringView title)
|
||||
{
|
||||
m_appView->Title = title.data();
|
||||
m_appView->Title = ref new Platform::String(title.data());
|
||||
}
|
||||
|
||||
void setCursor(EMouseCursor cursor)
|
||||
|
@ -315,18 +336,18 @@ public:
|
|||
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const
|
||||
{
|
||||
xOut = m_coreWindow->bounds.X;
|
||||
yOut = m_coreWindow->bounds.Y;
|
||||
wOut = m_coreWindow->bounds.Width;
|
||||
hOut = m_coreWindow->bounds.Height;
|
||||
xOut = m_coreWindow->Bounds.X;
|
||||
yOut = m_coreWindow->Bounds.Y;
|
||||
wOut = m_coreWindow->Bounds.Width;
|
||||
hOut = m_coreWindow->Bounds.Height;
|
||||
}
|
||||
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const
|
||||
{
|
||||
xOut = m_coreWindow->bounds.X;
|
||||
yOut = m_coreWindow->bounds.Y;
|
||||
wOut = m_coreWindow->bounds.Width;
|
||||
hOut = m_coreWindow->bounds.Height;
|
||||
xOut = m_coreWindow->Bounds.X;
|
||||
yOut = m_coreWindow->Bounds.Y;
|
||||
wOut = m_coreWindow->Bounds.Width;
|
||||
hOut = m_coreWindow->Bounds.Height;
|
||||
}
|
||||
|
||||
void setWindowFrame(float x, float y, float w, float h)
|
||||
|
@ -339,8 +360,8 @@ public:
|
|||
|
||||
float getVirtualPixelFactor() const
|
||||
{
|
||||
DisplayInformation dispInfo = DisplayInformation::GetForCurrentView();
|
||||
return dispInfo.LogicalDpi / 96.f;
|
||||
DisplayInformation^ dispInfo = DisplayInformation::GetForCurrentView();
|
||||
return dispInfo->LogicalDpi / 96.f;
|
||||
}
|
||||
|
||||
bool isFullscreen() const
|
||||
|
@ -359,6 +380,7 @@ public:
|
|||
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz)
|
||||
|
@ -383,12 +405,10 @@ public:
|
|||
}
|
||||
|
||||
void OnKeyDown(CoreWindow^ window, KeyEventArgs^ keyEventArgs)
|
||||
{
|
||||
if (auto w = m_window.lock())
|
||||
{
|
||||
ESpecialKey specialKey;
|
||||
EModifierKey modifierKey;
|
||||
uint32_t charCode = translateKeysym(keyEventArgs->VirtualKey, specialKey, modifierKey);
|
||||
uint32_t charCode = translateKeysym(m_coreWindow, keyEventArgs->VirtualKey, specialKey, modifierKey);
|
||||
EModifierKey modifierMask = translateModifiers(window);
|
||||
bool repeat = keyEventArgs->KeyStatus.RepeatCount > 1;
|
||||
if (charCode)
|
||||
|
@ -398,23 +418,19 @@ public:
|
|||
else if (modifierKey != EModifierKey::None)
|
||||
m_callback->modKeyDown(modifierKey, repeat);
|
||||
}
|
||||
}
|
||||
|
||||
void OnKeyUp(CoreWindow^ window, KeyEventArgs^ keyEventArgs)
|
||||
{
|
||||
if (auto w = m_window.lock())
|
||||
{
|
||||
ESpecialKey specialKey;
|
||||
EModifierKey modifierKey;
|
||||
uint32_t charCode = translateKeysym(keyEventArgs->VirtualKey, specialKey, modifierKey);
|
||||
uint32_t charCode = translateKeysym(m_coreWindow, keyEventArgs->VirtualKey, specialKey, modifierKey);
|
||||
EModifierKey modifierMask = translateModifiers(window);
|
||||
if (charCode)
|
||||
m_callback->charKeyDown(charCode, modifierMask);
|
||||
m_callback->charKeyUp(charCode, modifierMask);
|
||||
else if (specialKey != ESpecialKey::None)
|
||||
m_callback->specialKeyDown(specialKey, modifierMask);
|
||||
m_callback->specialKeyUp(specialKey, modifierMask);
|
||||
else if (modifierKey != EModifierKey::None)
|
||||
m_callback->modKeyDown(modifierKey);
|
||||
}
|
||||
m_callback->modKeyUp(modifierKey);
|
||||
}
|
||||
|
||||
void OnClosed(CoreWindow ^sender, CoreWindowEventArgs ^args)
|
||||
|
@ -459,7 +475,7 @@ public:
|
|||
|
||||
};
|
||||
|
||||
std::shared_ptr<IWindow> _WindowUAPNew(SystemStringView title, Boo3DAppContext& d3dCtx,
|
||||
std::shared_ptr<IWindow> _WindowUWPNew(SystemStringView title, Boo3DAppContextUWP& d3dCtx,
|
||||
uint32_t sampleCount)
|
||||
{
|
||||
return std::make_shared<WindowUWP>(title, d3dCtx, sampleCount);
|
||||
|
|
2
logvisor
2
logvisor
|
@ -1 +1 @@
|
|||
Subproject commit 59741b63b88ce6c1135733a326e3cbfaf8d22e0c
|
||||
Subproject commit 408ae926d76128fa23a12607d0a1e0a970ab3554
|
|
@ -336,6 +336,7 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
/* Make shader pipeline */
|
||||
boo::ObjToken<IShaderPipeline> pipeline;
|
||||
auto plat = ctx.platform();
|
||||
#if BOO_HAS_GL
|
||||
if (plat == IGraphicsDataFactory::Platform::OpenGL)
|
||||
{
|
||||
GLDataFactory::Context& glF = dynamic_cast<GLDataFactory::Context&>(ctx);
|
||||
|
@ -369,9 +370,10 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
BlendFactor::One, BlendFactor::Zero,
|
||||
Primitive::TriStrips, boo::ZTest::LEqual,
|
||||
true, true, false, CullMode::None);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#if BOO_HAS_VULKAN
|
||||
else if (plat == IGraphicsDataFactory::Platform::Vulkan)
|
||||
if (plat == IGraphicsDataFactory::Platform::Vulkan)
|
||||
{
|
||||
VulkanDataFactory::Context& vkF = dynamic_cast<VulkanDataFactory::Context&>(ctx);
|
||||
|
||||
|
@ -402,10 +404,10 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
pipeline = vkF.newShaderPipeline(VS, FS, vfmt, BlendFactor::One, BlendFactor::Zero,
|
||||
Primitive::TriStrips, boo::ZTest::LEqual,
|
||||
true, true, false, CullMode::None);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#if _WIN32
|
||||
else if (plat == IGraphicsDataFactory::Platform::D3D12 ||
|
||||
if (plat == IGraphicsDataFactory::Platform::D3D12 ||
|
||||
plat == IGraphicsDataFactory::Platform::D3D11)
|
||||
{
|
||||
ID3DDataFactory::Context& d3dF = dynamic_cast<ID3DDataFactory::Context&>(ctx);
|
||||
|
@ -434,9 +436,9 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
BlendFactor::One, BlendFactor::Zero,
|
||||
Primitive::TriStrips, boo::ZTest::LEqual,
|
||||
true, true, false, CullMode::None);
|
||||
}
|
||||
} else
|
||||
#elif BOO_HAS_METAL
|
||||
else if (plat == IGraphicsDataFactory::Platform::Metal)
|
||||
if (plat == IGraphicsDataFactory::Platform::Metal)
|
||||
{
|
||||
MetalDataFactory::Context& metalF = dynamic_cast<MetalDataFactory::Context&>(ctx);
|
||||
|
||||
|
@ -466,8 +468,9 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
pipeline = metalF.newShaderPipeline(VS, FS, nullptr, nullptr, vfmt, 1,
|
||||
BlendFactor::One, BlendFactor::Zero, Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, true, true, true, boo::CullMode::None);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{}
|
||||
|
||||
/* Make shader data binding */
|
||||
self->m_binding =
|
||||
|
@ -581,6 +584,7 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
|
||||
}
|
||||
|
||||
#if !WINDOWS_STORE
|
||||
#if _WIN32
|
||||
int wmain(int argc, const boo::SystemChar** argv)
|
||||
#else
|
||||
|
@ -596,7 +600,7 @@ int main(int argc, const boo::SystemChar** argv)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if WINAPI_FAMILY && !WINAPI_PARTITION_DESKTOP
|
||||
#else
|
||||
using namespace Windows::ApplicationModel::Core;
|
||||
|
||||
[Platform::MTAThread]
|
||||
|
@ -605,12 +609,14 @@ int WINAPIV main(Platform::Array<Platform::String^>^ params)
|
|||
logvisor::RegisterStandardExceptions();
|
||||
logvisor::RegisterConsoleLogger();
|
||||
boo::TestApplicationCallback appCb;
|
||||
auto viewProvider = ref new ViewProvider(appCb, _S("boo"), _S("boo"), params, false);
|
||||
boo::ViewProvider^ viewProvider =
|
||||
ref new boo::ViewProvider(appCb, _S("boo"), _S("boo"), _S("boo"), params, false);
|
||||
CoreApplication::Run(viewProvider);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif _WIN32
|
||||
#if _WIN32 && !WINDOWS_STORE
|
||||
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int)
|
||||
{
|
||||
int argc = 0;
|
||||
|
|
Loading…
Reference in New Issue