mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Examples: WGPU: tweak headers and standardize other things so examples have less differences. (#8381)
This commit is contained in:
parent
3cc8b470a6
commit
8e5e79054e
3 changed files with 23 additions and 20 deletions
|
|
@ -22,13 +22,12 @@
|
||||||
#if defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)
|
#if defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)
|
||||||
#include <emscripten/html5_webgpu.h>
|
#include <emscripten/html5_webgpu.h>
|
||||||
#endif
|
#endif
|
||||||
#include <webgpu/webgpu.h>
|
|
||||||
#include <webgpu/webgpu_cpp.h>
|
|
||||||
#include "../libs/emscripten/emscripten_mainloop_stub.h"
|
#include "../libs/emscripten/emscripten_mainloop_stub.h"
|
||||||
#else
|
|
||||||
#if defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN)
|
|
||||||
#include <webgpu/webgpu_glfw.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <webgpu/webgpu.h>
|
||||||
|
#if defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN)
|
||||||
|
#include <webgpu/webgpu_cpp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
|
|
@ -323,6 +322,7 @@ int main(int, char**)
|
||||||
#endif
|
#endif
|
||||||
#include <GLFW/glfw3native.h>
|
#include <GLFW/glfw3native.h>
|
||||||
#undef Status // X11 headers are leaking this.
|
#undef Status // X11 headers are leaking this.
|
||||||
|
#undef Success // X11 headers are leaking this.
|
||||||
|
|
||||||
WGPUSurface CreateWGPUSurface(const WGPUInstance& instance, GLFWwindow* window)
|
WGPUSurface CreateWGPUSurface(const WGPUInstance& instance, GLFWwindow* window)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
WGPUInstance wgpu_instance = nullptr;
|
static WGPUInstance wgpu_instance = nullptr;
|
||||||
WGPUDevice wgpu_device = nullptr;
|
static WGPUDevice wgpu_device = nullptr;
|
||||||
WGPUSurface wgpu_surface = nullptr;
|
static WGPUSurface wgpu_surface = nullptr;
|
||||||
WGPUQueue wgpu_queue = nullptr;
|
static WGPUQueue wgpu_queue = nullptr;
|
||||||
WGPUSurfaceConfiguration wgpu_surface_configuration = {};
|
static WGPUSurfaceConfiguration wgpu_surface_configuration = {};
|
||||||
int wgpu_surface_width = 1280;
|
static int wgpu_surface_width = 1280;
|
||||||
int wgpu_surface_height = 800;
|
static int wgpu_surface_height = 800;
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
static bool InitWGPU(SDL_Window* window);
|
static bool InitWGPU(SDL_Window* window);
|
||||||
|
|
@ -282,6 +282,9 @@ int main(int, char**)
|
||||||
#if !defined(__EMSCRIPTEN__) && (defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU) || defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN))
|
#if !defined(__EMSCRIPTEN__) && (defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU) || defined(IMGUI_IMPL_WEBGPU_BACKEND_DAWN))
|
||||||
|
|
||||||
#include <SDL_syswm.h>
|
#include <SDL_syswm.h>
|
||||||
|
#undef Status // X11 headers are leaking this.
|
||||||
|
#undef Success // X11 headers are leaking this.
|
||||||
|
|
||||||
WGPUSurface CreateWGPUSurface(const WGPUInstance& instance, SDL_Window* window)
|
WGPUSurface CreateWGPUSurface(const WGPUInstance& instance, SDL_Window* window)
|
||||||
{
|
{
|
||||||
SDL_SysWMinfo sysWMInfo;
|
SDL_SysWMinfo sysWMInfo;
|
||||||
|
|
|
||||||
|
|
@ -32,18 +32,18 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
WGPUInstance wgpu_instance = nullptr;
|
static WGPUInstance wgpu_instance = nullptr;
|
||||||
WGPUDevice wgpu_device = nullptr;
|
static WGPUDevice wgpu_device = nullptr;
|
||||||
WGPUSurface wgpu_surface = nullptr;
|
static WGPUSurface wgpu_surface = nullptr;
|
||||||
WGPUQueue wgpu_queue = nullptr;
|
static WGPUQueue wgpu_queue = nullptr;
|
||||||
WGPUSurfaceConfiguration wgpu_surface_configuration = {};
|
static WGPUSurfaceConfiguration wgpu_surface_configuration = {};
|
||||||
int wgpu_surface_width = 1280;
|
static int wgpu_surface_width = 1280;
|
||||||
int wgpu_surface_height = 800;
|
static int wgpu_surface_height = 800;
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
static bool InitWGPU(SDL_Window* window);
|
static bool InitWGPU(SDL_Window* window);
|
||||||
|
|
||||||
void ResizeSurface(int width, int height)
|
static void ResizeSurface(int width, int height)
|
||||||
{
|
{
|
||||||
wgpu_surface_configuration.width = wgpu_surface_width = width;
|
wgpu_surface_configuration.width = wgpu_surface_width = width;
|
||||||
wgpu_surface_configuration.height = wgpu_surface_height = height;
|
wgpu_surface_configuration.height = wgpu_surface_height = height;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue