pixi.js
Version:
<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">
29 lines (26 loc) • 757 B
JavaScript
;
;
const gpuUploadBufferImageResource = {
type: "image",
upload(source, gpuTexture, gpu) {
const resource = source.resource;
const total = (source.pixelWidth | 0) * (source.pixelHeight | 0);
const bytesPerPixel = resource.byteLength / total;
gpu.device.queue.writeTexture(
{ texture: gpuTexture },
resource,
{
offset: 0,
rowsPerImage: source.pixelHeight,
bytesPerRow: source.pixelHeight * bytesPerPixel
},
{
width: source.pixelWidth,
height: source.pixelHeight,
depthOrArrayLayers: 1
}
);
}
};
exports.gpuUploadBufferImageResource = gpuUploadBufferImageResource;
//# sourceMappingURL=gpuUploadBufferImageResource.js.map