diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index c6b65dd2f..87cf826c1 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -53,7 +53,10 @@ Other Changes:
ClearRendererHandlers() on shutdown, so as not to leave function pointers
which may be dangling when using backend in e.g. DLL. (#8945, #2769)
- Backends: OpenGL3: fixed GL loader to work on Haiku OS which does not support
- `RTLD_NOLOAD`. (#8952) [@Xottab-DUTY]
+ `RTLD_NOLOAD`. (#8952) [@Xottab-DUTY, @threedeyes]
+- Examples: SDL2+DirectX11: Try WARP software driver if hardware driver is
+ not available. (#5924, #5562)
+- Examples: SDL3+DirectX11: Added SDL3+DirectX11 example. (#8956, #8957) [@tomaz82]
-----------------------------------------------------------------------
diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md
index 038bd5858..f61297fd1 100644
--- a/docs/EXAMPLES.md
+++ b/docs/EXAMPLES.md
@@ -149,8 +149,12 @@ SDL2 (Win32, Mac, Linux, etc.) + Vulkan example.
This is quite long and tedious, because: Vulkan.
For this example, the main.cpp file exceptionally use helpers function from imgui_impl_vulkan.h/cpp.
+[example_sdl3_directx11/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl3_directx11/)
+SDL3 + DirectX11 examples, Windows only.
+= main.cpp + imgui_impl_sdl3.cpp + imgui_impl_dx11.cpp
+
[example_sdl3_metal/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl3_metal/)
-SDL3 + Metal example (Mac).
+SDL3 + Metal example, Mac only.
= main.cpp + imgui_impl_sdl3.cpp + imgui_impl_metal.mm
[example_sdl3_opengl3/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl3_opengl3/)
diff --git a/examples/example_sdl2_directx11/main.cpp b/examples/example_sdl2_directx11/main.cpp
index a2b39f362..ec6602f83 100644
--- a/examples/example_sdl2_directx11/main.cpp
+++ b/examples/example_sdl2_directx11/main.cpp
@@ -230,7 +230,10 @@ bool CreateDeviceD3D(HWND hWnd)
//createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
D3D_FEATURE_LEVEL featureLevel;
const D3D_FEATURE_LEVEL featureLevelArray[2] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_0, };
- if (D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, createDeviceFlags, featureLevelArray, 2, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &featureLevel, &g_pd3dDeviceContext) != S_OK)
+ HRESULT res = D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, createDeviceFlags, featureLevelArray, 2, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &featureLevel, &g_pd3dDeviceContext);
+ if (res == DXGI_ERROR_UNSUPPORTED) // Try high-performance WARP software driver if hardware is not available.
+ res = D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_WARP, nullptr, createDeviceFlags, featureLevelArray, 2, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &featureLevel, &g_pd3dDeviceContext);
+ if (res != S_OK)
return false;
CreateRenderTarget();
diff --git a/examples/example_sdl3_directx11/main.cpp b/examples/example_sdl3_directx11/main.cpp
index a604e3076..bc8889b8c 100644
--- a/examples/example_sdl3_directx11/main.cpp
+++ b/examples/example_sdl3_directx11/main.cpp
@@ -11,7 +11,7 @@
#include "imgui_impl_sdl3.h"
#include "imgui_impl_dx11.h"
#include
-#include
+#include // printf
#include
// Data
@@ -40,7 +40,7 @@ int main(int, char**)
// Setup window
float main_scale = SDL_GetDisplayContentScale(SDL_GetPrimaryDisplay());
SDL_WindowFlags window_flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN | SDL_WINDOW_HIGH_PIXEL_DENSITY;
- SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL3+DirectX11 example", (int)(1280 * main_scale), (int)(720 * main_scale), window_flags);
+ SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL3+DirectX11 example", (int)(1280 * main_scale), (int)(800 * main_scale), window_flags);
if (window == nullptr)
{
printf("Error: SDL_CreateWindow(): %s\n", SDL_GetError());
@@ -54,7 +54,7 @@ int main(int, char**)
if (!CreateDeviceD3D(hwnd))
{
CleanupDeviceD3D();
- return 1;
+ return -1;
}
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
@@ -189,6 +189,7 @@ int main(int, char**)
}
// Cleanup
+ // [If using SDL_MAIN_USE_CALLBACKS: all code below would likely be your SDL_AppQuit() function]
ImGui_ImplDX11_Shutdown();
ImGui_ImplSDL3_Shutdown();
ImGui::DestroyContext();
@@ -224,7 +225,10 @@ bool CreateDeviceD3D(HWND hWnd)
//createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
D3D_FEATURE_LEVEL featureLevel;
const D3D_FEATURE_LEVEL featureLevelArray[2] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_0, };
- if (D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, createDeviceFlags, featureLevelArray, 2, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &featureLevel, &g_pd3dDeviceContext) != S_OK)
+ HRESULT res = D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, createDeviceFlags, featureLevelArray, 2, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &featureLevel, &g_pd3dDeviceContext);
+ if (res == DXGI_ERROR_UNSUPPORTED) // Try high-performance WARP software driver if hardware is not available.
+ res = D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_WARP, nullptr, createDeviceFlags, featureLevelArray, 2, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &featureLevel, &g_pd3dDeviceContext);
+ if (res != S_OK)
return false;
CreateRenderTarget();
diff --git a/examples/example_win32_directx10/main.cpp b/examples/example_win32_directx10/main.cpp
index 12f10ab4d..6fd10f83d 100644
--- a/examples/example_win32_directx10/main.cpp
+++ b/examples/example_win32_directx10/main.cpp
@@ -1,4 +1,4 @@
-// Dear ImGui: standalone example application for DirectX 10
+// Dear ImGui: standalone example application for Windows API + DirectX 10
// Learn about Dear ImGui:
// - FAQ https://dearimgui.com/faq
diff --git a/examples/example_win32_directx11/main.cpp b/examples/example_win32_directx11/main.cpp
index 2b85895f7..5b88007a9 100644
--- a/examples/example_win32_directx11/main.cpp
+++ b/examples/example_win32_directx11/main.cpp
@@ -1,4 +1,4 @@
-// Dear ImGui: standalone example application for DirectX 11
+// Dear ImGui: standalone example application for Windows API + DirectX 11
// Learn about Dear ImGui:
// - FAQ https://dearimgui.com/faq
diff --git a/examples/example_win32_directx12/main.cpp b/examples/example_win32_directx12/main.cpp
index 4ff7c54e5..a5396d31b 100644
--- a/examples/example_win32_directx12/main.cpp
+++ b/examples/example_win32_directx12/main.cpp
@@ -1,4 +1,4 @@
-// Dear ImGui: standalone example application for DirectX 12
+// Dear ImGui: standalone example application for Windows API + DirectX 12
// Learn about Dear ImGui:
// - FAQ https://dearimgui.com/faq
diff --git a/examples/example_win32_directx9/main.cpp b/examples/example_win32_directx9/main.cpp
index 66369d242..b330efdeb 100644
--- a/examples/example_win32_directx9/main.cpp
+++ b/examples/example_win32_directx9/main.cpp
@@ -1,4 +1,4 @@
-// Dear ImGui: standalone example application for DirectX 9
+// Dear ImGui: standalone example application for Windows API + DirectX 9
// Learn about Dear ImGui:
// - FAQ https://dearimgui.com/faq
diff --git a/examples/example_win32_opengl3/main.cpp b/examples/example_win32_opengl3/main.cpp
index 648d0d969..9ad74d61f 100644
--- a/examples/example_win32_opengl3/main.cpp
+++ b/examples/example_win32_opengl3/main.cpp
@@ -1,4 +1,4 @@
-// Dear ImGui: standalone example application for Win32 + OpenGL 3
+// Dear ImGui: standalone example application for Windows API + OpenGL
// Learn about Dear ImGui:
// - FAQ https://dearimgui.com/faq
diff --git a/examples/example_win32_vulkan/main.cpp b/examples/example_win32_vulkan/main.cpp
index b4b3a0860..6063437d8 100644
--- a/examples/example_win32_vulkan/main.cpp
+++ b/examples/example_win32_vulkan/main.cpp
@@ -1,4 +1,4 @@
-// Dear ImGui: standalone example application for Win32 + Vulkan
+// Dear ImGui: standalone example application for Windows API + Vulkan
// Learn about Dear ImGui:
// - FAQ https://dearimgui.com/faq