/
githubmirror
/
pixijs
Обзор
Документация
Войти
/
githubmirror
/
pixijs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
src/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.ts
33 строки
1 KB
Krzysztof Sternik
feat: Canvas renderer (#11815)
03 фев 2026, 18:43
Не верифицирован
03 фев 2026, 18:43
c52309f
Код
Авторство
О чём код?
import type { BufferImageSource } from '../../../shared/texture/sources/BufferImageSource'; import type { GPU } from '../../GpuDeviceSystem'; import type { GpuTextureUploader } from './GpuTextureUploader'; /** @internal */ export const gpuUploadBufferImageResource = { type: 'image', upload(source: BufferImageSource, gpuTexture: GPUTexture, gpu: GPU, originZOverride = 0) { const resource = source.resource; const total = (source.pixelWidth | 0) * (source.pixelHeight | 0); const bytesPerPixel = resource.byteLength / total; gpu.device.queue.writeTexture( { texture: gpuTexture, origin: { x: 0, y: 0, z: originZOverride } }, resource as ArrayBuffer, { offset: 0, rowsPerImage: source.pixelHeight, bytesPerRow: source.pixelWidth * bytesPerPixel, }, { width: source.pixelWidth, height: source.pixelHeight, depthOrArrayLayers: 1, } ); } } as GpuTextureUploader<BufferImageSource>;