浏览代码

Backends: WebGPU: Add nextInChain field for VertexAttributes under Dawn (#8438)

Alan 5 月之前
父节点
当前提交
cdafefd4be
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      backends/imgui_impl_wgpu.cpp

+ 6 - 0
backends/imgui_impl_wgpu.cpp

@@ -687,9 +687,15 @@ bool ImGui_ImplWGPU_CreateDeviceObjects()
     // Vertex input configuration
     // Vertex input configuration
     WGPUVertexAttribute attribute_desc[] =
     WGPUVertexAttribute attribute_desc[] =
     {
     {
+#ifdef IMGUI_IMPL_WEBGPU_BACKEND_DAWN
+        { nullptr, WGPUVertexFormat_Float32x2, (uint64_t)offsetof(ImDrawVert, pos), 0 },
+        { nullptr, WGPUVertexFormat_Float32x2, (uint64_t)offsetof(ImDrawVert, uv),  1 },
+        { nullptr, WGPUVertexFormat_Unorm8x4,  (uint64_t)offsetof(ImDrawVert, col), 2 },
+#else
         { WGPUVertexFormat_Float32x2, (uint64_t)offsetof(ImDrawVert, pos), 0 },
         { WGPUVertexFormat_Float32x2, (uint64_t)offsetof(ImDrawVert, pos), 0 },
         { WGPUVertexFormat_Float32x2, (uint64_t)offsetof(ImDrawVert, uv),  1 },
         { WGPUVertexFormat_Float32x2, (uint64_t)offsetof(ImDrawVert, uv),  1 },
         { WGPUVertexFormat_Unorm8x4,  (uint64_t)offsetof(ImDrawVert, col), 2 },
         { WGPUVertexFormat_Unorm8x4,  (uint64_t)offsetof(ImDrawVert, col), 2 },
+#endif
     };
     };
 
 
     WGPUVertexBufferLayout buffer_layouts[1];
     WGPUVertexBufferLayout buffer_layouts[1];