From b4033b37ad7980e34a7335aac8375ffc109ef818 Mon Sep 17 00:00:00 2001 From: Nicolas Chavez Date: Mon, 21 Oct 2024 14:19:31 +0200 Subject: [PATCH] Backends: WGPU: update for Dawn WGPU String usage. (#8082, #8083) --- backends/imgui_impl_wgpu.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/backends/imgui_impl_wgpu.cpp b/backends/imgui_impl_wgpu.cpp index 95f1b0c63..075f74734 100644 --- a/backends/imgui_impl_wgpu.cpp +++ b/backends/imgui_impl_wgpu.cpp @@ -17,6 +17,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2024-10-14: Update Dawn support for change of string usages. (#8082, #8083) // 2024-10-07: Expose selected render state in ImGui_ImplWGPU_RenderState, which you can access in 'void* platform_io.Renderer_RenderState' during draw callbacks. // 2024-10-07: Changed default texture sampler to Clamp instead of Repeat/Wrap. // 2024-09-16: Added support for optional IMGUI_IMPL_WEBGPU_BACKEND_DAWN / IMGUI_IMPL_WEBGPU_BACKEND_WGPU define to handle ever-changing native implementations. (#7977) @@ -275,7 +276,11 @@ static WGPUProgrammableStageDescriptor ImGui_ImplWGPU_CreateShaderModule(const c WGPUProgrammableStageDescriptor stage_desc = {}; stage_desc.module = wgpuDeviceCreateShaderModule(bd->wgpuDevice, &desc); +#ifdef IMGUI_IMPL_WEBGPU_BACKEND_DAWN + stage_desc.entryPoint = { "main", WGPU_STRLEN }; +#else stage_desc.entryPoint = "main"; +#endif return stage_desc; } @@ -388,6 +393,9 @@ void ImGui_ImplWGPU_RenderDrawData(ImDrawData* draw_data, WGPURenderPassEncoder { nullptr, "Dear ImGui Vertex buffer", +#ifdef IMGUI_IMPL_WEBGPU_BACKEND_DAWN + WGPU_STRLEN, +#endif WGPUBufferUsage_CopyDst | WGPUBufferUsage_Vertex, MEMALIGN(fr->VertexBufferSize * sizeof(ImDrawVert), 4), false @@ -412,6 +420,9 @@ void ImGui_ImplWGPU_RenderDrawData(ImDrawData* draw_data, WGPURenderPassEncoder { nullptr, "Dear ImGui Index buffer", +#ifdef IMGUI_IMPL_WEBGPU_BACKEND_DAWN + WGPU_STRLEN, +#endif WGPUBufferUsage_CopyDst | WGPUBufferUsage_Index, MEMALIGN(fr->IndexBufferSize * sizeof(ImDrawIdx), 4), false @@ -522,7 +533,11 @@ static void ImGui_ImplWGPU_CreateFontsTexture() // Upload texture to graphics system { WGPUTextureDescriptor tex_desc = {}; +#ifdef IMGUI_IMPL_WEBGPU_BACKEND_DAWN + tex_desc.label = { "Dear ImGui Font Texture", WGPU_STRLEN }; +#else tex_desc.label = "Dear ImGui Font Texture"; +#endif tex_desc.dimension = WGPUTextureDimension_2D; tex_desc.size.width = width; tex_desc.size.height = height; @@ -585,6 +600,9 @@ static void ImGui_ImplWGPU_CreateUniformBuffer() { nullptr, "Dear ImGui Uniform buffer", +#ifdef IMGUI_IMPL_WEBGPU_BACKEND_DAWN + WGPU_STRLEN, +#endif WGPUBufferUsage_CopyDst | WGPUBufferUsage_Uniform, MEMALIGN(sizeof(Uniforms), 16), false