Commit 2aa3b436 by Jamie Madill

Revert "Added support for premultiplied alpha mode for composition swapchains"

Unused member warning: ..\..\third_party\angle\src\libANGLE/renderer/d3d/d3d11/NativeWindow.h(68,24) : error: private field 'mConfig' is not used [-Werror,-Wunused-private-field] const egl::Config *mConfig; ^ BUG=None This reverts commit 98233372. Change-Id: I8ed41770eb3fe70ab7e32ba9a0860e2c397e22c5 Reviewed-on: https://chromium-review.googlesource.com/298830Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 86f8dd7c
...@@ -33,14 +33,8 @@ SurfaceD3D *SurfaceD3D::createFromWindow(RendererD3D *renderer, egl::Display *di ...@@ -33,14 +33,8 @@ SurfaceD3D *SurfaceD3D::createFromWindow(RendererD3D *renderer, egl::Display *di
return new SurfaceD3D(renderer, display, config, width, height, fixedSize, static_cast<EGLClientBuffer>(0), window); return new SurfaceD3D(renderer, display, config, width, height, fixedSize, static_cast<EGLClientBuffer>(0), window);
} }
SurfaceD3D::SurfaceD3D(RendererD3D *renderer, SurfaceD3D::SurfaceD3D(RendererD3D *renderer, egl::Display *display, const egl::Config *config, EGLint width, EGLint height, EGLint fixedSize,
egl::Display *display, EGLClientBuffer shareHandle, EGLNativeWindowType window)
const egl::Config *config,
EGLint width,
EGLint height,
EGLint fixedSize,
EGLClientBuffer shareHandle,
EGLNativeWindowType window)
: SurfaceImpl(), : SurfaceImpl(),
mRenderer(renderer), mRenderer(renderer),
mDisplay(display), mDisplay(display),
...@@ -49,11 +43,11 @@ SurfaceD3D::SurfaceD3D(RendererD3D *renderer, ...@@ -49,11 +43,11 @@ SurfaceD3D::SurfaceD3D(RendererD3D *renderer,
mDepthStencilFormat(config->depthStencilFormat), mDepthStencilFormat(config->depthStencilFormat),
mSwapChain(nullptr), mSwapChain(nullptr),
mSwapIntervalDirty(true), mSwapIntervalDirty(true),
mNativeWindow(window, config), mNativeWindow(window),
mWidth(width), mWidth(width),
mHeight(height), mHeight(height),
mSwapInterval(1), mSwapInterval(1),
mShareHandle(reinterpret_cast<HANDLE *>(shareHandle)) mShareHandle(reinterpret_cast<HANDLE*>(shareHandle))
{ {
} }
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "common/platform.h" #include "common/platform.h"
#include <EGL/eglplatform.h> #include <EGL/eglplatform.h>
#include "libANGLE/Config.h"
// DXGISwapChain and DXGIFactory are typedef'd to specific required // DXGISwapChain and DXGIFactory are typedef'd to specific required
// types. The HWND NativeWindow implementation requires IDXGISwapChain // types. The HWND NativeWindow implementation requires IDXGISwapChain
...@@ -50,7 +49,7 @@ namespace rx ...@@ -50,7 +49,7 @@ namespace rx
class NativeWindow class NativeWindow
{ {
public: public:
explicit NativeWindow(EGLNativeWindowType window, const egl::Config *config); explicit NativeWindow(EGLNativeWindowType window);
bool initialize(); bool initialize();
bool getClientRect(LPRECT rect); bool getClientRect(LPRECT rect);
...@@ -65,7 +64,6 @@ class NativeWindow ...@@ -65,7 +64,6 @@ class NativeWindow
private: private:
EGLNativeWindowType mWindow; EGLNativeWindowType mWindow;
const egl::Config *mConfig;
#if defined(ANGLE_ENABLE_WINDOWS_STORE) #if defined(ANGLE_ENABLE_WINDOWS_STORE)
std::shared_ptr<InspectableNativeWindow> mImpl; std::shared_ptr<InspectableNativeWindow> mImpl;
......
...@@ -678,13 +678,15 @@ void Renderer11::populateRenderer11DeviceCaps() ...@@ -678,13 +678,15 @@ void Renderer11::populateRenderer11DeviceCaps()
egl::ConfigSet Renderer11::generateConfigs() const egl::ConfigSet Renderer11::generateConfigs() const
{ {
static const GLenum colorBufferFormats[] = { static const GLenum colorBufferFormats[] =
{
// 32-bit supported formats // 32-bit supported formats
GL_BGRA8_EXT, GL_RGBA8_OES, GL_BGRA8_EXT,
// 24-bit supported formats GL_RGBA8_OES,
GL_RGB8_OES,
// 16-bit supported formats // 16-bit supported formats
GL_RGBA4, GL_RGB5_A1, GL_RGB565, GL_RGBA4,
GL_RGB5_A1,
GL_RGB565,
}; };
static const GLenum depthStencilBufferFormats[] = static const GLenum depthStencilBufferFormats[] =
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
namespace rx namespace rx
{ {
NativeWindow::NativeWindow(EGLNativeWindowType window, const egl::Config *config) NativeWindow::NativeWindow(EGLNativeWindowType window) : mWindow(window)
: mWindow(window), mConfig(config)
{ {
} }
......
...@@ -134,13 +134,7 @@ void CoreWindowNativeWindow::unregisterForSizeChangeEvents() ...@@ -134,13 +134,7 @@ void CoreWindowNativeWindow::unregisterForSizeChangeEvents()
mSizeChangedEventToken.value = 0; mSizeChangedEventToken.value = 0;
} }
HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
DXGIFactory *factory,
DXGI_FORMAT format,
unsigned int width,
unsigned int height,
bool containsAlpha,
DXGISwapChain **swapChain)
{ {
if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0) if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0)
{ {
...@@ -158,7 +152,6 @@ HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, ...@@ -158,7 +152,6 @@ HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device,
swapChainDesc.BufferCount = 2; swapChainDesc.BufferCount = 2;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
swapChainDesc.Scaling = DXGI_SCALING_STRETCH; swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;
*swapChain = nullptr; *swapChain = nullptr;
......
...@@ -25,13 +25,7 @@ class CoreWindowNativeWindow : public InspectableNativeWindow, public std::enabl ...@@ -25,13 +25,7 @@ class CoreWindowNativeWindow : public InspectableNativeWindow, public std::enabl
~CoreWindowNativeWindow(); ~CoreWindowNativeWindow();
bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) override; bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) override;
HRESULT createSwapChain(ID3D11Device *device, HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain) override;
DXGIFactory *factory,
DXGI_FORMAT format,
unsigned int width,
unsigned int height,
bool containsAlpha,
DXGISwapChain **swapChain) override;
protected: protected:
HRESULT scaleSwapChain(const SIZE &windowSize, const RECT &clientRect) override; HRESULT scaleSwapChain(const SIZE &windowSize, const RECT &clientRect) override;
......
...@@ -11,10 +11,9 @@ ...@@ -11,10 +11,9 @@
namespace rx namespace rx
{ {
NativeWindow::NativeWindow(EGLNativeWindowType window, const egl::Config *config) NativeWindow::NativeWindow(EGLNativeWindowType window)
{ {
mWindow = window; mWindow = window;
mConfig = config;
} }
bool NativeWindow::initialize() bool NativeWindow::initialize()
...@@ -84,9 +83,7 @@ HRESULT NativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory ...@@ -84,9 +83,7 @@ HRESULT NativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory
{ {
if (mImpl) if (mImpl)
{ {
bool containsAlpha = (mConfig->alphaSize > 0); return mImpl->createSwapChain(device, factory, format, width, height, swapChain);
return mImpl->createSwapChain(device, factory, format, width, height, containsAlpha,
swapChain);
} }
return E_UNEXPECTED; return E_UNEXPECTED;
......
...@@ -43,13 +43,7 @@ class InspectableNativeWindow ...@@ -43,13 +43,7 @@ class InspectableNativeWindow
virtual ~InspectableNativeWindow(){} virtual ~InspectableNativeWindow(){}
virtual bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) = 0; virtual bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) = 0;
virtual HRESULT createSwapChain(ID3D11Device *device, virtual HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain) = 0;
DXGIFactory *factory,
DXGI_FORMAT format,
unsigned int width,
unsigned int height,
bool containsAlpha,
DXGISwapChain **swapChain) = 0;
bool getClientRect(RECT *rect) bool getClientRect(RECT *rect)
{ {
......
...@@ -146,13 +146,7 @@ void SwapChainPanelNativeWindow::unregisterForSizeChangeEvents() ...@@ -146,13 +146,7 @@ void SwapChainPanelNativeWindow::unregisterForSizeChangeEvents()
mSizeChangedEventToken.value = 0; mSizeChangedEventToken.value = 0;
} }
HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
DXGIFactory *factory,
DXGI_FORMAT format,
unsigned int width,
unsigned int height,
bool containsAlpha,
DXGISwapChain **swapChain)
{ {
if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0) if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0)
{ {
...@@ -170,8 +164,7 @@ HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, ...@@ -170,8 +164,7 @@ HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device,
swapChainDesc.BufferCount = 2; swapChainDesc.BufferCount = 2;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
swapChainDesc.Scaling = DXGI_SCALING_STRETCH; swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
swapChainDesc.AlphaMode = swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
containsAlpha ? DXGI_ALPHA_MODE_PREMULTIPLIED : DXGI_ALPHA_MODE_IGNORE;
*swapChain = nullptr; *swapChain = nullptr;
......
...@@ -19,13 +19,7 @@ class SwapChainPanelNativeWindow : public InspectableNativeWindow, public std::e ...@@ -19,13 +19,7 @@ class SwapChainPanelNativeWindow : public InspectableNativeWindow, public std::e
~SwapChainPanelNativeWindow(); ~SwapChainPanelNativeWindow();
bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) override; bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) override;
HRESULT createSwapChain(ID3D11Device *device, HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain) override;
DXGIFactory *factory,
DXGI_FORMAT format,
unsigned int width,
unsigned int height,
bool containsAlpha,
DXGISwapChain **swapChain) override;
protected: protected:
HRESULT scaleSwapChain(const SIZE &windowSize, const RECT &clientRect) override; HRESULT scaleSwapChain(const SIZE &windowSize, const RECT &clientRect) override;
......
...@@ -342,7 +342,8 @@ TEST_F(EGLSurfaceTest, ResizeD3DWindow) ...@@ -342,7 +342,8 @@ TEST_F(EGLSurfaceTest, ResizeD3DWindow)
// support GL_RGB565 // support GL_RGB565
TEST_F(EGLSurfaceTest, CreateWithEGLConfig5650Support) TEST_F(EGLSurfaceTest, CreateWithEGLConfig5650Support)
{ {
if (!ANGLETest::eglDisplayExtensionEnabled(EGL_NO_DISPLAY, "EGL_ANGLE_platform_angle_d3d")) const char *extensionsString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (strstr(extensionsString, "EGL_ANGLE_platform_angle_d3d") == nullptr)
{ {
std::cout << "D3D Platform not supported in ANGLE" << std::endl; std::cout << "D3D Platform not supported in ANGLE" << std::endl;
return; return;
...@@ -371,7 +372,7 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig5650Support) ...@@ -371,7 +372,7 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig5650Support)
initializeSurface(config); initializeSurface(config);
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext); eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_EGL_SUCCESS(); ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
GLuint program = createProgram(); GLuint program = createProgram();
drawWithProgram(program); drawWithProgram(program);
...@@ -383,7 +384,8 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig5650Support) ...@@ -383,7 +384,8 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig5650Support)
// support GL_RGBA4 // support GL_RGBA4
TEST_F(EGLSurfaceTest, CreateWithEGLConfig4444Support) TEST_F(EGLSurfaceTest, CreateWithEGLConfig4444Support)
{ {
if (!ANGLETest::eglDisplayExtensionEnabled(EGL_NO_DISPLAY, "EGL_ANGLE_platform_angle_d3d")) const char *extensionsString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (strstr(extensionsString, "EGL_ANGLE_platform_angle_d3d") == nullptr)
{ {
std::cout << "D3D Platform not supported in ANGLE" << std::endl; std::cout << "D3D Platform not supported in ANGLE" << std::endl;
return; return;
...@@ -412,7 +414,7 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig4444Support) ...@@ -412,7 +414,7 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig4444Support)
initializeSurface(config); initializeSurface(config);
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext); eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_EGL_SUCCESS(); ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
GLuint program = createProgram(); GLuint program = createProgram();
drawWithProgram(program); drawWithProgram(program);
...@@ -424,7 +426,8 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig4444Support) ...@@ -424,7 +426,8 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig4444Support)
// support GL_RGB5_A1 // support GL_RGB5_A1
TEST_F(EGLSurfaceTest, CreateWithEGLConfig5551Support) TEST_F(EGLSurfaceTest, CreateWithEGLConfig5551Support)
{ {
if (!ANGLETest::eglDisplayExtensionEnabled(EGL_NO_DISPLAY, "EGL_ANGLE_platform_angle_d3d")) const char *extensionsString = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (strstr(extensionsString, "EGL_ANGLE_platform_angle_d3d") == nullptr)
{ {
std::cout << "D3D Platform not supported in ANGLE" << std::endl; std::cout << "D3D Platform not supported in ANGLE" << std::endl;
return; return;
...@@ -453,48 +456,7 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig5551Support) ...@@ -453,48 +456,7 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig5551Support)
initializeSurface(config); initializeSurface(config);
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext); eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_EGL_SUCCESS(); ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
GLuint program = createProgram();
drawWithProgram(program);
EXPECT_GL_NO_ERROR();
glDeleteProgram(program);
}
// Test creating a surface that supports a EGLConfig without alpha support
TEST_F(EGLSurfaceTest, CreateWithEGLConfig8880Support)
{
if (!ANGLETest::eglDisplayExtensionEnabled(EGL_NO_DISPLAY, "EGL_ANGLE_platform_angle_d3d"))
{
std::cout << "D3D Platform not supported in ANGLE" << std::endl;
return;
}
const EGLint configAttributes[] =
{
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 0,
EGL_DEPTH_SIZE, 0,
EGL_STENCIL_SIZE, 0,
EGL_SAMPLE_BUFFERS, 0,
EGL_NONE
};
initializeDisplay(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
EGLConfig config;
if (EGLWindow::FindEGLConfig(mDisplay, configAttributes, &config) == EGL_FALSE)
{
std::cout << "EGLConfig for a GL_RGB8_OES surface is not supported, skipping test"
<< std::endl;
return;
}
initializeSurface(config);
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_EGL_SUCCESS();
GLuint program = createProgram(); GLuint program = createProgram();
drawWithProgram(program); drawWithProgram(program);
......
...@@ -27,7 +27,6 @@ class D3D11InputLayoutCacheTest : public ANGLETest ...@@ -27,7 +27,6 @@ class D3D11InputLayoutCacheTest : public ANGLETest
setWindowWidth(64); setWindowWidth(64);
setWindowHeight(64); setWindowHeight(64);
setConfigRedBits(8); setConfigRedBits(8);
setConfigAlphaBits(8);
} }
GLuint makeProgramWithAttribCount(unsigned int attribCount) GLuint makeProgramWithAttribCount(unsigned int attribCount)
......
...@@ -68,7 +68,6 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters> ...@@ -68,7 +68,6 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters>
static bool InitTestWindow(); static bool InitTestWindow();
static bool DestroyTestWindow(); static bool DestroyTestWindow();
static void SetWindowVisible(bool isVisible); static void SetWindowVisible(bool isVisible);
static bool eglDisplayExtensionEnabled(EGLDisplay display, const std::string &extName);
protected: protected:
virtual void SetUp(); virtual void SetUp();
...@@ -79,6 +78,7 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters> ...@@ -79,6 +78,7 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters>
static void drawQuad(GLuint program, const std::string& positionAttribName, GLfloat quadDepth, GLfloat quadScale = 1.0f); static void drawQuad(GLuint program, const std::string& positionAttribName, GLfloat quadDepth, GLfloat quadScale = 1.0f);
static GLuint compileShader(GLenum type, const std::string &source); static GLuint compileShader(GLenum type, const std::string &source);
static bool extensionEnabled(const std::string &extName); static bool extensionEnabled(const std::string &extName);
static bool eglDisplayExtensionEnabled(EGLDisplay display, const std::string &extName);
static bool eglClientExtensionEnabled(const std::string &extName); static bool eglClientExtensionEnabled(const std::string &extName);
void setWindowWidth(int width); void setWindowWidth(int width);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment