From f35eff3fdef26863d1c008e020015e461c15cd08 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Mon, 20 Aug 2018 17:37:57 +0200 Subject: [PATCH] Remove BindGroupBuilder::SetUsage BindGroup usage isn't something that's part of WebGPU's sketch.idl and it might never exist. Remove it to simplify the migration of bindgroup to descriptor. Change-Id: I21e0a98eb60434d4009e748cd9afcbf89edd7e6a --- dawn.json | 13 ------------ examples/ComputeBoids.cpp | 1 - examples/CppHelloTriangle.cpp | 1 - examples/CubeReflection.cpp | 2 -- examples/glTFViewer/glTFViewer.cpp | 4 ++-- src/dawn_native/BindGroup.cpp | 20 ++----------------- src/dawn_native/BindGroup.h | 4 ---- src/tests/end2end/BlendStateTests.cpp | 1 - .../end2end/ComputeCopyStorageBufferTests.cpp | 1 - src/tests/end2end/DepthStencilStateTests.cpp | 1 - src/tests/end2end/PushConstantTests.cpp | 1 - src/tests/end2end/SamplerTests.cpp | 1 - .../validation/BindGroupValidationTests.cpp | 6 ------ 13 files changed, 4 insertions(+), 52 deletions(-) diff --git a/dawn.json b/dawn.json index ec2d54e52d..4628a1718f 100644 --- a/dawn.json +++ b/dawn.json @@ -33,12 +33,6 @@ {"name": "layout", "type": "bind group layout"} ] }, - { - "name": "set usage", - "args": [ - {"name": "usage", "type": "bind group usage"} - ] - }, { "name": "set buffer views", "args": [ @@ -68,13 +62,6 @@ "When resource are added, add methods for setting the content of the bind group" ] }, - "bind group usage": { - "category": "enum", - "values": [ - {"value": 0, "name": "frozen"}, - {"value": 1, "name": "dynamic"} - ] - }, "bind group layout": { "category": "object" }, diff --git a/examples/ComputeBoids.cpp b/examples/ComputeBoids.cpp index 5be5163c5b..c001635b87 100644 --- a/examples/ComputeBoids.cpp +++ b/examples/ComputeBoids.cpp @@ -250,7 +250,6 @@ void initSim() { for (uint32_t i = 0; i < 2; ++i) { updateBGs[i] = device.CreateBindGroupBuilder() .SetLayout(bgl) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &updateParamsView) .SetBufferViews(1, 1, &views[i]) .SetBufferViews(2, 1, &views[(i + 1) % 2]) diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp index 10101adcac..ea3578bd0d 100644 --- a/examples/CppHelloTriangle.cpp +++ b/examples/CppHelloTriangle.cpp @@ -132,7 +132,6 @@ void init() { bindGroup = device.CreateBindGroupBuilder() .SetLayout(bgl) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetSamplers(0, 1, &sampler) .SetTextureViews(1, 1, &view) .GetResult(); diff --git a/examples/CubeReflection.cpp b/examples/CubeReflection.cpp index f4a003c0a1..4e5f0072d8 100644 --- a/examples/CubeReflection.cpp +++ b/examples/CubeReflection.cpp @@ -195,14 +195,12 @@ void init() { bindGroup[0] = device.CreateBindGroupBuilder() .SetLayout(bgl) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &cameraBufferView) .SetBufferViews(1, 1, &transformBufferView[0]) .GetResult(); bindGroup[1] = device.CreateBindGroupBuilder() .SetLayout(bgl) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &cameraBufferView) .SetBufferViews(1, 1, &transformBufferView[1]) .GetResult(); diff --git a/examples/glTFViewer/glTFViewer.cpp b/examples/glTFViewer/glTFViewer.cpp index 4fc84a65ca..7074c48b23 100644 --- a/examples/glTFViewer/glTFViewer.cpp +++ b/examples/glTFViewer/glTFViewer.cpp @@ -299,8 +299,8 @@ namespace { .GetResult(); auto bindGroupBuilder = device.CreateBindGroupBuilder(); - bindGroupBuilder.SetLayout(bindGroupLayout) - .SetUsage(dawn::BindGroupUsage::Frozen); + bindGroupBuilder.SetLayout(bindGroupLayout); + if (hasTexture) { const auto& textureView = textures[iTextureID]; const auto& iSamplerID = scene.textures[iTextureID].sampler; diff --git a/src/dawn_native/BindGroup.cpp b/src/dawn_native/BindGroup.cpp index 388f2a70ef..708b26576a 100644 --- a/src/dawn_native/BindGroup.cpp +++ b/src/dawn_native/BindGroup.cpp @@ -27,7 +27,6 @@ namespace dawn_native { BindGroupBase::BindGroupBase(BindGroupBuilder* builder) : mLayout(std::move(builder->mLayout)), - mUsage(builder->mUsage), mBindings(std::move(builder->mBindings)) { } @@ -35,10 +34,6 @@ namespace dawn_native { return mLayout.Get(); } - dawn::BindGroupUsage BindGroupBase::GetUsage() const { - return mUsage; - } - BufferViewBase* BindGroupBase::GetBindingAsBufferView(size_t binding) { ASSERT(binding < kMaxBindingsPerGroup); ASSERT(mLayout->GetBindingInfo().mask[binding]); @@ -68,15 +63,14 @@ namespace dawn_native { // BindGroupBuilder enum BindGroupSetProperties { - BINDGROUP_PROPERTY_USAGE = 0x1, - BINDGROUP_PROPERTY_LAYOUT = 0x2, + BINDGROUP_PROPERTY_LAYOUT = 0x1, }; BindGroupBuilder::BindGroupBuilder(DeviceBase* device) : Builder(device) { } BindGroupBase* BindGroupBuilder::GetResultImpl() { - constexpr int allProperties = BINDGROUP_PROPERTY_USAGE | BINDGROUP_PROPERTY_LAYOUT; + constexpr int allProperties = BINDGROUP_PROPERTY_LAYOUT; if ((mPropertiesSet & allProperties) != allProperties) { HandleError("Bindgroup missing properties"); return nullptr; @@ -100,16 +94,6 @@ namespace dawn_native { mPropertiesSet |= BINDGROUP_PROPERTY_LAYOUT; } - void BindGroupBuilder::SetUsage(dawn::BindGroupUsage usage) { - if ((mPropertiesSet & BINDGROUP_PROPERTY_USAGE) != 0) { - HandleError("Bindgroup usage property set multiple times"); - return; - } - - mUsage = usage; - mPropertiesSet |= BINDGROUP_PROPERTY_USAGE; - } - void BindGroupBuilder::SetBufferViews(uint32_t start, uint32_t count, BufferViewBase* const* bufferViews) { diff --git a/src/dawn_native/BindGroup.h b/src/dawn_native/BindGroup.h index 9aea5a63f9..cd4846e199 100644 --- a/src/dawn_native/BindGroup.h +++ b/src/dawn_native/BindGroup.h @@ -33,7 +33,6 @@ namespace dawn_native { BindGroupBase(BindGroupBuilder* builder); const BindGroupLayoutBase* GetLayout() const; - dawn::BindGroupUsage GetUsage() const; BufferViewBase* GetBindingAsBufferView(size_t binding); SamplerBase* GetBindingAsSampler(size_t binding); TextureViewBase* GetBindingAsTextureView(size_t binding); @@ -42,7 +41,6 @@ namespace dawn_native { private: Ref mLayout; - dawn::BindGroupUsage mUsage; std::array, kMaxBindingsPerGroup> mBindings; }; @@ -52,7 +50,6 @@ namespace dawn_native { // Dawn API void SetLayout(BindGroupLayoutBase* layout); - void SetUsage(dawn::BindGroupUsage usage); void SetBufferViews(uint32_t start, uint32_t count, BufferViewBase* const* bufferViews); void SetSamplers(uint32_t start, uint32_t count, SamplerBase* const* samplers); @@ -69,7 +66,6 @@ namespace dawn_native { int mPropertiesSet = 0; Ref mLayout; - dawn::BindGroupUsage mUsage; std::array, kMaxBindingsPerGroup> mBindings; }; diff --git a/src/tests/end2end/BlendStateTests.cpp b/src/tests/end2end/BlendStateTests.cpp index c1cdfd9171..7d7441ada4 100644 --- a/src/tests/end2end/BlendStateTests.cpp +++ b/src/tests/end2end/BlendStateTests.cpp @@ -103,7 +103,6 @@ class BlendStateTest : public DawnTest { return device.CreateBindGroupBuilder() .SetLayout(bindGroupLayout) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &view) .GetResult(); } diff --git a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp index ded655fe9f..84936b508a 100644 --- a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp +++ b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp @@ -73,7 +73,6 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) { // Set up bind group and issue dispatch auto bindGroup = device.CreateBindGroupBuilder() .SetLayout(bgl) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &srcView) .SetBufferViews(1, 1, &dstView) .GetResult(); diff --git a/src/tests/end2end/DepthStencilStateTests.cpp b/src/tests/end2end/DepthStencilStateTests.cpp index a998724afa..f70806e869 100644 --- a/src/tests/end2end/DepthStencilStateTests.cpp +++ b/src/tests/end2end/DepthStencilStateTests.cpp @@ -210,7 +210,6 @@ class DepthStencilStateTest : public DawnTest { // Create a bind group for the data dawn::BindGroup bindGroup = device.CreateBindGroupBuilder() .SetLayout(bindGroupLayout) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &view) .GetResult(); diff --git a/src/tests/end2end/PushConstantTests.cpp b/src/tests/end2end/PushConstantTests.cpp index eefec2bc46..f6343adfe3 100644 --- a/src/tests/end2end/PushConstantTests.cpp +++ b/src/tests/end2end/PushConstantTests.cpp @@ -61,7 +61,6 @@ class PushConstantTest: public DawnTest { dawn::BindGroup bg = device.CreateBindGroupBuilder() .SetLayout(bgl) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, extraBuffer ? 2 : 1, views) .GetResult(); diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp index c9cbcdb25b..b0aea72b09 100644 --- a/src/tests/end2end/SamplerTests.cpp +++ b/src/tests/end2end/SamplerTests.cpp @@ -120,7 +120,6 @@ protected: auto bindGroup = device.CreateBindGroupBuilder() .SetLayout(mBindGroupLayout) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetSamplers(0, 1, &sampler) .SetTextureViews(1, 1, &mTextureView) .GetResult(); diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp index 3963f63569..cec08dc81a 100644 --- a/src/tests/unittests/validation/BindGroupValidationTests.cpp +++ b/src/tests/unittests/validation/BindGroupValidationTests.cpp @@ -37,7 +37,6 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { auto bindGroup = AssertWillBeSuccess(device.CreateBindGroupBuilder()) .SetLayout(layout) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &bufferView) .GetResult(); } @@ -50,7 +49,6 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { auto bindGroup = AssertWillBeSuccess(device.CreateBindGroupBuilder()) .SetLayout(layout) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &bufferView) .GetResult(); } @@ -63,7 +61,6 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder()) .SetLayout(layout) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &bufferView) .GetResult(); } @@ -75,7 +72,6 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder()) .SetLayout(layout) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &bufferView) .GetResult(); } @@ -87,7 +83,6 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder()) .SetLayout(layout) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &bufferView) .GetResult(); } @@ -99,7 +94,6 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) { auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder()) .SetLayout(layout) - .SetUsage(dawn::BindGroupUsage::Frozen) .SetBufferViews(0, 1, &bufferView) .GetResult(); }