imgui_impl_wgpu.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334
  1. // dear imgui: Renderer for WebGPU
  2. // This needs to be used along with a Platform Binding (e.g. GLFW)
  3. // (Please note that WebGPU is currently experimental, will not run on non-beta browsers, and may break.)
  4. // Implemented features:
  5. // [X] Renderer: User texture binding. Use 'WGPUTextureView' as ImTextureID. Read the FAQ about ImTextureID!
  6. // [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
  7. // Missing features:
  8. // [ ] Renderer: Multi-viewport support (multiple windows). Not meaningful on the web.
  9. // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
  10. // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
  11. // Learn about Dear ImGui:
  12. // - FAQ https://dearimgui.com/faq
  13. // - Getting Started https://dearimgui.com/getting-started
  14. // - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
  15. // - Introduction, links and more at the top of imgui.cpp
  16. #pragma once
  17. #include "imgui.h" // IMGUI_IMPL_API
  18. #ifndef IMGUI_DISABLE
  19. #include <webgpu/webgpu.h>
  20. IMGUI_IMPL_API bool ImGui_ImplWGPU_Init(WGPUDevice device, int num_frames_in_flight, WGPUTextureFormat rt_format, WGPUTextureFormat depth_format = WGPUTextureFormat_Undefined);
  21. IMGUI_IMPL_API void ImGui_ImplWGPU_Shutdown();
  22. IMGUI_IMPL_API void ImGui_ImplWGPU_NewFrame();
  23. IMGUI_IMPL_API void ImGui_ImplWGPU_RenderDrawData(ImDrawData* draw_data, WGPURenderPassEncoder pass_encoder);
  24. // Use if you want to reset your rendering device without losing Dear ImGui state.
  25. IMGUI_IMPL_API void ImGui_ImplWGPU_InvalidateDeviceObjects();
  26. IMGUI_IMPL_API bool ImGui_ImplWGPU_CreateDeviceObjects();
  27. #endif // #ifndef IMGUI_DISABLE