Remove deprecated BindGroupLayout options.

Bug: dawn:527
Change-Id: I169dd0b80b006a326f5d8f121a49de6d6ac7b768
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/32024
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Corentin Wallez 2020-11-25 08:57:44 +00:00 committed by Commit Bot service account
parent 5fad85bbd9
commit 441f10a4db
14 changed files with 98 additions and 339 deletions

View File

@ -94,7 +94,6 @@
{"name": "type", "type": "binding type"},
{"name": "has dynamic offset", "type": "bool", "default": "false"},
{"name": "min buffer binding size", "type": "uint64_t", "default": "0"},
{"name": "multisampled", "type": "bool", "default": "false"},
{"name": "view dimension", "type": "texture view dimension", "default": "undefined"},
{"name": "texture component type", "type": "texture component type", "default": "float"},
{"name": "storage texture format", "type": "texture format", "default": "undefined"}

View File

@ -81,23 +81,6 @@ namespace dawn_native {
viewDimension = entry.viewDimension;
}
// Fixup multisampled=true to use MultisampledTexture instead.
// TODO(dawn:527): Remove once the deprecation of multisampled is done.
wgpu::BindingType type = entry.type;
if (entry.multisampled) {
if (type == wgpu::BindingType::MultisampledTexture) {
return DAWN_VALIDATION_ERROR(
"Cannot use multisampled = true and MultisampledTexture at the same time.");
} else if (type == wgpu::BindingType::SampledTexture) {
device->EmitDeprecationWarning(
"BGLEntry::multisampled is deprecated, use "
"wgpu::BindingType::MultisampledTexture instead.");
type = wgpu::BindingType::MultisampledTexture;
} else {
return DAWN_VALIDATION_ERROR("Binding type cannot be multisampled");
}
}
if (bindingsSet.count(bindingNumber) != 0) {
return DAWN_VALIDATION_ERROR("some binding index was specified more than once");
}
@ -105,7 +88,7 @@ namespace dawn_native {
bool canBeDynamic = false;
wgpu::ShaderStage allowedStages = kAllStages;
switch (type) {
switch (entry.type) {
case wgpu::BindingType::StorageBuffer:
allowedStages &= ~wgpu::ShaderStage::Vertex;
DAWN_FALLTHROUGH;
@ -276,16 +259,6 @@ namespace dawn_native {
std::vector<BindGroupLayoutEntry> sortedBindings(
descriptor->entries, descriptor->entries + descriptor->entryCount);
// Fixup multisampled=true to use MultisampledTexture instead.
// TODO(dawn:527): Remove once multisampled=true deprecation is finished.
for (BindGroupLayoutEntry& entry : sortedBindings) {
if (entry.multisampled) {
ASSERT(entry.type == wgpu::BindingType::SampledTexture);
entry.multisampled = false;
entry.type = wgpu::BindingType::MultisampledTexture;
}
}
std::sort(sortedBindings.begin(), sortedBindings.end(), SortBindingsCompare);
for (BindingIndex i{0}; i < mBindingInfo.size(); ++i) {

View File

@ -433,23 +433,11 @@ namespace dawn_native {
case wgpu::BindingType::SampledTexture:
case wgpu::BindingType::MultisampledTexture: {
if (layoutInfo.textureComponentType != shaderInfo.textureComponentType) {
// TODO(dawn:527): Remove once the deprecation timeline is complete.
if (layoutInfo.textureComponentType ==
wgpu::TextureComponentType::Float &&
shaderInfo.textureComponentType ==
wgpu::TextureComponentType::DepthComparison) {
device->EmitDeprecationWarning(
"Using depth texture in the shader with "
"TextureComponentType::Float is deprecated use "
"TextureComponentType::DepthComparison in the bind group "
"layout instead.");
} else {
return DAWN_VALIDATION_ERROR(
"The textureComponentType of the bind group layout entry is "
"different from " +
GetShaderDeclarationString(group, bindingNumber));
}
}
if (layoutInfo.viewDimension != shaderInfo.viewDimension) {
return DAWN_VALIDATION_ERROR(

View File

@ -48,110 +48,6 @@ TEST_P(DeprecationTests, SetIndexBufferWithFormat) {
pass.EndPass();
}
// Test that using BGLEntry.multisampled = true emits a deprecation warning.
TEST_P(DeprecationTests, BGLEntryMultisampledDeprecated) {
wgpu::BindGroupLayoutEntry entry{};
entry.visibility = wgpu::ShaderStage::Fragment;
entry.type = wgpu::BindingType::SampledTexture;
entry.multisampled = true;
entry.binding = 0;
wgpu::BindGroupLayoutDescriptor desc;
desc.entryCount = 1;
desc.entries = &entry;
EXPECT_DEPRECATION_WARNING(device.CreateBindGroupLayout(&desc));
}
// Test that using BGLEntry.multisampled = true with MultisampledTexture is an error.
TEST_P(DeprecationTests, BGLEntryMultisampledBooleanAndTypeIsAnError) {
wgpu::BindGroupLayoutEntry entry{};
entry.visibility = wgpu::ShaderStage::Fragment;
entry.type = wgpu::BindingType::MultisampledTexture;
entry.multisampled = true;
entry.binding = 0;
wgpu::BindGroupLayoutDescriptor desc;
desc.entryCount = 1;
desc.entries = &entry;
ASSERT_DEVICE_ERROR(device.CreateBindGroupLayout(&desc));
}
// Test that a using BGLEntry.multisampled produces the correct state tracking.
TEST_P(DeprecationTests, BGLEntryMultisampledBooleanTracking) {
// Create a BGL with the deprecated multisampled boolean
wgpu::BindGroupLayoutEntry entry{};
entry.visibility = wgpu::ShaderStage::Fragment;
entry.type = wgpu::BindingType::SampledTexture;
entry.multisampled = true;
entry.binding = 0;
wgpu::BindGroupLayoutDescriptor desc;
desc.entryCount = 1;
desc.entries = &entry;
wgpu::BindGroupLayout bgl;
EXPECT_DEPRECATION_WARNING(bgl = device.CreateBindGroupLayout(&desc));
// Create both a multisampled and non-multisampled texture.
wgpu::TextureDescriptor textureDesc;
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
textureDesc.usage = wgpu::TextureUsage::Sampled;
textureDesc.size = {1, 1, 1};
textureDesc.dimension = wgpu::TextureDimension::e2D;
textureDesc.sampleCount = 1;
wgpu::Texture texture1Sample = device.CreateTexture(&textureDesc);
textureDesc.sampleCount = 4;
wgpu::Texture texture4Sample = device.CreateTexture(&textureDesc);
// Creating a bindgroup with that layout is only valid with multisampled = true
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, bgl, {{0, texture1Sample.CreateView()}}));
utils::MakeBindGroup(device, bgl, {{0, texture4Sample.CreateView()}});
}
// Test that compiling a pipeline with TextureComponentType::Float in the BGL when ::DepthComparison
// is expected emits a deprecation warning but isn't an error.
TEST_P(DeprecationTests, TextureComponentTypeFloatWhenDepthComparisonIsExpected) {
wgpu::ShaderModule module =
utils::CreateShaderModule(device, utils::SingleShaderStage::Compute, R"(
#version 450
layout(set = 0, binding = 0) uniform samplerShadow samp;
layout(set = 0, binding = 1) uniform texture2D tex;
void main() {
texture(sampler2DShadow(tex, samp), vec3(0.5, 0.5, 0.5));
}
)");
{
wgpu::BindGroupLayout goodBgl = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ComparisonSampler},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0, false,
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::DepthComparison}});
wgpu::ComputePipelineDescriptor goodDesc;
goodDesc.layout = utils::MakeBasicPipelineLayout(device, &goodBgl);
goodDesc.computeStage.module = module;
goodDesc.computeStage.entryPoint = "main";
device.CreateComputePipeline(&goodDesc);
}
{
wgpu::BindGroupLayout badBgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ComparisonSampler},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::ComputePipelineDescriptor badDesc;
badDesc.layout = utils::MakeBasicPipelineLayout(device, &badBgl);
badDesc.computeStage.module = module;
badDesc.computeStage.entryPoint = "main";
EXPECT_DEPRECATION_WARNING(device.CreateComputePipeline(&badDesc));
}
}
DAWN_INSTANTIATE_TEST(DeprecationTests,
D3D12Backend(),
MetalBackend(),

View File

@ -208,9 +208,8 @@ class DepthStencilSamplingTest : public DawnTest {
// TODO(dawn:367): Cannot use GetBindGroupLayout for comparison samplers without shader
// reflection data.
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ComparisonSampler},
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0, false,
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ComparisonSampler},
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::DepthComparison},
{2, wgpu::ShaderStage::Fragment, wgpu::BindingType::UniformBuffer}});
@ -244,9 +243,8 @@ class DepthStencilSamplingTest : public DawnTest {
// TODO(dawn:367): Cannot use GetBindGroupLayout without shader reflection data.
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ComparisonSampler},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0, false,
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ComparisonSampler},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::DepthComparison},
{2, wgpu::ShaderStage::Compute, wgpu::BindingType::UniformBuffer},
{3, wgpu::ShaderStage::Compute, wgpu::BindingType::StorageBuffer}});

View File

@ -50,13 +50,13 @@ TEST_P(ObjectCachingTest, BindGroupLayoutDynamic) {
TEST_P(ObjectCachingTest, BindGroupLayoutTextureComponentType) {
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::BindGroupLayout sameBgl = utils::MakeBindGroupLayout(
device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Uint}});
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Uint}});
EXPECT_NE(bgl.Get(), otherBgl.Get());
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
@ -67,13 +67,13 @@ TEST_P(ObjectCachingTest, BindGroupLayoutTextureComponentType) {
TEST_P(ObjectCachingTest, BindGroupLayoutViewDimension) {
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::BindGroupLayout sameBgl = utils::MakeBindGroupLayout(
device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2DArray, wgpu::TextureComponentType::Float}});
wgpu::TextureViewDimension::e2DArray, wgpu::TextureComponentType::Float}});
EXPECT_NE(bgl.Get(), otherBgl.Get());
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());

View File

@ -298,7 +298,7 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
TEST_F(BindGroupValidationTest, TextureComponentType) {
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
// Control case: setting a Float typed texture view works.
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
@ -358,8 +358,7 @@ TEST_F(BindGroupValidationTest, SamplingDepthStencilTexture) {
// Check that a texture must have a correct format for DepthComparison
TEST_F(BindGroupValidationTest, TextureComponentTypeDepthComparison) {
wgpu::BindGroupLayout depthLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0, false,
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::DepthComparison}});
// Control case: setting a depth texture works.
@ -375,13 +374,12 @@ TEST_F(BindGroupValidationTest, TextureComponentTypeDepthComparison) {
// ::DepthComparison
TEST_F(BindGroupValidationTest, TextureComponentTypeForDepthTexture) {
wgpu::BindGroupLayout depthLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0, false,
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::DepthComparison}});
wgpu::BindGroupLayout floatLayout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::Texture depthTexture =
CreateTexture(wgpu::TextureUsage::Sampled, wgpu::TextureFormat::Depth32Float, 1);
@ -394,7 +392,7 @@ TEST_F(BindGroupValidationTest, TextureComponentTypeForDepthTexture) {
TEST_F(BindGroupValidationTest, TextureDimension) {
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
// Control case: setting a 2D texture view works.
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
@ -466,7 +464,7 @@ TEST_F(BindGroupValidationTest, BufferOffsetAlignment) {
TEST_F(BindGroupValidationTest, MultisampledTexture) {
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::MultisampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::BindGroupEntry binding;
binding.binding = 0;
@ -950,49 +948,49 @@ TEST_F(BindGroupLayoutValidationTest, MultisampledTextureViewDimension) {
utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false,
0, false, wgpu::TextureViewDimension::e2D},
0, wgpu::TextureViewDimension::e2D},
});
// Multisampled 2D (defaulted) texture works.
utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false,
0, false, wgpu::TextureViewDimension::Undefined},
0, wgpu::TextureViewDimension::Undefined},
});
// Multisampled 2D array texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false,
0, false, wgpu::TextureViewDimension::e2DArray},
0, wgpu::TextureViewDimension::e2DArray},
}));
// Multisampled cube texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false,
0, false, wgpu::TextureViewDimension::Cube},
0, wgpu::TextureViewDimension::Cube},
}));
// Multisampled cube array texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false,
0, false, wgpu::TextureViewDimension::CubeArray},
0, wgpu::TextureViewDimension::CubeArray},
}));
// Multisampled 3D texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false,
0, false, wgpu::TextureViewDimension::e3D},
0, wgpu::TextureViewDimension::e3D},
}));
// Multisampled 1D texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false,
0, false, wgpu::TextureViewDimension::e1D},
0, wgpu::TextureViewDimension::e1D},
}));
}
@ -1002,77 +1000,39 @@ TEST_F(BindGroupLayoutValidationTest, MultisampledTextureComponentType) {
utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false,
0, false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float},
0, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float},
});
// Multisampled float (defaulted) component type works.
utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false,
0, false, wgpu::TextureViewDimension::e2D},
0, wgpu::TextureViewDimension::e2D},
});
// Multisampled uint component type works.
utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false,
0, false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Uint},
0, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Uint},
});
// Multisampled sint component type works.
utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false,
0, false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Sint},
0, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Sint},
});
// Multisampled depth comparison component typeworks.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device,
{
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false, 0, false,
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::MultisampledTexture, false, 0,
wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::DepthComparison},
}));
}
// Test that it is an error to pass multisampled=true for non-texture bindings.
// TODO(crbug.com/dawn/527): Remove this test when multisampled=true is removed.
TEST_F(BindGroupLayoutValidationTest, MultisampledMustBeSampledTexture) {
// Base: Multisampled 2D texture works.
EXPECT_DEPRECATION_WARNING(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
true, wgpu::TextureViewDimension::e2D},
}));
// Multisampled uniform buffer binding is invalid
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device,
{
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::UniformBuffer, false, 0, true},
}));
// Multisampled storage buffer binding is invalid
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device,
{
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::StorageBuffer, false, 0, true},
}));
// Multisampled sampler binding is invalid
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::Sampler, false, 0, true},
}));
// Multisampled 2D storage texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture,
false, 0, true, wgpu::TextureViewDimension::e2D},
}));
}
constexpr uint64_t kBufferSize = 3 * kMinDynamicBufferOffsetAlignment + 8;
constexpr uint32_t kBindingSize = 9;
@ -1845,28 +1805,28 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
kTexture2DShader,
{utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D}})});
wgpu::TextureViewDimension::e2D}})});
// Render: Test that 2D texture with 2D array view dimension is invalid
ASSERT_DEVICE_ERROR(CreateFSRenderPipeline(
kTexture2DShader,
{utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2DArray}})}));
wgpu::TextureViewDimension::e2DArray}})}));
// Compute: Test that 2D texture with 2D view dimension works
CreateComputePipeline(
kTexture2DShader,
{utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D}})});
wgpu::TextureViewDimension::e2D}})});
// Compute: Test that 2D texture with 2D array view dimension is invalid
ASSERT_DEVICE_ERROR(CreateComputePipeline(
kTexture2DShader,
{utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2DArray}})}));
wgpu::TextureViewDimension::e2DArray}})}));
constexpr char kTexture2DArrayShader[] = R"(
#version 450
@ -1879,28 +1839,28 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
kTexture2DArrayShader,
{utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2DArray}})});
wgpu::TextureViewDimension::e2DArray}})});
// Render: Test that 2D texture array with 2D view dimension is invalid
ASSERT_DEVICE_ERROR(CreateFSRenderPipeline(
kTexture2DArrayShader,
{utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D}})}));
wgpu::TextureViewDimension::e2D}})}));
// Compute: Test that 2D texture array with 2D array view dimension works
CreateComputePipeline(
kTexture2DArrayShader,
{utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2DArray}})});
wgpu::TextureViewDimension::e2DArray}})});
// Compute: Test that 2D texture array with 2D view dimension is invalid
ASSERT_DEVICE_ERROR(CreateComputePipeline(
kTexture2DArrayShader,
{utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D}})}));
wgpu::TextureViewDimension::e2D}})}));
}
class BindingsValidationTest : public BindGroupLayoutCompatibilityTest {

View File

@ -104,7 +104,6 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) {
wgpu::BindGroupLayoutEntry binding = {};
binding.binding = 0;
binding.type = wgpu::BindingType::UniformBuffer;
binding.multisampled = false;
binding.minBufferBindingSize = 4 * sizeof(float);
wgpu::BindGroupLayoutDescriptor desc = {};
@ -166,7 +165,6 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
wgpu::BindGroupLayoutEntry binding = {};
binding.binding = 0;
binding.hasDynamicOffset = false;
binding.multisampled = false;
binding.minBufferBindingSize = 4 * sizeof(float);
binding.visibility = wgpu::ShaderStage::Fragment;
@ -243,54 +241,6 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
}
}
// Test that multisampling matches the shader.
TEST_F(GetBindGroupLayoutTests, Multisampled) {
wgpu::BindGroupLayoutEntry binding = {};
binding.binding = 0;
binding.visibility = wgpu::ShaderStage::Fragment;
binding.hasDynamicOffset = false;
wgpu::BindGroupLayoutDescriptor desc = {};
desc.entryCount = 1;
desc.entries = &binding;
{
binding.type = wgpu::BindingType::SampledTexture;
binding.multisampled = false;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
#version 450
layout(set = 0, binding = 0) uniform texture2D tex;
void main() {})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
{
binding.type = wgpu::BindingType::MultisampledTexture;
binding.multisampled = false;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
#version 450
layout(set = 0, binding = 0) uniform texture2DMS tex;
void main() {})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}
// TODO(crbug.com/dawn/527): Remove this block when multisampled=true is removed.
{
binding.type = wgpu::BindingType::SampledTexture;
binding.multisampled = true;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
#version 450
layout(set = 0, binding = 0) uniform texture2DMS tex;
void main() {})");
wgpu::BindGroupLayout bgl;
EXPECT_DEPRECATION_WARNING(bgl = device.CreateBindGroupLayout(&desc));
EXPECT_EQ(bgl.Get(), pipeline.GetBindGroupLayout(0).Get());
}
}
// Test that texture view dimension matches the shader.
TEST_F(GetBindGroupLayoutTests, ViewDimension) {
wgpu::BindGroupLayoutEntry binding = {};
@ -298,7 +248,6 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
binding.type = wgpu::BindingType::SampledTexture;
binding.visibility = wgpu::ShaderStage::Fragment;
binding.hasDynamicOffset = false;
binding.multisampled = false;
wgpu::BindGroupLayoutDescriptor desc = {};
desc.entryCount = 1;
@ -372,7 +321,6 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
binding.type = wgpu::BindingType::SampledTexture;
binding.visibility = wgpu::ShaderStage::Fragment;
binding.hasDynamicOffset = false;
binding.multisampled = false;
wgpu::BindGroupLayoutDescriptor desc = {};
desc.entryCount = 1;
@ -415,7 +363,6 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
binding.type = wgpu::BindingType::UniformBuffer;
binding.visibility = wgpu::ShaderStage::Fragment;
binding.hasDynamicOffset = false;
binding.multisampled = false;
binding.minBufferBindingSize = 4 * sizeof(float);
wgpu::BindGroupLayoutDescriptor desc = {};

View File

@ -394,8 +394,8 @@ TEST_F(MinBufferSizeBindGroupCreationTests, LayoutEquality) {
auto MakeLayout = [&](uint64_t size) {
return utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::UniformBuffer, false, size,
false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, wgpu::TextureFormat::Undefined}});
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float,
wgpu::TextureFormat::Undefined}});
};
EXPECT_EQ(MakeLayout(0).Get(), MakeLayout(0).Get());

View File

@ -418,7 +418,7 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false,
0, false, wgpu::TextureViewDimension::e2D, kTextureComponentTypes[j]}});
0, wgpu::TextureViewDimension::e2D, kTextureComponentTypes[j]}});
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
if (i == j) {
@ -468,7 +468,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false,
0, false, kTextureViewDimensions[j], wgpu::TextureComponentType::Float}});
0, kTextureViewDimensions[j], wgpu::TextureComponentType::Float}});
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
if (i == j) {

View File

@ -867,7 +867,7 @@ namespace {
{{0, wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute,
wgpu::BindingType::SampledTexture},
{1, wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute,
wgpu::BindingType::ReadonlyStorageTexture, false, 0, false,
wgpu::BindingType::ReadonlyStorageTexture, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}, {1, view}});
@ -930,7 +930,7 @@ namespace {
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}, {1, view}});
@ -976,8 +976,8 @@ namespace {
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::WriteonlyStorageTexture, false,
0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
0, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float,
kFormat}});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}});
// It is invalid to use the texture as both writeonly storage and render target in
@ -1016,10 +1016,10 @@ namespace {
// Create a bind group to use the texture as sampled and writeonly bindings
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}, {1, view}});
@ -1098,11 +1098,11 @@ namespace {
// Create bind groups to use the texture as readonly and writeonly bindings
wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup readBG = utils::MakeBindGroup(device, readBGL, {{0, view}});
wgpu::BindGroup writeBG = utils::MakeBindGroup(device, writeBGL, {{0, view}});
@ -1130,11 +1130,11 @@ namespace {
// Create bind groups to use the texture as readonly and writeonly bindings
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup writeBG = utils::MakeBindGroup(device, writeBGL, {{0, view}});
wgpu::BindGroup readBG = utils::MakeBindGroup(device, readBGL, {{0, view}});
@ -1173,8 +1173,8 @@ namespace {
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::WriteonlyStorageTexture, false,
0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
0, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float,
kFormat}});
wgpu::BindGroup sampledBG = utils::MakeBindGroup(device, sampledBGL, {{0, view}});
wgpu::BindGroup writeBG = utils::MakeBindGroup(device, writeBGL, {{0, view}});
@ -1203,11 +1203,11 @@ namespace {
// Create bind groups to use the texture as readonly and writeonly storage bindings
wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup readBG = utils::MakeBindGroup(device, readBGL, {{0, view}});
wgpu::BindGroup writeBG = utils::MakeBindGroup(device, writeBGL, {{0, view}});
@ -1248,8 +1248,8 @@ namespace {
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::WriteonlyStorageTexture, false,
0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
0, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float,
kFormat}});
wgpu::BindGroup sampledBG = utils::MakeBindGroup(device, sampledBGL, {{0, view}});
wgpu::BindGroup writeBG = utils::MakeBindGroup(device, writeBGL, {{0, view}});
@ -1276,11 +1276,11 @@ namespace {
// Create the bind group to use the texture as readonly and writeonly storage bindings
wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup readBG = utils::MakeBindGroup(device, readBGL, {{0, view}});
wgpu::BindGroup writeBG = utils::MakeBindGroup(device, writeBGL, {{0, view}});
@ -1403,12 +1403,12 @@ namespace {
// Create the bind group to use the texture as readonly and writeonly bindings
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup writeBG0 = utils::MakeBindGroup(device, writeBGL, {{0, view0}});
@ -1466,10 +1466,10 @@ namespace {
// Create a bind group whose bindings are not visible in render pass
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::None, wgpu::BindingType::WriteonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}, {1, view}});
@ -1488,10 +1488,10 @@ namespace {
// Create a bind group whose bindings are not visible in compute pass
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::None, wgpu::BindingType::WriteonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}, {1, view}});
@ -1527,7 +1527,7 @@ namespace {
// Create a bind group which use the texture as readonly storage in compute stage
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}});
@ -1546,10 +1546,10 @@ namespace {
// Create a bind group which contains both fragment and compute stages
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}, {1, view}});
@ -1582,12 +1582,12 @@ namespace {
wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute,
wgpu::BindingType::ReadonlyStorageTexture, false, 0, false,
wgpu::BindingType::ReadonlyStorageTexture, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute,
wgpu::BindingType::WriteonlyStorageTexture, false, 0, false,
wgpu::BindingType::WriteonlyStorageTexture, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup readBG = utils::MakeBindGroup(device, readBGL, {{0, view}});
wgpu::BindGroup writeBG = utils::MakeBindGroup(device, writeBGL, {{0, view}});

View File

@ -403,7 +403,7 @@ TEST_F(StorageTextureValidationTests, UnsupportedTextureViewDimensionInBindGroup
for (wgpu::BindingType bindingType : kSupportedStorageTextureBindingTypes) {
for (wgpu::TextureViewDimension dimension : kUnsupportedTextureViewDimensions) {
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, bindingType, false, 0, false, dimension,
device, {{0, wgpu::ShaderStage::Compute, bindingType, false, 0, dimension,
wgpu::TextureComponentType::Float, kFormat}}));
}
}
@ -812,7 +812,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureInRenderPass) {
// Create a bind group that contains a storage texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, 0, false,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroupWithStorageTexture =
@ -845,9 +845,9 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneRender
// texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, 0, false,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0, false,
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
device, bindGroupLayout,
@ -886,7 +886,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndRenderAttachmentInOneRend
// Create a bind group that contains a storage texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, 0, false,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroupWithStorageTexture =
utils::MakeBindGroup(device, bindGroupLayout, {{0, storageTexture.CreateView()}});
@ -912,10 +912,9 @@ TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneRen
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture, false, 0,
false, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat},
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::WriteonlyStorageTexture, false, 0,
false, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float,
kFormat}});
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, bindGroupLayout,
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
@ -943,9 +942,9 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneComput
// texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Compute, storageTextureType, false, 0, false,
{{0, wgpu::ShaderStage::Compute, storageTextureType, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0, false,
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup = utils::MakeBindGroup(
device, bindGroupLayout,
@ -971,11 +970,10 @@ TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneCom
// texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture, false, 0, false,
{{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture, false, 0,
false, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float,
kFormat}});
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, bindGroupLayout,
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});

View File

@ -75,7 +75,7 @@ namespace {
wgpu::BindGroupLayout bgl1 = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup1 = utils::MakeBindGroup(device, bgl1, {{0, samplerView}});
@ -106,7 +106,7 @@ namespace {
wgpu::BindGroupLayout bgl1 = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::WriteonlyStorageTexture,
false, 0, false, wgpu::TextureViewDimension::Undefined,
false, 0, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup1 = utils::MakeBindGroup(device, bgl1, {{0, samplerView}});

View File

@ -307,12 +307,12 @@ TEST_F(WireArgumentTests, StructureOfObjectArrayArgument) {
TEST_F(WireArgumentTests, StructureOfStructureArrayArgument) {
static constexpr int NUM_BINDINGS = 3;
WGPUBindGroupLayoutEntry entries[NUM_BINDINGS]{
{0, WGPUShaderStage_Vertex, WGPUBindingType_Sampler, false, 0, false,
WGPUTextureViewDimension_2D, WGPUTextureComponentType_Float, WGPUTextureFormat_RGBA8Unorm},
{1, WGPUShaderStage_Vertex, WGPUBindingType_SampledTexture, false, 0, false,
{0, WGPUShaderStage_Vertex, WGPUBindingType_Sampler, false, 0, WGPUTextureViewDimension_2D,
WGPUTextureComponentType_Float, WGPUTextureFormat_RGBA8Unorm},
{1, WGPUShaderStage_Vertex, WGPUBindingType_SampledTexture, false, 0,
WGPUTextureViewDimension_2D, WGPUTextureComponentType_Float, WGPUTextureFormat_RGBA8Unorm},
{2, static_cast<WGPUShaderStage>(WGPUShaderStage_Vertex | WGPUShaderStage_Fragment),
WGPUBindingType_UniformBuffer, false, 0, false, WGPUTextureViewDimension_2D,
WGPUBindingType_UniformBuffer, false, 0, WGPUTextureViewDimension_2D,
WGPUTextureComponentType_Float, WGPUTextureFormat_RGBA8Unorm},
};
WGPUBindGroupLayoutDescriptor bglDescriptor = {};