Update BindingInfo to reflect new BindGroupLayoutEntry structure
Changes the internal BindingInfo structure and any references to it. The
BindGroupLayoutEntry information is normalized when converting it into
the internal representation, but still accepted as either the old or
new layout. A "bindingType" member is added to the BindingInfo that's
not present in the BindGroupLayoutEntry itself to indicate which of
buffer, sampler, texture, or storageTexture is populated. This proves
useful for a myriad of switch statements in the various backends.
Bug: dawn:527
Change-Id: I6ae65adae61d0005fc50ed6d1bc2ec9b2a1295ad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/35862
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Auto-Submit: Brandon Jones <bajones@chromium.org>
diff --git a/src/dawn_native/opengl/BindGroupGL.cpp b/src/dawn_native/opengl/BindGroupGL.cpp
index 02c1af4..486eb2c 100644
--- a/src/dawn_native/opengl/BindGroupGL.cpp
+++ b/src/dawn_native/opengl/BindGroupGL.cpp
@@ -30,31 +30,15 @@
ASSERT(bindingIndex < descriptor->layout->GetBindingCount());
const BindingInfo& bindingInfo = descriptor->layout->GetBindingInfo(bindingIndex);
- switch (bindingInfo.type) {
- case wgpu::BindingType::ReadonlyStorageTexture:
- case wgpu::BindingType::WriteonlyStorageTexture: {
- ASSERT(entry.textureView != nullptr);
- const uint32_t textureViewLayerCount = entry.textureView->GetLayerCount();
- if (textureViewLayerCount != 1 &&
- textureViewLayerCount !=
- entry.textureView->GetTexture()->GetArrayLayers()) {
- return DAWN_VALIDATION_ERROR(
- "Currently the OpenGL backend only supports either binding a layer or "
- "the entire texture as storage texture.");
- }
- } break;
-
- case wgpu::BindingType::UniformBuffer:
- case wgpu::BindingType::StorageBuffer:
- case wgpu::BindingType::ReadonlyStorageBuffer:
- case wgpu::BindingType::SampledTexture:
- case wgpu::BindingType::MultisampledTexture:
- case wgpu::BindingType::Sampler:
- case wgpu::BindingType::ComparisonSampler:
- break;
-
- case wgpu::BindingType::Undefined:
- UNREACHABLE();
+ if (bindingInfo.bindingType == BindingInfoType::StorageTexture) {
+ ASSERT(entry.textureView != nullptr);
+ const uint32_t textureViewLayerCount = entry.textureView->GetLayerCount();
+ if (textureViewLayerCount != 1 &&
+ textureViewLayerCount != entry.textureView->GetTexture()->GetArrayLayers()) {
+ return DAWN_VALIDATION_ERROR(
+ "Currently the OpenGL backend only supports either binding a layer or "
+ "the entire texture as storage texture.");
+ }
}
}