mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 09:25:25 +00:00
Remove deprecated BindGroupLayoutEntry fields
Bug: dawn:22 Change-Id: Idf0fd0505fb7e5e5389520fa7bc638e137f4c0b6 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51765 Commit-Queue: Brandon Jones <bajones@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
8bc3e68bd1
commit
7e59470563
@@ -736,75 +736,45 @@ TEST_F(BindGroupLayoutValidationTest, BindGroupLayoutVisibilityNoneExpectsBindGr
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, bgl, {{0, buffer}}));
|
||||
}
|
||||
|
||||
#define BGLEntryType(...) \
|
||||
utils::BindingLayoutEntryInitializationHelper(0, wgpu::ShaderStage::Compute, __VA_ARGS__)
|
||||
|
||||
TEST_F(BindGroupLayoutValidationTest, PerStageLimits) {
|
||||
struct TestInfo {
|
||||
uint32_t maxCount;
|
||||
wgpu::BindingType bindingType;
|
||||
wgpu::BindingType otherBindingType;
|
||||
wgpu::BindGroupLayoutEntry entry;
|
||||
wgpu::BindGroupLayoutEntry otherEntry;
|
||||
};
|
||||
|
||||
constexpr TestInfo kTestInfos[] = {
|
||||
{kMaxSampledTexturesPerShaderStage, wgpu::BindingType::SampledTexture,
|
||||
wgpu::BindingType::UniformBuffer},
|
||||
{kMaxSamplersPerShaderStage, wgpu::BindingType::Sampler, wgpu::BindingType::UniformBuffer},
|
||||
{kMaxSamplersPerShaderStage, wgpu::BindingType::ComparisonSampler,
|
||||
wgpu::BindingType::UniformBuffer},
|
||||
{kMaxStorageBuffersPerShaderStage, wgpu::BindingType::StorageBuffer,
|
||||
wgpu::BindingType::UniformBuffer},
|
||||
{kMaxStorageTexturesPerShaderStage, wgpu::BindingType::ReadonlyStorageTexture,
|
||||
wgpu::BindingType::UniformBuffer},
|
||||
{kMaxStorageTexturesPerShaderStage, wgpu::BindingType::WriteonlyStorageTexture,
|
||||
wgpu::BindingType::UniformBuffer},
|
||||
{kMaxUniformBuffersPerShaderStage, wgpu::BindingType::UniformBuffer,
|
||||
wgpu::BindingType::SampledTexture},
|
||||
std::array<TestInfo, 7> kTestInfos = {
|
||||
TestInfo{kMaxSampledTexturesPerShaderStage, BGLEntryType(wgpu::TextureSampleType::Float),
|
||||
BGLEntryType(wgpu::BufferBindingType::Uniform)},
|
||||
TestInfo{kMaxSamplersPerShaderStage, BGLEntryType(wgpu::SamplerBindingType::Filtering),
|
||||
BGLEntryType(wgpu::BufferBindingType::Uniform)},
|
||||
TestInfo{kMaxSamplersPerShaderStage, BGLEntryType(wgpu::SamplerBindingType::Comparison),
|
||||
BGLEntryType(wgpu::BufferBindingType::Uniform)},
|
||||
TestInfo{kMaxStorageBuffersPerShaderStage, BGLEntryType(wgpu::BufferBindingType::Storage),
|
||||
BGLEntryType(wgpu::BufferBindingType::Uniform)},
|
||||
TestInfo{
|
||||
kMaxStorageTexturesPerShaderStage,
|
||||
BGLEntryType(wgpu::StorageTextureAccess::ReadOnly, wgpu::TextureFormat::RGBA8Unorm),
|
||||
BGLEntryType(wgpu::BufferBindingType::Uniform)},
|
||||
TestInfo{
|
||||
kMaxStorageTexturesPerShaderStage,
|
||||
BGLEntryType(wgpu::StorageTextureAccess::WriteOnly, wgpu::TextureFormat::RGBA8Unorm),
|
||||
BGLEntryType(wgpu::BufferBindingType::Uniform)},
|
||||
TestInfo{kMaxUniformBuffersPerShaderStage, BGLEntryType(wgpu::BufferBindingType::Uniform),
|
||||
BGLEntryType(wgpu::TextureSampleType::Float)},
|
||||
};
|
||||
|
||||
for (TestInfo info : kTestInfos) {
|
||||
wgpu::BindGroupLayout bgl[2];
|
||||
std::vector<utils::BindingLayoutEntryInitializationHelper> maxBindings;
|
||||
|
||||
auto PopulateEntry = [](utils::BindingLayoutEntryInitializationHelper entry) {
|
||||
switch (entry.type) {
|
||||
case wgpu::BindingType::UniformBuffer:
|
||||
entry.buffer.type = wgpu::BufferBindingType::Uniform;
|
||||
break;
|
||||
case wgpu::BindingType::StorageBuffer:
|
||||
entry.buffer.type = wgpu::BufferBindingType::Storage;
|
||||
break;
|
||||
case wgpu::BindingType::ReadonlyStorageBuffer:
|
||||
entry.buffer.type = wgpu::BufferBindingType::ReadOnlyStorage;
|
||||
break;
|
||||
|
||||
case wgpu::BindingType::Sampler:
|
||||
entry.sampler.type = wgpu::SamplerBindingType::Filtering;
|
||||
break;
|
||||
case wgpu::BindingType::ComparisonSampler:
|
||||
entry.sampler.type = wgpu::SamplerBindingType::Comparison;
|
||||
break;
|
||||
|
||||
case wgpu::BindingType::SampledTexture:
|
||||
entry.texture.sampleType = wgpu::TextureSampleType::Float;
|
||||
break;
|
||||
|
||||
case wgpu::BindingType::ReadonlyStorageTexture:
|
||||
entry.storageTexture.access = wgpu::StorageTextureAccess::ReadOnly;
|
||||
entry.storageTexture.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
break;
|
||||
case wgpu::BindingType::WriteonlyStorageTexture:
|
||||
entry.storageTexture.access = wgpu::StorageTextureAccess::WriteOnly;
|
||||
entry.storageTexture.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
break;
|
||||
default:
|
||||
return entry;
|
||||
}
|
||||
|
||||
entry.type = wgpu::BindingType::Undefined;
|
||||
|
||||
return entry;
|
||||
};
|
||||
|
||||
for (uint32_t i = 0; i < info.maxCount; ++i) {
|
||||
maxBindings.push_back(PopulateEntry({i, wgpu::ShaderStage::Compute, info.bindingType}));
|
||||
wgpu::BindGroupLayoutEntry entry = info.entry;
|
||||
entry.binding = i;
|
||||
maxBindings.push_back(entry);
|
||||
}
|
||||
|
||||
// Creating with the maxes works.
|
||||
@@ -813,24 +783,28 @@ TEST_F(BindGroupLayoutValidationTest, PerStageLimits) {
|
||||
// Adding an extra binding of a different type works.
|
||||
{
|
||||
std::vector<utils::BindingLayoutEntryInitializationHelper> bindings = maxBindings;
|
||||
bindings.push_back(
|
||||
PopulateEntry({info.maxCount, wgpu::ShaderStage::Compute, info.otherBindingType}));
|
||||
wgpu::BindGroupLayoutEntry entry = info.otherEntry;
|
||||
entry.binding = info.maxCount;
|
||||
bindings.push_back(entry);
|
||||
MakeBindGroupLayout(bindings.data(), bindings.size());
|
||||
}
|
||||
|
||||
// Adding an extra binding of the maxed type in a different stage works
|
||||
{
|
||||
std::vector<utils::BindingLayoutEntryInitializationHelper> bindings = maxBindings;
|
||||
bindings.push_back(
|
||||
PopulateEntry({info.maxCount, wgpu::ShaderStage::Fragment, info.bindingType}));
|
||||
wgpu::BindGroupLayoutEntry entry = info.entry;
|
||||
entry.binding = info.maxCount;
|
||||
entry.visibility = wgpu::ShaderStage::Fragment;
|
||||
bindings.push_back(entry);
|
||||
MakeBindGroupLayout(bindings.data(), bindings.size());
|
||||
}
|
||||
|
||||
// Adding an extra binding of the maxed type and stage exceeds the per stage limit.
|
||||
{
|
||||
std::vector<utils::BindingLayoutEntryInitializationHelper> bindings = maxBindings;
|
||||
bindings.push_back(
|
||||
PopulateEntry({info.maxCount, wgpu::ShaderStage::Compute, info.bindingType}));
|
||||
wgpu::BindGroupLayoutEntry entry = info.entry;
|
||||
entry.binding = info.maxCount;
|
||||
bindings.push_back(entry);
|
||||
ASSERT_DEVICE_ERROR(MakeBindGroupLayout(bindings.data(), bindings.size()));
|
||||
}
|
||||
|
||||
@@ -838,18 +812,19 @@ TEST_F(BindGroupLayoutValidationTest, PerStageLimits) {
|
||||
TestCreatePipelineLayout(bgl, 1, true);
|
||||
|
||||
// Adding an extra binding of a different type in a different BGL works
|
||||
bgl[1] = utils::MakeBindGroupLayout(
|
||||
device, {PopulateEntry({0, wgpu::ShaderStage::Compute, info.otherBindingType})});
|
||||
bgl[1] = utils::MakeBindGroupLayout(device, {info.otherEntry});
|
||||
TestCreatePipelineLayout(bgl, 2, true);
|
||||
|
||||
// Adding an extra binding of the maxed type in a different stage works
|
||||
bgl[1] = utils::MakeBindGroupLayout(
|
||||
device, {PopulateEntry({0, wgpu::ShaderStage::Fragment, info.bindingType})});
|
||||
TestCreatePipelineLayout(bgl, 2, true);
|
||||
{
|
||||
// Adding an extra binding of the maxed type in a different stage works
|
||||
wgpu::BindGroupLayoutEntry entry = info.entry;
|
||||
entry.visibility = wgpu::ShaderStage::Fragment;
|
||||
bgl[1] = utils::MakeBindGroupLayout(device, {entry});
|
||||
TestCreatePipelineLayout(bgl, 2, true);
|
||||
}
|
||||
|
||||
// Adding an extra binding of the maxed type in a different BGL exceeds the per stage limit.
|
||||
bgl[1] = utils::MakeBindGroupLayout(
|
||||
device, {PopulateEntry({0, wgpu::ShaderStage::Compute, info.bindingType})});
|
||||
bgl[1] = utils::MakeBindGroupLayout(device, {info.entry});
|
||||
TestCreatePipelineLayout(bgl, 2, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -567,25 +567,6 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutViewDimensionMatchesShaderD
|
||||
}
|
||||
}
|
||||
|
||||
// Verify that in a bind group layout binding neither read-only nor write-only storage textures
|
||||
// are allowed to have dynamic offsets.
|
||||
// TODO(dawn:527): No longer be applicable after changes to BindGroupLayoutEntry are complete.
|
||||
TEST_F(StorageTextureValidationTests, StorageTextureCannotHaveDynamicOffsets) {
|
||||
const std::array<wgpu::BindingType, 2> kSupportedStorageTextureBindingTypes = {
|
||||
wgpu::BindingType::ReadonlyStorageTexture, wgpu::BindingType::WriteonlyStorageTexture};
|
||||
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
|
||||
wgpu::BindGroupLayoutEntry bindGroupLayoutBinding;
|
||||
bindGroupLayoutBinding.binding = 0;
|
||||
bindGroupLayoutBinding.visibility = wgpu::ShaderStage::Compute;
|
||||
bindGroupLayoutBinding.type = storageBindingType;
|
||||
bindGroupLayoutBinding.storageTextureFormat = wgpu::TextureFormat::R32Float;
|
||||
|
||||
bindGroupLayoutBinding.hasDynamicOffset = true;
|
||||
ASSERT_DEVICE_ERROR(EXPECT_DEPRECATION_WARNING(
|
||||
utils::MakeBindGroupLayout(device, {bindGroupLayoutBinding})));
|
||||
}
|
||||
}
|
||||
|
||||
// Verify that only a texture view can be used as a read-only or write-only storage texture in a
|
||||
// bind group.
|
||||
TEST_F(StorageTextureValidationTests, StorageTextureBindingTypeInBindGroup) {
|
||||
|
||||
Reference in New Issue
Block a user