Browse Source

Backends: WebGPU: fixed validation error with default depth buffer settings. (#5869, #5914)

(initialize WGPUCompareFunction params to valid values)
kdchambers 2 years ago
parent
commit
233d7ad3f2
2 changed files with 5 additions and 1 deletions
  1. 4 0
      backends/imgui_impl_wgpu.cpp
  2. 1 1
      docs/CHANGELOG.txt

+ 4 - 0
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;

+ 1 - 1
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.