// THIS FILE HAS BEEN AUTO-GENERATED BY THE 'DEAR BINDINGS' GENERATOR.
// **DO NOT EDIT DIRECTLY**
// https://github.com/dearimgui/dear_bindings

// dear imgui: Renderer for WebGPU
// Auto-generated forward declarations for C header
typedef struct ImGui_ImplWGPU_InitInfo_t ImGui_ImplWGPU_InitInfo;
typedef struct ImGui_ImplWGPU_RenderState_t ImGui_ImplWGPU_RenderState;
typedef struct ImGui_ImplWGPU_CreateSurfaceInfo_t ImGui_ImplWGPU_CreateSurfaceInfo;
// ImDrawIdx: vertex index. [Compile-time configurable type]
// - To use 16-bit indices + allow large meshes: backend need to set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset (recommended).
// - To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in your imconfig.h file.
#ifndef ImDrawIdx
typedef unsigned short ImDrawIdx;  // Default: 16-bit (for maximum compatibility with renderer backends)
#endif // #ifndef ImDrawIdx
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL2, SDL3)
// (Please note that WebGPU is a recent API, may not be supported by all browser, and its ecosystem is generally a mess)

// When targeting native platforms:
//  - One of IMGUI_IMPL_WEBGPU_BACKEND_DAWN, IMGUI_IMPL_WEBGPU_BACKEND_WGPU or IMGUI_IMPL_WEBGPU_BACKEND_WGVK *must* be provided.
// When targeting Emscripten:
//  - We now defaults to IMGUI_IMPL_WEBGPU_BACKEND_DAWN and requires Emscripten 4.0.10+, which correspond to using Emscripten '--use-port=emdawnwebgpu'.
//  - Emscripten < 4.0.10 is not supported anymore (old '-sUSE_WEBGPU=1' option).
//  - We can still define IMGUI_IMPL_WEBGPU_BACKEND_WGPU to use Emscripten '-s USE_WEBGPU=1' which is marked as obsolete by Emscripten.
// Add #define to your imconfig.h file, or as a compilation flag in your build system.
// This requirement may be removed once WebGPU stabilizes and backends converge on a unified interface.
//#define IMGUI_IMPL_WEBGPU_BACKEND_DAWN
//#define IMGUI_IMPL_WEBGPU_BACKEND_WGPU
//#define IMGUI_IMPL_WEBGPU_BACKEND_WGVK

// Implemented features:
//  [X] Renderer: User texture binding. Use 'WGPUTextureView' as ImTextureID. Read the FAQ about ImTextureID/ImTextureRef!
//  [X] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).
//  [X] Renderer: Expose selected render state for draw callbacks to use. Access in '(ImGui_ImplXXXX_RenderState*)GetPlatformIO().Renderer_RenderState'.
//  [X] Renderer: Texture updates support for dynamic font system (ImGuiBackendFlags_RendererHasTextures).
// Missing features or Issues:
//  [ ] Renderer: Multi-viewport support (multiple windows), useful for desktop.

// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
// Learn about Dear ImGui:
// - FAQ                  https://dearimgui.com/faq
// - Getting Started      https://dearimgui.com/getting-started
// - Documentation        https://dearimgui.com/docs (same as your local docs/ folder).
// - Introduction, links and more at the top of imgui.cpp

#pragma once

#ifdef __cplusplus
extern "C"
{
#endif
#include "dcimgui.h"
#ifndef IMGUI_DISABLE
// Setup Emscripten default if not specified.
#if defined(__EMSCRIPTEN__)&&!defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN)&&!defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)
#include <emscripten/version.h>
#define IMGUI_IMPL_WEBGPU_BACKEND_DAWN
#endif // #if defined(__EMSCRIPTEN__)&&!defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN)&&!defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)
#include <webgpu/webgpu.h>
#if defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)&&!defined(__EMSCRIPTEN__)
#include <webgpu/wgpu.h>
#endif // #if defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)&&!defined(__EMSCRIPTEN__)
typedef struct ImGui_ImplWGPU_InitInfo_ImDrawData_t ImGui_ImplWGPU_InitInfo_ImDrawData;
// Initialization data, for ImGui_ImplWGPU_Init()
struct ImGui_ImplWGPU_InitInfo_t
{
    WGPUDevice           Device /* = nullptr */;
    int                  NumFramesInFlight /* = 3 */;
    WGPUTextureFormat    RenderTargetFormat /* = WGPUTextureFormat_Undefined */;
    WGPUTextureFormat    DepthStencilFormat /* = WGPUTextureFormat_Undefined */;
    WGPUMultisampleState PipelineMultisampleState /* = {} */;
};

// Follow "Getting Started" link and check examples/ folder to learn about using backends!
CIMGUI_IMPL_API bool cImGui_ImplWGPU_Init(ImGui_ImplWGPU_InitInfo* init_info);
CIMGUI_IMPL_API void cImGui_ImplWGPU_Shutdown(void);
CIMGUI_IMPL_API void cImGui_ImplWGPU_NewFrame(void);
CIMGUI_IMPL_API void cImGui_ImplWGPU_RenderDrawData(ImDrawData* draw_data, WGPURenderPassEncoder pass_encoder);

// Use if you want to reset your rendering device without losing Dear ImGui state.
CIMGUI_IMPL_API bool cImGui_ImplWGPU_CreateDeviceObjects(void);
CIMGUI_IMPL_API void cImGui_ImplWGPU_InvalidateDeviceObjects(void);

// (Advanced) Use e.g. if you need to precisely control the timing of texture updates (e.g. for staged rendering), by setting ImDrawData::Textures = nullptr to handle this manually.
CIMGUI_IMPL_API void cImGui_ImplWGPU_UpdateTexture(ImTextureData* tex);

// [BETA] Selected render state data shared with callbacks.
// This is temporarily stored in GetPlatformIO().Renderer_RenderState during the ImGui_ImplWGPU_RenderDrawData() call.
// (Please open an issue if you feel you need access to more data)
struct ImGui_ImplWGPU_RenderState_t
{
    WGPUDevice            Device;
    WGPURenderPassEncoder RenderPassEncoder;
};

//-------------------------------------------------------------------------
// Internal Helpers
// Those are currently used by our example applications.
//-------------------------------------------------------------------------

// (Optional) Helper to wrap some of the Dawn/WGPU/Emscripten quirks
CIMGUI_IMPL_API bool cImGui_ImplWGPU_IsSurfaceStatusError(WGPUSurfaceGetCurrentTextureStatus status);
CIMGUI_IMPL_API bool cImGui_ImplWGPU_IsSurfaceStatusSubOptimal(WGPUSurfaceGetCurrentTextureStatus status); // Return whether the texture is suboptimal and may need to be recreated.

// (Optional) Helper for debugging/logging
CIMGUI_IMPL_API void   cImGui_ImplWGPU_DebugPrintAdapterInfo(WGPUAdapter adapter);
CIMGUI_IMPL_API const char* cImGui_ImplWGPU_GetBackendTypeName(WGPUBackendType type);
CIMGUI_IMPL_API const char* cImGui_ImplWGPU_GetAdapterTypeName(WGPUAdapterType type);
#if defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN)
CIMGUI_IMPL_API const char* cImGui_ImplWGPU_GetDeviceLostReasonName(WGPUDeviceLostReason type);
CIMGUI_IMPL_API const char* cImGui_ImplWGPU_GetErrorTypeName(WGPUErrorType type);
#else
#if defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)
CIMGUI_IMPL_API const char* cImGui_ImplWGPU_GetLogLevelName(WGPULogLevel level);
#endif // #if defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)
#endif // #if defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN)
// (Optional) Helper to create a surface on macOS/Wayland/X11/Window
#ifndef __EMSCRIPTEN__
struct ImGui_ImplWGPU_CreateSurfaceInfo_t
{
    WGPUInstance Instance;
    const char*  System;       // "cocoa"   | "wayland"   | "x11"     | "win32"
    void*        RawWindow;    // NSWindow* | 0           | Window    | HWND
    void*        RawDisplay;   // 0         | wl_display* | Display*  | 0
    void*        RawSurface;   //           | wl_surface* | 0         | 0
    void*        RawInstance;  // 0         | 0           | 0         | HINSTANCE
};
CIMGUI_IMPL_API WGPUSurface cImGui_ImplWGPU_CreateWGPUSurfaceHelper(ImGui_ImplWGPU_CreateSurfaceInfo* info);
#endif// #ifndef __EMSCRIPTEN__
#endif// #ifndef IMGUI_DISABLE
#ifdef __cplusplus
} // End of extern "C" block
#endif
