Misc amends (8381)

This commit is contained in:
ocornut
2025-09-24 16:41:25 +02:00
parent 46ca8bc16f
commit 4deba36e83
11 changed files with 388 additions and 402 deletions

View File

@@ -28,13 +28,10 @@
#ifndef IMGUI_DISABLE
#include <webgpu/webgpu.h>
#if defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN)
// DAWN "wgpu::" classes (e.g. used in Validation Layers Callbacks)
#include <webgpu/webgpu_cpp.h>
#include <webgpu/webgpu_cpp.h> // for wgpu::Device, wgpu::DeviceLostReason, wgpu::ErrorType used by validation layer callbacks.
#elif !defined(__EMSCRIPTEN__)
// WGPU-Native specific data structure (e.g. used in WGPULogLevel)
#include <webgpu/wgpu.h>
#include <webgpu/wgpu.h> // WGPULogLevel
#endif
// Initialization data, for ImGui_ImplWGPU_Init()
@@ -76,20 +73,14 @@ struct ImGui_ImplWGPU_RenderState
WGPURenderPassEncoder RenderPassEncoder;
};
// WebGPU Helpers
// Check if the Status of SurfaceTexture is Optimal
bool ImGui_ImplWGPU_CheckSurfaceTextureOptimalStatus_Helper(WGPUSurfaceGetCurrentTextureStatus status);
// Print Adapter info
void ImGui_ImplWGPU_PrintAdapterInfo_Helper(const WGPUAdapter &adapter);
// (Optional) WebGPU Helpers
bool ImGui_ImplWGPU_CheckSurfaceTextureOptimalStatus_Helper(WGPUSurfaceGetCurrentTextureStatus status); // Check if the status of surface texture is optimal
void ImGui_ImplWGPU_PrintAdapterInfo_Helper(const WGPUAdapter& adapter);
#if defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN) // DAWN both Native / EMSCRIPTEN
// DAWN Validation Layer callback: reason for device loss
void ImGui_ImplWGPU_DAWN_DeviceLostCallback_Helper(const wgpu::Device&, wgpu::DeviceLostReason reason, wgpu::StringView message);
// DAWN Validation Layer callback: print error type
void ImGui_ImplWGPU_DAWN_ErrorCallback_Helper(const wgpu::Device&, wgpu::ErrorType type, wgpu::StringView message);
void ImGui_ImplWGPU_DAWN_DeviceLostCallback_Helper(const wgpu::Device&, wgpu::DeviceLostReason reason, wgpu::StringView msg);// DAWN Validation Layer callback: reason for device loss
void ImGui_ImplWGPU_DAWN_ErrorCallback_Helper(const wgpu::Device&, wgpu::ErrorType type, wgpu::StringView msg); // DAWN Validation Layer callback: print error type
#elif !defined(__EMSCRIPTEN__) // WGPU-Native
// WGPU-Native LOG callback: print information based on request level
void ImGui_ImplWGPU_WGPU_LogCallback_Helper(WGPULogLevel level, WGPUStringView message, void *userdata);
void ImGui_ImplWGPU_WGPU_LogCallback_Helper(WGPULogLevel level, WGPUStringView msg, void* userdata); // WGPU-Native log callback: print information based on request level.
#endif
#endif // #ifndef IMGUI_DISABLE