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
return new SurfaceD3D(renderer, display, config, width, height, fixedSize, static_cast<EGLClientBuffer>(0), window);
}
SurfaceD3D::SurfaceD3D(RendererD3D *renderer,
egl::Display *display,
const egl::Config *config,
EGLint width,
EGLint height,
EGLint fixedSize,
EGLClientBuffer shareHandle,
EGLNativeWindowType window)
SurfaceD3D::SurfaceD3D(RendererD3D *renderer, egl::Display *display, const egl::Config *config, EGLint width, EGLint height, EGLint fixedSize,
EGLClientBuffer shareHandle, EGLNativeWindowType window)
: SurfaceImpl(),
mRenderer(renderer),
mDisplay(display),
......@@ -49,11 +43,11 @@ SurfaceD3D::SurfaceD3D(RendererD3D *renderer,
mDepthStencilFormat(config->depthStencilFormat),
mSwapChain(nullptr),
mSwapIntervalDirty(true),
mNativeWindow(window, config),
mNativeWindow(window),
mWidth(width),
mHeight(height),
mSwapInterval(1),
mShareHandle(reinterpret_cast<HANDLE *>(shareHandle))
mShareHandle(reinterpret_cast<HANDLE*>(shareHandle))
{
}
......
......@@ -16,7 +16,6 @@
#include "common/platform.h"
#include <EGL/eglplatform.h>
#include "libANGLE/Config.h"
// DXGISwapChain and DXGIFactory are typedef'd to specific required
// types. The HWND NativeWindow implementation requires IDXGISwapChain
......@@ -50,7 +49,7 @@ namespace rx
class NativeWindow
{
public:
explicit NativeWindow(EGLNativeWindowType window, const egl::Config *config);
explicit NativeWindow(EGLNativeWindowType window);
bool initialize();
bool getClientRect(LPRECT rect);
......@@ -65,7 +64,6 @@ class NativeWindow
private:
EGLNativeWindowType mWindow;
const egl::Config *mConfig;
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
std::shared_ptr<InspectableNativeWindow> mImpl;
......
......@@ -678,13 +678,15 @@ void Renderer11::populateRenderer11DeviceCaps()
egl::ConfigSet Renderer11::generateConfigs() const
{
static const GLenum colorBufferFormats[] = {
static const GLenum colorBufferFormats[] =
{
// 32-bit supported formats
GL_BGRA8_EXT, GL_RGBA8_OES,
// 24-bit supported formats
GL_RGB8_OES,
GL_BGRA8_EXT,
GL_RGBA8_OES,
// 16-bit supported formats
GL_RGBA4, GL_RGB5_A1, GL_RGB565,
GL_RGBA4,
GL_RGB5_A1,
GL_RGB565,
};
static const GLenum depthStencilBufferFormats[] =
......
......@@ -14,8 +14,7 @@
namespace rx
{
NativeWindow::NativeWindow(EGLNativeWindowType window, const egl::Config *config)
: mWindow(window), mConfig(config)
NativeWindow::NativeWindow(EGLNativeWindowType window) : mWindow(window)
{
}
......
......@@ -134,13 +134,7 @@ void CoreWindowNativeWindow::unregisterForSizeChangeEvents()
mSizeChangedEventToken.value = 0;
}
HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device,
DXGIFactory *factory,
DXGI_FORMAT format,
unsigned int width,
unsigned int height,
bool containsAlpha,
DXGISwapChain **swapChain)
HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
{
if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0)
{
......@@ -158,7 +152,6 @@ HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device,
swapChainDesc.BufferCount = 2;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;
*swapChain = nullptr;
......
......@@ -25,13 +25,7 @@ class CoreWindowNativeWindow : public InspectableNativeWindow, public std::enabl
~CoreWindowNativeWindow();
bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) override;
HRESULT createSwapChain(ID3D11Device *device,
DXGIFactory *factory,
DXGI_FORMAT format,
unsigned int width,
unsigned int height,
bool containsAlpha,
DXGISwapChain **swapChain) override;
HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain) override;
protected:
HRESULT scaleSwapChain(const SIZE &windowSize, const RECT &clientRect) override;
......
......@@ -11,10 +11,9 @@
namespace rx
{
NativeWindow::NativeWindow(EGLNativeWindowType window, const egl::Config *config)
NativeWindow::NativeWindow(EGLNativeWindowType window)
{
mWindow = window;
mConfig = config;
}
bool NativeWindow::initialize()
......@@ -84,9 +83,7 @@ HRESULT NativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory
{
if (mImpl)
{
bool containsAlpha = (mConfig->alphaSize > 0);
return mImpl->createSwapChain(device, factory, format, width, height, containsAlpha,
swapChain);
return mImpl->createSwapChain(device, factory, format, width, height, swapChain);
}
return E_UNEXPECTED;
......
......@@ -43,13 +43,7 @@ class InspectableNativeWindow
virtual ~InspectableNativeWindow(){}
virtual bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) = 0;
virtual HRESULT createSwapChain(ID3D11Device *device,
DXGIFactory *factory,
DXGI_FORMAT format,
unsigned int width,
unsigned int height,
bool containsAlpha,
DXGISwapChain **swapChain) = 0;
virtual HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain) = 0;
bool getClientRect(RECT *rect)
{
......
......@@ -146,13 +146,7 @@ void SwapChainPanelNativeWindow::unregisterForSizeChangeEvents()
mSizeChangedEventToken.value = 0;
}
HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device,
DXGIFactory *factory,
DXGI_FORMAT format,
unsigned int width,
unsigned int height,
bool containsAlpha,
DXGISwapChain **swapChain)
HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
{
if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0)
{
......@@ -170,8 +164,7 @@ HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device,
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;
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
*swapChain = nullptr;
......
......@@ -19,13 +19,7 @@ class SwapChainPanelNativeWindow : public InspectableNativeWindow, public std::e
~SwapChainPanelNativeWindow();
bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) override;
HRESULT createSwapChain(ID3D11Device *device,
DXGIFactory *factory,
DXGI_FORMAT format,
unsigned int width,
unsigned int height,
bool containsAlpha,
DXGISwapChain **swapChain) override;
HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain) override;
protected:
HRESULT scaleSwapChain(const SIZE &windowSize, const RECT &clientRect) override;
......
......@@ -342,7 +342,8 @@ TEST_F(EGLSurfaceTest, ResizeD3DWindow)
// support GL_RGB565
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;
return;
......@@ -371,7 +372,7 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig5650Support)
initializeSurface(config);
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_EGL_SUCCESS();
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
GLuint program = createProgram();
drawWithProgram(program);
......@@ -383,7 +384,8 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig5650Support)
// support GL_RGBA4
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;
return;
......@@ -412,7 +414,7 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig4444Support)
initializeSurface(config);
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_EGL_SUCCESS();
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
GLuint program = createProgram();
drawWithProgram(program);
......@@ -424,7 +426,8 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig4444Support)
// support GL_RGB5_A1
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;
return;
......@@ -453,48 +456,7 @@ TEST_F(EGLSurfaceTest, CreateWithEGLConfig5551Support)
initializeSurface(config);
eglMakeCurrent(mDisplay, mWindowSurface, mWindowSurface, mContext);
ASSERT_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();
ASSERT_TRUE(eglGetError() == EGL_SUCCESS);
GLuint program = createProgram();
drawWithProgram(program);
......
......@@ -27,7 +27,6 @@ class D3D11InputLayoutCacheTest : public ANGLETest
setWindowWidth(64);
setWindowHeight(64);
setConfigRedBits(8);
setConfigAlphaBits(8);
}
GLuint makeProgramWithAttribCount(unsigned int attribCount)
......
......@@ -68,7 +68,6 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters>
static bool InitTestWindow();
static bool DestroyTestWindow();
static void SetWindowVisible(bool isVisible);
static bool eglDisplayExtensionEnabled(EGLDisplay display, const std::string &extName);
protected:
virtual void SetUp();
......@@ -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 GLuint compileShader(GLenum type, const std::string &source);
static bool extensionEnabled(const std::string &extName);
static bool eglDisplayExtensionEnabled(EGLDisplay display, const std::string &extName);
static bool eglClientExtensionEnabled(const std::string &extName);
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