Commit 673e680c by Nicolas Capens

Don't allocate unused swap chain buffers

According to msdn.microsoft.com/en-us/library/windows/desktop/bb173075(v=vs.85).aspx the front buffer is the desktop and is not a dedicated part of the swap chain. Thus we should only need 1 swap chain buffer instead of the currently allocated 2. Samples in the DirectX SDK also only allocate just one. BUG=angle:662 Change-Id: If88eeab1954cbc92b39ac7cf42f924515c4b77f9 Reviewed-on: https://chromium-review.googlesource.com/201860Tested-by: 's avatarNicolas Capens <nicolascapens@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 9cd1915c
#include "precompiled.h" #include "precompiled.h"
// //
// Copyright (c) 2012-2013 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -326,7 +326,7 @@ EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight) ...@@ -326,7 +326,7 @@ EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight)
// Resize swap chain // Resize swap chain
DXGI_FORMAT backbufferDXGIFormat = gl_d3d11::GetTexFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion()); DXGI_FORMAT backbufferDXGIFormat = gl_d3d11::GetTexFormat(mBackBufferFormat, mRenderer->getCurrentClientVersion());
HRESULT result = mSwapChain->ResizeBuffers(2, backbufferWidth, backbufferHeight, backbufferDXGIFormat, 0); HRESULT result = mSwapChain->ResizeBuffers(1, backbufferWidth, backbufferHeight, backbufferDXGIFormat, 0);
if (FAILED(result)) if (FAILED(result))
{ {
...@@ -404,7 +404,7 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap ...@@ -404,7 +404,7 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap
swapChainDesc.SampleDesc.Count = 1; swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SampleDesc.Quality = 0; swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferCount = 2; swapChainDesc.BufferCount = 1;
swapChainDesc.OutputWindow = mWindow; swapChainDesc.OutputWindow = mWindow;
swapChainDesc.Windowed = TRUE; swapChainDesc.Windowed = TRUE;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
......
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