diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-05-18 15:16:30 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-05-26 15:11:40 +0200 |
commit | 752497910b67b2a1a80560840ca44548d8893434 (patch) | |
tree | 541501c9abfd97c3d2fa450d2e6abb60582c4420 /src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp | |
parent | 7db527dbdd911c79f31425d099d1fc9c63e42453 (diff) |
Remove ANGLE
This marks the end of EGL and OpenGL ES support on Windows.
The concepts of -opengl dynamic, -opengl desktop, QT_OPENGL=software,
etc. remain unchanged, with the exception of the disapperance of
everything ANGLE related.
CMake builds now work identically to qmake on Windows: they default to
'dynamic' OpenGL on Windows, unless -DINPUT_opengl=desktop is specified.
On Windows, Qt 6 is expected to default to the "dynamic" OpenGL model by
default, just like Qt 5.15. This can be changed by switching to "desktop"
OpenGL, which will link to opengl32 (publicly, so other libs and applications
will do so as well) and disallows using another OpenGL DLL.
The "dynamic" mode is essential still because the fallback to a software
rasterizer, such as the opengl32sw.dll we ship with the Qt packages,
has to to work exactly like in Qt 5, the removal of ANGLE does not
change this concept in any way (except of course that the middle option
of using ANGLE is now gone)
When it comes to the windows plugin's OpenGL blacklist feature, it works
like before and accepts the ANGLE/D3D related keywords. They will
then be ignored. Similarly, requesting QT_OPENGL=angle is ignored (but
will show a warning).
The D3D11 and DXGI configure time tests are removed: Qt 5.14 already
depends on D3D 11.1 and DXGI 1.3 headers being available unconditionally
on Win32 (in QRhi's D3D11 backend). No need to test for these.
[ChangeLog][Windows] ANGLE is no longer included with Qt. Dynamic OpenGL
builds work like before but ANGLE is no longer an option. OpenGL proper
or an alternative opengl32 implementation are the two remaining options
now. Attempting to set QT_OPENGL=angle or Qt::AA_UseOpenGLES will have
no effect on Windows.
Fixes: QTBUG-79103
Change-Id: Ia404e0d07f3fe191b27434d863c81180112ecb3b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp')
-rw-r--r-- | src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp | 208 |
1 files changed, 0 insertions, 208 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; -} -} |