Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backends/imgui_impl_sdlgpu3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ static void ImGui_ImplSDLGPU3_CreateWindow(ImGuiViewport* viewport)
ImGui_ImplSDLGPU3_Data* data = ImGui_ImplSDLGPU3_GetBackendData();
SDL_Window* window = SDL_GetWindowFromID((SDL_WindowID)(intptr_t)viewport->PlatformHandle);
SDL_ClaimWindowForGPUDevice(data->InitInfo.Device, window);
SDL_SetGPUSwapchainParameters(data->InitInfo.Device, window, data->InitInfo.SwapchainComposition, data->InitInfo.PresentMode);
viewport->RendererUserData = (void*)1;
}

Expand Down
8 changes: 5 additions & 3 deletions backends/imgui_impl_sdlgpu3.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
// - Remember to set ColorTargetFormat to the correct format. If you're rendering to the swapchain, call SDL_GetGPUSwapchainTextureFormat to query the right value
struct ImGui_ImplSDLGPU3_InitInfo
{
SDL_GPUDevice* Device = nullptr;
SDL_GPUTextureFormat ColorTargetFormat = SDL_GPU_TEXTUREFORMAT_INVALID;
SDL_GPUSampleCount MSAASamples = SDL_GPU_SAMPLECOUNT_1;
SDL_GPUDevice* Device = nullptr;
SDL_GPUTextureFormat ColorTargetFormat = SDL_GPU_TEXTUREFORMAT_INVALID;
SDL_GPUSampleCount MSAASamples = SDL_GPU_SAMPLECOUNT_1;
SDL_GPUSwapchainComposition SwapchainComposition = SDL_GPU_SWAPCHAINCOMPOSITION_SDR;
SDL_GPUPresentMode PresentMode = SDL_GPU_PRESENTMODE_VSYNC;
};

// Follow "Getting Started" link and check examples/ folder to learn about using backends!
Expand Down
2 changes: 2 additions & 0 deletions examples/example_sdl3_sdlgpu3/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ int main(int, char**)
init_info.Device = gpu_device;
init_info.ColorTargetFormat = SDL_GetGPUSwapchainTextureFormat(gpu_device, window);
init_info.MSAASamples = SDL_GPU_SAMPLECOUNT_1;
init_info.SwapchainComposition = SDL_GPU_SWAPCHAINCOMPOSITION_SDR;
init_info.PresentMode = SDL_GPU_PRESENTMODE_VSYNC;
ImGui_ImplSDLGPU3_Init(&init_info);

// Load Fonts
Expand Down
⌂ 换网址