mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	Backends: SDL_GPU: add swapchain parameters to ImGui_ImplSDLGPU3_InitInfo. (#8892)
(master branch commit, values are not used)
This commit is contained in:
		| @@ -22,6 +22,7 @@ | |||||||
| //   Calling the function is MANDATORY, otherwise the ImGui will not upload neither the vertex nor the index buffer for the GPU. See imgui_impl_sdlgpu3.cpp for more info. | //   Calling the function is MANDATORY, otherwise the ImGui will not upload neither the vertex nor the index buffer for the GPU. See imgui_impl_sdlgpu3.cpp for more info. | ||||||
|  |  | ||||||
| // CHANGELOG | // CHANGELOG | ||||||
|  | //  2025-08-20: Added SwapchainComposition::SwapchainComposition and SwapchainComposition::PresentMode to configure how secondary viewports are created. | ||||||
| //  2025-08-08: *BREAKING* Changed ImTextureID type from SDL_GPUTextureSamplerBinding* to SDL_GPUTexture*, which is more natural and easier for user to manage. If you need to change the current sampler, you can access the ImGui_ImplSDLGPU3_RenderState struct. (#8866, #8163, #7998, #7988) | //  2025-08-08: *BREAKING* Changed ImTextureID type from SDL_GPUTextureSamplerBinding* to SDL_GPUTexture*, which is more natural and easier for user to manage. If you need to change the current sampler, you can access the ImGui_ImplSDLGPU3_RenderState struct. (#8866, #8163, #7998, #7988) | ||||||
| //  2025-08-08: Expose SamplerDefault and SamplerCurrent in ImGui_ImplSDLGPU3_RenderState. Allow callback to change sampler. | //  2025-08-08: Expose SamplerDefault and SamplerCurrent in ImGui_ImplSDLGPU3_RenderState. Allow callback to change sampler. | ||||||
| //  2025-06-25: Mapping transfer buffer for texture update use cycle=true. Fixes artifacts e.g. on Metal backend. | //  2025-06-25: Mapping transfer buffer for texture update use cycle=true. Fixes artifacts e.g. on Metal backend. | ||||||
|   | |||||||
| @@ -27,12 +27,14 @@ | |||||||
| #include <SDL3/SDL_gpu.h> | #include <SDL3/SDL_gpu.h> | ||||||
|  |  | ||||||
| // Initialization data, for ImGui_ImplSDLGPU_Init() | // Initialization data, for ImGui_ImplSDLGPU_Init() | ||||||
| // - Remember to set ColorTargetFormat to the correct format. If you're rendering to the swapchain, call SDL_GetGPUSwapchainTextureFormat to query the right value | // - 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 | struct ImGui_ImplSDLGPU3_InitInfo | ||||||
| { | { | ||||||
|     SDL_GPUDevice*       Device             = nullptr; |     SDL_GPUDevice*              Device                  = nullptr; | ||||||
|     SDL_GPUTextureFormat ColorTargetFormat  = SDL_GPU_TEXTUREFORMAT_INVALID; |     SDL_GPUTextureFormat        ColorTargetFormat       = SDL_GPU_TEXTUREFORMAT_INVALID; | ||||||
|     SDL_GPUSampleCount   MSAASamples        = SDL_GPU_SAMPLECOUNT_1; |     SDL_GPUSampleCount          MSAASamples             = SDL_GPU_SAMPLECOUNT_1; | ||||||
|  |     SDL_GPUSwapchainComposition SwapchainComposition    = SDL_GPU_SWAPCHAINCOMPOSITION_SDR;     // Only used in multi-viewports mode. | ||||||
|  |     SDL_GPUPresentMode          PresentMode             = SDL_GPU_PRESENTMODE_VSYNC;            // Only used in multi-viewports mode. | ||||||
| }; | }; | ||||||
|  |  | ||||||
| // Follow "Getting Started" link and check examples/ folder to learn about using backends! | // Follow "Getting Started" link and check examples/ folder to learn about using backends! | ||||||
|   | |||||||
| @@ -83,7 +83,9 @@ int main(int, char**) | |||||||
|     ImGui_ImplSDLGPU3_InitInfo init_info = {}; |     ImGui_ImplSDLGPU3_InitInfo init_info = {}; | ||||||
|     init_info.Device = gpu_device; |     init_info.Device = gpu_device; | ||||||
|     init_info.ColorTargetFormat = SDL_GetGPUSwapchainTextureFormat(gpu_device, window); |     init_info.ColorTargetFormat = SDL_GetGPUSwapchainTextureFormat(gpu_device, window); | ||||||
|     init_info.MSAASamples = SDL_GPU_SAMPLECOUNT_1; |     init_info.MSAASamples = SDL_GPU_SAMPLECOUNT_1;                      // Only used in multi-viewports mode. | ||||||
|  |     init_info.SwapchainComposition = SDL_GPU_SWAPCHAINCOMPOSITION_SDR;  // Only used in multi-viewports mode. | ||||||
|  |     init_info.PresentMode = SDL_GPU_PRESENTMODE_VSYNC; | ||||||
|     ImGui_ImplSDLGPU3_Init(&init_info); |     ImGui_ImplSDLGPU3_Init(&init_info); | ||||||
|  |  | ||||||
|     // Load Fonts |     // Load Fonts | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 PTSVU
					PTSVU