mirror of
https://github.com/ocornut/imgui.git
synced 2025-12-19 12:55:34 +00:00
Examples: DirectX10, DirectX11, DirectX12: comments about fullscreen mode and swapchain setup. (#8979)
This commit is contained in:
@@ -210,6 +210,7 @@ int main(int, char**)
|
|||||||
bool CreateDeviceD3D(HWND hWnd)
|
bool CreateDeviceD3D(HWND hWnd)
|
||||||
{
|
{
|
||||||
// Setup swap chain
|
// Setup swap chain
|
||||||
|
// This is a basic setup. Optimally could use e.g. DXGI_SWAP_EFFECT_FLIP_DISCARD and handle fullscreen mode differently. See #8979 for suggestions.
|
||||||
DXGI_SWAP_CHAIN_DESC sd;
|
DXGI_SWAP_CHAIN_DESC sd;
|
||||||
ZeroMemory(&sd, sizeof(sd));
|
ZeroMemory(&sd, sizeof(sd));
|
||||||
sd.BufferCount = 2;
|
sd.BufferCount = 2;
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ int main(int, char**)
|
|||||||
bool CreateDeviceD3D(HWND hWnd)
|
bool CreateDeviceD3D(HWND hWnd)
|
||||||
{
|
{
|
||||||
// Setup swap chain
|
// Setup swap chain
|
||||||
|
// This is a basic setup. Optimally could use e.g. DXGI_SWAP_EFFECT_FLIP_DISCARD and handle fullscreen mode differently. See #8979 for suggestions.
|
||||||
DXGI_SWAP_CHAIN_DESC sd;
|
DXGI_SWAP_CHAIN_DESC sd;
|
||||||
ZeroMemory(&sd, sizeof(sd));
|
ZeroMemory(&sd, sizeof(sd));
|
||||||
sd.BufferCount = 2;
|
sd.BufferCount = 2;
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ int main(int, char**)
|
|||||||
bool CreateDeviceD3D(HWND hWnd)
|
bool CreateDeviceD3D(HWND hWnd)
|
||||||
{
|
{
|
||||||
// Setup swap chain
|
// Setup swap chain
|
||||||
|
// This is a basic setup. Optimally could use e.g. DXGI_SWAP_EFFECT_FLIP_DISCARD and handle fullscreen mode differently. See #8979 for suggestions.
|
||||||
DXGI_SWAP_CHAIN_DESC sd;
|
DXGI_SWAP_CHAIN_DESC sd;
|
||||||
ZeroMemory(&sd, sizeof(sd));
|
ZeroMemory(&sd, sizeof(sd));
|
||||||
sd.BufferCount = 2;
|
sd.BufferCount = 2;
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ int main(int, char**)
|
|||||||
bool CreateDeviceD3D(HWND hWnd)
|
bool CreateDeviceD3D(HWND hWnd)
|
||||||
{
|
{
|
||||||
// Setup swap chain
|
// Setup swap chain
|
||||||
|
// This is a basic setup. Optimally could use e.g. DXGI_SWAP_EFFECT_FLIP_DISCARD and handle fullscreen mode differently. See #8979 for suggestions.
|
||||||
DXGI_SWAP_CHAIN_DESC sd;
|
DXGI_SWAP_CHAIN_DESC sd;
|
||||||
ZeroMemory(&sd, sizeof(sd));
|
ZeroMemory(&sd, sizeof(sd));
|
||||||
sd.BufferCount = 2;
|
sd.BufferCount = 2;
|
||||||
|
|||||||
@@ -312,6 +312,7 @@ int main(int, char**)
|
|||||||
bool CreateDeviceD3D(HWND hWnd)
|
bool CreateDeviceD3D(HWND hWnd)
|
||||||
{
|
{
|
||||||
// Setup swap chain
|
// Setup swap chain
|
||||||
|
// This is a basic setup. Optimally could handle fullscreen mode differently. See #8979 for suggestions.
|
||||||
DXGI_SWAP_CHAIN_DESC1 sd;
|
DXGI_SWAP_CHAIN_DESC1 sd;
|
||||||
{
|
{
|
||||||
ZeroMemory(&sd, sizeof(sd));
|
ZeroMemory(&sd, sizeof(sd));
|
||||||
@@ -525,7 +526,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
DXGI_SWAP_CHAIN_DESC1 desc = {};
|
DXGI_SWAP_CHAIN_DESC1 desc = {};
|
||||||
g_pSwapChain->GetDesc1(&desc);
|
g_pSwapChain->GetDesc1(&desc);
|
||||||
HRESULT result = g_pSwapChain->ResizeBuffers(0, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam), desc.Format, desc.Flags);
|
HRESULT result = g_pSwapChain->ResizeBuffers(0, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam), desc.Format, desc.Flags);
|
||||||
assert(SUCCEEDED(result) && "Failed to resize swapchain.");
|
IM_ASSERT(SUCCEEDED(result) && "Failed to resize swapchain.");
|
||||||
CreateRenderTarget();
|
CreateRenderTarget();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user