summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt')
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp208
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h90
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp297
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h136
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp126
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h51
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp359
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h93
8 files changed, 0 insertions, 1360 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp
deleted file mode 100644
index 1ef90e7b09..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-//
-// 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.
-//
-
-// CoreWindowNativeWindow.cpp: NativeWindow for managing ICoreWindow native window types.
-
-#include "libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h"
-
-#include <windows.graphics.display.h>
-
-using namespace ABI::Windows::Foundation::Collections;
-
-namespace rx
-{
-CoreWindowNativeWindow::~CoreWindowNativeWindow()
-{
- unregisterForSizeChangeEvents();
-}
-
-bool CoreWindowNativeWindow::initialize(EGLNativeWindowType window, IPropertySet *propertySet)
-{
- ComPtr<IPropertySet> props = propertySet;
- ComPtr<IInspectable> win = window;
- SIZE swapChainSize = {};
- HRESULT result = S_OK;
-
- // IPropertySet is an optional parameter and can be null.
- // If one is specified, cache as an IMap and read the properties
- // used for initial host initialization.
- if (propertySet)
- {
- result = props.As(&mPropertyMap);
- if (FAILED(result))
- {
- return false;
- }
-
- // The EGLRenderSurfaceSizeProperty is optional and may be missing. The IPropertySet
- // was prevalidated to contain the EGLNativeWindowType before being passed to
- // this host.
- result = GetOptionalSizePropertyValue(mPropertyMap, EGLRenderSurfaceSizeProperty, &swapChainSize, &mSwapChainSizeSpecified);
- if (FAILED(result))
- {
- return false;
- }
-
- // The EGLRenderResolutionScaleProperty is optional and may be missing. The IPropertySet
- // was prevalidated to contain the EGLNativeWindowType before being passed to
- // this host.
- result = GetOptionalSinglePropertyValue(mPropertyMap, EGLRenderResolutionScaleProperty, &mSwapChainScale, &mSwapChainScaleSpecified);
- if (FAILED(result))
- {
- return false;
- }
-
- if (!mSwapChainScaleSpecified)
- {
- // Default value for the scale is 1.0f
- mSwapChainScale = 1.0f;
- }
-
- // A EGLRenderSurfaceSizeProperty and a EGLRenderResolutionScaleProperty can't both be specified
- if (mSwapChainScaleSpecified && mSwapChainSizeSpecified)
- {
- ERR() << "It is invalid to specify both an EGLRenderSurfaceSizeProperty and a "
- "EGLRenderResolutionScaleProperty.";
- return false;
- }
- }
-
- if (SUCCEEDED(result))
- {
- result = win.As(&mCoreWindow);
- }
-
- if (SUCCEEDED(result))
- {
- // If a swapchain size is specfied, then the automatic resize
- // behaviors implemented by the host should be disabled. The swapchain
- // will be still be scaled when being rendered to fit the bounds
- // of the host.
- // Scaling of the swapchain output occurs automatically because if
- // the scaling mode setting DXGI_SCALING_STRETCH on the swapchain.
- if (mSwapChainSizeSpecified)
- {
- mClientRect = { 0, 0, swapChainSize.cx, swapChainSize.cy };
- }
- else
- {
- Size coreWindowSize;
- result = GetCoreWindowSizeInPixels(mCoreWindow, &coreWindowSize);
-
- if (SUCCEEDED(result))
- {
- mClientRect = clientRect(coreWindowSize);
- }
- }
- }
-
- if (SUCCEEDED(result))
- {
- mNewClientRect = mClientRect;
- mClientRectChanged = false;
- return registerForSizeChangeEvents();
- }
-
- return false;
-}
-
-bool CoreWindowNativeWindow::registerForSizeChangeEvents()
-{
- ComPtr<IWindowSizeChangedEventHandler> sizeChangedHandler;
- HRESULT result = Microsoft::WRL::MakeAndInitialize<CoreWindowSizeChangedHandler>(sizeChangedHandler.ReleaseAndGetAddressOf(), this->shared_from_this());
- if (SUCCEEDED(result))
- {
- result = mCoreWindow->add_SizeChanged(sizeChangedHandler.Get(), &mSizeChangedEventToken);
- }
-
- if (SUCCEEDED(result))
- {
- return true;
- }
-
- return false;
-}
-
-void CoreWindowNativeWindow::unregisterForSizeChangeEvents()
-{
- if (mCoreWindow)
- {
- (void)mCoreWindow->remove_SizeChanged(mSizeChangedEventToken);
- }
- mSizeChangedEventToken.value = 0;
-}
-
-HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device,
- IDXGIFactory2 *factory,
- DXGI_FORMAT format,
- unsigned int width,
- unsigned int height,
- bool containsAlpha,
- IDXGISwapChain1 **swapChain)
-{
- if (device == nullptr || factory == nullptr || swapChain == nullptr || width == 0 ||
- height == 0)
- {
- return E_INVALIDARG;
- }
-
- DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 };
- swapChainDesc.Width = width;
- swapChainDesc.Height = height;
- swapChainDesc.Format = format;
- swapChainDesc.Stereo = FALSE;
- swapChainDesc.SampleDesc.Count = 1;
- swapChainDesc.SampleDesc.Quality = 0;
- swapChainDesc.BufferUsage =
- DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER;
- swapChainDesc.BufferCount = 2;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
- swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
- swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;
-
- *swapChain = nullptr;
-
- ComPtr<IDXGISwapChain1> newSwapChain;
- HRESULT result = factory->CreateSwapChainForCoreWindow(device, mCoreWindow.Get(), &swapChainDesc, nullptr, newSwapChain.ReleaseAndGetAddressOf());
- if (SUCCEEDED(result))
- {
- result = newSwapChain.CopyTo(swapChain);
- }
-
- if (SUCCEEDED(result))
- {
- // If automatic swapchain resize behaviors have been disabled, then
- // unregister for the resize change events.
- if (mSupportsSwapChainResize == false)
- {
- unregisterForSizeChangeEvents();
- }
- }
-
- return result;
-}
-
-inline HRESULT CoreWindowNativeWindow::scaleSwapChain(const Size &windowSize,
- const RECT &clientRect)
-{
- // We don't need to do any additional work to scale CoreWindow swapchains.
- // Using DXGI_SCALING_STRETCH to create the swapchain above does all the necessary work.
- return S_OK;
-}
-
-HRESULT GetCoreWindowSizeInPixels(const ComPtr<ABI::Windows::UI::Core::ICoreWindow> &coreWindow,
- Size *windowSize)
-{
- ABI::Windows::Foundation::Rect bounds;
- HRESULT result = coreWindow->get_Bounds(&bounds);
- if (SUCCEEDED(result))
- {
- *windowSize = { ConvertDipsToPixels(bounds.Width), ConvertDipsToPixels(bounds.Height) };
- }
-
- return result;
-}
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h
deleted file mode 100644
index 21855c2c3b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h
+++ /dev/null
@@ -1,90 +0,0 @@
-//
-// 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.
-//
-
-// CoreWindowNativeWindow.h: NativeWindow for managing ICoreWindow native window types.
-
-#ifndef LIBANGLE_RENDERER_D3D_D3D11_WINRT_COREWINDOWNATIVEWINDOW_H_
-#define LIBANGLE_RENDERER_D3D_D3D11_WINRT_COREWINDOWNATIVEWINDOW_H_
-
-#include "libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h"
-
-#include <memory>
-
-#include <EGL/eglplatform.h>
-
-typedef ABI::Windows::Foundation::__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowSizeChangedEventArgs_t IWindowSizeChangedEventHandler;
-
-namespace rx
-{
-class CoreWindowNativeWindow : public InspectableNativeWindow, public std::enable_shared_from_this<CoreWindowNativeWindow>
-{
- public:
- ~CoreWindowNativeWindow();
-
- bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) override;
- HRESULT createSwapChain(ID3D11Device *device,
- IDXGIFactory2 *factory,
- DXGI_FORMAT format,
- unsigned int width,
- unsigned int height,
- bool containsAlpha,
- IDXGISwapChain1 **swapChain) override;
-
- protected:
- HRESULT scaleSwapChain(const Size &windowSize, const RECT &clientRect) override;
-
- bool registerForSizeChangeEvents();
- void unregisterForSizeChangeEvents();
-
- private:
- ComPtr<ABI::Windows::UI::Core::ICoreWindow> mCoreWindow;
- ComPtr<IMap<HSTRING, IInspectable*>> mPropertyMap;
-};
-
-[uuid(7F924F66-EBAE-40E5-A10B-B8F35E245190)]
-class CoreWindowSizeChangedHandler :
- public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, IWindowSizeChangedEventHandler>
-{
- public:
- CoreWindowSizeChangedHandler() { }
- HRESULT RuntimeClassInitialize(std::shared_ptr<InspectableNativeWindow> host)
- {
- if (!host)
- {
- return E_INVALIDARG;
- }
-
- mHost = host;
- return S_OK;
- }
-
- // IWindowSizeChangedEventHandler
- IFACEMETHOD(Invoke)(ABI::Windows::UI::Core::ICoreWindow *sender, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *sizeChangedEventArgs)
- {
- std::shared_ptr<InspectableNativeWindow> host = mHost.lock();
- if (host)
- {
- ABI::Windows::Foundation::Size windowSize;
- if (SUCCEEDED(sizeChangedEventArgs->get_Size(&windowSize)))
- {
- Size windowSizeInPixels = {ConvertDipsToPixels(windowSize.Width),
- ConvertDipsToPixels(windowSize.Height)};
- host->setNewClientSize(windowSizeInPixels);
- }
- }
-
- return S_OK;
- }
-
- private:
- std::weak_ptr<InspectableNativeWindow> mHost;
-};
-
-HRESULT GetCoreWindowSizeInPixels(const ComPtr<ABI::Windows::UI::Core::ICoreWindow> &coreWindow,
- Size *windowSize);
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_WINRT_COREWINDOWNATIVEWINDOW_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
deleted file mode 100644
index 1bd796e58f..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-//
-// 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.
-//
-
-// InspectableNativeWindow.cpp: NativeWindow base class for managing IInspectable native window types.
-
-#include "libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h"
-#include "libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h"
-
-namespace rx
-{
-
-bool IsCoreWindow(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Core::ICoreWindow> *coreWindow)
-{
- if (!window)
- {
- return false;
- }
-
- ComPtr<IInspectable> win = window;
- ComPtr<ABI::Windows::UI::Core::ICoreWindow> coreWin;
- if (SUCCEEDED(win.As(&coreWin)))
- {
- if (coreWindow != nullptr)
- {
- *coreWindow = coreWin;
- }
- return true;
- }
-
- return false;
-}
-
-bool IsSwapChainPanel(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> *swapChainPanel)
-{
- if (!window)
- {
- return false;
- }
-
- ComPtr<IInspectable> win = window;
- ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> panel;
- if (SUCCEEDED(win.As(&panel)))
- {
- if (swapChainPanel != nullptr)
- {
- *swapChainPanel = panel;
- }
- return true;
- }
-
- return false;
-}
-
-bool IsEGLConfiguredPropertySet(EGLNativeWindowType window, ABI::Windows::Foundation::Collections::IPropertySet **propertySet, IInspectable **eglNativeWindow)
-{
- if (!window)
- {
- return false;
- }
-
- ComPtr<IInspectable> props = window;
- ComPtr<IPropertySet> propSet;
- ComPtr<IInspectable> nativeWindow;
- ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> propMap;
- boolean hasEglNativeWindowPropertyKey = false;
-
- HRESULT result = props.As(&propSet);
- if (SUCCEEDED(result))
- {
- result = propSet.As(&propMap);
- }
-
- // Look for the presence of the EGLNativeWindowType in the property set
- if (SUCCEEDED(result))
- {
- result = propMap->HasKey(HStringReference(EGLNativeWindowTypeProperty).Get(), &hasEglNativeWindowPropertyKey);
- }
-
- // If the IPropertySet does not contain the required EglNativeWindowType key, the property set is
- // considered invalid.
- if (SUCCEEDED(result) && !hasEglNativeWindowPropertyKey)
- {
- ERR() << "Could not find EGLNativeWindowTypeProperty in IPropertySet. Valid "
- "EGLNativeWindowTypeProperty values include ICoreWindow";
- return false;
- }
-
- // The EglNativeWindowType property exists, so retreive the IInspectable that represents the EGLNativeWindowType
- if (SUCCEEDED(result) && hasEglNativeWindowPropertyKey)
- {
- result = propMap->Lookup(HStringReference(EGLNativeWindowTypeProperty).Get(), &nativeWindow);
- }
-
- if (SUCCEEDED(result))
- {
- if (propertySet != nullptr)
- {
- result = propSet.CopyTo(propertySet);
- }
- }
-
- if (SUCCEEDED(result))
- {
- if (eglNativeWindow != nullptr)
- {
- result = nativeWindow.CopyTo(eglNativeWindow);
- }
- }
-
- if (SUCCEEDED(result))
- {
- return true;
- }
-
- return false;
-}
-
-// Retrieve an optional property from a property set
-HRESULT GetOptionalPropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
- const wchar_t *propertyName,
- boolean *hasKey,
- ComPtr<ABI::Windows::Foundation::IPropertyValue> &propertyValue)
-{
- if (!propertyMap || !hasKey)
- {
- return E_INVALIDARG;
- }
-
- // Assume that the value does not exist
- *hasKey = false;
-
- HRESULT result = propertyMap->HasKey(HStringReference(propertyName).Get(), hasKey);
- if (SUCCEEDED(result) && !(*hasKey))
- {
- // Value does not exist, so return S_OK and set the exists parameter to false to indicate
- // that a the optional property does not exist.
- return S_OK;
- }
-
- if (SUCCEEDED(result))
- {
- result = propertyMap->Lookup(HStringReference(propertyName).Get(), &propertyValue);
- }
-
- return result;
-}
-
-// Attempts to read an optional SIZE property value that is assumed to be in the form of
-// an ABI::Windows::Foundation::Size. This function validates the Size value before returning
-// it to the caller.
-//
-// Possible return values are:
-// S_OK, valueExists == true - optional SIZE value was successfully retrieved and validated
-// S_OK, valueExists == false - optional SIZE value was not found
-// E_INVALIDARG, valueExists = false - optional SIZE value was malformed in the property set.
-// * Incorrect property type ( must be PropertyType_Size)
-// * Invalid property value (width/height must be > 0)
-// Additional errors may be returned from IMap or IPropertyValue
-//
-HRESULT GetOptionalSizePropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
- const wchar_t *propertyName, SIZE *value, bool *valueExists)
-{
- ComPtr<ABI::Windows::Foundation::IPropertyValue> propertyValue;
- ABI::Windows::Foundation::PropertyType propertyType = ABI::Windows::Foundation::PropertyType::PropertyType_Empty;
- Size sizeValue = { 0, 0 };
- boolean hasKey = false;
-
- if (!propertyMap || !value || !valueExists)
- {
- return E_INVALIDARG;
- }
-
- // Assume that the value does not exist
- *valueExists = false;
- *value = { 0, 0 };
-
- HRESULT result = GetOptionalPropertyValue(propertyMap, propertyName, &hasKey, propertyValue);
- if (SUCCEEDED(result) && hasKey)
- {
- result = propertyValue->get_Type(&propertyType);
-
- // Check if the expected Size property is of PropertyType_Size type.
- if (SUCCEEDED(result) && propertyType == ABI::Windows::Foundation::PropertyType::PropertyType_Size)
- {
- if (SUCCEEDED(propertyValue->GetSize(&sizeValue)) && (sizeValue.Width > 0 && sizeValue.Height > 0))
- {
- // A valid property value exists
- *value = { static_cast<long>(sizeValue.Width), static_cast<long>(sizeValue.Height) };
- *valueExists = true;
- result = S_OK;
- }
- else
- {
- // An invalid Size property was detected. Width/Height values must > 0
- result = E_INVALIDARG;
- }
- }
- else
- {
- // An invalid property type was detected. Size property must be of PropertyType_Size
- result = E_INVALIDARG;
- }
- }
-
- return result;
-}
-
-// Attempts to read an optional float property value that is assumed to be in the form of
-// an ABI::Windows::Foundation::Single. This function validates the Single value before returning
-// it to the caller.
-//
-// Possible return values are:
-// S_OK, valueExists == true - optional Single value was successfully retrieved and validated
-// S_OK, valueExists == false - optional Single value was not found
-// E_INVALIDARG, valueExists = false - optional Single value was malformed in the property set.
-// * Incorrect property type ( must be PropertyType_Single)
-// * Invalid property value (must be > 0)
-// Additional errors may be returned from IMap or IPropertyValue
-//
-HRESULT GetOptionalSinglePropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
- const wchar_t *propertyName, float *value, bool *valueExists)
-{
- ComPtr<ABI::Windows::Foundation::IPropertyValue> propertyValue;
- ABI::Windows::Foundation::PropertyType propertyType = ABI::Windows::Foundation::PropertyType::PropertyType_Empty;
- float scaleValue = 0.0f;
- boolean hasKey = false;
-
- if (!propertyMap || !value || !valueExists)
- {
- return E_INVALIDARG;
- }
-
- // Assume that the value does not exist
- *valueExists = false;
- *value = 0.0f;
-
- HRESULT result = GetOptionalPropertyValue(propertyMap, propertyName, &hasKey, propertyValue);
- if (SUCCEEDED(result) && hasKey)
- {
- result = propertyValue->get_Type(&propertyType);
-
- // Check if the expected Scale property is of PropertyType_Single type.
- if (SUCCEEDED(result) && propertyType == ABI::Windows::Foundation::PropertyType::PropertyType_Single)
- {
- if (SUCCEEDED(propertyValue->GetSingle(&scaleValue)) && (scaleValue > 0.0f))
- {
- // A valid property value exists
- *value = scaleValue;
- *valueExists = true;
- result = S_OK;
- }
- else
- {
- // An invalid scale was set
- result = E_INVALIDARG;
- }
- }
- else
- {
- // An invalid property type was detected. Size property must be of PropertyType_Single
- result = E_INVALIDARG;
- }
- }
-
- return result;
-}
-
-RECT InspectableNativeWindow::clientRect(const Size &size)
-{
- return {0, 0, static_cast<long>(ConvertDipsToPixels(size.Width)),
- static_cast<long>(ConvertDipsToPixels(size.Height))};
-}
-
-float GetLogicalDpi()
-{
- ComPtr<ABI::Windows::Graphics::Display::IDisplayPropertiesStatics> displayProperties;
- float dpi = 96.0f;
-
- if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), displayProperties.GetAddressOf())))
- {
- if (SUCCEEDED(displayProperties->get_LogicalDpi(&dpi)))
- {
- return dpi;
- }
- }
- return dpi;
-}
-
-float ConvertDipsToPixels(float dips)
-{
- static const float dipsPerInch = 96.0f;
- return lround((dips * GetLogicalDpi() / dipsPerInch));
-}
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h
deleted file mode 100644
index d81c3e5fb9..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h
+++ /dev/null
@@ -1,136 +0,0 @@
-//
-// 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.
-//
-
-// InspectableNativeWindow.h: Host specific implementation interface for
-// managing IInspectable native window types.
-
-#ifndef LIBANGLE_RENDERER_D3D_D3D11_WINRT_INSPECTABLENATIVEWINDOW_H_
-#define LIBANGLE_RENDERER_D3D_D3D11_WINRT_INSPECTABLENATIVEWINDOW_H_
-
-#include "common/debug.h"
-#include "common/platform.h"
-
-#include "angle_windowsstore.h"
-
-#include <EGL/eglplatform.h>
-
-#include <windows.applicationmodel.core.h>
-#include <windows.ui.xaml.h>
-#include <windows.ui.xaml.media.dxinterop.h>
-#include <wrl.h>
-#include <wrl/wrappers/corewrappers.h>
-
-using namespace Microsoft::WRL;
-using namespace Microsoft::WRL::Wrappers;
-using namespace ABI::Windows::Foundation;
-using namespace ABI::Windows::Foundation::Collections;
-
-namespace rx
-{
-float ConvertDipsToPixels(float dips);
-float GetLogicalDpi();
-
-class InspectableNativeWindow
-{
- public:
- InspectableNativeWindow() :
- mSupportsSwapChainResize(true),
- mSwapChainSizeSpecified(false),
- mSwapChainScaleSpecified(false),
- mClientRectChanged(false),
- mClientRect({0,0,0,0}),
- mNewClientRect({0,0,0,0})
- {
- mSizeChangedEventToken.value = 0;
- mSwapChainScale = 96.0f / GetLogicalDpi();
- if (mSwapChainScale != 1.0f)
- mSwapChainScaleSpecified = true;
- }
- virtual ~InspectableNativeWindow(){}
-
- virtual bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) = 0;
- virtual HRESULT createSwapChain(ID3D11Device *device,
- IDXGIFactory2 *factory,
- DXGI_FORMAT format,
- unsigned int width,
- unsigned int height,
- bool containsAlpha,
- IDXGISwapChain1 **swapChain) = 0;
-
- bool getClientRect(RECT *rect)
- {
- if (mClientRectChanged)
- {
- mClientRect = mNewClientRect;
- }
-
- *rect = mClientRect;
-
- return true;
- }
-
- // setNewClientSize is used by the WinRT size change handler. It isn't used by the rest of ANGLE.
- void setNewClientSize(const Size &newWindowSize)
- {
- // If the client doesn't support swapchain resizing then we should have already unregistered from size change handler
- ASSERT(mSupportsSwapChainResize);
-
- if (mSupportsSwapChainResize)
- {
- // If the swapchain size was specified then we should ignore this call too
- if (!mSwapChainSizeSpecified)
- {
- mNewClientRect = clientRect(newWindowSize);
- mClientRectChanged = true;
-
- // If a scale was specified, then now is the time to apply the scale matrix for the new swapchain size and window size
- if (mSwapChainScaleSpecified)
- {
- scaleSwapChain(newWindowSize, mNewClientRect);
- }
- }
-
- // Even if the swapchain size was fixed, the window might have changed size.
- // In this case, we should recalculate the scale matrix to account for the new window size
- if (mSwapChainSizeSpecified)
- {
- scaleSwapChain(newWindowSize, mClientRect);
- }
- }
- }
-
- protected:
- virtual HRESULT scaleSwapChain(const Size &windowSize, const RECT &clientRect) = 0;
- RECT clientRect(const Size &size);
-
- bool mSupportsSwapChainResize; // Support for IDXGISwapChain::ResizeBuffers method
- bool mSwapChainSizeSpecified; // If an EGLRenderSurfaceSizeProperty was specified
- bool mSwapChainScaleSpecified; // If an EGLRenderResolutionScaleProperty was specified
- float mSwapChainScale; // The scale value specified by the EGLRenderResolutionScaleProperty property
- RECT mClientRect;
- RECT mNewClientRect;
- bool mClientRectChanged;
-
- EventRegistrationToken mSizeChangedEventToken;
-};
-
-bool IsCoreWindow(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Core::ICoreWindow> *coreWindow = nullptr);
-bool IsSwapChainPanel(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> *swapChainPanel = nullptr);
-bool IsEGLConfiguredPropertySet(EGLNativeWindowType window, ABI::Windows::Foundation::Collections::IPropertySet **propertySet = nullptr, IInspectable **inspectable = nullptr);
-
-HRESULT GetOptionalPropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
- const wchar_t *propertyName,
- boolean *hasKey,
- ComPtr<ABI::Windows::Foundation::IPropertyValue> &propertyValue);
-
-HRESULT GetOptionalSizePropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
- const wchar_t *propertyName, SIZE *value, bool *valueExists);
-
-HRESULT GetOptionalSinglePropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> &propertyMap,
- const wchar_t *propertyName, float *value, bool *valueExists);
-}
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_WINRT_INSPECTABLENATIVEWINDOW_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp
deleted file mode 100644
index 655b23be83..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-// Copyright (c) 2016 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.
-//
-
-// NativeWindow11WinRT.cpp: NativeWindow base class for managing IInspectable native window types.
-
-#include "libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h"
-
-#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
-#include "libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h"
-#include "libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h"
-#include "libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h"
-
-using namespace Microsoft::WRL;
-using namespace Microsoft::WRL::Wrappers;
-
-namespace rx
-{
-NativeWindow11WinRT::NativeWindow11WinRT(EGLNativeWindowType window, bool hasAlpha)
- : NativeWindow11(window), mHasAlpha(hasAlpha)
-{
-}
-
-bool NativeWindow11WinRT::initialize()
-{
- EGLNativeWindowType window = getNativeWindow();
-
- // If the native window type is a IPropertySet, extract the
- // EGLNativeWindowType (IInspectable) and initialize the
- // proper host with this IPropertySet.
- ComPtr<ABI::Windows::Foundation::Collections::IPropertySet> propertySet;
- ComPtr<IInspectable> eglNativeWindow;
- if (IsEGLConfiguredPropertySet(window, &propertySet, &eglNativeWindow))
- {
- // A property set was found and the EGLNativeWindowType was
- // retrieved. The mWindow member of the host to must be updated
- // to use the EGLNativeWindowType specified in the property set.
- // mWindow is treated as a raw pointer not an AddRef'd interface, so
- // the old mWindow does not need a Release() before this assignment.
- window = eglNativeWindow.Get();
- }
-
- ComPtr<ABI::Windows::UI::Core::ICoreWindow> coreWindow;
- ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> swapChainPanel;
- if (IsCoreWindow(window, &coreWindow))
- {
- mImpl = std::make_shared<CoreWindowNativeWindow>();
- if (mImpl)
- {
- return mImpl->initialize(window, propertySet.Get());
- }
- }
- else if (IsSwapChainPanel(window, &swapChainPanel))
- {
- mImpl = std::make_shared<SwapChainPanelNativeWindow>();
- if (mImpl)
- {
- return mImpl->initialize(window, propertySet.Get());
- }
- }
- else
- {
- ERR() << "Invalid IInspectable EGLNativeWindowType detected. Valid IInspectables include "
- "ICoreWindow, ISwapChainPanel and IPropertySet";
- }
-
- return false;
-}
-
-bool NativeWindow11WinRT::getClientRect(LPRECT rect) const
-{
- if (mImpl)
- {
- return mImpl->getClientRect(rect);
- }
-
- return false;
-}
-
-bool NativeWindow11WinRT::isIconic() const
-{
- return false;
-}
-
-HRESULT NativeWindow11WinRT::createSwapChain(ID3D11Device *device,
- IDXGIFactory *factory,
- DXGI_FORMAT format,
- UINT width,
- UINT height,
- UINT samples,
- IDXGISwapChain **swapChain)
-{
- if (mImpl)
- {
- IDXGIFactory2 *factory2 = d3d11::DynamicCastComObject<IDXGIFactory2>(factory);
- IDXGISwapChain1 *swapChain1 = nullptr;
- HRESULT result =
- mImpl->createSwapChain(device, factory2, format, width, height, mHasAlpha, &swapChain1);
- SafeRelease(factory2);
- *swapChain = static_cast<IDXGISwapChain *>(swapChain1);
- return result;
- }
-
- return E_UNEXPECTED;
-}
-
-void NativeWindow11WinRT::commitChange()
-{
-}
-
-// static
-bool NativeWindow11WinRT::IsValidNativeWindow(EGLNativeWindowType window)
-{
- // A Valid EGLNativeWindowType IInspectable can only be:
- //
- // ICoreWindow
- // ISwapChainPanel
- // IPropertySet
- //
- // Anything else will be rejected as an invalid IInspectable.
- return IsCoreWindow(window) || IsSwapChainPanel(window) || IsEGLConfiguredPropertySet(window);
-}
-
-} // namespace rx
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h
deleted file mode 100644
index c4ac997a55..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// Copyright (c) 2016 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.
-//
-
-// NativeWindow11WinRT.h: NativeWindow base class for managing IInspectable native window types.
-
-#ifndef LIBANGLE_RENDERER_D3D_D3D11_WINRT_NATIVEWINDOW11WINRT_H_
-#define LIBANGLE_RENDERER_D3D_D3D11_WINRT_NATIVEWINDOW11WINRT_H_
-
-#include "libANGLE/renderer/d3d/d3d11/NativeWindow11.h"
-
-#include <memory>
-#include <windows.applicationmodel.core.h>
-#include <wrl.h>
-#include <wrl/wrappers/corewrappers.h>
-
-namespace rx
-{
-class InspectableNativeWindow;
-
-class NativeWindow11WinRT : public NativeWindow11
-{
- public:
- NativeWindow11WinRT(EGLNativeWindowType window, bool hasAlpha);
-
- bool initialize() override;
- bool getClientRect(LPRECT rect) const override;
- bool isIconic() const override;
-
- HRESULT createSwapChain(ID3D11Device *device,
- IDXGIFactory *factory,
- DXGI_FORMAT format,
- UINT width,
- UINT height,
- UINT samples,
- IDXGISwapChain **swapChain) override;
-
- void commitChange() override;
-
- static bool IsValidNativeWindow(EGLNativeWindowType window);
-
- private:
- bool mHasAlpha;
- std::shared_ptr<InspectableNativeWindow> mImpl;
-};
-
-} // namespace rx
-
-#endif // LIBANGLE_RENDERER_D3D_D3D11_WINRT_NATIVEWINDOW11WINRT_H_
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp
deleted file mode 100644
index 3425fad95d..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp
+++ /dev/null
@@ -1,359 +0,0 @@
-//
-// 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.
-//
-
-// SwapChainPanelNativeWindow.cpp: NativeWindow for managing ISwapChainPanel native window types.
-
-#include "libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h"
-
-#include <algorithm>
-#include <math.h>
-
-using namespace ABI::Windows::Foundation;
-using namespace ABI::Windows::Foundation::Collections;
-using namespace ABI::Windows::UI::Core;
-using namespace ABI::Windows::UI::Xaml;
-using namespace Microsoft::WRL;
-
-namespace rx
-{
-SwapChainPanelNativeWindow::~SwapChainPanelNativeWindow()
-{
- unregisterForSizeChangeEvents();
-}
-
-template <typename T>
-struct AddFtmBase
-{
- typedef Implements<RuntimeClassFlags<ClassicCom>, T, FtmBase> Type;
-};
-
-template <typename CODE>
-HRESULT RunOnUIThread(CODE &&code, const ComPtr<ICoreDispatcher> &dispatcher)
-{
- ComPtr<IAsyncAction> asyncAction;
- HRESULT result = S_OK;
-
- boolean hasThreadAccess;
- result = dispatcher->get_HasThreadAccess(&hasThreadAccess);
- if (FAILED(result))
- {
- return result;
- }
-
- if (hasThreadAccess)
- {
- return code();
- }
- else
- {
- Event waitEvent(
- CreateEventEx(nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS));
- if (!waitEvent.IsValid())
- {
- return E_FAIL;
- }
-
- HRESULT codeResult = E_FAIL;
- auto handler =
- Callback<AddFtmBase<IDispatchedHandler>::Type>([&codeResult, &code, &waitEvent]
- {
- codeResult = code();
- SetEvent(waitEvent.Get());
- return S_OK;
- });
-
- result = dispatcher->RunAsync(CoreDispatcherPriority_Normal, handler.Get(),
- asyncAction.GetAddressOf());
- if (FAILED(result))
- {
- return result;
- }
-
- auto waitResult = WaitForSingleObjectEx(waitEvent.Get(), 10 * 1000, true);
- if (waitResult != WAIT_OBJECT_0)
- {
- // Wait 10 seconds before giving up. At this point, the application is in an
- // unrecoverable state (probably deadlocked). We therefore terminate the application
- // entirely. This also prevents stack corruption if the async operation is eventually
- // run.
- ERR()
- << "Timeout waiting for async action on UI thread. The UI thread might be blocked.";
- std::terminate();
- return E_FAIL;
- }
-
- return codeResult;
- }
-}
-
-bool SwapChainPanelNativeWindow::initialize(EGLNativeWindowType window, IPropertySet *propertySet)
-{
- ComPtr<IPropertySet> props = propertySet;
- ComPtr<IInspectable> win = window;
- SIZE swapChainSize = {};
- HRESULT result = S_OK;
-
- // IPropertySet is an optional parameter and can be null.
- // If one is specified, cache as an IMap and read the properties
- // used for initial host initialization.
- if (propertySet)
- {
- result = props.As(&mPropertyMap);
- if (FAILED(result))
- {
- return false;
- }
-
- // The EGLRenderSurfaceSizeProperty is optional and may be missing. The IPropertySet
- // was prevalidated to contain the EGLNativeWindowType before being passed to
- // this host.
- result = GetOptionalSizePropertyValue(mPropertyMap, EGLRenderSurfaceSizeProperty, &swapChainSize, &mSwapChainSizeSpecified);
- if (FAILED(result))
- {
- return false;
- }
-
- // The EGLRenderResolutionScaleProperty is optional and may be missing. The IPropertySet
- // was prevalidated to contain the EGLNativeWindowType before being passed to
- // this host.
- result = GetOptionalSinglePropertyValue(mPropertyMap, EGLRenderResolutionScaleProperty, &mSwapChainScale, &mSwapChainScaleSpecified);
- if (FAILED(result))
- {
- return false;
- }
-
- if (!mSwapChainScaleSpecified)
- {
- // Default value for the scale is 1.0f
- mSwapChainScale = 1.0f;
- }
-
- // A EGLRenderSurfaceSizeProperty and a EGLRenderResolutionScaleProperty can't both be specified
- if (mSwapChainScaleSpecified && mSwapChainSizeSpecified)
- {
- ERR() << "It is invalid to specify both an EGLRenderSurfaceSizeProperty and a "
- "EGLRenderResolutionScaleProperty.";
- return false;
- }
- }
-
- if (SUCCEEDED(result))
- {
- result = win.As(&mSwapChainPanel);
- }
-
- ComPtr<IDependencyObject> swapChainPanelDependencyObject;
- if (SUCCEEDED(result))
- {
- result = mSwapChainPanel.As(&swapChainPanelDependencyObject);
- }
-
- if (SUCCEEDED(result))
- {
- result = swapChainPanelDependencyObject->get_Dispatcher(
- mSwapChainPanelDispatcher.GetAddressOf());
- }
-
- if (SUCCEEDED(result))
- {
- // If a swapchain size is specfied, then the automatic resize
- // behaviors implemented by the host should be disabled. The swapchain
- // will be still be scaled when being rendered to fit the bounds
- // of the host.
- // Scaling of the swapchain output needs to be handled by the
- // host for swapchain panels even though the scaling mode setting
- // DXGI_SCALING_STRETCH is configured on the swapchain.
- if (mSwapChainSizeSpecified)
- {
- mClientRect = { 0, 0, swapChainSize.cx, swapChainSize.cy };
- }
- else
- {
- Size swapChainPanelSize;
- result = GetSwapChainPanelSize(mSwapChainPanel, mSwapChainPanelDispatcher,
- &swapChainPanelSize);
-
- if (SUCCEEDED(result))
- {
- // Update the client rect to account for any swapchain scale factor
- mClientRect = clientRect(swapChainPanelSize);
- }
- }
- }
-
- if (SUCCEEDED(result))
- {
- mNewClientRect = mClientRect;
- mClientRectChanged = false;
- return registerForSizeChangeEvents();
- }
-
- return false;
-}
-
-bool SwapChainPanelNativeWindow::registerForSizeChangeEvents()
-{
- ComPtr<ISizeChangedEventHandler> sizeChangedHandler;
- ComPtr<IFrameworkElement> frameworkElement;
- HRESULT result = Microsoft::WRL::MakeAndInitialize<SwapChainPanelSizeChangedHandler>(sizeChangedHandler.ReleaseAndGetAddressOf(), this->shared_from_this());
-
- if (SUCCEEDED(result))
- {
- result = mSwapChainPanel.As(&frameworkElement);
- }
-
- if (SUCCEEDED(result))
- {
- result = RunOnUIThread(
- [this, frameworkElement, sizeChangedHandler]
- {
- return frameworkElement->add_SizeChanged(sizeChangedHandler.Get(),
- &mSizeChangedEventToken);
- },
- mSwapChainPanelDispatcher);
- }
-
- if (SUCCEEDED(result))
- {
- return true;
- }
-
- return false;
-}
-
-void SwapChainPanelNativeWindow::unregisterForSizeChangeEvents()
-{
- ComPtr<IFrameworkElement> frameworkElement;
- if (mSwapChainPanel && SUCCEEDED(mSwapChainPanel.As(&frameworkElement)))
- {
- RunOnUIThread(
- [this, frameworkElement]
- {
- return frameworkElement->remove_SizeChanged(mSizeChangedEventToken);
- },
- mSwapChainPanelDispatcher);
- }
-
- mSizeChangedEventToken.value = 0;
-}
-
-HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device,
- IDXGIFactory2 *factory,
- DXGI_FORMAT format,
- unsigned int width,
- unsigned int height,
- bool containsAlpha,
- IDXGISwapChain1 **swapChain)
-{
- if (device == nullptr || factory == nullptr || swapChain == nullptr || width == 0 ||
- height == 0)
- {
- return E_INVALIDARG;
- }
-
- DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 };
- swapChainDesc.Width = width;
- swapChainDesc.Height = height;
- swapChainDesc.Format = format;
- swapChainDesc.Stereo = FALSE;
- swapChainDesc.SampleDesc.Count = 1;
- swapChainDesc.SampleDesc.Quality = 0;
- swapChainDesc.BufferUsage =
- DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER;
- swapChainDesc.BufferCount = 2;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
- swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
- swapChainDesc.AlphaMode =
- containsAlpha ? DXGI_ALPHA_MODE_PREMULTIPLIED : DXGI_ALPHA_MODE_IGNORE;
-
- *swapChain = nullptr;
-
- ComPtr<IDXGISwapChain1> newSwapChain;
- ComPtr<ISwapChainPanelNative> swapChainPanelNative;
- Size currentPanelSize = {};
-
- HRESULT result = factory->CreateSwapChainForComposition(device, &swapChainDesc, nullptr, newSwapChain.ReleaseAndGetAddressOf());
-
- if (SUCCEEDED(result))
- {
- result = mSwapChainPanel.As(&swapChainPanelNative);
- }
-
- if (SUCCEEDED(result))
- {
- result = RunOnUIThread(
- [swapChainPanelNative, newSwapChain]
- {
- return swapChainPanelNative->SetSwapChain(newSwapChain.Get());
- },
- mSwapChainPanelDispatcher);
- }
-
- if (SUCCEEDED(result))
- {
- // The swapchain panel host requires an instance of the swapchain set on the SwapChainPanel
- // to perform the runtime-scale behavior. This swapchain is cached here because there are
- // no methods for retreiving the currently configured on from ISwapChainPanelNative.
- mSwapChain = newSwapChain;
- result = newSwapChain.CopyTo(swapChain);
- }
-
- // If the host is responsible for scaling the output of the swapchain, then
- // scale it now before returning an instance to the caller. This is done by
- // first reading the current size of the swapchain panel, then scaling
- if (SUCCEEDED(result))
- {
- if (mSwapChainSizeSpecified || mSwapChainScaleSpecified)
- {
- result = GetSwapChainPanelSize(mSwapChainPanel, mSwapChainPanelDispatcher,
- &currentPanelSize);
-
- // Scale the swapchain to fit inside the contents of the panel.
- if (SUCCEEDED(result))
- {
- result = scaleSwapChain(currentPanelSize, mClientRect);
- }
- }
- }
-
- return result;
-}
-
-HRESULT SwapChainPanelNativeWindow::scaleSwapChain(const Size &windowSize, const RECT &clientRect)
-{
- Size renderScale = {windowSize.Width / std::max(LONG(1), clientRect.right),
- windowSize.Height / std::max(LONG(1), clientRect.bottom)};
- // Setup a scale matrix for the swap chain
- DXGI_MATRIX_3X2_F scaleMatrix = {};
- scaleMatrix._11 = renderScale.Width;
- scaleMatrix._22 = renderScale.Height;
-
- ComPtr<IDXGISwapChain2> swapChain2;
- HRESULT result = mSwapChain.As(&swapChain2);
- if (SUCCEEDED(result))
- {
- result = swapChain2->SetMatrixTransform(&scaleMatrix);
- }
-
- return result;
-}
-
-HRESULT GetSwapChainPanelSize(
- const ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> &swapChainPanel,
- const ComPtr<ICoreDispatcher> &dispatcher,
- Size *windowSize)
-{
- ComPtr<IUIElement> uiElement;
- HRESULT result = swapChainPanel.As(&uiElement);
- if (SUCCEEDED(result))
- {
- result = RunOnUIThread(
- [uiElement, windowSize] { return uiElement->get_RenderSize(windowSize); }, dispatcher);
- }
-
- return result;
-}
-}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h
deleted file mode 100644
index f9a2fc0e4b..0000000000
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h
+++ /dev/null
@@ -1,93 +0,0 @@
-//
-// 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.
-//
-
-// SwapChainPanelNativeWindow.h: NativeWindow for managing ISwapChainPanel native window types.
-
-#ifndef LIBANGLE_RENDERER_D3D_D3D11_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_
-#define LIBANGLE_RENDERER_D3D_D3D11_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_
-
-#include "libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h"
-
-#include <memory>
-
-namespace rx
-{
-class SwapChainPanelNativeWindow : public InspectableNativeWindow, public std::enable_shared_from_this<SwapChainPanelNativeWindow>
-{
- public:
- ~SwapChainPanelNativeWindow();
-
- bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) override;
- HRESULT createSwapChain(ID3D11Device *device,
- IDXGIFactory2 *factory,
- DXGI_FORMAT format,
- unsigned int width,
- unsigned int height,
- bool containsAlpha,
- IDXGISwapChain1 **swapChain) override;
-
- protected:
- HRESULT scaleSwapChain(const Size &windowSize, const RECT &clientRect) override;
-
- bool registerForSizeChangeEvents();
- void unregisterForSizeChangeEvents();
-
- private:
- ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> mSwapChainPanel;
- ComPtr<ABI::Windows::UI::Core::ICoreDispatcher> mSwapChainPanelDispatcher;
- ComPtr<IMap<HSTRING, IInspectable*>> mPropertyMap;
- ComPtr<IDXGISwapChain1> mSwapChain;
-};
-
-[uuid(8ACBD974-8187-4508-AD80-AEC77F93CF36)]
-class SwapChainPanelSizeChangedHandler :
- public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, ABI::Windows::UI::Xaml::ISizeChangedEventHandler>
-{
- public:
- SwapChainPanelSizeChangedHandler() { }
- HRESULT RuntimeClassInitialize(std::shared_ptr<InspectableNativeWindow> host)
- {
- if (!host)
- {
- return E_INVALIDARG;
- }
-
- mHost = host;
- return S_OK;
- }
-
- // ISizeChangedEventHandler
- IFACEMETHOD(Invoke)(IInspectable *sender, ABI::Windows::UI::Xaml::ISizeChangedEventArgs *sizeChangedEventArgs)
- {
- std::shared_ptr<InspectableNativeWindow> host = mHost.lock();
- if (host)
- {
- // The size of the ISwapChainPanel control is returned in DIPs.
- // We are keeping these in dips because the swapchain created for composition
- // also uses dip units. This keeps dimensions, viewports, etc in the same unit.
- // XAML Clients of the ISwapChainPanel are required to use dips to define their
- // layout sizes as well.
- ABI::Windows::Foundation::Size newSize;
- HRESULT result = sizeChangedEventArgs->get_NewSize(&newSize);
- if (SUCCEEDED(result))
- {
- host->setNewClientSize(newSize);
- }
- }
-
- return S_OK;
- }
-
- private:
- std::weak_ptr<InspectableNativeWindow> mHost;
-};
-
-HRESULT GetSwapChainPanelSize(
- const ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> &swapChainPanel,
- const ComPtr<ABI::Windows::UI::Core::ICoreDispatcher> &dispatcher,
- Size *windowSize);
-}
-#endif // LIBANGLE_RENDERER_D3D_D3D11_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_