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/PipelineLayoutGL.cpp b/src/dawn_native/opengl/PipelineLayoutGL.cpp index 7161bfb..088eaf3 100644 --- a/src/dawn_native/opengl/PipelineLayoutGL.cpp +++ b/src/dawn_native/opengl/PipelineLayoutGL.cpp
@@ -34,36 +34,38 @@ for (BindingIndex bindingIndex{0}; bindingIndex < bgl->GetBindingCount(); ++bindingIndex) { - switch (bgl->GetBindingInfo(bindingIndex).type) { - case wgpu::BindingType::UniformBuffer: - mIndexInfo[group][bindingIndex] = uboIndex; - uboIndex++; + const BindingInfo& bindingInfo = bgl->GetBindingInfo(bindingIndex); + switch (bindingInfo.bindingType) { + case BindingInfoType::Buffer: + switch (bindingInfo.buffer.type) { + case wgpu::BufferBindingType::Uniform: + mIndexInfo[group][bindingIndex] = uboIndex; + uboIndex++; + break; + case wgpu::BufferBindingType::Storage: + case wgpu::BufferBindingType::ReadOnlyStorage: + mIndexInfo[group][bindingIndex] = ssboIndex; + ssboIndex++; + break; + case wgpu::BufferBindingType::Undefined: + UNREACHABLE(); + } break; - case wgpu::BindingType::Sampler: - case wgpu::BindingType::ComparisonSampler: + + case BindingInfoType::Sampler: mIndexInfo[group][bindingIndex] = samplerIndex; samplerIndex++; break; - case wgpu::BindingType::SampledTexture: - case wgpu::BindingType::MultisampledTexture: + + case BindingInfoType::Texture: mIndexInfo[group][bindingIndex] = sampledTextureIndex; sampledTextureIndex++; break; - case wgpu::BindingType::StorageBuffer: - case wgpu::BindingType::ReadonlyStorageBuffer: - mIndexInfo[group][bindingIndex] = ssboIndex; - ssboIndex++; - break; - - case wgpu::BindingType::ReadonlyStorageTexture: - case wgpu::BindingType::WriteonlyStorageTexture: + case BindingInfoType::StorageTexture: mIndexInfo[group][bindingIndex] = storageTextureIndex; storageTextureIndex++; break; - - case wgpu::BindingType::Undefined: - UNREACHABLE(); } } }