载入中...
搜索中...
未找到
imgui_impl_wgpu.cpp
浏览该文件的文档.
1// dear imgui: Renderer Backend for WebGPU (wgpu), adapted for EVEngine's
2// vendored imgui v1.83. Uses the stable webgpu.h C API so the same file
3// compiles against Dawn (native) and Emscripten (browser).
4//
5// This is a self-contained renderer: imgui draws are issued into an existing
6// WGPURenderPassEncoder supplied by the host (EVEngine's present overlay).
7
8// The source scanner compiles every *.cpp under ui/imgui/ on all platforms;
9// keep this TU empty when the WebGPU backend is not active.
10// config.h must be included before the guard: EVENGINE_WEBGPU is defined by
11// config.h, not by a -D flag, so including it inside the guard would make this
12// TU always empty.
13#include "common/config.h"
14
15#if defined(EVENGINE_WEBGPU)
16
17#include "imgui_impl_wgpu.h"
18
19#include <limits.h>
20#include <string.h>
21#include <limits>
22#include <vector>
23
24// Avoid clashes with Windows headers.
25#if defined(WIN32) && defined(min)
26#undef min
27#undef max
28#endif
29
30//-------------------------------------------------------------------------
31// Configuration
32//-------------------------------------------------------------------------
33#ifndef IMGUI_IMPL_WEBGPU_DEFAULT_FONT_SAMPLER
34#define IMGUI_IMPL_WEBGPU_DEFAULT_FONT_SAMPLER 0
35#endif
36
37//-----------------------------------------------------------------------------
38// Implementation
39//-----------------------------------------------------------------------------
40
41struct ImGui_ImplWGPU_Data {
42 WGPUDevice wgpuDevice = nullptr;
43 WGPUTextureFormat rtFormat = WGPUTextureFormat_BGRA8Unorm;
44
45 WGPUQueue defaultQueue = nullptr;
46
47 WGPUBindGroupLayout bindGroupLayout = nullptr;
48 WGPUBindGroup bindGroup = nullptr;
49 WGPUBuffer uniformBuffer = nullptr;
50 uint32_t uniformBufferSize = 0;
51 WGPURenderPipeline renderPipeline = nullptr;
52
53 WGPUTexture fontTexture = nullptr;
54 WGPUTextureView fontTextureView = nullptr;
55 WGPUSampler fontSampler = nullptr;
56
57 int numFramesInFlight = 1;
58 int frameIndex = 0;
59};
60
61// Backend data stored in io.BackendRendererUserData to allow support for multiple
62// Dear ImGui contexts.
63static ImGui_ImplWGPU_Data *ImGui_ImplWGPU_GetBackendData() {
64 return ImGui::GetCurrentContext() ? (ImGui_ImplWGPU_Data *)ImGui::GetIO().BackendRendererUserData
65 : nullptr;
66}
67
68static const char *ImGui_ImplWGPU_GetWGSLVertexShader() {
69 return R"(
70struct Uniforms {
71 mvp: mat4x4f,
72};
73struct VertexInput {
74 @location(0) position: vec2f,
75 @location(1) uv: vec2f,
76 @location(2) color: vec4f,
77};
78struct VertexOutput {
79 @builtin(position) position: vec4f,
80 @location(0) uv: vec2f,
81 @location(1) color: vec4f,
82};
83@group(0) @binding(0) var<uniform> uniforms: Uniforms;
84@vertex
85fn vs_main(in: VertexInput) -> VertexOutput {
86 var out: VertexOutput;
87 out.position = uniforms.mvp * vec4f(in.position, 0.0, 1.0);
88 out.uv = in.uv;
89 out.color = in.color;
90 return out;
91}
92)";
93}
94
95static const char *ImGui_ImplWGPU_GetWGSLFragmentShader() {
96 return R"(
97struct VertexOutput {
98 @builtin(position) position: vec4f,
99 @location(0) uv: vec2f,
100 @location(1) color: vec4f,
101};
102@group(0) @binding(1) var fontSampler: sampler;
103@group(0) @binding(2) var fontTexture: texture_2d<f32>;
104@fragment
105fn fs_main(in: VertexOutput) -> @location(0) vec4f {
106 return textureSample(fontTexture, fontSampler, in.uv) * in.color;
107}
108)";
109}
110
111static void ImGui_ImplWGPU_SetupRenderState(ImDrawData *draw_data,
112 WGPURenderPassEncoder pass_encoder) {
113 ImGui_ImplWGPU_Data *bd = ImGui_ImplWGPU_GetBackendData();
114
115 // Setup orthographic projection matrix into our constant buffer.
116 {
117 float L = draw_data->DisplayPos.x;
118 float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
119 float T = draw_data->DisplayPos.y;
120 float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y;
121 float mvp[4][4] = {
122 {2.0f / (R - L), 0.0f, 0.0f, 0.0f},
123 {0.0f, 2.0f / (T - B), 0.0f, 0.0f},
124 {0.0f, 0.0f, 0.5f, 0.0f},
125 {(R + L) / (L - R), (T + B) / (B - T), 0.5f, 1.0f},
126 };
127 wgpuQueueWriteBuffer(bd->defaultQueue, bd->uniformBuffer, 0, mvp, sizeof(mvp));
128 }
129
130 wgpuRenderPassEncoderSetPipeline(pass_encoder, bd->renderPipeline);
131 wgpuRenderPassEncoderSetBindGroup(pass_encoder, 0, bd->bindGroup, 0, nullptr);
132}
133
134static void ImGui_ImplWGPU_CreatePipeline() {
135 ImGui_ImplWGPU_Data *bd = ImGui_ImplWGPU_GetBackendData();
136 WGPUDevice device = bd->wgpuDevice;
137
138 // Shader modules.
139 WGPUShaderSourceWGSL wgslVert{};
140 wgslVert.chain.sType = WGPUSType_ShaderSourceWGSL;
141 wgslVert.code = WGPUStringView{ImGui_ImplWGPU_GetWGSLVertexShader(),
142 strlen(ImGui_ImplWGPU_GetWGSLVertexShader())};
143 WGPUShaderModuleDescriptor vsDesc{};
144 vsDesc.nextInChain = &wgslVert.chain;
145 WGPUShaderModule vsModule = wgpuDeviceCreateShaderModule(device, &vsDesc);
146
147 WGPUShaderSourceWGSL wgslFrag{};
148 wgslFrag.chain.sType = WGPUSType_ShaderSourceWGSL;
149 wgslFrag.code = WGPUStringView{ImGui_ImplWGPU_GetWGSLFragmentShader(),
150 strlen(ImGui_ImplWGPU_GetWGSLFragmentShader())};
151 WGPUShaderModuleDescriptor fsDesc{};
152 fsDesc.nextInChain = &wgslFrag.chain;
153 WGPUShaderModule fsModule = wgpuDeviceCreateShaderModule(device, &fsDesc);
154
155 // Bind group layout.
156 WGPUBindGroupLayoutEntry entries[3] = {};
157 entries[0].binding = 0;
158 entries[0].visibility = WGPUShaderStage_Vertex;
159 entries[0].buffer.type = WGPUBufferBindingType_Uniform;
160 entries[0].buffer.minBindingSize = 64;
161 entries[1].binding = 1;
162 entries[1].visibility = WGPUShaderStage_Fragment;
163 entries[1].sampler.type = WGPUSamplerBindingType_Filtering;
164 entries[2].binding = 2;
165 entries[2].visibility = WGPUShaderStage_Fragment;
166 entries[2].texture.sampleType = WGPUTextureSampleType_Float;
167 entries[2].texture.viewDimension = WGPUTextureViewDimension_2D;
168 WGPUBindGroupLayoutDescriptor bglDesc{};
169 bglDesc.entryCount = 3;
170 bglDesc.entries = entries;
171 bd->bindGroupLayout = wgpuDeviceCreateBindGroupLayout(device, &bglDesc);
172
173 // Pipeline layout.
174 WGPUPipelineLayoutDescriptor plDesc{};
175 plDesc.bindGroupLayoutCount = 1;
176 plDesc.bindGroupLayouts = &bd->bindGroupLayout;
177 WGPUPipelineLayout pipelineLayout = wgpuDeviceCreatePipelineLayout(device, &plDesc);
178
179 // Vertex layout: ImDrawVert { vec2 pos; vec2 uv; u32 col; }
180 WGPUVertexAttribute attrs[3] = {};
181 attrs[0].format = WGPUVertexFormat_Float32x2;
182 attrs[0].offset = IM_OFFSETOF(ImDrawVert, pos);
183 attrs[0].shaderLocation = 0;
184 attrs[1].format = WGPUVertexFormat_Float32x2;
185 attrs[1].offset = IM_OFFSETOF(ImDrawVert, uv);
186 attrs[1].shaderLocation = 1;
187 attrs[2].format = WGPUVertexFormat_Unorm8x4;
188 attrs[2].offset = IM_OFFSETOF(ImDrawVert, col);
189 attrs[2].shaderLocation = 2;
190 WGPUVertexBufferLayout vbLayout{};
191 vbLayout.arrayStride = sizeof(ImDrawVert);
192 vbLayout.stepMode = WGPUVertexStepMode_Vertex;
193 vbLayout.attributeCount = 3;
194 vbLayout.attributes = attrs;
195
196 WGPUBlendState blend{};
197 blend.color.srcFactor = WGPUBlendFactor_SrcAlpha;
198 blend.color.dstFactor = WGPUBlendFactor_OneMinusSrcAlpha;
199 blend.color.operation = WGPUBlendOperation_Add;
200 blend.alpha.srcFactor = WGPUBlendFactor_One;
201 blend.alpha.dstFactor = WGPUBlendFactor_OneMinusSrcAlpha;
202 blend.alpha.operation = WGPUBlendOperation_Add;
203
204 WGPUColorTargetState colorTarget{};
205 colorTarget.format = bd->rtFormat;
206 colorTarget.blend = &blend;
207 colorTarget.writeMask = WGPUColorWriteMask_All;
208
209 WGPURenderPipelineDescriptor desc{};
210 desc.layout = pipelineLayout;
211 desc.vertex.module = vsModule;
212 desc.vertex.entryPoint = WGPUStringView{"vs_main", sizeof("vs_main") - 1};
213 desc.vertex.bufferCount = 1;
214 desc.vertex.buffers = &vbLayout;
215 desc.primitive.topology = WGPUPrimitiveTopology_TriangleList;
216 desc.primitive.frontFace = WGPUFrontFace_CCW;
217 desc.primitive.cullMode = WGPUCullMode_None;
218 desc.primitive.stripIndexFormat = WGPUIndexFormat_Undefined;
219 WGPUFragmentState fragState{};
220 fragState.module = fsModule;
221 fragState.entryPoint = WGPUStringView{"fs_main", sizeof("fs_main") - 1};
222 fragState.targetCount = 1;
223 fragState.targets = &colorTarget;
224 desc.fragment = &fragState;
225 desc.multisample.count = 1;
226 desc.multisample.mask = UINT32_MAX;
227 bd->renderPipeline = wgpuDeviceCreateRenderPipeline(device, &desc);
228}
229
230static void ImGui_ImplWGPU_CreateUniformBuffer() {
231 ImGui_ImplWGPU_Data *bd = ImGui_ImplWGPU_GetBackendData();
232 WGPUDevice device = bd->wgpuDevice;
233
234 bd->uniformBufferSize = 64;
235 WGPUBufferDescriptor desc{};
236 desc.size = bd->uniformBufferSize;
237 desc.usage = WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst;
238 desc.mappedAtCreation = false;
239 bd->uniformBuffer = wgpuDeviceCreateBuffer(device, &desc);
240}
241
243 ImGuiIO &io = ImGui::GetIO();
244 ImGui_ImplWGPU_Data *bd = ImGui_ImplWGPU_GetBackendData();
245 WGPUDevice device = bd->wgpuDevice;
246
247 unsigned char *pixels;
248 int width, height, size;
249 io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height, &size);
250 size_t stride = static_cast<size_t>(width) * 4;
251 if (width <= 0 || height <= 0 || stride > std::numeric_limits<uint32_t>::max()) return false;
252
253 WGPUTextureDescriptor texDesc{};
254 texDesc.dimension = WGPUTextureDimension_2D;
255 texDesc.size.width = width;
256 texDesc.size.height = height;
257 texDesc.size.depthOrArrayLayers = 1;
258 texDesc.sampleCount = 1;
259 texDesc.format = WGPUTextureFormat_RGBA8Unorm;
260 texDesc.mipLevelCount = 1;
261 texDesc.usage = WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopyDst;
262 bd->fontTexture = wgpuDeviceCreateTexture(device, &texDesc);
263
264 WGPUTexelCopyBufferLayout layout{};
265 layout.offset = 0;
266 layout.bytesPerRow = static_cast<uint32_t>(stride);
267 layout.rowsPerImage = height;
268 WGPUTexelCopyTextureInfo copyDst{};
269 copyDst.texture = bd->fontTexture;
270 copyDst.mipLevel = 0;
271 copyDst.aspect = WGPUTextureAspect_All;
272 WGPUExtent3D extent{static_cast<uint32_t>(width), static_cast<uint32_t>(height), 1};
273 wgpuQueueWriteTexture(bd->defaultQueue, &copyDst, pixels, stride * height, &layout, &extent);
274
275 WGPUTextureViewDescriptor viewDesc{};
276 viewDesc.format = WGPUTextureFormat_RGBA8Unorm;
277 viewDesc.dimension = WGPUTextureViewDimension_2D;
278 viewDesc.baseMipLevel = 0;
279 viewDesc.mipLevelCount = 1;
280 viewDesc.baseArrayLayer = 0;
281 viewDesc.arrayLayerCount = 1;
282 bd->fontTextureView = wgpuTextureCreateView(bd->fontTexture, &viewDesc);
283
284 WGPUSamplerDescriptor samplerDesc{};
285 samplerDesc.maxAnisotropy = 1;
286 samplerDesc.lodMaxClamp = 32.f;
287 samplerDesc.minFilter = WGPUFilterMode_Linear;
288 samplerDesc.magFilter = WGPUFilterMode_Linear;
289 samplerDesc.mipmapFilter = WGPUMipmapFilterMode_Linear;
290 samplerDesc.addressModeU = WGPUAddressMode_ClampToEdge;
291 samplerDesc.addressModeV = WGPUAddressMode_ClampToEdge;
292 samplerDesc.addressModeW = WGPUAddressMode_ClampToEdge;
293 bd->fontSampler = wgpuDeviceCreateSampler(device, &samplerDesc);
294
295 WGPUBindGroupEntry entries[3] = {};
296 entries[0].binding = 0;
297 entries[0].buffer = bd->uniformBuffer;
298 entries[0].size = bd->uniformBufferSize;
299 entries[1].binding = 1;
300 entries[1].sampler = bd->fontSampler;
301 entries[2].binding = 2;
302 entries[2].textureView = bd->fontTextureView;
303
304 WGPUBindGroupDescriptor bgDesc{};
305 bgDesc.layout = bd->bindGroupLayout;
306 bgDesc.entryCount = 3;
307 bgDesc.entries = entries;
308 bd->bindGroup = wgpuDeviceCreateBindGroup(device, &bgDesc);
309
310 io.Fonts->SetTexID((ImTextureID)(intptr_t)bd->fontTextureView);
311 return true;
312}
313
315 ImGui_ImplWGPU_Data *bd = ImGui_ImplWGPU_GetBackendData();
316 if (!bd) return;
317 if (bd->fontTexture) { wgpuTextureRelease(bd->fontTexture); bd->fontTexture = nullptr; }
318 if (bd->fontTextureView) { wgpuTextureViewRelease(bd->fontTextureView); bd->fontTextureView = nullptr; }
319 if (bd->fontSampler) { wgpuSamplerRelease(bd->fontSampler); bd->fontSampler = nullptr; }
320 if (bd->bindGroup) { wgpuBindGroupRelease(bd->bindGroup); bd->bindGroup = nullptr; }
321 if (bd->bindGroupLayout) { wgpuBindGroupLayoutRelease(bd->bindGroupLayout); bd->bindGroupLayout = nullptr; }
322 if (bd->uniformBuffer) { wgpuBufferRelease(bd->uniformBuffer); bd->uniformBuffer = nullptr; }
323 if (bd->renderPipeline) { wgpuRenderPipelineRelease(bd->renderPipeline); bd->renderPipeline = nullptr; }
324 if (ImGui::GetCurrentContext() && ImGui::GetIO().Fonts)
325 ImGui::GetIO().Fonts->SetTexID(0);
326}
327
328bool ImGui_ImplWGPU_Init(WGPUDevice device, int num_frames_in_flight, WGPUTextureFormat rt_format) {
329 ImGuiIO &io = ImGui::GetIO();
330 IM_ASSERT(io.BackendRendererUserData == NULL && "Already initialized a renderer backend!");
331
332 ImGui_ImplWGPU_Data *bd = IM_NEW(ImGui_ImplWGPU_Data)();
333 io.BackendRendererUserData = (void *)bd;
334 io.BackendRendererName = "imgui_impl_webgpu";
335 io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset;
336
337 bd->wgpuDevice = device;
338 wgpuDeviceAddRef(device);
339 bd->rtFormat = rt_format;
340 bd->numFramesInFlight = num_frames_in_flight;
341 bd->defaultQueue = wgpuDeviceGetQueue(device);
342
343 ImGui_ImplWGPU_CreateUniformBuffer();
344 ImGui_ImplWGPU_CreatePipeline();
346
347 return true;
348}
349
351 ImGui_ImplWGPU_Data *bd = ImGui_ImplWGPU_GetBackendData();
352 IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
354 if (bd->defaultQueue) { wgpuQueueRelease(bd->defaultQueue); bd->defaultQueue = nullptr; }
355 if (bd->wgpuDevice) { wgpuDeviceRelease(bd->wgpuDevice); bd->wgpuDevice = nullptr; }
356 ImGuiIO &io = ImGui::GetIO();
357 io.BackendRendererName = NULL;
358 io.BackendRendererUserData = NULL;
359 IM_DELETE(bd);
360}
361
363 ImGui_ImplWGPU_Data *bd = ImGui_ImplWGPU_GetBackendData();
364 IM_ASSERT(bd != NULL && "Did you call ImGui_ImplWGPU_Init()?");
365 bd->frameIndex = (bd->frameIndex + 1) % bd->numFramesInFlight;
366}
367
368void ImGui_ImplWGPU_RenderDrawData(ImDrawData *draw_data, WGPURenderPassEncoder pass_encoder) {
369 ImGui_ImplWGPU_Data *bd = ImGui_ImplWGPU_GetBackendData();
370 if (draw_data->CmdListsCount == 0) return;
371
372 ImGui_ImplWGPU_SetupRenderState(draw_data, pass_encoder);
373
374 // Will project scissor/clipping rectangles into framebuffer space.
375 ImVec2 clip_off = draw_data->DisplayPos;
376 ImVec2 clip_scale = draw_data->FramebufferScale;
377
378 const float fb_width = draw_data->DisplaySize.x * clip_scale.x;
379 const float fb_height = draw_data->DisplaySize.y * clip_scale.y;
380 if (fb_width <= 0.0f || fb_height <= 0.0f) return;
381
382 for (int n = 0; n < draw_data->CmdListsCount; n++) {
383 const ImDrawList *cmd_list = draw_data->CmdLists[n];
384
385 // Create and upload vertex/index buffers.
386 size_t vbSize = (size_t)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert);
387 size_t ibSize = (size_t)cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx);
388 WGPUBuffer vb = nullptr;
389 WGPUBuffer ib = nullptr;
390
391 WGPUBufferDescriptor vbDesc{};
392 vbDesc.size = vbSize;
393 vbDesc.usage = WGPUBufferUsage_Vertex | WGPUBufferUsage_CopyDst;
394 vbDesc.mappedAtCreation = false;
395 vb = wgpuDeviceCreateBuffer(bd->wgpuDevice, &vbDesc);
396 wgpuQueueWriteBuffer(bd->defaultQueue, vb, 0, cmd_list->VtxBuffer.Data, vbSize);
397
398 WGPUBufferDescriptor ibDesc{};
399 const size_t alignedIbSize = (ibSize + 3) & ~size_t(3);
400 ibDesc.size = alignedIbSize;
401 ibDesc.usage = WGPUBufferUsage_Index | WGPUBufferUsage_CopyDst;
402 ibDesc.mappedAtCreation = false;
403 ib = wgpuDeviceCreateBuffer(bd->wgpuDevice, &ibDesc);
404 // writeBuffer requires four-byte sizes, including odd 16-bit index counts.
405 std::vector<unsigned char> indexUpload(alignedIbSize, 0);
406 memcpy(indexUpload.data(), cmd_list->IdxBuffer.Data, ibSize);
407 wgpuQueueWriteBuffer(bd->defaultQueue, ib, 0, indexUpload.data(), alignedIbSize);
408
409 wgpuRenderPassEncoderSetVertexBuffer(pass_encoder, 0, vb, 0, vbSize);
410 wgpuRenderPassEncoderSetIndexBuffer(pass_encoder, ib,
411 sizeof(ImDrawIdx) == 2 ? WGPUIndexFormat_Uint16
412 : WGPUIndexFormat_Uint32,
413 0, ibSize);
414
415 for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) {
416 const ImDrawCmd *pcmd = &cmd_list->CmdBuffer[cmd_i];
417 if (pcmd->UserCallback != NULL) {
418 pcmd->UserCallback(cmd_list, pcmd);
419 } else {
420 // Project scissor/clipping rectangles into framebuffer space.
421 ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x,
422 (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
423 ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x,
424 (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
425 if (clip_min.x < 0.0f) clip_min.x = 0.0f;
426 if (clip_min.y < 0.0f) clip_min.y = 0.0f;
427 if (clip_max.x > fb_width) clip_max.x = fb_width;
428 if (clip_max.y > fb_height) clip_max.y = fb_height;
429 if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y) continue;
430
431 wgpuRenderPassEncoderSetScissorRect(pass_encoder,
432 (uint32_t)clip_min.x, (uint32_t)clip_min.y,
433 (uint32_t)(clip_max.x - clip_min.x),
434 (uint32_t)(clip_max.y - clip_min.y));
435
436 // Bind font texture when the texture id changes.
437 WGPUTextureView fontTextureView =
438 (WGPUTextureView)(intptr_t)pcmd->TextureId;
439 if (fontTextureView != bd->fontTextureView) {
440 WGPUBindGroupEntry entries[3] = {};
441 entries[0].binding = 0;
442 entries[0].buffer = bd->uniformBuffer;
443 entries[0].size = bd->uniformBufferSize;
444 entries[1].binding = 1;
445 entries[1].sampler = bd->fontSampler;
446 entries[2].binding = 2;
447 entries[2].textureView = fontTextureView;
448 WGPUBindGroupDescriptor bgDesc{};
449 bgDesc.layout = bd->bindGroupLayout;
450 bgDesc.entryCount = 3;
451 bgDesc.entries = entries;
452 WGPUBindGroup bg = wgpuDeviceCreateBindGroup(bd->wgpuDevice, &bgDesc);
453 wgpuRenderPassEncoderSetBindGroup(pass_encoder, 0, bg, 0, nullptr);
454 wgpuBindGroupRelease(bg);
455 } else {
456 wgpuRenderPassEncoderSetBindGroup(pass_encoder, 0, bd->bindGroup, 0, nullptr);
457 }
458
459 wgpuRenderPassEncoderDrawIndexed(pass_encoder, pcmd->ElemCount, 1,
460 pcmd->IdxOffset, (int32_t)pcmd->VtxOffset, 0);
461 }
462 }
463
464 wgpuBufferRelease(vb);
465 wgpuBufferRelease(ib);
466 }
467}
468
469#endif // EVENGINE_WEBGPU
std::unordered_map< std::string, QuestRuntime > entries
float uv
scene::NodeDesc desc
std::string layout
vkb::Device & device
glm::mat4 mvp
glm::vec3 n
Definition Grass.cpp:63
float blend
std::uint32_t height
std::uint32_t width
uint8_t * pixels
float size
Definition TreeMesh.cpp:158
bool ImGui_ImplWGPU_CreateFontsTexture()
Internal EVUI font-upload compatibility entry point following the ImGui backend convention.
void ImGui_ImplWGPU_InvalidateDeviceObjects()
Im gui impl wgpu invalidate device objects.
void ImGui_ImplWGPU_RenderDrawData(ImDrawData *draw_data, WGPURenderPassEncoder pass_encoder)
Im gui impl wgpu render draw data.
bool ImGui_ImplWGPU_Init(WGPUDevice device, int num_frames_in_flight, WGPUTextureFormat rt_format)
Internal EVUI compatibility entry point following the ImGui renderer backend convention.
void ImGui_ImplWGPU_Shutdown()
Im gui impl wgpu shutdown.
void ImGui_ImplWGPU_NewFrame()
Im gui impl wgpu new frame.
std::vector< int64_t > attrs(const Node &n, const char *key, std::vector< int64_t > fallback)
Attrs.