Reorder minBufferBindingSize to match upstream webgpu.h

Bug: dawn:22
Change-Id: I409a2de9f1704613d1cdbda976c3ab50eff48d46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24603
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Kai Ninomiya 2020-07-09 20:49:43 +00:00 committed by Commit Bot service account
parent c9fc175bba
commit 479689912e
9 changed files with 121 additions and 187 deletions

View File

@ -92,11 +92,11 @@
{"name": "visibility", "type": "shader stage"}, {"name": "visibility", "type": "shader stage"},
{"name": "type", "type": "binding type"}, {"name": "type", "type": "binding type"},
{"name": "has dynamic offset", "type": "bool", "default": "false"}, {"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": "multisampled", "type": "bool", "default": "false"},
{"name": "view dimension", "type": "texture view dimension", "default": "undefined"}, {"name": "view dimension", "type": "texture view dimension", "default": "undefined"},
{"name": "texture component type", "type": "texture component type", "default": "float"}, {"name": "texture component type", "type": "texture component type", "default": "float"},
{"name": "storage texture format", "type": "texture format", "default": "undefined"}, {"name": "storage texture format", "type": "texture format", "default": "undefined"}
{"name": "min buffer binding size", "type": "uint64_t", "default": "0"}
] ]
}, },
"bind group layout descriptor": { "bind group layout descriptor": {

View File

@ -48,30 +48,15 @@ TEST_P(ObjectCachingTest, BindGroupLayoutDynamic) {
// Test that two similar bind group layouts won't refer to the same one if they differ by // Test that two similar bind group layouts won't refer to the same one if they differ by
// textureComponentType // textureComponentType
TEST_P(ObjectCachingTest, BindGroupLayoutTextureComponentType) { TEST_P(ObjectCachingTest, BindGroupLayoutTextureComponentType) {
wgpu::BindGroupLayout bgl = wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
utils::MakeBindGroupLayout(device, {{1, device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
wgpu::ShaderStage::Fragment, false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::BindingType::SampledTexture, wgpu::BindGroupLayout sameBgl = utils::MakeBindGroupLayout(
false, device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::TextureViewDimension::e2D, wgpu::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
wgpu::TextureComponentType::Float}}); device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
wgpu::BindGroupLayout sameBgl = false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Uint}});
utils::MakeBindGroupLayout(device, {{1,
wgpu::ShaderStage::Fragment,
wgpu::BindingType::SampledTexture,
false,
false,
wgpu::TextureViewDimension::e2D,
wgpu::TextureComponentType::Float}});
wgpu::BindGroupLayout otherBgl =
utils::MakeBindGroupLayout(device, {{1,
wgpu::ShaderStage::Fragment,
wgpu::BindingType::SampledTexture,
false,
false,
wgpu::TextureViewDimension::e2D,
wgpu::TextureComponentType::Uint}});
EXPECT_NE(bgl.Get(), otherBgl.Get()); EXPECT_NE(bgl.Get(), otherBgl.Get());
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire()); EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
@ -80,30 +65,15 @@ TEST_P(ObjectCachingTest, BindGroupLayoutTextureComponentType) {
// Test that two similar bind group layouts won't refer to the same one if they differ by // Test that two similar bind group layouts won't refer to the same one if they differ by
// viewDimension // viewDimension
TEST_P(ObjectCachingTest, BindGroupLayoutViewDimension) { TEST_P(ObjectCachingTest, BindGroupLayoutViewDimension) {
wgpu::BindGroupLayout bgl = wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
utils::MakeBindGroupLayout(device, {{1, device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
wgpu::ShaderStage::Fragment, false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::BindingType::SampledTexture, wgpu::BindGroupLayout sameBgl = utils::MakeBindGroupLayout(
false, device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::TextureViewDimension::e2D, wgpu::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
wgpu::TextureComponentType::Float}}); device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
wgpu::BindGroupLayout sameBgl = false, wgpu::TextureViewDimension::e2DArray, wgpu::TextureComponentType::Float}});
utils::MakeBindGroupLayout(device, {{1,
wgpu::ShaderStage::Fragment,
wgpu::BindingType::SampledTexture,
false,
false,
wgpu::TextureViewDimension::e2D,
wgpu::TextureComponentType::Float}});
wgpu::BindGroupLayout otherBgl =
utils::MakeBindGroupLayout(device, {{1,
wgpu::ShaderStage::Fragment,
wgpu::BindingType::SampledTexture,
false,
false,
wgpu::TextureViewDimension::e2DArray,
wgpu::TextureComponentType::Float}});
EXPECT_NE(bgl.Get(), otherBgl.Get()); EXPECT_NE(bgl.Get(), otherBgl.Get());
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire()); EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());

View File

@ -303,14 +303,9 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
// Check that a texture must have the correct component type // Check that a texture must have the correct component type
TEST_F(BindGroupValidationTest, TextureComponentType) { TEST_F(BindGroupValidationTest, TextureComponentType) {
wgpu::BindGroupLayout layout = wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
utils::MakeBindGroupLayout(device, {{0, device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
wgpu::ShaderStage::Fragment, false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::BindingType::SampledTexture,
false,
false,
wgpu::TextureViewDimension::e2D,
wgpu::TextureComponentType::Float}});
// Control case: setting a Float typed texture view works. // Control case: setting a Float typed texture view works.
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}}); utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
@ -325,14 +320,9 @@ TEST_F(BindGroupValidationTest, TextureComponentType) {
// Check that a texture must have the correct dimension // Check that a texture must have the correct dimension
TEST_F(BindGroupValidationTest, TextureDimension) { TEST_F(BindGroupValidationTest, TextureDimension) {
wgpu::BindGroupLayout layout = wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
utils::MakeBindGroupLayout(device, {{0, device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
wgpu::ShaderStage::Fragment, false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
wgpu::BindingType::SampledTexture,
false,
false,
wgpu::TextureViewDimension::e2D,
wgpu::TextureComponentType::Float}});
// Control case: setting a 2D texture view works. // Control case: setting a 2D texture view works.
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}}); utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
@ -770,50 +760,50 @@ TEST_F(BindGroupLayoutValidationTest, MultisampledTextures) {
// Multisampled 2D texture works. // Multisampled 2D texture works.
utils::MakeBindGroupLayout( utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true, {0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::e2D}, true, wgpu::TextureViewDimension::e2D},
}); });
// Multisampled 2D (defaulted) texture works. // Multisampled 2D (defaulted) texture works.
utils::MakeBindGroupLayout( utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true, {0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::Undefined}, true, wgpu::TextureViewDimension::Undefined},
}); });
// Multisampled 2D storage texture is invalid. // Multisampled 2D storage texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture, {0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture,
false, true, wgpu::TextureViewDimension::e2D}, false, 0, true, wgpu::TextureViewDimension::e2D},
})); }));
// Multisampled 2D array texture is invalid. // Multisampled 2D array texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true, {0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::e2DArray}, true, wgpu::TextureViewDimension::e2DArray},
})); }));
// Multisampled cube texture is invalid. // Multisampled cube texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true, {0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::Cube}, true, wgpu::TextureViewDimension::Cube},
})); }));
// Multisampled cube array texture is invalid. // Multisampled cube array texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true, {0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::CubeArray}, true, wgpu::TextureViewDimension::CubeArray},
})); }));
// Multisampled 3D texture is invalid. // Multisampled 3D texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true, {0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::e3D}, true, wgpu::TextureViewDimension::e3D},
})); }));
} }
@ -822,26 +812,28 @@ TEST_F(BindGroupLayoutValidationTest, MultisampledMustBeTexture) {
// Base: Multisampled 2D texture works. // Base: Multisampled 2D texture works.
utils::MakeBindGroupLayout( utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true, {0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
wgpu::TextureViewDimension::e2D}, true, wgpu::TextureViewDimension::e2D},
}); });
// Multisampled uniform buffer binding is invalid // Multisampled uniform buffer binding is invalid
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device,
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::UniformBuffer, false, true}, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::UniformBuffer, false, 0, true},
})); }));
// Multisampled storage buffer binding is invalid // Multisampled storage buffer binding is invalid
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device,
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::StorageBuffer, false, true}, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::StorageBuffer, false, 0, true},
})); }));
// Multisampled sampler binding is invalid // Multisampled sampler binding is invalid
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, { device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::Sampler, false, true}, {0, wgpu::ShaderStage::Compute, wgpu::BindingType::Sampler, false, 0, true},
})); }));
} }
@ -1613,28 +1605,28 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
CreateFSRenderPipeline( CreateFSRenderPipeline(
kTexture2DShader, kTexture2DShader,
{utils::MakeBindGroupLayout( {utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D}})}); false, wgpu::TextureViewDimension::e2D}})});
// Render: Test that 2D texture with 2D array view dimension is invalid // Render: Test that 2D texture with 2D array view dimension is invalid
ASSERT_DEVICE_ERROR(CreateFSRenderPipeline( ASSERT_DEVICE_ERROR(CreateFSRenderPipeline(
kTexture2DShader, kTexture2DShader,
{utils::MakeBindGroupLayout( {utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2DArray}})})); false, wgpu::TextureViewDimension::e2DArray}})}));
// Compute: Test that 2D texture with 2D view dimension works // Compute: Test that 2D texture with 2D view dimension works
CreateComputePipeline( CreateComputePipeline(
kTexture2DShader, kTexture2DShader,
{utils::MakeBindGroupLayout( {utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D}})}); false, wgpu::TextureViewDimension::e2D}})});
// Compute: Test that 2D texture with 2D array view dimension is invalid // Compute: Test that 2D texture with 2D array view dimension is invalid
ASSERT_DEVICE_ERROR(CreateComputePipeline( ASSERT_DEVICE_ERROR(CreateComputePipeline(
kTexture2DShader, kTexture2DShader,
{utils::MakeBindGroupLayout( {utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2DArray}})})); false, wgpu::TextureViewDimension::e2DArray}})}));
constexpr char kTexture2DArrayShader[] = R"( constexpr char kTexture2DArrayShader[] = R"(
@ -1647,28 +1639,28 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
CreateFSRenderPipeline( CreateFSRenderPipeline(
kTexture2DArrayShader, kTexture2DArrayShader,
{utils::MakeBindGroupLayout( {utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2DArray}})}); false, wgpu::TextureViewDimension::e2DArray}})});
// Render: Test that 2D texture array with 2D view dimension is invalid // Render: Test that 2D texture array with 2D view dimension is invalid
ASSERT_DEVICE_ERROR(CreateFSRenderPipeline( ASSERT_DEVICE_ERROR(CreateFSRenderPipeline(
kTexture2DArrayShader, kTexture2DArrayShader,
{utils::MakeBindGroupLayout( {utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D}})})); false, wgpu::TextureViewDimension::e2D}})}));
// Compute: Test that 2D texture array with 2D array view dimension works // Compute: Test that 2D texture array with 2D array view dimension works
CreateComputePipeline( CreateComputePipeline(
kTexture2DArrayShader, kTexture2DArrayShader,
{utils::MakeBindGroupLayout( {utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2DArray}})}); false, wgpu::TextureViewDimension::e2DArray}})});
// Compute: Test that 2D texture array with 2D view dimension is invalid // Compute: Test that 2D texture array with 2D view dimension is invalid
ASSERT_DEVICE_ERROR(CreateComputePipeline( ASSERT_DEVICE_ERROR(CreateComputePipeline(
kTexture2DArrayShader, kTexture2DArrayShader,
{utils::MakeBindGroupLayout( {utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D}})})); false, wgpu::TextureViewDimension::e2D}})}));
} }

View File

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

View File

@ -392,14 +392,9 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
descriptor.cFragmentStage.module = utils::CreateShaderModule( descriptor.cFragmentStage.module = utils::CreateShaderModule(
device, utils::SingleShaderStage::Fragment, stream.str().c_str()); device, utils::SingleShaderStage::Fragment, stream.str().c_str());
wgpu::BindGroupLayout bgl = wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
utils::MakeBindGroupLayout(device, {{0, device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false,
wgpu::ShaderStage::Fragment, 0, false, wgpu::TextureViewDimension::e2D, kTextureComponentTypes[j]}});
wgpu::BindingType::SampledTexture,
false,
false,
wgpu::TextureViewDimension::e2D,
kTextureComponentTypes[j]}});
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl); descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
if (i == j) { if (i == j) {
@ -447,14 +442,9 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
descriptor.cFragmentStage.module = utils::CreateShaderModule( descriptor.cFragmentStage.module = utils::CreateShaderModule(
device, utils::SingleShaderStage::Fragment, stream.str().c_str()); device, utils::SingleShaderStage::Fragment, stream.str().c_str());
wgpu::BindGroupLayout bgl = wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
utils::MakeBindGroupLayout(device, {{0, device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false,
wgpu::ShaderStage::Fragment, 0, false, kTextureViewDimensions[j], wgpu::TextureComponentType::Float}});
wgpu::BindingType::SampledTexture,
false,
false,
kTextureViewDimensions[j],
wgpu::TextureComponentType::Float}});
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl); descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
if (i == j) { if (i == j) {

View File

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

View File

@ -422,7 +422,7 @@ TEST_F(StorageTextureValidationTests, UnsupportedTextureViewDimensionInBindGroup
for (wgpu::BindingType bindingType : kSupportedStorageTextureBindingTypes) { for (wgpu::BindingType bindingType : kSupportedStorageTextureBindingTypes) {
for (wgpu::TextureViewDimension dimension : kUnsupportedTextureViewDimensions) { for (wgpu::TextureViewDimension dimension : kUnsupportedTextureViewDimensions) {
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout( ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, bindingType, false, false, dimension, device, {{0, wgpu::ShaderStage::Compute, bindingType, false, 0, false, dimension,
wgpu::TextureComponentType::Float, kFormat}})); wgpu::TextureComponentType::Float, kFormat}}));
} }
} }
@ -838,7 +838,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureInRenderPass) {
// Create a bind group that contains a storage texture. // Create a bind group that contains a storage texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout( wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, device,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, false, {{0, wgpu::ShaderStage::Fragment, storageTextureType, false, 0, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}}); wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroupWithStorageTexture = wgpu::BindGroup bindGroupWithStorageTexture =
@ -871,9 +871,9 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneRender
// texture. // texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout( wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, device,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, false, {{0, wgpu::ShaderStage::Fragment, storageTextureType, false, 0, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, false, {1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}}); wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup = utils::MakeBindGroup( wgpu::BindGroup bindGroup = utils::MakeBindGroup(
device, bindGroupLayout, device, bindGroupLayout,
@ -912,7 +912,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndOutputAttachmentInOneRend
// Create a bind group that contains a storage texture. // Create a bind group that contains a storage texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout( wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, device,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, false, {{0, wgpu::ShaderStage::Fragment, storageTextureType, false, 0, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}}); wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroupWithStorageTexture = wgpu::BindGroup bindGroupWithStorageTexture =
utils::MakeBindGroup(device, bindGroupLayout, {{0, storageTexture.CreateView()}}); utils::MakeBindGroup(device, bindGroupLayout, {{0, storageTexture.CreateView()}});
@ -937,10 +937,11 @@ TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneRen
// texture. // texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout( wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, device,
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture, false, false, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}, false, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::WriteonlyStorageTexture, false, false, {1, wgpu::ShaderStage::Fragment, wgpu::BindingType::WriteonlyStorageTexture, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}}); false, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float,
kFormat}});
wgpu::BindGroup bindGroup = wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, bindGroupLayout, utils::MakeBindGroup(device, bindGroupLayout,
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}}); {{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
@ -968,9 +969,9 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneComput
// texture. // texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout( wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, device,
{{0, wgpu::ShaderStage::Compute, storageTextureType, false, false, {{0, wgpu::ShaderStage::Compute, storageTextureType, false, 0, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, false, {1, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}}); wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup = utils::MakeBindGroup( wgpu::BindGroup bindGroup = utils::MakeBindGroup(
device, bindGroupLayout, device, bindGroupLayout,
@ -996,10 +997,11 @@ TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneCom
// texture. // texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout( wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device, device,
{{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture, false, false, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture, false, 0, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture, false, false, {1, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture, false, 0,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}}); false, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float,
kFormat}});
wgpu::BindGroup bindGroup = wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, bindGroupLayout, utils::MakeBindGroup(device, bindGroupLayout,
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}}); {{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});

View File

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

View File

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