Skip to content

Commit

Permalink
Backends: WGPU: Fix new WGPUStringView breaks shader compilation. (#8009
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Sibly authored and ocornut committed Sep 23, 2024
1 parent fb41046 commit 7f81fbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions backends/imgui_impl_wgpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,15 @@ static WGPUProgrammableStageDescriptor ImGui_ImplWGPU_CreateShaderModule(const c
{
ImGui_ImplWGPU_Data* bd = ImGui_ImplWGPU_GetBackendData();

WGPUShaderModuleWGSLDescriptor wgsl_desc = {};
#ifdef IMGUI_IMPL_WEBGPU_BACKEND_DAWN
WGPUShaderSourceWGSL wgsl_desc = {};
wgsl_desc.chain.sType = WGPUSType_ShaderSourceWGSL;
wgsl_desc.code = { wgsl_source, WGPU_STRLEN };
#else
WGPUShaderModuleWGSLDescriptor wgsl_desc = {};
wgsl_desc.chain.sType = WGPUSType_ShaderModuleWGSLDescriptor;
wgsl_desc.code = wgsl_source;
#endif
wgsl_desc.code = wgsl_source;

WGPUShaderModuleDescriptor desc = {};
desc.nextInChain = reinterpret_cast<WGPUChainedStruct*>(&wgsl_desc);
Expand Down
3 changes: 2 additions & 1 deletion docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ Other changes:
- Scrollbar: added io.ConfigScrollbarScrollByPage setting (default to true). (#8002, #7328)
Set io.ConfigScrollbarScrollByPage=false to enforce always scrolling to clicked location.
- Backends: SDL3: Update for API changes: SDL_bool removal. SDL_INIT_TIMER removal.

- Backends: WebGPU: Fixed DAWN api change using WGPUStringView in WGPUShaderSourceWGSL.
(#8009, #8010) [@blitz-research]

-----------------------------------------------------------------------
VERSION 1.91.2 (Released 2024-09-19)
Expand Down

0 comments on commit 7f81fbc

Please sign in to comment.