Ensure we do not try to create a swapchain with dimensions smaller than 1x1.

TRAC #22548 Signed-off-by: Geoff Lang Signed-off-by: Nicolas Capens Author: Jamie Madill git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1889 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 2df7d8e1
...@@ -2678,14 +2678,17 @@ RenderTarget *Renderer11::createRenderTarget(SwapChain *swapChain, bool depth) ...@@ -2678,14 +2678,17 @@ RenderTarget *Renderer11::createRenderTarget(SwapChain *swapChain, bool depth)
{ {
SwapChain11 *swapChain11 = SwapChain11::makeSwapChain11(swapChain); SwapChain11 *swapChain11 = SwapChain11::makeSwapChain11(swapChain);
RenderTarget11 *renderTarget = NULL; RenderTarget11 *renderTarget = NULL;
if (depth) if (depth)
{ {
// Note: depth stencil may be NULL for 0 sized surfaces
renderTarget = new RenderTarget11(this, swapChain11->getDepthStencil(), renderTarget = new RenderTarget11(this, swapChain11->getDepthStencil(),
swapChain11->getDepthStencilTexture(), NULL, swapChain11->getDepthStencilTexture(), NULL,
swapChain11->getWidth(), swapChain11->getHeight()); swapChain11->getWidth(), swapChain11->getHeight());
} }
else else
{ {
// Note: render target may be NULL for 0 sized surfaces
renderTarget = new RenderTarget11(this, swapChain11->getRenderTarget(), renderTarget = new RenderTarget11(this, swapChain11->getRenderTarget(),
swapChain11->getOffscreenTexture(), swapChain11->getOffscreenTexture(),
swapChain11->getRenderTargetShaderResource(), swapChain11->getRenderTargetShaderResource(),
......
...@@ -459,6 +459,13 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap ...@@ -459,6 +459,13 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
return EGL_BAD_PARAMETER; return EGL_BAD_PARAMETER;
} }
// EGL allows creating a surface with 0x0 dimension, however, DXGI does not like 0x0 swapchains
if (backbufferWidth < 1 || backbufferHeight < 1)
{
releaseOffscreenTexture();
return EGL_SUCCESS;
}
if (mWindow) if (mWindow)
{ {
// We cannot create a swap chain for an HWND that is owned by a different process // We cannot create a swap chain for an HWND that is owned by a different process
......
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