Hash :
39b11018
Author :
Date :
2016-08-22T13:42:30
Remove Windows 8.1 (Store apps) and Windows Phone 8.1 support ANGLE has moved onto the Windows 10 SDK, and is using new compiler features that aren't supported by the old Windows 8.1 toolchain. Support for the 8.1 projects has been broken in master for some time now. Since more and more developers are moving towards Windows 10, we are going to take a snapshot of ANGLE that includes 8.1 support and freeze it in a branch on github.com/microsoft/angle. If developers wish to compile for use ANGLE in 8.1 apps then they should use that branch going forward. Change-Id: Ifee2d8a8cc0332500e0bd338911d831e7624fa82 Reviewed-on: https://chromium-review.googlesource.com/374039 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Trim11.cpp: Trim support utility class.
#include "libANGLE/renderer/d3d/d3d11/Trim11.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#if defined (ANGLE_ENABLE_WINDOWS_STORE)
#include <wrl.h>
#include <wrl/wrappers/corewrappers.h>
#include <windows.applicationmodel.core.h>
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
using namespace ABI::Windows::ApplicationModel;
using namespace ABI::Windows::ApplicationModel::Core;
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::Foundation::Collections;
#endif
namespace rx
{
Trim11::Trim11(rx::Renderer11 *renderer)
: mRenderer(renderer)
{
bool result = true;
result = registerForRendererTrimRequest();
ASSERT(result);
}
Trim11::~Trim11()
{
unregisterForRendererTrimRequest();
}
void Trim11::trim()
{
if (!mRenderer)
{
return;
}
#if defined (ANGLE_ENABLE_WINDOWS_STORE)
ID3D11Device* device = mRenderer->getDevice();
IDXGIDevice3 *dxgiDevice3 = d3d11::DynamicCastComObject<IDXGIDevice3>(device);
if (dxgiDevice3)
{
dxgiDevice3->Trim();
}
SafeRelease(dxgiDevice3);
#endif
}
bool Trim11::registerForRendererTrimRequest()
{
#if defined (ANGLE_ENABLE_WINDOWS_STORE)
ICoreApplication* coreApplication = nullptr;
HRESULT result = GetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), &coreApplication);
if (SUCCEEDED(result))
{
auto suspendHandler = Callback<IEventHandler<SuspendingEventArgs*>>(
[this](IInspectable*, ISuspendingEventArgs*) -> HRESULT
{
trim();
return S_OK;
});
result = coreApplication->add_Suspending(suspendHandler.Get(), &mApplicationSuspendedEventToken);
}
SafeRelease(coreApplication);
if (FAILED(result))
{
return false;
}
#endif
return true;
}
void Trim11::unregisterForRendererTrimRequest()
{
#if defined (ANGLE_ENABLE_WINDOWS_STORE)
if (mApplicationSuspendedEventToken.value != 0)
{
ICoreApplication* coreApplication = nullptr;
if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), &coreApplication)))
{
coreApplication->remove_Suspending(mApplicationSuspendedEventToken);
}
mApplicationSuspendedEventToken.value = 0;
SafeRelease(coreApplication);
}
#endif
}
}