From 233d7ad3f2234919aca2e78b974a7982ab71c249 Mon Sep 17 00:00:00 2001 From: kdchambers Date: Wed, 23 Nov 2022 15:58:02 -0500 Subject: [PATCH] Backends: WebGPU: fixed validation error with default depth buffer settings. (#5869, #5914) (initialize WGPUCompareFunction params to valid values) --- backends/imgui_impl_wgpu.cpp | 4 ++++ docs/CHANGELOG.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backends/imgui_impl_wgpu.cpp b/backends/imgui_impl_wgpu.cpp index c4bc5c76c..3282cf364 100644 --- a/backends/imgui_impl_wgpu.cpp +++ b/backends/imgui_impl_wgpu.cpp @@ -13,6 +13,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2022-11-24: Fixed validation error with default depth buffer settings. // 2022-11-10: Fixed rendering when a depth buffer is enabled. Added 'WGPUTextureFormat depth_format' parameter to ImGui_ImplWGPU_Init(). // 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11. // 2021-11-29: Passing explicit buffer sizes to wgpuRenderPassEncoderSetVertexBuffer()/wgpuRenderPassEncoderSetIndexBuffer(). @@ -606,6 +607,9 @@ bool ImGui_ImplWGPU_CreateDeviceObjects() WGPUDepthStencilState depth_stencil_state = {}; depth_stencil_state.format = g_depthStencilFormat; depth_stencil_state.depthWriteEnabled = false; + depth_stencil_state.depthCompare = WGPUCompareFunction_Always; + depth_stencil_state.stencilFront.compare = WGPUCompareFunction_Always; + depth_stencil_state.stencilBack.compare = WGPUCompareFunction_Always; // Configure disabled depth-stencil state graphics_pipeline_desc.depthStencil = g_depthStencilFormat == WGPUTextureFormat_Undefined ? nullptr : &depth_stencil_state; diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index ed6ff97e6..885bdbabe 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -46,6 +46,7 @@ HOW TO UPDATE? active but a payload hasn't been submitted yet. This is convenient to detect new payload from within a drag source handler. (#5910, #143) - Backends: GLFW: cancel out errors emitted by glfwGetKeyName() when a name is missing. (#5908) +- Backends: WebGPU: fixed validation error with default depth buffer settings. (#5869, #5914) [@kdchambers] ----------------------------------------------------------------------- @@ -114,7 +115,6 @@ Breaking changes: - Removed support for 1.42-era IMGUI_DISABLE_INCLUDE_IMCONFIG_H / IMGUI_INCLUDE_IMCONFIG_H. (#255) They only made sense before we could use IMGUI_USER_CONFIG. - Other Changes: - Popups & Modals: fixed nested Begin() inside a popup being erroneously input-inhibited.