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
This commit is contained in:
parent
df6710358b
commit
f35eff3fde
13
dawn.json
13
dawn.json
|
@ -33,12 +33,6 @@
|
||||||
{"name": "layout", "type": "bind group layout"}
|
{"name": "layout", "type": "bind group layout"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "set usage",
|
|
||||||
"args": [
|
|
||||||
{"name": "usage", "type": "bind group usage"}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "set buffer views",
|
"name": "set buffer views",
|
||||||
"args": [
|
"args": [
|
||||||
|
@ -68,13 +62,6 @@
|
||||||
"When resource are added, add methods for setting the content of the bind group"
|
"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": {
|
"bind group layout": {
|
||||||
"category": "object"
|
"category": "object"
|
||||||
},
|
},
|
||||||
|
|
|
@ -250,7 +250,6 @@ void initSim() {
|
||||||
for (uint32_t i = 0; i < 2; ++i) {
|
for (uint32_t i = 0; i < 2; ++i) {
|
||||||
updateBGs[i] = device.CreateBindGroupBuilder()
|
updateBGs[i] = device.CreateBindGroupBuilder()
|
||||||
.SetLayout(bgl)
|
.SetLayout(bgl)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, 1, &updateParamsView)
|
.SetBufferViews(0, 1, &updateParamsView)
|
||||||
.SetBufferViews(1, 1, &views[i])
|
.SetBufferViews(1, 1, &views[i])
|
||||||
.SetBufferViews(2, 1, &views[(i + 1) % 2])
|
.SetBufferViews(2, 1, &views[(i + 1) % 2])
|
||||||
|
|
|
@ -132,7 +132,6 @@ void init() {
|
||||||
|
|
||||||
bindGroup = device.CreateBindGroupBuilder()
|
bindGroup = device.CreateBindGroupBuilder()
|
||||||
.SetLayout(bgl)
|
.SetLayout(bgl)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetSamplers(0, 1, &sampler)
|
.SetSamplers(0, 1, &sampler)
|
||||||
.SetTextureViews(1, 1, &view)
|
.SetTextureViews(1, 1, &view)
|
||||||
.GetResult();
|
.GetResult();
|
||||||
|
|
|
@ -195,14 +195,12 @@ void init() {
|
||||||
|
|
||||||
bindGroup[0] = device.CreateBindGroupBuilder()
|
bindGroup[0] = device.CreateBindGroupBuilder()
|
||||||
.SetLayout(bgl)
|
.SetLayout(bgl)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, 1, &cameraBufferView)
|
.SetBufferViews(0, 1, &cameraBufferView)
|
||||||
.SetBufferViews(1, 1, &transformBufferView[0])
|
.SetBufferViews(1, 1, &transformBufferView[0])
|
||||||
.GetResult();
|
.GetResult();
|
||||||
|
|
||||||
bindGroup[1] = device.CreateBindGroupBuilder()
|
bindGroup[1] = device.CreateBindGroupBuilder()
|
||||||
.SetLayout(bgl)
|
.SetLayout(bgl)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, 1, &cameraBufferView)
|
.SetBufferViews(0, 1, &cameraBufferView)
|
||||||
.SetBufferViews(1, 1, &transformBufferView[1])
|
.SetBufferViews(1, 1, &transformBufferView[1])
|
||||||
.GetResult();
|
.GetResult();
|
||||||
|
|
|
@ -299,8 +299,8 @@ namespace {
|
||||||
.GetResult();
|
.GetResult();
|
||||||
|
|
||||||
auto bindGroupBuilder = device.CreateBindGroupBuilder();
|
auto bindGroupBuilder = device.CreateBindGroupBuilder();
|
||||||
bindGroupBuilder.SetLayout(bindGroupLayout)
|
bindGroupBuilder.SetLayout(bindGroupLayout);
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen);
|
|
||||||
if (hasTexture) {
|
if (hasTexture) {
|
||||||
const auto& textureView = textures[iTextureID];
|
const auto& textureView = textures[iTextureID];
|
||||||
const auto& iSamplerID = scene.textures[iTextureID].sampler;
|
const auto& iSamplerID = scene.textures[iTextureID].sampler;
|
||||||
|
|
|
@ -27,7 +27,6 @@ namespace dawn_native {
|
||||||
|
|
||||||
BindGroupBase::BindGroupBase(BindGroupBuilder* builder)
|
BindGroupBase::BindGroupBase(BindGroupBuilder* builder)
|
||||||
: mLayout(std::move(builder->mLayout)),
|
: mLayout(std::move(builder->mLayout)),
|
||||||
mUsage(builder->mUsage),
|
|
||||||
mBindings(std::move(builder->mBindings)) {
|
mBindings(std::move(builder->mBindings)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,10 +34,6 @@ namespace dawn_native {
|
||||||
return mLayout.Get();
|
return mLayout.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
dawn::BindGroupUsage BindGroupBase::GetUsage() const {
|
|
||||||
return mUsage;
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferViewBase* BindGroupBase::GetBindingAsBufferView(size_t binding) {
|
BufferViewBase* BindGroupBase::GetBindingAsBufferView(size_t binding) {
|
||||||
ASSERT(binding < kMaxBindingsPerGroup);
|
ASSERT(binding < kMaxBindingsPerGroup);
|
||||||
ASSERT(mLayout->GetBindingInfo().mask[binding]);
|
ASSERT(mLayout->GetBindingInfo().mask[binding]);
|
||||||
|
@ -68,15 +63,14 @@ namespace dawn_native {
|
||||||
// BindGroupBuilder
|
// BindGroupBuilder
|
||||||
|
|
||||||
enum BindGroupSetProperties {
|
enum BindGroupSetProperties {
|
||||||
BINDGROUP_PROPERTY_USAGE = 0x1,
|
BINDGROUP_PROPERTY_LAYOUT = 0x1,
|
||||||
BINDGROUP_PROPERTY_LAYOUT = 0x2,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BindGroupBuilder::BindGroupBuilder(DeviceBase* device) : Builder(device) {
|
BindGroupBuilder::BindGroupBuilder(DeviceBase* device) : Builder(device) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BindGroupBase* BindGroupBuilder::GetResultImpl() {
|
BindGroupBase* BindGroupBuilder::GetResultImpl() {
|
||||||
constexpr int allProperties = BINDGROUP_PROPERTY_USAGE | BINDGROUP_PROPERTY_LAYOUT;
|
constexpr int allProperties = BINDGROUP_PROPERTY_LAYOUT;
|
||||||
if ((mPropertiesSet & allProperties) != allProperties) {
|
if ((mPropertiesSet & allProperties) != allProperties) {
|
||||||
HandleError("Bindgroup missing properties");
|
HandleError("Bindgroup missing properties");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -100,16 +94,6 @@ namespace dawn_native {
|
||||||
mPropertiesSet |= BINDGROUP_PROPERTY_LAYOUT;
|
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,
|
void BindGroupBuilder::SetBufferViews(uint32_t start,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
BufferViewBase* const* bufferViews) {
|
BufferViewBase* const* bufferViews) {
|
||||||
|
|
|
@ -33,7 +33,6 @@ namespace dawn_native {
|
||||||
BindGroupBase(BindGroupBuilder* builder);
|
BindGroupBase(BindGroupBuilder* builder);
|
||||||
|
|
||||||
const BindGroupLayoutBase* GetLayout() const;
|
const BindGroupLayoutBase* GetLayout() const;
|
||||||
dawn::BindGroupUsage GetUsage() const;
|
|
||||||
BufferViewBase* GetBindingAsBufferView(size_t binding);
|
BufferViewBase* GetBindingAsBufferView(size_t binding);
|
||||||
SamplerBase* GetBindingAsSampler(size_t binding);
|
SamplerBase* GetBindingAsSampler(size_t binding);
|
||||||
TextureViewBase* GetBindingAsTextureView(size_t binding);
|
TextureViewBase* GetBindingAsTextureView(size_t binding);
|
||||||
|
@ -42,7 +41,6 @@ namespace dawn_native {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ref<BindGroupLayoutBase> mLayout;
|
Ref<BindGroupLayoutBase> mLayout;
|
||||||
dawn::BindGroupUsage mUsage;
|
|
||||||
std::array<Ref<RefCounted>, kMaxBindingsPerGroup> mBindings;
|
std::array<Ref<RefCounted>, kMaxBindingsPerGroup> mBindings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,7 +50,6 @@ namespace dawn_native {
|
||||||
|
|
||||||
// Dawn API
|
// Dawn API
|
||||||
void SetLayout(BindGroupLayoutBase* layout);
|
void SetLayout(BindGroupLayoutBase* layout);
|
||||||
void SetUsage(dawn::BindGroupUsage usage);
|
|
||||||
|
|
||||||
void SetBufferViews(uint32_t start, uint32_t count, BufferViewBase* const* bufferViews);
|
void SetBufferViews(uint32_t start, uint32_t count, BufferViewBase* const* bufferViews);
|
||||||
void SetSamplers(uint32_t start, uint32_t count, SamplerBase* const* samplers);
|
void SetSamplers(uint32_t start, uint32_t count, SamplerBase* const* samplers);
|
||||||
|
@ -69,7 +66,6 @@ namespace dawn_native {
|
||||||
int mPropertiesSet = 0;
|
int mPropertiesSet = 0;
|
||||||
|
|
||||||
Ref<BindGroupLayoutBase> mLayout;
|
Ref<BindGroupLayoutBase> mLayout;
|
||||||
dawn::BindGroupUsage mUsage;
|
|
||||||
std::array<Ref<RefCounted>, kMaxBindingsPerGroup> mBindings;
|
std::array<Ref<RefCounted>, kMaxBindingsPerGroup> mBindings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,6 @@ class BlendStateTest : public DawnTest {
|
||||||
|
|
||||||
return device.CreateBindGroupBuilder()
|
return device.CreateBindGroupBuilder()
|
||||||
.SetLayout(bindGroupLayout)
|
.SetLayout(bindGroupLayout)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, 1, &view)
|
.SetBufferViews(0, 1, &view)
|
||||||
.GetResult();
|
.GetResult();
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,6 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) {
|
||||||
// Set up bind group and issue dispatch
|
// Set up bind group and issue dispatch
|
||||||
auto bindGroup = device.CreateBindGroupBuilder()
|
auto bindGroup = device.CreateBindGroupBuilder()
|
||||||
.SetLayout(bgl)
|
.SetLayout(bgl)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, 1, &srcView)
|
.SetBufferViews(0, 1, &srcView)
|
||||||
.SetBufferViews(1, 1, &dstView)
|
.SetBufferViews(1, 1, &dstView)
|
||||||
.GetResult();
|
.GetResult();
|
||||||
|
|
|
@ -210,7 +210,6 @@ class DepthStencilStateTest : public DawnTest {
|
||||||
// Create a bind group for the data
|
// Create a bind group for the data
|
||||||
dawn::BindGroup bindGroup = device.CreateBindGroupBuilder()
|
dawn::BindGroup bindGroup = device.CreateBindGroupBuilder()
|
||||||
.SetLayout(bindGroupLayout)
|
.SetLayout(bindGroupLayout)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, 1, &view)
|
.SetBufferViews(0, 1, &view)
|
||||||
.GetResult();
|
.GetResult();
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ class PushConstantTest: public DawnTest {
|
||||||
|
|
||||||
dawn::BindGroup bg = device.CreateBindGroupBuilder()
|
dawn::BindGroup bg = device.CreateBindGroupBuilder()
|
||||||
.SetLayout(bgl)
|
.SetLayout(bgl)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, extraBuffer ? 2 : 1, views)
|
.SetBufferViews(0, extraBuffer ? 2 : 1, views)
|
||||||
.GetResult();
|
.GetResult();
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,6 @@ protected:
|
||||||
|
|
||||||
auto bindGroup = device.CreateBindGroupBuilder()
|
auto bindGroup = device.CreateBindGroupBuilder()
|
||||||
.SetLayout(mBindGroupLayout)
|
.SetLayout(mBindGroupLayout)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetSamplers(0, 1, &sampler)
|
.SetSamplers(0, 1, &sampler)
|
||||||
.SetTextureViews(1, 1, &mTextureView)
|
.SetTextureViews(1, 1, &mTextureView)
|
||||||
.GetResult();
|
.GetResult();
|
||||||
|
|
|
@ -37,7 +37,6 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) {
|
||||||
|
|
||||||
auto bindGroup = AssertWillBeSuccess(device.CreateBindGroupBuilder())
|
auto bindGroup = AssertWillBeSuccess(device.CreateBindGroupBuilder())
|
||||||
.SetLayout(layout)
|
.SetLayout(layout)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, 1, &bufferView)
|
.SetBufferViews(0, 1, &bufferView)
|
||||||
.GetResult();
|
.GetResult();
|
||||||
}
|
}
|
||||||
|
@ -50,7 +49,6 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) {
|
||||||
|
|
||||||
auto bindGroup = AssertWillBeSuccess(device.CreateBindGroupBuilder())
|
auto bindGroup = AssertWillBeSuccess(device.CreateBindGroupBuilder())
|
||||||
.SetLayout(layout)
|
.SetLayout(layout)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, 1, &bufferView)
|
.SetBufferViews(0, 1, &bufferView)
|
||||||
.GetResult();
|
.GetResult();
|
||||||
}
|
}
|
||||||
|
@ -63,7 +61,6 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) {
|
||||||
|
|
||||||
auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder())
|
auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder())
|
||||||
.SetLayout(layout)
|
.SetLayout(layout)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, 1, &bufferView)
|
.SetBufferViews(0, 1, &bufferView)
|
||||||
.GetResult();
|
.GetResult();
|
||||||
}
|
}
|
||||||
|
@ -75,7 +72,6 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) {
|
||||||
|
|
||||||
auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder())
|
auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder())
|
||||||
.SetLayout(layout)
|
.SetLayout(layout)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, 1, &bufferView)
|
.SetBufferViews(0, 1, &bufferView)
|
||||||
.GetResult();
|
.GetResult();
|
||||||
}
|
}
|
||||||
|
@ -87,7 +83,6 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) {
|
||||||
|
|
||||||
auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder())
|
auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder())
|
||||||
.SetLayout(layout)
|
.SetLayout(layout)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, 1, &bufferView)
|
.SetBufferViews(0, 1, &bufferView)
|
||||||
.GetResult();
|
.GetResult();
|
||||||
}
|
}
|
||||||
|
@ -99,7 +94,6 @@ TEST_F(BindGroupValidationTest, BufferViewOffset) {
|
||||||
|
|
||||||
auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder())
|
auto bindGroup = AssertWillBeError(device.CreateBindGroupBuilder())
|
||||||
.SetLayout(layout)
|
.SetLayout(layout)
|
||||||
.SetUsage(dawn::BindGroupUsage::Frozen)
|
|
||||||
.SetBufferViews(0, 1, &bufferView)
|
.SetBufferViews(0, 1, &bufferView)
|
||||||
.GetResult();
|
.GetResult();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue