我正在尝试在 WebGpu 中使用 external_texture,但遇到了错误。
localhost/:1 Destroyed texture [Texture] used in a submit.
at ValidateCanUseInSubmitNow (../../third_party/dawn/src/dawn_native/Texture.cpp:605)
at ValidateSubmit (../../third_party/dawn/src/dawn_native/Queue.cpp:395)
我创建了一个视频元素并创建了一个外部纹理:
const video = document.createElement('video');
video.loop = true;
video.autoplay = true;
video.muted = true;
video.src = '/videos/sample.webm';
await video.play();
const videoTexture = device.importExternalTexture({
source: video,
});
我像这样绑定它:
{
binding: 2,
resource: videoTexture,
},
并在我的着色器中引用它,如下所示:
[[binding(2), group(0)]] var diffuseTexture: texture_external;
...
var diffuse = textureSampleLevel(diffuseTexture, textureSampler, in.uv).xyz
我已将视频元素和 videoTexture 都存储到一个变量中,以防万一它与垃圾收集有关,但它没有帮助。我似乎做的一切都与视频上传示例 ( https://austin-eng.com/webgpu-samples/samples/videoUploading ) 中的一样,除了我的程序中还有很多事情要做。