Skip to content

Commit a7bec12

Browse files
author
Yang Gu
authored
webgpu: Enable importExternalTexture (#7976)
BUG * webgpu: Enable importExternalTexture Issues related to importExternalTexture were fixed in Chrome, so that we may enable this feature by default again. Note that its Linux implementation still has problem, and WebGPU support on Linux hasn't been officially released yet. Bug #7972 * Fix the test case though it's not enabled
1 parent b229842 commit a7bec12

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

tfjs-backend-webgpu/src/from_pixels_webgpu_test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ describeWebGPU('fromPixels', () => {
5050
document.body.appendChild(video);
5151
await test_util.play(video);
5252

53-
// importExternalTexture is temporarily disabled
5453
{
5554
tf.env().set('WEBGPU_IMPORT_EXTERNAL_TEXTURE', true);
5655
const res = tf.browser.fromPixels(video);
@@ -59,7 +58,7 @@ describeWebGPU('fromPixels', () => {
5958
expect(data.length).toEqual(90 * 160 * 3);
6059
const freeTexturesAfterFromPixels =
6160
textureManager.getNumFreeTextures();
62-
expect(freeTexturesAfterFromPixels).toEqual(1);
61+
expect(freeTexturesAfterFromPixels).toEqual(0);
6362
const usedTexturesAfterFromPixels =
6463
textureManager.getNumUsedTextures();
6564
expect(usedTexturesAfterFromPixels).toEqual(0);

tfjs-backend-webgpu/src/kernels/FromPixels.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,8 @@ export function fromPixels(args: {
6363
[pixels.width, pixels.height];
6464
const outputShape = [height, width, numChannels];
6565

66-
// Disable importExternalTexture temporarily as it has problem in spec and
67-
// browser impl
6866
const importVideo =
69-
false && env().getBool('WEBGPU_IMPORT_EXTERNAL_TEXTURE') && isVideo;
67+
env().getBool('WEBGPU_IMPORT_EXTERNAL_TEXTURE') && isVideo;
7068
const isVideoOrImage = isVideo || isImage;
7169
if (isImageBitmap || isCanvas || isVideoOrImage) {
7270
let resource;

0 commit comments

Comments
 (0)