Skip to content

Commit

Permalink
Use 'trackForCleanUp' to destroy HTMLVideoElement (gpuweb#3365)
Browse files Browse the repository at this point in the history
* Use 'trackForCleanUp' to destroy HTMLVideoElement

This PR adds HTMLVideoElement as DestroyObject type and uses
'trackForCleanUp' to reset video element source and srcObject
after case finished.

Fix:gpuweb#3364

* update cache
  • Loading branch information
shaoboyan authored Feb 5, 2024
1 parent 90b2eb7 commit e05aad5
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 109 deletions.
9 changes: 7 additions & 2 deletions src/common/framework/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export type TestParams = {
type DestroyableObject =
| { destroy(): void }
| { close(): void }
| { getExtension(extensionName: 'WEBGL_lose_context'): WEBGL_lose_context };
| { getExtension(extensionName: 'WEBGL_lose_context'): WEBGL_lose_context }
| HTMLVideoElement;

export class SubcaseBatchState {
constructor(
Expand Down Expand Up @@ -124,8 +125,12 @@ export class Fixture<S extends SubcaseBatchState = SubcaseBatchState> {
if (WEBGL_lose_context) WEBGL_lose_context.loseContext();
} else if ('destroy' in o) {
o.destroy();
} else {
} else if ('close' in o) {
o.close();
} else {
// HTMLVideoElement
o.src = '';
o.srcObject = null;
}
}
}
Expand Down
210 changes: 105 additions & 105 deletions src/resources/cache/hashes.json
Original file line number Diff line number Diff line change
@@ -1,107 +1,107 @@
{
"webgpu/shader/execution/binary/af_addition.bin": "c7c51c39",
"webgpu/shader/execution/binary/af_logical.bin": "59188363",
"webgpu/shader/execution/binary/af_division.bin": "3dceb51d",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "7dce888f",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "1bf7797",
"webgpu/shader/execution/binary/af_multiplication.bin": "5bd9db91",
"webgpu/shader/execution/binary/af_remainder.bin": "9426ee9f",
"webgpu/shader/execution/binary/af_subtraction.bin": "823576a9",
"webgpu/shader/execution/binary/f16_addition.bin": "98228b04",
"webgpu/shader/execution/binary/f16_logical.bin": "7f4e05ab",
"webgpu/shader/execution/binary/f16_division.bin": "95e60c24",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "3503e24",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "5b0b6c54",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "7c2b67cc",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "3ab51e54",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "c509829e",
"webgpu/shader/execution/binary/f16_multiplication.bin": "2cb9031c",
"webgpu/shader/execution/binary/f16_remainder.bin": "36a93ab6",
"webgpu/shader/execution/binary/f16_subtraction.bin": "5e564fad",
"webgpu/shader/execution/binary/f32_addition.bin": "6a004a96",
"webgpu/shader/execution/binary/f32_logical.bin": "29b78ff7",
"webgpu/shader/execution/binary/f32_division.bin": "f3960bd",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "b7a7252c",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "223c03dc",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "9fa0adb0",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "48fb4b77",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "9a9a8e4f",
"webgpu/shader/execution/binary/f32_multiplication.bin": "6384c269",
"webgpu/shader/execution/binary/f32_remainder.bin": "668869cd",
"webgpu/shader/execution/binary/f32_subtraction.bin": "b720a489",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "794ff384",
"webgpu/shader/execution/binary/i32_comparison.bin": "5742ecc8",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "61c3eca",
"webgpu/shader/execution/binary/u32_comparison.bin": "8b463360",
"webgpu/shader/execution/abs.bin": "84759b96",
"webgpu/shader/execution/acos.bin": "d2fecf7e",
"webgpu/shader/execution/acosh.bin": "ae49ab4a",
"webgpu/shader/execution/asin.bin": "ef8d1ee0",
"webgpu/shader/execution/asinh.bin": "3fddcdc",
"webgpu/shader/execution/atan.bin": "fa01b779",
"webgpu/shader/execution/atan2.bin": "6544e27b",
"webgpu/shader/execution/atanh.bin": "dbfcf972",
"webgpu/shader/execution/bitcast.bin": "c871c53a",
"webgpu/shader/execution/ceil.bin": "a9259b43",
"webgpu/shader/execution/clamp.bin": "1c0cdd92",
"webgpu/shader/execution/cos.bin": "d32e388f",
"webgpu/shader/execution/cosh.bin": "353519fe",
"webgpu/shader/execution/cross.bin": "e1425e59",
"webgpu/shader/execution/degrees.bin": "303cb3",
"webgpu/shader/execution/determinant.bin": "b61bbfdb",
"webgpu/shader/execution/distance.bin": "9aee4ac6",
"webgpu/shader/execution/dot.bin": "2786d688",
"webgpu/shader/execution/exp.bin": "c791dee0",
"webgpu/shader/execution/exp2.bin": "7317dc87",
"webgpu/shader/execution/faceForward.bin": "2d7ecc3d",
"webgpu/shader/execution/floor.bin": "aad85712",
"webgpu/shader/execution/fma.bin": "cc8a275d",
"webgpu/shader/execution/fract.bin": "b651c53",
"webgpu/shader/execution/frexp.bin": "63c4d7b5",
"webgpu/shader/execution/inverseSqrt.bin": "8065a8af",
"webgpu/shader/execution/ldexp.bin": "e3d5da1e",
"webgpu/shader/execution/length.bin": "c4a77d",
"webgpu/shader/execution/log.bin": "19bd1b97",
"webgpu/shader/execution/log2.bin": "750e4aef",
"webgpu/shader/execution/max.bin": "1858ef6c",
"webgpu/shader/execution/min.bin": "27604a2a",
"webgpu/shader/execution/mix.bin": "e9174bda",
"webgpu/shader/execution/modf.bin": "faeb6938",
"webgpu/shader/execution/normalize.bin": "8325262b",
"webgpu/shader/execution/pack2x16float.bin": "3eab9d7e",
"webgpu/shader/execution/pow.bin": "a95ee5d5",
"webgpu/shader/execution/quantizeToF16.bin": "87ea1db0",
"webgpu/shader/execution/radians.bin": "8900171f",
"webgpu/shader/execution/reflect.bin": "34871ff1",
"webgpu/shader/execution/refract.bin": "8afd8086",
"webgpu/shader/execution/round.bin": "1f0d895",
"webgpu/shader/execution/saturate.bin": "208f6223",
"webgpu/shader/execution/sign.bin": "5d5eef01",
"webgpu/shader/execution/sin.bin": "88673d1b",
"webgpu/shader/execution/sinh.bin": "912004c4",
"webgpu/shader/execution/smoothstep.bin": "58521adc",
"webgpu/shader/execution/sqrt.bin": "6efab59a",
"webgpu/shader/execution/step.bin": "5d6a0269",
"webgpu/shader/execution/tan.bin": "1c2ed170",
"webgpu/shader/execution/tanh.bin": "69c199a6",
"webgpu/shader/execution/transpose.bin": "298a08a6",
"webgpu/shader/execution/trunc.bin": "b7f8c151",
"webgpu/shader/execution/unpack2x16float.bin": "ea2edfa",
"webgpu/shader/execution/unpack2x16snorm.bin": "982a4f26",
"webgpu/shader/execution/unpack2x16unorm.bin": "938aa3f3",
"webgpu/shader/execution/unpack4x8snorm.bin": "38d66fd9",
"webgpu/shader/execution/unpack4x8unorm.bin": "ea69a50e",
"webgpu/shader/execution/unary/af_arithmetic.bin": "ff253208",
"webgpu/shader/execution/unary/af_assignment.bin": "9b7be51c",
"webgpu/shader/execution/unary/bool_conversion.bin": "cc9afc72",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "9d141077",
"webgpu/shader/execution/unary/f16_conversion.bin": "411d49cb",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "cfbaceaf",
"webgpu/shader/execution/unary/f32_conversion.bin": "1e5cb1a7",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "a10a7f07",
"webgpu/shader/execution/unary/i32_complement.bin": "4a7fabe2",
"webgpu/shader/execution/unary/i32_conversion.bin": "46a36b14",
"webgpu/shader/execution/unary/u32_complement.bin": "efe3fec7",
"webgpu/shader/execution/unary/u32_conversion.bin": "afebfab2",
"webgpu/shader/execution/unary/ai_assignment.bin": "dd599f63"
"webgpu/shader/execution/binary/af_addition.bin": "9755be26",
"webgpu/shader/execution/binary/af_logical.bin": "1dee20d1",
"webgpu/shader/execution/binary/af_division.bin": "2c0ece2c",
"webgpu/shader/execution/binary/af_matrix_addition.bin": "90b4218a",
"webgpu/shader/execution/binary/af_matrix_subtraction.bin": "dc3be66b",
"webgpu/shader/execution/binary/af_multiplication.bin": "3ed2d0cd",
"webgpu/shader/execution/binary/af_remainder.bin": "432a22fc",
"webgpu/shader/execution/binary/af_subtraction.bin": "51cd965a",
"webgpu/shader/execution/binary/f16_addition.bin": "6c4661ac",
"webgpu/shader/execution/binary/f16_logical.bin": "aabe0f6",
"webgpu/shader/execution/binary/f16_division.bin": "49799d6e",
"webgpu/shader/execution/binary/f16_matrix_addition.bin": "a33291ac",
"webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin": "706c8614",
"webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin": "92d2a48e",
"webgpu/shader/execution/binary/f16_matrix_subtraction.bin": "9ad06094",
"webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin": "b29b9af1",
"webgpu/shader/execution/binary/f16_multiplication.bin": "241efe28",
"webgpu/shader/execution/binary/f16_remainder.bin": "55174180",
"webgpu/shader/execution/binary/f16_subtraction.bin": "8c7e2afb",
"webgpu/shader/execution/binary/f32_addition.bin": "e379f168",
"webgpu/shader/execution/binary/f32_logical.bin": "b6486329",
"webgpu/shader/execution/binary/f32_division.bin": "906311cf",
"webgpu/shader/execution/binary/f32_matrix_addition.bin": "a3bba0eb",
"webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin": "87f0606d",
"webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin": "dfa59308",
"webgpu/shader/execution/binary/f32_matrix_subtraction.bin": "6cfa7d3",
"webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin": "405f43da",
"webgpu/shader/execution/binary/f32_multiplication.bin": "a25a787f",
"webgpu/shader/execution/binary/f32_remainder.bin": "1678d0f3",
"webgpu/shader/execution/binary/f32_subtraction.bin": "eae9a902",
"webgpu/shader/execution/binary/i32_arithmetic.bin": "bbd740a1",
"webgpu/shader/execution/binary/i32_comparison.bin": "7e902d26",
"webgpu/shader/execution/binary/u32_arithmetic.bin": "1c5583d5",
"webgpu/shader/execution/binary/u32_comparison.bin": "33be7f31",
"webgpu/shader/execution/abs.bin": "c867fb38",
"webgpu/shader/execution/acos.bin": "be19d623",
"webgpu/shader/execution/acosh.bin": "d3649d20",
"webgpu/shader/execution/asin.bin": "3d2695b0",
"webgpu/shader/execution/asinh.bin": "559040d5",
"webgpu/shader/execution/atan.bin": "582f39ca",
"webgpu/shader/execution/atan2.bin": "46e24d4",
"webgpu/shader/execution/atanh.bin": "1af4af2",
"webgpu/shader/execution/bitcast.bin": "df71d701",
"webgpu/shader/execution/ceil.bin": "845cf1e6",
"webgpu/shader/execution/clamp.bin": "a053e15",
"webgpu/shader/execution/cos.bin": "dce44ab3",
"webgpu/shader/execution/cosh.bin": "56c5a4e4",
"webgpu/shader/execution/cross.bin": "98c00b9f",
"webgpu/shader/execution/degrees.bin": "92019849",
"webgpu/shader/execution/determinant.bin": "f4af66e6",
"webgpu/shader/execution/distance.bin": "9e50adac",
"webgpu/shader/execution/dot.bin": "3e5525a1",
"webgpu/shader/execution/exp.bin": "4c065c76",
"webgpu/shader/execution/exp2.bin": "adcd3a21",
"webgpu/shader/execution/faceForward.bin": "8a8d8685",
"webgpu/shader/execution/floor.bin": "d9873745",
"webgpu/shader/execution/fma.bin": "8b1f2abc",
"webgpu/shader/execution/fract.bin": "8e151885",
"webgpu/shader/execution/frexp.bin": "d6571dbe",
"webgpu/shader/execution/inverseSqrt.bin": "132ab36d",
"webgpu/shader/execution/ldexp.bin": "9827613d",
"webgpu/shader/execution/length.bin": "37e2a162",
"webgpu/shader/execution/log.bin": "71332cd1",
"webgpu/shader/execution/log2.bin": "e580764f",
"webgpu/shader/execution/max.bin": "ead9520e",
"webgpu/shader/execution/min.bin": "149badb",
"webgpu/shader/execution/mix.bin": "a0b58a6c",
"webgpu/shader/execution/modf.bin": "278afe21",
"webgpu/shader/execution/normalize.bin": "227413d0",
"webgpu/shader/execution/pack2x16float.bin": "3404ec6f",
"webgpu/shader/execution/pow.bin": "3824b6dd",
"webgpu/shader/execution/quantizeToF16.bin": "501b2013",
"webgpu/shader/execution/radians.bin": "c214442d",
"webgpu/shader/execution/reflect.bin": "1f3ec378",
"webgpu/shader/execution/refract.bin": "11d0ef06",
"webgpu/shader/execution/round.bin": "f981d400",
"webgpu/shader/execution/saturate.bin": "a6bbe93e",
"webgpu/shader/execution/sign.bin": "4a2a514f",
"webgpu/shader/execution/sin.bin": "ff70ba59",
"webgpu/shader/execution/sinh.bin": "c0302fb0",
"webgpu/shader/execution/smoothstep.bin": "e88285f6",
"webgpu/shader/execution/sqrt.bin": "115a6f54",
"webgpu/shader/execution/step.bin": "d5c0a1b7",
"webgpu/shader/execution/tan.bin": "9d80cd2e",
"webgpu/shader/execution/tanh.bin": "6d7f7ecc",
"webgpu/shader/execution/transpose.bin": "d346d8e5",
"webgpu/shader/execution/trunc.bin": "977370bf",
"webgpu/shader/execution/unpack2x16float.bin": "4699bafc",
"webgpu/shader/execution/unpack2x16snorm.bin": "7f9df5a0",
"webgpu/shader/execution/unpack2x16unorm.bin": "51e232a6",
"webgpu/shader/execution/unpack4x8snorm.bin": "d887142a",
"webgpu/shader/execution/unpack4x8unorm.bin": "fa243574",
"webgpu/shader/execution/unary/af_arithmetic.bin": "e3ff7a88",
"webgpu/shader/execution/unary/af_assignment.bin": "6a791651",
"webgpu/shader/execution/unary/bool_conversion.bin": "a5de0db4",
"webgpu/shader/execution/unary/f16_arithmetic.bin": "a009769f",
"webgpu/shader/execution/unary/f16_conversion.bin": "9c5d7ce0",
"webgpu/shader/execution/unary/f32_arithmetic.bin": "e0aff9c",
"webgpu/shader/execution/unary/f32_conversion.bin": "86c3571d",
"webgpu/shader/execution/unary/i32_arithmetic.bin": "b3588ea6",
"webgpu/shader/execution/unary/i32_complement.bin": "93221538",
"webgpu/shader/execution/unary/i32_conversion.bin": "ed1d110",
"webgpu/shader/execution/unary/u32_complement.bin": "cf4b466a",
"webgpu/shader/execution/unary/u32_conversion.bin": "d6d0d40d",
"webgpu/shader/execution/unary/ai_assignment.bin": "9ca8ad4a"
}
Binary file modified src/resources/cache/webgpu/shader/execution/bitcast.bin
Binary file not shown.
4 changes: 2 additions & 2 deletions src/webgpu/web_platform/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,6 @@ export function startPlayingAndWaitForVideo(
try {
await callback();
resolve();
video.src = '';
video.srcObject = null;
} catch (ex) {
reject(ex);
}
Expand Down Expand Up @@ -514,6 +512,8 @@ export function getVideoElement(t: GPUTest, videoName: VideoName): HTMLVideoElem
const videoUrl = getResourcePath(videoName);
videoElement.src = videoUrl;

t.trackForCleanup(videoElement);

return videoElement;
}

Expand Down

0 comments on commit e05aad5

Please sign in to comment.