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": "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"},
{"name": "min buffer binding size", "type": "uint64_t", "default": "0"}
{"name": "storage texture format", "type": "texture format", "default": "undefined"}
]
},
"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
// textureComponentType
TEST_P(ObjectCachingTest, BindGroupLayoutTextureComponentType) {
wgpu::BindGroupLayout bgl =
utils::MakeBindGroupLayout(device, {{1,
wgpu::ShaderStage::Fragment,
wgpu::BindingType::SampledTexture,
false,
false,
wgpu::TextureViewDimension::e2D,
wgpu::TextureComponentType::Float}});
wgpu::BindGroupLayout sameBgl =
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}});
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, 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::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Uint}});
EXPECT_NE(bgl.Get(), otherBgl.Get());
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
// viewDimension
TEST_P(ObjectCachingTest, BindGroupLayoutViewDimension) {
wgpu::BindGroupLayout bgl =
utils::MakeBindGroupLayout(device, {{1,
wgpu::ShaderStage::Fragment,
wgpu::BindingType::SampledTexture,
false,
false,
wgpu::TextureViewDimension::e2D,
wgpu::TextureComponentType::Float}});
wgpu::BindGroupLayout sameBgl =
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}});
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, 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::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
device, {{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2DArray, wgpu::TextureComponentType::Float}});
EXPECT_NE(bgl.Get(), otherBgl.Get());
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
TEST_F(BindGroupValidationTest, TextureComponentType) {
wgpu::BindGroupLayout layout =
utils::MakeBindGroupLayout(device, {{0,
wgpu::ShaderStage::Fragment,
wgpu::BindingType::SampledTexture,
false,
false,
wgpu::TextureViewDimension::e2D,
wgpu::TextureComponentType::Float}});
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
// Control case: setting a Float typed texture view works.
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
@ -325,14 +320,9 @@ TEST_F(BindGroupValidationTest, TextureComponentType) {
// Check that a texture must have the correct dimension
TEST_F(BindGroupValidationTest, TextureDimension) {
wgpu::BindGroupLayout layout =
utils::MakeBindGroupLayout(device, {{0,
wgpu::ShaderStage::Fragment,
wgpu::BindingType::SampledTexture,
false,
false,
wgpu::TextureViewDimension::e2D,
wgpu::TextureComponentType::Float}});
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D, wgpu::TextureComponentType::Float}});
// Control case: setting a 2D texture view works.
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
@ -770,50 +760,50 @@ TEST_F(BindGroupLayoutValidationTest, MultisampledTextures) {
// Multisampled 2D texture works.
utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true,
wgpu::TextureViewDimension::e2D},
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
true, wgpu::TextureViewDimension::e2D},
});
// Multisampled 2D (defaulted) texture works.
utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true,
wgpu::TextureViewDimension::Undefined},
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
true, wgpu::TextureViewDimension::Undefined},
});
// Multisampled 2D storage texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture,
false, true, wgpu::TextureViewDimension::e2D},
false, 0, true, wgpu::TextureViewDimension::e2D},
}));
// Multisampled 2D array texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true,
wgpu::TextureViewDimension::e2DArray},
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
true, wgpu::TextureViewDimension::e2DArray},
}));
// Multisampled cube texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true,
wgpu::TextureViewDimension::Cube},
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
true, wgpu::TextureViewDimension::Cube},
}));
// Multisampled cube array texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true,
wgpu::TextureViewDimension::CubeArray},
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
true, wgpu::TextureViewDimension::CubeArray},
}));
// Multisampled 3D texture is invalid.
ASSERT_DEVICE_ERROR(utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true,
wgpu::TextureViewDimension::e3D},
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
true, wgpu::TextureViewDimension::e3D},
}));
}
@ -822,26 +812,28 @@ TEST_F(BindGroupLayoutValidationTest, MultisampledMustBeTexture) {
// Base: Multisampled 2D texture works.
utils::MakeBindGroupLayout(
device, {
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, true,
wgpu::TextureViewDimension::e2D},
{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, true},
}));
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, true},
}));
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, true},
{0, wgpu::ShaderStage::Compute, wgpu::BindingType::Sampler, false, 0, true},
}));
}
@ -1613,28 +1605,28 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
CreateFSRenderPipeline(
kTexture2DShader,
{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}})});
// 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,
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, 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,
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, 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,
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2DArray}})}));
constexpr char kTexture2DArrayShader[] = R"(
@ -1647,28 +1639,28 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
CreateFSRenderPipeline(
kTexture2DArrayShader,
{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}})});
// 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,
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false, 0,
false, 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,
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, 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,
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::SampledTexture, false, 0,
false, wgpu::TextureViewDimension::e2D}})}));
}

View File

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

View File

@ -392,14 +392,9 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
descriptor.cFragmentStage.module = utils::CreateShaderModule(
device, utils::SingleShaderStage::Fragment, stream.str().c_str());
wgpu::BindGroupLayout bgl =
utils::MakeBindGroupLayout(device, {{0,
wgpu::ShaderStage::Fragment,
wgpu::BindingType::SampledTexture,
false,
false,
wgpu::TextureViewDimension::e2D,
kTextureComponentTypes[j]}});
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false,
0, false, wgpu::TextureViewDimension::e2D, kTextureComponentTypes[j]}});
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
if (i == j) {
@ -447,14 +442,9 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
descriptor.cFragmentStage.module = utils::CreateShaderModule(
device, utils::SingleShaderStage::Fragment, stream.str().c_str());
wgpu::BindGroupLayout bgl =
utils::MakeBindGroupLayout(device, {{0,
wgpu::ShaderStage::Fragment,
wgpu::BindingType::SampledTexture,
false,
false,
kTextureViewDimensions[j],
wgpu::TextureComponentType::Float}});
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture, false,
0, false, 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, false,
wgpu::BindingType::ReadonlyStorageTexture, false, 0, false,
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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, 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,
false, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float,
kFormat}});
0, false, 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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, 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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, 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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture,
false, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, 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,
false, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float,
kFormat}});
0, false, 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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, 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,
false, wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float,
kFormat}});
0, false, 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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, 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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroupLayout readBGL = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture,
false, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, 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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::None, wgpu::BindingType::WriteonlyStorageTexture,
false, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, 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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::None, wgpu::BindingType::WriteonlyStorageTexture,
false, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, 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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, 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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture,
false, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, 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, false,
wgpu::BindingType::ReadonlyStorageTexture, false, 0, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroupLayout writeBGL = utils::MakeBindGroupLayout(
device,
{{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::BindGroup readBG = utils::MakeBindGroup(device, readBGL, {{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::TextureViewDimension dimension : kUnsupportedTextureViewDimensions) {
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}}));
}
}
@ -838,7 +838,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, false,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, 0, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroupWithStorageTexture =
@ -871,9 +871,9 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneRender
// texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, false,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, 0, false,
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::BindGroup bindGroup = utils::MakeBindGroup(
device, bindGroupLayout,
@ -912,7 +912,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndOutputAttachmentInOneRend
// Create a bind group that contains a storage texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, false,
{{0, wgpu::ShaderStage::Fragment, storageTextureType, false, 0, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroupWithStorageTexture =
utils::MakeBindGroup(device, bindGroupLayout, {{0, storageTexture.CreateView()}});
@ -937,10 +937,11 @@ TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneRen
// texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture, false, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat},
{1, wgpu::ShaderStage::Fragment, wgpu::BindingType::WriteonlyStorageTexture, false, false,
wgpu::TextureViewDimension::Undefined, wgpu::TextureComponentType::Float, kFormat}});
{{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture, false, 0,
false, 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::BindGroup bindGroup =
utils::MakeBindGroup(device, bindGroupLayout,
{{0, storageTexture.CreateView()}, {1, storageTexture.CreateView()}});
@ -968,9 +969,9 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneComput
// texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
device,
{{0, wgpu::ShaderStage::Compute, storageTextureType, false, false,
{{0, wgpu::ShaderStage::Compute, storageTextureType, false, 0, false,
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::BindGroup bindGroup = utils::MakeBindGroup(
device, bindGroupLayout,
@ -996,10 +997,11 @@ TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneCom
// texture.
wgpu::BindGroupLayout bindGroupLayout = utils::MakeBindGroupLayout(
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},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture, false, false,
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::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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, 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, false, wgpu::TextureViewDimension::Undefined,
false, 0, false, wgpu::TextureViewDimension::Undefined,
wgpu::TextureComponentType::Float, kFormat}});
wgpu::BindGroup bindGroup1 = utils::MakeBindGroup(device, bgl1, {{0, samplerView}});

View File

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