From fca200d5492c6a66d910a5eac2c4e0b19fa7dce9 Mon Sep 17 00:00:00 2001 From: bridgewaterrobbie Date: Tue, 6 May 2025 13:39:27 -0400 Subject: [PATCH] Use variant layout label if available --- filament/backend/src/webgpu/WebGPUHandles.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/filament/backend/src/webgpu/WebGPUHandles.cpp b/filament/backend/src/webgpu/WebGPUHandles.cpp index e380af099c..1de9f09e41 100644 --- a/filament/backend/src/webgpu/WebGPUHandles.cpp +++ b/filament/backend/src/webgpu/WebGPUHandles.cpp @@ -201,6 +201,15 @@ WebGPUDescriptorSetLayout::WebGPUDescriptorSetLayout(DescriptorSetLayout const& wgpu::Device const& device) { assert_invariant(device); + std::string baseLabel; + if (std::holds_alternative(layout.label)) { + const auto& temp = std::get_if(&layout.label); + baseLabel = temp->c_str(); + } else if (std::holds_alternative(layout.label)) { + const auto& temp = std::get_if(&layout.label); + baseLabel = temp->c_str(); + } + // TODO: layoutDescriptor has a "Label". Ideally we can get info on what this layout is for // debugging. For now, hack an incrementing value. static int layoutNum = 0; @@ -258,7 +267,7 @@ WebGPUDescriptorSetLayout::WebGPUDescriptorSetLayout(DescriptorSetLayout const& } // fEntry.count is unused currently } - std::string label = "layout_"+ std::to_string(++layoutNum) ; + std::string label = "layout_" + baseLabel + std::to_string(++layoutNum) ; wgpu::BindGroupLayoutDescriptor layoutDescriptor{ .label{label.c_str()}, // Use .c_str() if label needs to be const char* .entryCount = wEntries.size(),