Skip to content

Commit

Permalink
Add tests on createBindGroupLayout() with new storage texture accesses (
Browse files Browse the repository at this point in the history
#3186)

* Add tests about creating bind group layouts with new storage texture accesses

* Run generate-cache

* Address reviewer's comments

* Revert "Run generate-cache"

This reverts commit 51de69c.

* generate cache

* Revert "generate cache"

This reverts commit a4de091.

* generate caches

* Revert "generate caches"

This reverts commit f0dff6e.

* Generate caches

* Update src/webgpu/api/validation/createBindGroupLayout.spec.ts

Co-authored-by: jzm-intel <[email protected]>

* Update src/webgpu/api/validation/createBindGroupLayout.spec.ts

Co-authored-by: jzm-intel <[email protected]>

* Run `npx grunt fix`

---------

Co-authored-by: jzm-intel <[email protected]>
  • Loading branch information
Jiawei-Shao and jiangzhaoming authored Nov 25, 2023
1 parent b37df1c commit 6e75f19
Show file tree
Hide file tree
Showing 110 changed files with 918 additions and 229 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@types/serve-index": "^1.9.3",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"@webgpu/types": "^0.1.38",
"@webgpu/types": "^0.1.39",
"ansi-colors": "4.1.3",
"babel-plugin-add-header-comment": "^1.0.3",
"babel-plugin-const-enum": "^1.2.0",
Expand Down
208 changes: 104 additions & 104 deletions src/resources/cache/hashes.json
Original file line number Diff line number Diff line change
@@ -1,106 +1,106 @@
{
"webgpu/shader/execution/binary/af_addition.bin": "a5da1df9",
"webgpu/shader/execution/binary/af_logical.bin": "27d915bd",
"webgpu/shader/execution/binary/af_division.bin": "a5270697",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "62f800a8",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "9183d57f",
"webgpu/shader/execution/binary/af_multiplication.bin": "865258e7",
"webgpu/shader/execution/binary/af_remainder.bin": "4c61df7e",
"webgpu/shader/execution/binary/af_subtraction.bin": "43dd47ae",
"webgpu/shader/execution/binary/f16_addition.bin": "513d71c8",
"webgpu/shader/execution/binary/f16_logical.bin": "443f9a98",
"webgpu/shader/execution/binary/f16_division.bin": "f54e29cb",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "f910cec6",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "b70ddbb2",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "62afef7a",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "29e3722d",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "f4a29ad1",
"webgpu/shader/execution/binary/f16_multiplication.bin": "9baf80a1",
"webgpu/shader/execution/binary/f16_remainder.bin": "85c74732",
"webgpu/shader/execution/binary/f16_subtraction.bin": "b06f0345",
"webgpu/shader/execution/binary/f32_addition.bin": "e0f9ce70",
"webgpu/shader/execution/binary/f32_logical.bin": "47cadba6",
"webgpu/shader/execution/binary/f32_division.bin": "7005e989",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "98e53a9",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "b5c60cda",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "522a3569",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "c19e488c",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "9af1d0c3",
"webgpu/shader/execution/binary/f32_multiplication.bin": "e59c1749",
"webgpu/shader/execution/binary/f32_remainder.bin": "f0aa263b",
"webgpu/shader/execution/binary/f32_subtraction.bin": "f4bc3081",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "e92caa13",
"webgpu/shader/execution/binary/i32_comparison.bin": "21f566be",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "4190d758",
"webgpu/shader/execution/binary/u32_comparison.bin": "91fe8844",
"webgpu/shader/execution/abs.bin": "40c39d52",
"webgpu/shader/execution/acos.bin": "9998e303",
"webgpu/shader/execution/acosh.bin": "7636c6b9",
"webgpu/shader/execution/asin.bin": "fd7059cd",
"webgpu/shader/execution/asinh.bin": "58959a2",
"webgpu/shader/execution/atan.bin": "ed0a5fe5",
"webgpu/shader/execution/atan2.bin": "bcfaa17a",
"webgpu/shader/execution/atanh.bin": "fe79d05d",
"webgpu/shader/execution/bitcast.bin": "ab8f3a85",
"webgpu/shader/execution/ceil.bin": "82690ce1",
"webgpu/shader/execution/clamp.bin": "a30a2b8e",
"webgpu/shader/execution/cos.bin": "bf80f288",
"webgpu/shader/execution/cosh.bin": "2add503b",
"webgpu/shader/execution/cross.bin": "ce546995",
"webgpu/shader/execution/degrees.bin": "af783136",
"webgpu/shader/execution/determinant.bin": "16d6108",
"webgpu/shader/execution/distance.bin": "34788cf8",
"webgpu/shader/execution/dot.bin": "5d8d3fff",
"webgpu/shader/execution/exp.bin": "e890f3d",
"webgpu/shader/execution/exp2.bin": "80f0c788",
"webgpu/shader/execution/faceForward.bin": "4cf3e04d",
"webgpu/shader/execution/floor.bin": "4d91b147",
"webgpu/shader/execution/fma.bin": "9579e337",
"webgpu/shader/execution/fract.bin": "a1372b54",
"webgpu/shader/execution/frexp.bin": "7d140601",
"webgpu/shader/execution/inverseSqrt.bin": "515fb6e3",
"webgpu/shader/execution/ldexp.bin": "826a29a8",
"webgpu/shader/execution/length.bin": "124ac33b",
"webgpu/shader/execution/log.bin": "aad3a1a8",
"webgpu/shader/execution/log2.bin": "7ef34360",
"webgpu/shader/execution/max.bin": "69a1807",
"webgpu/shader/execution/min.bin": "8dfa353d",
"webgpu/shader/execution/mix.bin": "96c9d02d",
"webgpu/shader/execution/modf.bin": "26670f53",
"webgpu/shader/execution/normalize.bin": "60571bc4",
"webgpu/shader/execution/pack2x16float.bin": "31601129",
"webgpu/shader/execution/pow.bin": "8f5de92",
"webgpu/shader/execution/quantizeToF16.bin": "9936c450",
"webgpu/shader/execution/radians.bin": "56c3610d",
"webgpu/shader/execution/reflect.bin": "61beb0cf",
"webgpu/shader/execution/refract.bin": "d0180f9b",
"webgpu/shader/execution/round.bin": "3bc78d47",
"webgpu/shader/execution/saturate.bin": "8478071d",
"webgpu/shader/execution/sign.bin": "58d75a88",
"webgpu/shader/execution/sin.bin": "b14cf00a",
"webgpu/shader/execution/sinh.bin": "a8d76c62",
"webgpu/shader/execution/smoothstep.bin": "246c76eb",
"webgpu/shader/execution/sqrt.bin": "f6c4f4c1",
"webgpu/shader/execution/step.bin": "8268c823",
"webgpu/shader/execution/tan.bin": "af3ecb02",
"webgpu/shader/execution/tanh.bin": "c22b8364",
"webgpu/shader/execution/transpose.bin": "f8663cd3",
"webgpu/shader/execution/trunc.bin": "b532e654",
"webgpu/shader/execution/unpack2x16float.bin": "67d0b480",
"webgpu/shader/execution/unpack2x16snorm.bin": "be8c0687",
"webgpu/shader/execution/unpack2x16unorm.bin": "8ef57a36",
"webgpu/shader/execution/unpack4x8snorm.bin": "a807e0f6",
"webgpu/shader/execution/unpack4x8unorm.bin": "b8ed39e8",
"webgpu/shader/execution/unary/af_arithmetic.bin": "f6181e3d",
"webgpu/shader/execution/unary/af_assignment.bin": "1da130e3",
"webgpu/shader/execution/unary/bool_conversion.bin": "166e7b55",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "576d8432",
"webgpu/shader/execution/unary/f16_conversion.bin": "187365c9",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "abfce14d",
"webgpu/shader/execution/unary/f32_conversion.bin": "69c41336",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "cca83969",
"webgpu/shader/execution/unary/i32_complement.bin": "2a173277",
"webgpu/shader/execution/unary/i32_conversion.bin": "11d03e95",
"webgpu/shader/execution/unary/u32_complement.bin": "6fce0665",
"webgpu/shader/execution/unary/u32_conversion.bin": "53c94e7b"
"webgpu/shader/execution/binary/af_addition.bin": "78c94ad8",
"webgpu/shader/execution/binary/af_logical.bin": "fa9ec211",
"webgpu/shader/execution/binary/af_division.bin": "5d6cb4be",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "207aebd0",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "1ccdc3af",
"webgpu/shader/execution/binary/af_multiplication.bin": "8a7b42df",
"webgpu/shader/execution/binary/af_remainder.bin": "5d2c6e8c",
"webgpu/shader/execution/binary/af_subtraction.bin": "c35c12b3",
"webgpu/shader/execution/binary/f16_addition.bin": "e269395b",
"webgpu/shader/execution/binary/f16_logical.bin": "bd056fdd",
"webgpu/shader/execution/binary/f16_division.bin": "63aee0a5",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "391be16b",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "57d98880",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "136c0f5f",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "16730051",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "ca591b1e",
"webgpu/shader/execution/binary/f16_multiplication.bin": "3ea00fdc",
"webgpu/shader/execution/binary/f16_remainder.bin": "9bd500da",
"webgpu/shader/execution/binary/f16_subtraction.bin": "833605e7",
"webgpu/shader/execution/binary/f32_addition.bin": "85e552cb",
"webgpu/shader/execution/binary/f32_logical.bin": "6ca238d2",
"webgpu/shader/execution/binary/f32_division.bin": "a1ef6e58",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "f68b863f",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "d55c0d78",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "2cb1e",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "83a77306",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "2a68c52",
"webgpu/shader/execution/binary/f32_multiplication.bin": "8b4452d3",
"webgpu/shader/execution/binary/f32_remainder.bin": "528d99c4",
"webgpu/shader/execution/binary/f32_subtraction.bin": "e2f72c71",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "431e0f57",
"webgpu/shader/execution/binary/i32_comparison.bin": "8517891f",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "15cec499",
"webgpu/shader/execution/binary/u32_comparison.bin": "c96a5982",
"webgpu/shader/execution/abs.bin": "d3fd65c2",
"webgpu/shader/execution/acos.bin": "5839852",
"webgpu/shader/execution/acosh.bin": "515c1629",
"webgpu/shader/execution/asin.bin": "2979db33",
"webgpu/shader/execution/asinh.bin": "884df7af",
"webgpu/shader/execution/atan.bin": "ea30536d",
"webgpu/shader/execution/atan2.bin": "a495e35a",
"webgpu/shader/execution/atanh.bin": "3920b6af",
"webgpu/shader/execution/bitcast.bin": "d3408cce",
"webgpu/shader/execution/ceil.bin": "b73e93a3",
"webgpu/shader/execution/clamp.bin": "931ba49e",
"webgpu/shader/execution/cos.bin": "8de6752",
"webgpu/shader/execution/cosh.bin": "f2ad6585",
"webgpu/shader/execution/cross.bin": "661dbc74",
"webgpu/shader/execution/degrees.bin": "613a2afc",
"webgpu/shader/execution/determinant.bin": "c3f6ebf9",
"webgpu/shader/execution/distance.bin": "a30afaad",
"webgpu/shader/execution/dot.bin": "1d5bc868",
"webgpu/shader/execution/exp.bin": "7094a6ee",
"webgpu/shader/execution/exp2.bin": "bd0da4cf",
"webgpu/shader/execution/faceForward.bin": "91757e9d",
"webgpu/shader/execution/floor.bin": "5d113e8e",
"webgpu/shader/execution/fma.bin": "6dd1e30a",
"webgpu/shader/execution/fract.bin": "5911d29a",
"webgpu/shader/execution/frexp.bin": "8a6b3d88",
"webgpu/shader/execution/inverseSqrt.bin": "c3060fd7",
"webgpu/shader/execution/ldexp.bin": "8af64f84",
"webgpu/shader/execution/length.bin": "94590226",
"webgpu/shader/execution/log.bin": "be9fbfea",
"webgpu/shader/execution/log2.bin": "67d7b594",
"webgpu/shader/execution/max.bin": "3f5dffbf",
"webgpu/shader/execution/min.bin": "909df14e",
"webgpu/shader/execution/mix.bin": "251864be",
"webgpu/shader/execution/modf.bin": "34d66497",
"webgpu/shader/execution/normalize.bin": "e4bd21a9",
"webgpu/shader/execution/pack2x16float.bin": "4de3bb3b",
"webgpu/shader/execution/pow.bin": "8da22713",
"webgpu/shader/execution/quantizeToF16.bin": "c40fe1ed",
"webgpu/shader/execution/radians.bin": "483c3033",
"webgpu/shader/execution/reflect.bin": "3a22a937",
"webgpu/shader/execution/refract.bin": "3f042dba",
"webgpu/shader/execution/round.bin": "a217f9d7",
"webgpu/shader/execution/saturate.bin": "a7c98160",
"webgpu/shader/execution/sign.bin": "8dff863c",
"webgpu/shader/execution/sin.bin": "165f57ee",
"webgpu/shader/execution/sinh.bin": "67e7427d",
"webgpu/shader/execution/smoothstep.bin": "12b9ef22",
"webgpu/shader/execution/sqrt.bin": "6f1cec1b",
"webgpu/shader/execution/step.bin": "9accf537",
"webgpu/shader/execution/tan.bin": "fa3b129a",
"webgpu/shader/execution/tanh.bin": "e189b51d",
"webgpu/shader/execution/transpose.bin": "a4fed513",
"webgpu/shader/execution/trunc.bin": "9017e528",
"webgpu/shader/execution/unpack2x16float.bin": "ec98d914",
"webgpu/shader/execution/unpack2x16snorm.bin": "a830e40e",
"webgpu/shader/execution/unpack2x16unorm.bin": "ad12839",
"webgpu/shader/execution/unpack4x8snorm.bin": "2313f18a",
"webgpu/shader/execution/unpack4x8unorm.bin": "42a3a55f",
"webgpu/shader/execution/unary/af_arithmetic.bin": "96b3c6cd",
"webgpu/shader/execution/unary/af_assignment.bin": "d57b4a12",
"webgpu/shader/execution/unary/bool_conversion.bin": "82a9a2b3",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "af2058d6",
"webgpu/shader/execution/unary/f16_conversion.bin": "f506caaf",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "12031f63",
"webgpu/shader/execution/unary/f32_conversion.bin": "6ecbbe5b",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "b7af3db9",
"webgpu/shader/execution/unary/i32_complement.bin": "10b546c7",
"webgpu/shader/execution/unary/i32_conversion.bin": "dc30bd80",
"webgpu/shader/execution/unary/u32_complement.bin": "ee0256a4",
"webgpu/shader/execution/unary/u32_conversion.bin": "c57cea18"
}
Binary file modified src/resources/cache/webgpu/shader/execution/abs.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/acos.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/acosh.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/asin.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/asinh.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/atan.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/atan2.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/atanh.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/bitcast.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/ceil.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/clamp.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/cos.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/cosh.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/cross.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/degrees.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/determinant.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/distance.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/dot.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/exp.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/exp2.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/faceForward.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/floor.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/fma.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/fract.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/frexp.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/inverseSqrt.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/ldexp.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/length.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/log.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/log2.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/max.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/min.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/mix.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/modf.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/normalize.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/pack2x16float.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/pow.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/quantizeToF16.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/radians.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/reflect.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/refract.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/round.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/saturate.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/sign.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/sin.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/sinh.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/smoothstep.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/sqrt.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/step.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/tan.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/tanh.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/transpose.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/trunc.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/unpack2x16float.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/unpack2x16snorm.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/unpack2x16unorm.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/unpack4x8snorm.bin
Binary file not shown.
Binary file modified src/resources/cache/webgpu/shader/execution/unpack4x8unorm.bin
Binary file not shown.
46 changes: 27 additions & 19 deletions src/webgpu/api/validation/createBindGroupLayout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,10 @@ g.test('visibility,VERTEX_shader_stage_storage_texture_access')
.fn(t => {
const { shaderStage, access } = t.params;

const appliedAccess = access ?? 'write-only';
const success = !(
(access ?? 'write-only') === 'write-only' && shaderStage & GPUShaderStage.VERTEX
// If visibility includes VERETX, storageTexture.access must be "read-only"
(shaderStage & GPUShaderStage.VERTEX && appliedAccess !== 'read-only')
);

t.expectValidationError(() => {
Expand All @@ -173,7 +175,7 @@ g.test('visibility,VERTEX_shader_stage_storage_texture_access')
{
binding: 0,
visibility: shaderStage,
storageTexture: { access, format: 'rgba8unorm' },
storageTexture: { access, format: 'r32uint' },
},
],
});
Expand Down Expand Up @@ -436,29 +438,35 @@ g.test('storage_texture,layout_dimension')
g.test('storage_texture,formats')
.desc(
`
Test that a validation error is generated if the format doesn't support the storage usage.
Test that a validation error is generated if the format doesn't support the storage usage. A
validation error is also generated if the format doesn't support the 'read-write' storage access
when the storage access is 'read-write'.
`
)
.params(u => u.combine('format', kAllTextureFormats))
.params(u =>
u //
.combine('format', kAllTextureFormats) //
.combine('access', kStorageTextureAccessValues)
)
.beforeAllSubcases(t => {
t.selectDeviceForTextureFormatOrSkipTestCase(t.params.format);
})
.fn(t => {
const { format } = t.params;
const { format, access } = t.params;
const info = kTextureFormatInfo[format];

t.expectValidationError(
() => {
t.device.createBindGroupLayout({
entries: [
{
binding: 0,
visibility: GPUShaderStage.COMPUTE,
storageTexture: { format },
},
],
});
},
!info.color?.storage
);
const success =
info.color?.storage && !(access === 'read-write' && !info.color?.readWriteStorage);

t.expectValidationError(() => {
t.device.createBindGroupLayout({
entries: [
{
binding: 0,
visibility: GPUShaderStage.COMPUTE,
storageTexture: { format, access },
},
],
});
}, !success);
});
2 changes: 1 addition & 1 deletion src/webgpu/capability_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ export function storageTextureBindingTypeInfo(d: GPUStorageTextureBindingLayout)
};
}
/** List of all GPUStorageTextureAccess values. */
export const kStorageTextureAccessValues = ['write-only'] as const;
export const kStorageTextureAccessValues = ['read-only', 'read-write', 'write-only'] as const;
assertTypeTrue<TypeEqual<GPUStorageTextureAccess, (typeof kStorageTextureAccessValues)[number]>>();

/** GPUBindGroupLayoutEntry, but only the "union" fields, not the common fields. */
Expand Down
Loading

0 comments on commit 6e75f19

Please sign in to comment.