From 698bb821c7c43c271f2ee1b770a4a440b69c0e7b Mon Sep 17 00:00:00 2001 From: Yunchao He Date: Fri, 1 Oct 2021 16:20:35 +0000 Subject: [PATCH] Refactor/remove dawn-defined buffer and texture usages This change refactors dawn-defined buffer and texture usages. It groups buffer usages together, and groups texture usages together, in order to avoid values conflict. It also removes kReadOnlyStorageTexture because its definition has already been removed. Bug: dawn:485 Change-Id: I8c772ebadd3d276905fbcdb3283f0d5d89f74dd6 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65680 Reviewed-by: Corentin Wallez Reviewed-by: Austin Eng Commit-Queue: Yunchao He --- src/dawn_native/ShaderModule.cpp | 1 - src/dawn_native/dawn_platform.h | 14 ++++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp index 47badae871..4c227063f5 100644 --- a/src/dawn_native/ShaderModule.cpp +++ b/src/dawn_native/ShaderModule.cpp @@ -165,7 +165,6 @@ namespace dawn_native { case tint::inspector::ResourceBinding::ResourceType::kDepthTexture: case tint::inspector::ResourceBinding::ResourceType::kDepthMultisampledTexture: return BindingInfoType::Texture; - case tint::inspector::ResourceBinding::ResourceType::kReadOnlyStorageTexture: case tint::inspector::ResourceBinding::ResourceType::kWriteOnlyStorageTexture: return BindingInfoType::StorageTexture; case tint::inspector::ResourceBinding::ResourceType::kExternalTexture: diff --git a/src/dawn_native/dawn_platform.h b/src/dawn_native/dawn_platform.h index 522259a4db..d36a48af0c 100644 --- a/src/dawn_native/dawn_platform.h +++ b/src/dawn_native/dawn_platform.h @@ -23,9 +23,19 @@ #include namespace dawn_native { + // Extra buffer usages + // Add an extra buffer usage and an extra binding type for binding the buffers with QueryResolve + // usage as storage buffer in the internal pipeline. + static constexpr wgpu::BufferUsage kInternalStorageBuffer = + static_cast(0x40000000); + // Add an extra buffer usage (readonly storage buffer usage) for render pass resource tracking static constexpr wgpu::BufferUsage kReadOnlyStorageBuffer = static_cast(0x80000000); + + // Extra texture usages + // Add an extra texture usage (readonly render attachment usage) for render pass resource + // tracking static constexpr wgpu::TextureUsage kReadOnlyRenderAttachment = static_cast(0x40000000); @@ -40,10 +50,6 @@ namespace dawn_native { // some bit when wgpu::TextureUsage::Present is removed. static constexpr wgpu::TextureUsage kPresentTextureUsage = wgpu::TextureUsage::Present; - // Add an extra buffer usage and an extra binding type for binding the buffers with QueryResolve - // usage as storage buffer in the internal pipeline. - static constexpr wgpu::BufferUsage kInternalStorageBuffer = - static_cast(0x40000000); static constexpr wgpu::BufferBindingType kInternalStorageBufferBinding = static_cast(0xFFFFFFFF); } // namespace dawn_native