Use an internal version of BufferBindingLayout.
Bug: TBD
Change-Id: Ib2ac584dc3097d1036cc4b47335c5058bf267cf5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/182920
Reviewed-by: Loko Kung <lokokung@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/generator/templates/dawn/native/api_absl_format.cpp b/generator/templates/dawn/native/api_absl_format.cpp
index 32cb043..d488d8b 100644
--- a/generator/templates/dawn/native/api_absl_format.cpp
+++ b/generator/templates/dawn/native/api_absl_format.cpp
@@ -78,7 +78,6 @@
{% for type in by_category["structure"] %}
{% if type.name.get() in [
- "buffer binding layout",
"sampler binding layout",
"texture binding layout",
"storage texture binding layout"
diff --git a/generator/templates/dawn/native/api_absl_format.h b/generator/templates/dawn/native/api_absl_format.h
index 4599e77..00c8ed8 100644
--- a/generator/templates/dawn/native/api_absl_format.h
+++ b/generator/templates/dawn/native/api_absl_format.h
@@ -68,7 +68,6 @@
//
{% for type in by_category["structure"] %}
{% if type.name.get() in [
- "buffer binding layout",
"sampler binding layout",
"texture binding layout",
"storage texture binding layout"
diff --git a/src/dawn/native/BindGroup.cpp b/src/dawn/native/BindGroup.cpp
index 65ff312..a122b86 100644
--- a/src/dawn/native/BindGroup.cpp
+++ b/src/dawn/native/BindGroup.cpp
@@ -51,7 +51,7 @@
MaybeError ValidateBufferBinding(const DeviceBase* device,
const BindGroupEntry& entry,
- const BufferBindingLayout& layout) {
+ const BufferBindingInfo& layout) {
DAWN_INVALID_IF(entry.buffer == nullptr, "Binding entry buffer not set.");
DAWN_INVALID_IF(entry.sampler != nullptr || entry.textureView != nullptr,
@@ -288,7 +288,7 @@
uint32_t packedIndex = 0;
for (BindingIndex bindingIndex{0}; bindingIndex < bgl->GetBufferCount(); ++bindingIndex) {
const auto* bufferLayout =
- std::get_if<BufferBindingLayout>(&bgl->GetBindingInfo(bindingIndex).bindingLayout);
+ std::get_if<BufferBindingInfo>(&bgl->GetBindingInfo(bindingIndex).bindingLayout);
if (bufferLayout == nullptr || bufferLayout->minBindingSize == 0) {
f(bindingIndex, packedIndex++);
}
@@ -367,7 +367,7 @@
// Perform binding-type specific validation.
DAWN_TRY(MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout& layout) -> MaybeError {
+ [&](const BufferBindingInfo& layout) -> MaybeError {
// TODO(dawn:1485): Validate buffer binding with usage validation mode.
DAWN_TRY_CONTEXT(ValidateBufferBinding(device, entry, layout),
"validating entries[%u] as a Buffer."
@@ -569,7 +569,7 @@
DAWN_ASSERT(!IsError());
const BindGroupLayoutInternalBase* layout = GetLayout();
DAWN_ASSERT(bindingIndex < layout->GetBindingCount());
- DAWN_ASSERT(std::holds_alternative<BufferBindingLayout>(
+ DAWN_ASSERT(std::holds_alternative<BufferBindingInfo>(
layout->GetBindingInfo(bindingIndex).bindingLayout));
BufferBase* buffer = static_cast<BufferBase*>(mBindingData.bindings[bindingIndex].Get());
return {buffer, mBindingData.bufferData[bindingIndex].offset,
diff --git a/src/dawn/native/BindGroupLayoutInternal.cpp b/src/dawn/native/BindGroupLayoutInternal.cpp
index 0d207b2..d16f911 100644
--- a/src/dawn/native/BindGroupLayoutInternal.cpp
+++ b/src/dawn/native/BindGroupLayoutInternal.cpp
@@ -346,8 +346,8 @@
return MatchVariant(
a.bindingLayout,
- [&](const BufferBindingLayout& layoutA) -> bool {
- const BufferBindingLayout& layoutB = std::get<BufferBindingLayout>(b.bindingLayout);
+ [&](const BufferBindingInfo& layoutA) -> bool {
+ const BufferBindingInfo& layoutB = std::get<BufferBindingInfo>(b.bindingLayout);
return layoutA.type != layoutB.type ||
layoutA.hasDynamicOffset != layoutB.hasDynamicOffset ||
layoutA.minBindingSize != layoutB.minBindingSize;
@@ -393,7 +393,7 @@
bindingInfo.visibility = binding->visibility;
if (binding->buffer.type != wgpu::BufferBindingType::Undefined) {
- bindingInfo.bindingLayout = binding->buffer;
+ bindingInfo.bindingLayout = BufferBindingInfo(binding->buffer);
} else if (binding->sampler.type != wgpu::SamplerBindingType::Undefined) {
bindingInfo.bindingLayout = binding->sampler;
} else if (binding->texture.sampleType != wgpu::TextureSampleType::Undefined) {
@@ -468,8 +468,8 @@
switch (GetBindingInfoType(aInfo)) {
case BindingInfoType::Buffer: {
- const auto& aLayout = std::get<BufferBindingLayout>(aInfo.bindingLayout);
- const auto& bLayout = std::get<BufferBindingLayout>(bInfo.bindingLayout);
+ const auto& aLayout = std::get<BufferBindingInfo>(aInfo.bindingLayout);
+ const auto& bLayout = std::get<BufferBindingInfo>(bInfo.bindingLayout);
if (aLayout.minBindingSize != bLayout.minBindingSize) {
return aLayout.minBindingSize < bLayout.minBindingSize;
}
@@ -532,7 +532,7 @@
BindingIndex lastBufferIndex{0};
BindingIndex firstNonBufferIndex = std::numeric_limits<BindingIndex>::max();
for (auto [i, binding] : Enumerate(bindings)) {
- if (std::holds_alternative<BufferBindingLayout>(binding.bindingLayout)) {
+ if (std::holds_alternative<BufferBindingInfo>(binding.bindingLayout)) {
lastBufferIndex = std::max(i, lastBufferIndex);
} else {
firstNonBufferIndex = std::min(i, firstNonBufferIndex);
@@ -633,7 +633,7 @@
MatchVariant(
info.bindingLayout,
- [&](const BufferBindingLayout& layout) {
+ [&](const BufferBindingInfo& layout) {
recorder.Record(BindingInfoType::Buffer, layout.hasDynamicOffset, layout.type,
layout.minBindingSize);
},
@@ -746,7 +746,7 @@
bool BindGroupLayoutInternalBase::IsStorageBufferBinding(BindingIndex bindingIndex) const {
DAWN_ASSERT(bindingIndex < GetBufferCount());
- switch (std::get<BufferBindingLayout>(GetBindingInfo(bindingIndex).bindingLayout).type) {
+ switch (std::get<BufferBindingInfo>(GetBindingInfo(bindingIndex).bindingLayout).type) {
case wgpu::BufferBindingType::Uniform:
return false;
case kInternalStorageBufferBinding:
diff --git a/src/dawn/native/BindingInfo.cpp b/src/dawn/native/BindingInfo.cpp
index b7714e0..1ca7259 100644
--- a/src/dawn/native/BindingInfo.cpp
+++ b/src/dawn/native/BindingInfo.cpp
@@ -36,7 +36,7 @@
BindingInfoType GetBindingInfoType(const BindingInfo& info) {
return MatchVariant(
info.bindingLayout,
- [](const BufferBindingLayout&) -> BindingInfoType { return BindingInfoType::Buffer; },
+ [](const BufferBindingInfo&) -> BindingInfoType { return BindingInfoType::Buffer; },
[](const SamplerBindingLayout&) -> BindingInfoType { return BindingInfoType::Sampler; },
[](const TextureBindingLayout&) -> BindingInfoType { return BindingInfoType::Texture; },
[](const StorageTextureBindingLayout&) -> BindingInfoType {
@@ -227,4 +227,11 @@
return {};
}
+BufferBindingInfo::BufferBindingInfo() = default;
+
+BufferBindingInfo::BufferBindingInfo(const BufferBindingLayout& apiLayout)
+ : type(apiLayout.type),
+ minBindingSize(apiLayout.minBindingSize),
+ hasDynamicOffset(apiLayout.hasDynamicOffset) {}
+
} // namespace dawn::native
diff --git a/src/dawn/native/BindingInfo.h b/src/dawn/native/BindingInfo.h
index 638d2f2..c53c6ab 100644
--- a/src/dawn/native/BindingInfo.h
+++ b/src/dawn/native/BindingInfo.h
@@ -70,11 +70,23 @@
Ref<SamplerBase> sampler;
};
+// A mirror of wgpu::BufferBindingLayout for use inside dawn::native.
+struct BufferBindingInfo {
+ BufferBindingInfo();
+ explicit BufferBindingInfo(const BufferBindingLayout& apiLayout);
+
+ wgpu::BufferBindingType type;
+ uint64_t minBindingSize;
+
+ // Always false in shader reflection.
+ bool hasDynamicOffset = false;
+};
+
struct BindingInfo {
BindingNumber binding;
wgpu::ShaderStage visibility;
- std::variant<BufferBindingLayout,
+ std::variant<BufferBindingInfo,
SamplerBindingLayout,
TextureBindingLayout,
StorageTextureBindingLayout,
diff --git a/src/dawn/native/CommandBufferStateTracker.cpp b/src/dawn/native/CommandBufferStateTracker.cpp
index a57bbb9..83a532a 100644
--- a/src/dawn/native/CommandBufferStateTracker.cpp
+++ b/src/dawn/native/CommandBufferStateTracker.cpp
@@ -124,8 +124,8 @@
for (BindingIndex bindingIndex{0}; bindingIndex < bgl->GetBufferCount(); ++bindingIndex) {
const BindingInfo& bindingInfo = bgl->GetBindingInfo(bindingIndex);
// Buffer bindings are sorted to have smallest of bindingIndex.
- const BufferBindingLayout& layout =
- std::get<BufferBindingLayout>(bindingInfo.bindingLayout);
+ const BufferBindingInfo& layout =
+ std::get<BufferBindingInfo>(bindingInfo.bindingLayout);
// BindGroup validation already guarantees the buffer usage includes
// wgpu::BufferUsage::Storage
@@ -676,7 +676,7 @@
mBindgroups[i]->GetUnverifiedBufferSizes()[packedIndex.value()];
uint64_t minBufferSize = (*mMinBufferSizes)[i][packedIndex.value()];
- const auto& layout = std::get<BufferBindingLayout>(bindingInfo.bindingLayout);
+ const auto& layout = std::get<BufferBindingInfo>(bindingInfo.bindingLayout);
return DAWN_VALIDATION_ERROR(
"%s bound with size %u at group %u, binding %u is too small. The pipeline (%s) "
"requires a buffer binding which is at least %u bytes.%s",
diff --git a/src/dawn/native/PassResourceUsageTracker.cpp b/src/dawn/native/PassResourceUsageTracker.cpp
index 96dff82..07ab558 100644
--- a/src/dawn/native/PassResourceUsageTracker.cpp
+++ b/src/dawn/native/PassResourceUsageTracker.cpp
@@ -111,7 +111,7 @@
MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout& layout) {
+ [&](const BufferBindingInfo& layout) {
BufferBase* buffer = group->GetBindingAsBufferBinding(bindingIndex).buffer;
switch (layout.type) {
case wgpu::BufferBindingType::Uniform:
@@ -215,7 +215,7 @@
MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout&) {
+ [&](const BufferBindingInfo&) {
mUsage.referencedBuffers.insert(group->GetBindingAsBufferBinding(index).buffer);
},
[&](const TextureBindingLayout&) {
diff --git a/src/dawn/native/ProgrammableEncoder.cpp b/src/dawn/native/ProgrammableEncoder.cpp
index 036b231..3372931 100644
--- a/src/dawn/native/ProgrammableEncoder.cpp
+++ b/src/dawn/native/ProgrammableEncoder.cpp
@@ -149,8 +149,8 @@
const BindingInfo& bindingInfo = layout->GetBindingInfo(i);
// BGL creation sorts bindings such that the dynamic buffer bindings are first.
- const BufferBindingLayout& bindingLayout =
- std::get<BufferBindingLayout>(bindingInfo.bindingLayout);
+ const BufferBindingInfo& bindingLayout =
+ std::get<BufferBindingInfo>(bindingInfo.bindingLayout);
DAWN_ASSERT(bindingLayout.hasDynamicOffset);
uint64_t requiredAlignment;
diff --git a/src/dawn/native/ShaderModule.cpp b/src/dawn/native/ShaderModule.cpp
index b23e14a..0702c8f 100644
--- a/src/dawn/native/ShaderModule.cpp
+++ b/src/dawn/native/ShaderModule.cpp
@@ -389,7 +389,7 @@
for (BindingIndex bindingIndex{0}; bindingIndex < layout->GetBufferCount(); ++bindingIndex) {
const BindingInfo& bindingInfo = layout->GetBindingInfo(bindingIndex);
const auto* bufferBindingLayout =
- std::get_if<BufferBindingLayout>(&bindingInfo.bindingLayout);
+ std::get_if<BufferBindingInfo>(&bindingInfo.bindingLayout);
if (bufferBindingLayout == nullptr || bufferBindingLayout->minBindingSize > 0) {
// Skip bindings that have minimum buffer size set in the layout
continue;
@@ -548,8 +548,8 @@
return {};
},
[&](const BufferBindingInfo& bindingInfo) -> MaybeError {
- const BufferBindingLayout& bindingLayout =
- std::get<BufferBindingLayout>(layoutInfo.bindingLayout);
+ const BufferBindingInfo& bindingLayout =
+ std::get<BufferBindingInfo>(layoutInfo.bindingLayout);
// Binding mismatch between shader and bind group is invalid. For example, a
// writable binding in the shader with a readonly storage buffer in the bind
// group layout is invalid. For internal usage with internal shaders, a storage
diff --git a/src/dawn/native/ShaderModule.h b/src/dawn/native/ShaderModule.h
index a186ac2..570f080 100644
--- a/src/dawn/native/ShaderModule.h
+++ b/src/dawn/native/ShaderModule.h
@@ -172,12 +172,6 @@
// Mirrors wgpu::ExternalTextureBindingLayout
struct ExternalTextureBindingInfo {};
-// Mirrors wgpu::BufferBindingLayout
-struct BufferBindingInfo {
- wgpu::BufferBindingType type;
- uint64_t minBindingSize;
-};
-
// Mirrors wgpu::StorageTextureBindingLayout
struct StorageTextureBindingInfo {
wgpu::TextureFormat format;
diff --git a/src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp b/src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp
index c1b3298..5467aad 100644
--- a/src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp
+++ b/src/dawn/native/d3d11/BindGroupTrackerD3D11.cpp
@@ -175,7 +175,7 @@
DAWN_TRY(MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout& layout) -> MaybeError {
+ [&](const BufferBindingInfo& layout) -> MaybeError {
BufferBinding binding = group->GetBindingAsBufferBinding(bindingIndex);
auto offset = binding.offset;
if (layout.hasDynamicOffset) {
@@ -295,7 +295,7 @@
DAWN_TRY(MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout& layout) -> MaybeError {
+ [&](const BufferBindingInfo& layout) -> MaybeError {
BufferBinding binding = group->GetBindingAsBufferBinding(bindingIndex);
auto offset = binding.offset;
if (layout.hasDynamicOffset) {
@@ -465,7 +465,7 @@
MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout& layout) {
+ [&](const BufferBindingInfo& layout) {
switch (layout.type) {
case wgpu::BufferBindingType::Uniform: {
ID3D11Buffer* nullBuffer = nullptr;
diff --git a/src/dawn/native/d3d11/PipelineLayoutD3D11.cpp b/src/dawn/native/d3d11/PipelineLayoutD3D11.cpp
index f3d7400..9da7d26 100644
--- a/src/dawn/native/d3d11/PipelineLayoutD3D11.cpp
+++ b/src/dawn/native/d3d11/PipelineLayoutD3D11.cpp
@@ -64,7 +64,7 @@
const BindingInfo& bindingInfo = bgl->GetBindingInfo(bindingIndex);
MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout& layout) {
+ [&](const BufferBindingInfo& layout) {
switch (layout.type) {
case wgpu::BufferBindingType::Uniform:
mIndexInfo[group][bindingIndex] = constantBufferIndex++;
diff --git a/src/dawn/native/d3d12/BindGroupD3D12.cpp b/src/dawn/native/d3d12/BindGroupD3D12.cpp
index 2698840..00a3ce5 100644
--- a/src/dawn/native/d3d12/BindGroupD3D12.cpp
+++ b/src/dawn/native/d3d12/BindGroupD3D12.cpp
@@ -74,7 +74,7 @@
// local to the allocation with OffsetFrom().
MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout& layout) {
+ [&](const BufferBindingInfo& layout) {
BufferBinding binding = GetBindingAsBufferBinding(bindingIndex);
ID3D12Resource* resource = ToBackend(binding.buffer)->GetD3D12Resource();
diff --git a/src/dawn/native/d3d12/BindGroupLayoutD3D12.cpp b/src/dawn/native/d3d12/BindGroupLayoutD3D12.cpp
index 7a8d088..44d621a 100644
--- a/src/dawn/native/d3d12/BindGroupLayoutD3D12.cpp
+++ b/src/dawn/native/d3d12/BindGroupLayoutD3D12.cpp
@@ -40,7 +40,7 @@
D3D12_DESCRIPTOR_RANGE_TYPE WGPUBindingInfoToDescriptorRangeType(const BindingInfo& bindingInfo) {
return MatchVariant(
bindingInfo.bindingLayout,
- [](const BufferBindingLayout& layout) -> D3D12_DESCRIPTOR_RANGE_TYPE {
+ [](const BufferBindingInfo& layout) -> D3D12_DESCRIPTOR_RANGE_TYPE {
switch (layout.type) {
case wgpu::BufferBindingType::Uniform:
return D3D12_DESCRIPTOR_RANGE_TYPE_CBV;
@@ -105,8 +105,8 @@
if (bindingIndex < GetDynamicBufferCount()) {
continue;
}
- DAWN_ASSERT(!std::holds_alternative<BufferBindingLayout>(bindingInfo.bindingLayout) ||
- !std::get<BufferBindingLayout>(bindingInfo.bindingLayout).hasDynamicOffset);
+ DAWN_ASSERT(!std::holds_alternative<BufferBindingInfo>(bindingInfo.bindingLayout) ||
+ !std::get<BufferBindingInfo>(bindingInfo.bindingLayout).hasDynamicOffset);
mDescriptorHeapOffsets[bindingIndex] =
descriptorRangeType == D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER
@@ -139,7 +139,7 @@
// point to data.
return D3D12_DESCRIPTOR_RANGE_FLAG_NONE;
},
- [](const BufferBindingLayout&) -> D3D12_DESCRIPTOR_RANGE_FLAGS {
+ [](const BufferBindingInfo&) -> D3D12_DESCRIPTOR_RANGE_FLAGS {
// In Dawn it's allowed to do state transitions on the buffers or textures after
// binding
// them on the current command list, which indicates a change to its data (or
diff --git a/src/dawn/native/d3d12/CommandBufferD3D12.cpp b/src/dawn/native/d3d12/CommandBufferD3D12.cpp
index 674ae04..78dc3a2 100644
--- a/src/dawn/native/d3d12/CommandBufferD3D12.cpp
+++ b/src/dawn/native/d3d12/CommandBufferD3D12.cpp
@@ -524,7 +524,7 @@
D3D12_GPU_VIRTUAL_ADDRESS bufferLocation =
ToBackend(binding.buffer)->GetVA() + offset;
- switch (std::get<BufferBindingLayout>(bindingInfo.bindingLayout).type) {
+ switch (std::get<BufferBindingInfo>(bindingInfo.bindingLayout).type) {
case wgpu::BufferBindingType::Uniform:
if (mInCompute) {
commandList->SetComputeRootConstantBufferView(parameterIndex,
diff --git a/src/dawn/native/d3d12/PipelineLayoutD3D12.cpp b/src/dawn/native/d3d12/PipelineLayoutD3D12.cpp
index 7aa0cff..4b0a879 100644
--- a/src/dawn/native/d3d12/PipelineLayoutD3D12.cpp
+++ b/src/dawn/native/d3d12/PipelineLayoutD3D12.cpp
@@ -250,7 +250,7 @@
// Set parameter types according to bind group layout descriptor.
rootParameter.ParameterType =
- RootParameterType(std::get<BufferBindingLayout>(bindingInfo.bindingLayout).type);
+ RootParameterType(std::get<BufferBindingInfo>(bindingInfo.bindingLayout).type);
// Set visibilities according to bind group layout descriptor.
rootParameter.ShaderVisibility = ShaderVisibilityType(bindingInfo.visibility);
@@ -425,7 +425,7 @@
uint32_t PipelineLayout::GetDynamicRootParameterIndex(BindGroupIndex group,
BindingIndex bindingIndex) const {
DAWN_ASSERT(group < kMaxBindGroupsTyped);
- DAWN_ASSERT(std::get<BufferBindingLayout>(
+ DAWN_ASSERT(std::get<BufferBindingInfo>(
GetBindGroupLayout(group)->GetBindingInfo(bindingIndex).bindingLayout)
.hasDynamicOffset);
DAWN_ASSERT(GetBindGroupLayout(group)->GetBindingInfo(bindingIndex).visibility !=
diff --git a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp
index b47f575..bc04f3c 100644
--- a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp
+++ b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp
@@ -260,7 +260,7 @@
if (bufferBindingInfo) {
const auto& bindingLayout =
- std::get<BufferBindingLayout>(bgl->GetBindingInfo(bindingIndex).bindingLayout);
+ std::get<BufferBindingInfo>(bgl->GetBindingInfo(bindingIndex).bindingLayout);
// Declaring a read-only storage buffer in HLSL but specifying a storage
// buffer in the BGL produces the wrong output. Force read-only storage
diff --git a/src/dawn/native/metal/CommandBufferMTL.mm b/src/dawn/native/metal/CommandBufferMTL.mm
index fe3d2c4..baadfcb 100644
--- a/src/dawn/native/metal/CommandBufferMTL.mm
+++ b/src/dawn/native/metal/CommandBufferMTL.mm
@@ -573,7 +573,7 @@
MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout& layout) {
+ [&](const BufferBindingInfo& layout) {
const BufferBinding& binding = group->GetBindingAsBufferBinding(bindingIndex);
ToBackend(binding.buffer)->TrackUsage();
const id<MTLBuffer> buffer = ToBackend(binding.buffer)->GetMTLBuffer();
diff --git a/src/dawn/native/metal/PipelineLayoutMTL.mm b/src/dawn/native/metal/PipelineLayoutMTL.mm
index 0eca24f..a597277 100644
--- a/src/dawn/native/metal/PipelineLayoutMTL.mm
+++ b/src/dawn/native/metal/PipelineLayoutMTL.mm
@@ -63,7 +63,7 @@
MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout&) {
+ [&](const BufferBindingInfo&) {
mIndexInfo[stage][group][bindingIndex] = bufferIndex;
bufferIndex++;
},
diff --git a/src/dawn/native/opengl/CommandBufferGL.cpp b/src/dawn/native/opengl/CommandBufferGL.cpp
index 9a6d891..0a8012e 100644
--- a/src/dawn/native/opengl/CommandBufferGL.cpp
+++ b/src/dawn/native/opengl/CommandBufferGL.cpp
@@ -295,7 +295,7 @@
const BindingInfo& bindingInfo = group->GetLayout()->GetBindingInfo(bindingIndex);
MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout& layout) {
+ [&](const BufferBindingInfo& layout) {
BufferBinding binding = group->GetBindingAsBufferBinding(bindingIndex);
GLuint buffer = ToBackend(binding.buffer)->GetHandle();
GLuint index = indices[bindingIndex];
diff --git a/src/dawn/native/opengl/PipelineLayoutGL.cpp b/src/dawn/native/opengl/PipelineLayoutGL.cpp
index 774316d..4b2a20d 100644
--- a/src/dawn/native/opengl/PipelineLayoutGL.cpp
+++ b/src/dawn/native/opengl/PipelineLayoutGL.cpp
@@ -51,7 +51,7 @@
const BindingInfo& bindingInfo = bgl->GetBindingInfo(bindingIndex);
MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout& layout) {
+ [&](const BufferBindingInfo& layout) {
switch (layout.type) {
case wgpu::BufferBindingType::Uniform:
mIndexInfo[group][bindingIndex] = uboIndex;
diff --git a/src/dawn/native/vulkan/BindGroupLayoutVk.cpp b/src/dawn/native/vulkan/BindGroupLayoutVk.cpp
index f4fc084..fb5f2bd 100644
--- a/src/dawn/native/vulkan/BindGroupLayoutVk.cpp
+++ b/src/dawn/native/vulkan/BindGroupLayoutVk.cpp
@@ -66,7 +66,7 @@
VkDescriptorType VulkanDescriptorType(const BindingInfo& bindingInfo) {
return MatchVariant(
bindingInfo.bindingLayout,
- [](const BufferBindingLayout& layout) -> VkDescriptorType {
+ [](const BufferBindingInfo& layout) -> VkDescriptorType {
switch (layout.type) {
case wgpu::BufferBindingType::Uniform:
if (layout.hasDynamicOffset) {
diff --git a/src/dawn/native/vulkan/BindGroupVk.cpp b/src/dawn/native/vulkan/BindGroupVk.cpp
index cb952ea..c9f932d 100644
--- a/src/dawn/native/vulkan/BindGroupVk.cpp
+++ b/src/dawn/native/vulkan/BindGroupVk.cpp
@@ -81,7 +81,7 @@
bool shouldWriteDescriptor = MatchVariant(
bindingInfo.bindingLayout,
- [&](const BufferBindingLayout&) -> bool {
+ [&](const BufferBindingInfo&) -> bool {
BufferBinding binding = GetBindingAsBufferBinding(bindingIndex);
VkBuffer handle = ToBackend(binding.buffer)->GetHandle();
diff --git a/src/dawn/native/webgpu_absl_format.cpp b/src/dawn/native/webgpu_absl_format.cpp
index 763aafc..f20aca2 100644
--- a/src/dawn/native/webgpu_absl_format.cpp
+++ b/src/dawn/native/webgpu_absl_format.cpp
@@ -119,7 +119,7 @@
new absl::ParsedFormat<'u', 's', 's', 's'>("{ binding: %u, visibility: %s, %s: %s }");
MatchVariant(
value.bindingLayout,
- [&](const BufferBindingLayout& layout) {
+ [&](const BufferBindingInfo& layout) {
s->Append(absl::StrFormat(*fmt, static_cast<uint32_t>(value.binding), value.visibility,
BindingInfoType::Buffer, layout));
},
@@ -143,6 +143,23 @@
}
absl::FormatConvertResult<absl::FormatConversionCharSet::kString> AbslFormatConvert(
+ const BufferBindingInfo& value,
+ const absl::FormatConversionSpec& spec,
+ absl::FormatSink* s) {
+ s->Append(absl::StrFormat("{type: %s, minBindingSize: %u, hasDynamicOffset: %u}", value.type,
+ value.minBindingSize, value.hasDynamicOffset));
+ return {true};
+}
+
+absl::FormatConvertResult<absl::FormatConversionCharSet::kString> AbslFormatConvert(
+ const BufferBindingLayout& value,
+ const absl::FormatConversionSpec& spec,
+ absl::FormatSink* s) {
+ BufferBindingInfo info(value);
+ return AbslFormatConvert(info, spec, s);
+}
+
+absl::FormatConvertResult<absl::FormatConversionCharSet::kString> AbslFormatConvert(
const ImageCopyTexture* value,
const absl::FormatConversionSpec& spec,
absl::FormatSink* s) {
diff --git a/src/dawn/native/webgpu_absl_format.h b/src/dawn/native/webgpu_absl_format.h
index 15e9393..c3af2f7 100644
--- a/src/dawn/native/webgpu_absl_format.h
+++ b/src/dawn/native/webgpu_absl_format.h
@@ -82,6 +82,18 @@
const absl::FormatConversionSpec& spec,
absl::FormatSink* s);
+struct BufferBindingInfo;
+absl::FormatConvertResult<absl::FormatConversionCharSet::kString> AbslFormatConvert(
+ const BufferBindingInfo& value,
+ const absl::FormatConversionSpec& spec,
+ absl::FormatSink* s);
+
+struct BufferBindingLayout;
+absl::FormatConvertResult<absl::FormatConversionCharSet::kString> AbslFormatConvert(
+ const BufferBindingLayout& value,
+ const absl::FormatConversionSpec& spec,
+ absl::FormatSink* s);
+
struct ImageCopyTexture;
absl::FormatConvertResult<absl::FormatConversionCharSet::kString> AbslFormatConvert(
const ImageCopyTexture* value,