xgpu
Version:
XGPU is an extendable library for WebGPU that provides a higher-level, easy-to-use interface for building rendering engines or processing numeric data. It handles automatic data binding, buffer alignment, variable declarations in shaders, and more. XGPU i
52 lines (51 loc) • 1.83 kB
TypeScript
/// <reference types="dist" />
import { Bindgroup } from "../Bindgroup";
import { IShaderResource } from "./IShaderResource";
export type VideoTextureDescriptor = {
source?: HTMLVideoElement;
format?: GPUTextureFormat;
usage?: GPUTextureUsageFlags;
size?: GPUExtent3D;
mipLevelCount?: GPUIntegerCoordinate;
sampleCount?: GPUSize32;
dimension?: GPUTextureDimension;
viewFormats?: GPUTextureFormat[];
defaultViewDescriptor?: any;
};
export declare class VideoTexture implements IShaderResource {
mustBeTransfered: boolean;
descriptor: VideoTextureDescriptor;
useWebcodec: boolean;
gpuResource: HTMLVideoElement;
protected bindgroups: Bindgroup[];
addBindgroup(bindgroup: Bindgroup): void;
constructor(descriptor: {
source?: HTMLVideoElement;
format?: GPUTextureFormat;
usage?: GPUTextureUsageFlags;
size?: GPUExtent3D;
mipLevelCount?: GPUIntegerCoordinate;
sampleCount?: GPUSize32;
dimension?: GPUTextureDimension;
viewFormats?: GPUTextureFormat[];
defaultViewDescriptor?: any;
});
clone(): VideoTexture;
set source(video: HTMLVideoElement);
createDeclaration(varName: string, bindingId: number, groupId?: number): string;
createBindGroupLayoutEntry(bindingId: number): {
binding: number;
visibility: number;
externalTexture: GPUExternalTextureBindingLayout;
};
createGpuResource(): void;
update(): void;
protected deviceId: number;
destroyGpuResource(): void;
private videoFrame;
createBindGroupEntry(bindingId: number): {
binding: number;
resource: GPUExternalTexture;
};
setPipelineType(pipelineType: "compute" | "render" | "compute_mixed"): void;
}