mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 00:47:13 +00:00
Deprecate BG[L]Desc::binding[s|Count] in favor of entr[ies|yCount]
Bug: dawn:22 Change-Id: I02188d70103a1bee25b9b2024a2ea9f785656236 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19862 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
be08000cb5
commit
3966eb1175
@@ -75,8 +75,8 @@ TEST_F(BindGroupValidationTest, NextInChainNullptr) {
|
||||
|
||||
wgpu::BindGroupDescriptor descriptor;
|
||||
descriptor.layout = layout;
|
||||
descriptor.bindingCount = 0;
|
||||
descriptor.bindings = nullptr;
|
||||
descriptor.entryCount = 0;
|
||||
descriptor.entries = nullptr;
|
||||
|
||||
// Control case: check that nextInChain = nullptr is valid
|
||||
descriptor.nextInChain = nullptr;
|
||||
@@ -88,15 +88,15 @@ TEST_F(BindGroupValidationTest, NextInChainNullptr) {
|
||||
ASSERT_DEVICE_ERROR(device.CreateBindGroup(&descriptor));
|
||||
}
|
||||
|
||||
// Check constraints on bindingCount
|
||||
TEST_F(BindGroupValidationTest, bindingCountMismatch) {
|
||||
// Check constraints on entryCount
|
||||
TEST_F(BindGroupValidationTest, EntryCountMismatch) {
|
||||
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::Sampler}});
|
||||
|
||||
// Control case: check that a descriptor with one binding is ok
|
||||
utils::MakeBindGroup(device, layout, {{0, mSampler}});
|
||||
|
||||
// Check that bindingCount != layout.bindingCount fails.
|
||||
// Check that entryCount != layout.entryCount fails.
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {}));
|
||||
}
|
||||
|
||||
@@ -149,8 +149,8 @@ TEST_F(BindGroupValidationTest, SamplerBindingType) {
|
||||
|
||||
wgpu::BindGroupDescriptor descriptor;
|
||||
descriptor.layout = layout;
|
||||
descriptor.bindingCount = 1;
|
||||
descriptor.bindings = &binding;
|
||||
descriptor.entryCount = 1;
|
||||
descriptor.entries = &binding;
|
||||
|
||||
// Not setting anything fails
|
||||
ASSERT_DEVICE_ERROR(device.CreateBindGroup(&descriptor));
|
||||
@@ -198,8 +198,8 @@ TEST_F(BindGroupValidationTest, TextureBindingType) {
|
||||
|
||||
wgpu::BindGroupDescriptor descriptor;
|
||||
descriptor.layout = layout;
|
||||
descriptor.bindingCount = 1;
|
||||
descriptor.bindings = &binding;
|
||||
descriptor.entryCount = 1;
|
||||
descriptor.entries = &binding;
|
||||
|
||||
// Not setting anything fails
|
||||
ASSERT_DEVICE_ERROR(device.CreateBindGroup(&descriptor));
|
||||
@@ -252,8 +252,8 @@ TEST_F(BindGroupValidationTest, BufferBindingType) {
|
||||
|
||||
wgpu::BindGroupDescriptor descriptor;
|
||||
descriptor.layout = layout;
|
||||
descriptor.bindingCount = 1;
|
||||
descriptor.bindings = &binding;
|
||||
descriptor.entryCount = 1;
|
||||
descriptor.entries = &binding;
|
||||
|
||||
// Not setting anything fails
|
||||
ASSERT_DEVICE_ERROR(device.CreateBindGroup(&descriptor));
|
||||
@@ -473,8 +473,8 @@ class BindGroupLayoutValidationTest : public ValidationTest {
|
||||
bool expected) {
|
||||
wgpu::BindGroupLayoutDescriptor descriptor;
|
||||
|
||||
descriptor.bindingCount = count;
|
||||
descriptor.bindings = binding;
|
||||
descriptor.entryCount = count;
|
||||
descriptor.entries = binding;
|
||||
|
||||
if (!expected) {
|
||||
ASSERT_DEVICE_ERROR(device.CreateBindGroupLayout(&descriptor));
|
||||
@@ -526,23 +526,23 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutEntryUnbounded) {
|
||||
|
||||
// Test that there can't be more than kMaxBindingPerGroup bindings per group
|
||||
TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutMaxBindings) {
|
||||
wgpu::BindGroupLayoutEntry bindings[kMaxBindingsPerGroup + 1];
|
||||
wgpu::BindGroupLayoutEntry entries[kMaxBindingsPerGroup + 1];
|
||||
|
||||
for (uint32_t i = 0; i < kMaxBindingsPerGroup + 1; i++) {
|
||||
bindings[i].type = wgpu::BindingType::UniformBuffer;
|
||||
bindings[i].binding = i;
|
||||
bindings[i].visibility = wgpu::ShaderStage::Compute;
|
||||
entries[i].type = wgpu::BindingType::UniformBuffer;
|
||||
entries[i].binding = i;
|
||||
entries[i].visibility = wgpu::ShaderStage::Compute;
|
||||
}
|
||||
|
||||
wgpu::BindGroupLayoutDescriptor desc;
|
||||
desc.bindings = bindings;
|
||||
desc.entries = entries;
|
||||
|
||||
// Control case: kMaxBindingsPerGroup bindings is allowed.
|
||||
desc.bindingCount = kMaxBindingsPerGroup;
|
||||
desc.entryCount = kMaxBindingsPerGroup;
|
||||
device.CreateBindGroupLayout(&desc);
|
||||
|
||||
// Error case: kMaxBindingsPerGroup + 1 bindings is not allowed.
|
||||
desc.bindingCount = kMaxBindingsPerGroup + 1;
|
||||
desc.entryCount = kMaxBindingsPerGroup + 1;
|
||||
ASSERT_DEVICE_ERROR(device.CreateBindGroupLayout(&desc));
|
||||
}
|
||||
|
||||
@@ -594,8 +594,8 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutVisibilityNone) {
|
||||
wgpu::BindGroupLayoutEntry binding = {0, wgpu::ShaderStage::None,
|
||||
wgpu::BindingType::UniformBuffer};
|
||||
wgpu::BindGroupLayoutDescriptor descriptor;
|
||||
descriptor.bindingCount = 1;
|
||||
descriptor.bindings = &binding;
|
||||
descriptor.entryCount = 1;
|
||||
descriptor.entries = &binding;
|
||||
device.CreateBindGroupLayout(&descriptor);
|
||||
}
|
||||
|
||||
@@ -642,8 +642,8 @@ TEST_F(BindGroupLayoutValidationTest, DynamicBufferNumberLimit) {
|
||||
auto MakeBindGroupLayout = [&](wgpu::BindGroupLayoutEntry* binding,
|
||||
uint32_t count) -> wgpu::BindGroupLayout {
|
||||
wgpu::BindGroupLayoutDescriptor descriptor;
|
||||
descriptor.bindingCount = count;
|
||||
descriptor.bindings = binding;
|
||||
descriptor.entryCount = count;
|
||||
descriptor.entries = binding;
|
||||
return device.CreateBindGroupLayout(&descriptor);
|
||||
};
|
||||
|
||||
@@ -1055,8 +1055,8 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
|
||||
|
||||
// Create the bind group layout.
|
||||
wgpu::BindGroupLayoutDescriptor bglDescriptor;
|
||||
bglDescriptor.bindingCount = static_cast<uint32_t>(bindings.size());
|
||||
bglDescriptor.bindings = bindings.data();
|
||||
bglDescriptor.entryCount = static_cast<uint32_t>(bindings.size());
|
||||
bglDescriptor.entries = bindings.data();
|
||||
bindGroupLayouts[l] = device.CreateBindGroupLayout(&bglDescriptor);
|
||||
}
|
||||
|
||||
|
||||
@@ -108,8 +108,8 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) {
|
||||
binding.multisampled = false;
|
||||
|
||||
wgpu::BindGroupLayoutDescriptor desc = {};
|
||||
desc.bindingCount = 1;
|
||||
desc.bindings = &binding;
|
||||
desc.entryCount = 1;
|
||||
desc.entries = &binding;
|
||||
|
||||
// Check that visibility and dynamic offsets match
|
||||
binding.hasDynamicOffset = false;
|
||||
@@ -157,8 +157,8 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
|
||||
binding.hasDynamicOffset = false;
|
||||
|
||||
wgpu::BindGroupLayoutDescriptor desc = {};
|
||||
desc.bindingCount = 1;
|
||||
desc.bindings = &binding;
|
||||
desc.entryCount = 1;
|
||||
desc.entries = &binding;
|
||||
|
||||
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
|
||||
}
|
||||
@@ -171,8 +171,8 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
||||
binding.multisampled = false;
|
||||
|
||||
wgpu::BindGroupLayoutDescriptor desc = {};
|
||||
desc.bindingCount = 1;
|
||||
desc.bindings = &binding;
|
||||
desc.entryCount = 1;
|
||||
desc.entries = &binding;
|
||||
|
||||
{
|
||||
// Storage buffer binding is not supported in vertex shader.
|
||||
@@ -243,8 +243,8 @@ TEST_F(GetBindGroupLayoutTests, Multisampled) {
|
||||
binding.hasDynamicOffset = false;
|
||||
|
||||
wgpu::BindGroupLayoutDescriptor desc = {};
|
||||
desc.bindingCount = 1;
|
||||
desc.bindings = &binding;
|
||||
desc.entryCount = 1;
|
||||
desc.entries = &binding;
|
||||
|
||||
{
|
||||
binding.multisampled = false;
|
||||
@@ -281,8 +281,8 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
||||
binding.multisampled = false;
|
||||
|
||||
wgpu::BindGroupLayoutDescriptor desc = {};
|
||||
desc.bindingCount = 1;
|
||||
desc.bindings = &binding;
|
||||
desc.entryCount = 1;
|
||||
desc.entries = &binding;
|
||||
|
||||
{
|
||||
binding.viewDimension = wgpu::TextureViewDimension::e1D;
|
||||
@@ -355,8 +355,8 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
|
||||
binding.multisampled = false;
|
||||
|
||||
wgpu::BindGroupLayoutDescriptor desc = {};
|
||||
desc.bindingCount = 1;
|
||||
desc.bindings = &binding;
|
||||
desc.entryCount = 1;
|
||||
desc.entries = &binding;
|
||||
|
||||
{
|
||||
binding.textureComponentType = wgpu::TextureComponentType::Float;
|
||||
@@ -398,8 +398,8 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
||||
binding.multisampled = false;
|
||||
|
||||
wgpu::BindGroupLayoutDescriptor desc = {};
|
||||
desc.bindingCount = 1;
|
||||
desc.bindings = &binding;
|
||||
desc.entryCount = 1;
|
||||
desc.entries = &binding;
|
||||
|
||||
{
|
||||
binding.binding = 0;
|
||||
@@ -605,8 +605,8 @@ TEST_F(GetBindGroupLayoutTests, UnusedIndex) {
|
||||
void main() {})");
|
||||
|
||||
wgpu::BindGroupLayoutDescriptor desc = {};
|
||||
desc.bindingCount = 0;
|
||||
desc.bindings = nullptr;
|
||||
desc.entryCount = 0;
|
||||
desc.entries = nullptr;
|
||||
|
||||
wgpu::BindGroupLayout emptyBindGroupLayout = device.CreateBindGroupLayout(&desc);
|
||||
|
||||
@@ -625,8 +625,8 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
|
||||
binding.visibility = wgpu::ShaderStage::Vertex;
|
||||
|
||||
wgpu::BindGroupLayoutDescriptor bglDesc = {};
|
||||
bglDesc.bindingCount = 1;
|
||||
bglDesc.bindings = &binding;
|
||||
bglDesc.entryCount = 1;
|
||||
bglDesc.entries = &binding;
|
||||
|
||||
wgpu::BindGroupLayout bindGroupLayout = device.CreateBindGroupLayout(&bglDesc);
|
||||
|
||||
@@ -663,8 +663,8 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
|
||||
|
||||
{
|
||||
wgpu::BindGroupLayoutDescriptor emptyDesc = {};
|
||||
emptyDesc.bindingCount = 0;
|
||||
emptyDesc.bindings = nullptr;
|
||||
emptyDesc.entryCount = 0;
|
||||
emptyDesc.entries = nullptr;
|
||||
|
||||
wgpu::BindGroupLayout emptyBindGroupLayout = device.CreateBindGroupLayout(&emptyDesc);
|
||||
|
||||
|
||||
@@ -381,11 +381,12 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutWithStorageTextureBindingTy
|
||||
{wgpu::ShaderStage::Compute, wgpu::BindingType::StorageTexture, false}}};
|
||||
|
||||
for (const auto& testSpec : kTestSpecs) {
|
||||
wgpu::BindGroupLayoutEntry binding = {0, testSpec.stage, testSpec.type};
|
||||
binding.storageTextureFormat = wgpu::TextureFormat::R32Uint;
|
||||
wgpu::BindGroupLayoutEntry entry = {0, testSpec.stage, testSpec.type};
|
||||
entry.storageTextureFormat = wgpu::TextureFormat::R32Uint;
|
||||
|
||||
wgpu::BindGroupLayoutDescriptor descriptor;
|
||||
descriptor.bindingCount = 1;
|
||||
descriptor.bindings = &binding;
|
||||
descriptor.entryCount = 1;
|
||||
descriptor.entries = &entry;
|
||||
|
||||
if (testSpec.valid) {
|
||||
device.CreateBindGroupLayout(&descriptor);
|
||||
|
||||
Reference in New Issue
Block a user