diff options
author | Andrew Knight <andrew.knight@digia.com> | 2013-10-01 09:44:12 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-02 12:36:10 +0200 |
commit | 11a2226cfe336a0d3cbed5ff090dcc657911a8ef (patch) | |
tree | 0f064a3021094d9ea7f975db75b9de4cfaa742cd /src/3rdparty/angle/src/libGLESv2/utilities.cpp | |
parent | 8cbc90ffb238146f2a9c3217bdf687c9535c5f9b (diff) |
ANGLE: Support WinRT
This enables EGL for WinRT's native types, and adjusts some codepaths
to accommodate differences in between desktop Windows and WinRT.
- WinRT native handles added to eglplatform.h
- References to native handles in libEGL/libGLESv2 follow eglplatform.h
- D3D 11.1 structures and methods used when necessary
- TLS replaced with thread attribute
- LocalAlloc/Free replaced with Heap API
Change-Id: Ia90377e700d335a1c569c2145008dd4b0dfd84d3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/3rdparty/angle/src/libGLESv2/utilities.cpp')
-rw-r--r-- | src/3rdparty/angle/src/libGLESv2/utilities.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/3rdparty/angle/src/libGLESv2/utilities.cpp b/src/3rdparty/angle/src/libGLESv2/utilities.cpp index 32df49e672..8fd193b164 100644 --- a/src/3rdparty/angle/src/libGLESv2/utilities.cpp +++ b/src/3rdparty/angle/src/libGLESv2/utilities.cpp @@ -10,6 +10,14 @@ #include "libGLESv2/utilities.h" #include "libGLESv2/mathutil.h" +#if defined(ANGLE_OS_WINRT) +#include <locale> +#include <codecvt> +#include <wrl.h> +#include <windows.storage.h> +using namespace ABI::Windows::Storage; +#endif + namespace gl { @@ -737,7 +745,50 @@ bool IsTriangleMode(GLenum drawMode) std::string getTempPath() { +#if defined(ANGLE_OS_WINRT) + + static std::string path; + + while (path.empty()) { + IApplicationDataStatics *applicationDataFactory; + HRESULT result = RoGetActivationFactory(Microsoft::WRL::Wrappers::HStringReference(RuntimeClass_Windows_Storage_ApplicationData).Get(), + IID_PPV_ARGS(&applicationDataFactory)); + if (FAILED(result)) + break; + + IApplicationData *applicationData; + result = applicationDataFactory->get_Current(&applicationData); + if (FAILED(result)) + break; + + IStorageFolder *storageFolder; + result = applicationData->get_LocalFolder(&storageFolder); + if (FAILED(result)) + break; + + IStorageItem *localFolder; + result = storageFolder->QueryInterface(IID_PPV_ARGS(&localFolder)); + if (FAILED(result)) + break; + + HSTRING localFolderPath; + result = localFolder->get_Path(&localFolderPath); + if (FAILED(result)) + break; + + std::wstring_convert< std::codecvt_utf8<wchar_t> > converter; + path = converter.to_bytes(WindowsGetStringRawBuffer(localFolderPath, NULL)); + if (path.empty()) + { + UNREACHABLE(); + break; + } + } + +#else + char path[MAX_PATH]; + DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path); if (pathLen == 0) { @@ -751,6 +802,8 @@ std::string getTempPath() UNREACHABLE(); return std::string(); } + +#endif return path; } |