D3DBase: Switch to a flip-model swap chain.
This commit is contained in:
parent
c399e2bc40
commit
6863abb31d
|
@ -52,6 +52,8 @@ unsigned int xres, yres;
|
||||||
|
|
||||||
bool bFrameInProgress = false;
|
bool bFrameInProgress = false;
|
||||||
|
|
||||||
|
#define NUM_SWAPCHAIN_BUFFERS 2
|
||||||
|
|
||||||
HRESULT LoadDXGI()
|
HRESULT LoadDXGI()
|
||||||
{
|
{
|
||||||
if (dxgi_dll_ref++ > 0)
|
if (dxgi_dll_ref++ > 0)
|
||||||
|
@ -292,13 +294,13 @@ HRESULT Create(HWND wnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
DXGI_SWAP_CHAIN_DESC1 swap_chain_desc = {};
|
DXGI_SWAP_CHAIN_DESC1 swap_chain_desc = {};
|
||||||
swap_chain_desc.BufferCount = 1;
|
swap_chain_desc.BufferCount = NUM_SWAPCHAIN_BUFFERS;
|
||||||
swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||||
swap_chain_desc.SampleDesc.Count = 1;
|
swap_chain_desc.SampleDesc.Count = 1;
|
||||||
swap_chain_desc.SampleDesc.Quality = 0;
|
swap_chain_desc.SampleDesc.Quality = 0;
|
||||||
swap_chain_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
swap_chain_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||||
swap_chain_desc.Scaling = DXGI_SCALING_STRETCH;
|
swap_chain_desc.Scaling = DXGI_SCALING_STRETCH;
|
||||||
swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
|
swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
|
||||||
swap_chain_desc.Width = xres;
|
swap_chain_desc.Width = xres;
|
||||||
swap_chain_desc.Height = yres;
|
swap_chain_desc.Height = yres;
|
||||||
|
|
||||||
|
@ -529,7 +531,7 @@ void Reset()
|
||||||
GetClientRect(hWnd, &client);
|
GetClientRect(hWnd, &client);
|
||||||
xres = client.right - client.left;
|
xres = client.right - client.left;
|
||||||
yres = client.bottom - client.top;
|
yres = client.bottom - client.top;
|
||||||
D3D::swapchain->ResizeBuffers(1, xres, yres, DXGI_FORMAT_R8G8B8A8_UNORM, 0);
|
D3D::swapchain->ResizeBuffers(NUM_SWAPCHAIN_BUFFERS, xres, yres, DXGI_FORMAT_R8G8B8A8_UNORM, 0);
|
||||||
|
|
||||||
// recreate back buffer texture
|
// recreate back buffer texture
|
||||||
ID3D11Texture2D* buf;
|
ID3D11Texture2D* buf;
|
||||||
|
|
Loading…
Reference in New Issue