sdfsdfs
This commit is contained in:
59
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/GpuTextureSystem.d.ts
generated
vendored
Normal file
59
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/GpuTextureSystem.d.ts
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/// <reference types="@webgpu/types" />
|
||||
import { ExtensionType } from '../../../../extensions/Extensions';
|
||||
import { BindGroup } from '../shader/BindGroup';
|
||||
import type { ICanvas } from '../../../../environment/canvas/ICanvas';
|
||||
import type { System } from '../../shared/system/System';
|
||||
import type { CanvasGenerator, GetPixelsOutput } from '../../shared/texture/GenerateCanvas';
|
||||
import type { TextureSource } from '../../shared/texture/sources/TextureSource';
|
||||
import type { BindableTexture, Texture } from '../../shared/texture/Texture';
|
||||
import type { TextureStyle } from '../../shared/texture/TextureStyle';
|
||||
import type { GPU } from '../GpuDeviceSystem';
|
||||
import type { WebGPURenderer } from '../WebGPURenderer';
|
||||
/**
|
||||
* The system that handles textures for the GPU.
|
||||
* @memberof rendering
|
||||
*/
|
||||
export declare class GpuTextureSystem implements System, CanvasGenerator {
|
||||
/** @ignore */
|
||||
static extension: {
|
||||
readonly type: readonly [ExtensionType.WebGPUSystem];
|
||||
readonly name: "texture";
|
||||
};
|
||||
readonly managedTextures: TextureSource[];
|
||||
protected CONTEXT_UID: number;
|
||||
private _gpuSources;
|
||||
private _gpuSamplers;
|
||||
private _bindGroupHash;
|
||||
private _textureViewHash;
|
||||
private readonly _uploads;
|
||||
private _gpu;
|
||||
private _mipmapGenerator?;
|
||||
private readonly _renderer;
|
||||
constructor(renderer: WebGPURenderer);
|
||||
protected contextChange(gpu: GPU): void;
|
||||
initSource(source: TextureSource): GPUTexture;
|
||||
protected onSourceUpdate(source: TextureSource): void;
|
||||
protected onSourceUnload(source: TextureSource): void;
|
||||
protected onUpdateMipmaps(source: TextureSource): void;
|
||||
protected onSourceDestroy(source: TextureSource): void;
|
||||
protected onSourceResize(source: TextureSource): void;
|
||||
private _initSampler;
|
||||
getGpuSampler(sampler: TextureStyle): GPUSampler;
|
||||
getGpuSource(source: TextureSource): GPUTexture;
|
||||
/**
|
||||
* this returns s bind group for a specific texture, the bind group contains
|
||||
* - the texture source
|
||||
* - the texture style
|
||||
* - the texture matrix
|
||||
* This is cached so the bind group should only be created once per texture
|
||||
* @param texture - the texture you want the bindgroup for
|
||||
* @returns the bind group for the texture
|
||||
*/
|
||||
getTextureBindGroup(texture: Texture): BindGroup;
|
||||
private _createTextureBindGroup;
|
||||
getTextureView(texture: BindableTexture): GPUTextureView;
|
||||
private _createTextureView;
|
||||
generateCanvas(texture: Texture): ICanvas;
|
||||
getPixels(texture: Texture): GetPixelsOutput;
|
||||
destroy(): void;
|
||||
}
|
220
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/GpuTextureSystem.js
generated
vendored
Normal file
220
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/GpuTextureSystem.js
generated
vendored
Normal file
@@ -0,0 +1,220 @@
|
||||
'use strict';
|
||||
|
||||
var adapter = require('../../../../environment/adapter.js');
|
||||
var Extensions = require('../../../../extensions/Extensions.js');
|
||||
var UniformGroup = require('../../shared/shader/UniformGroup.js');
|
||||
var CanvasPool = require('../../shared/texture/CanvasPool.js');
|
||||
var BindGroup = require('../shader/BindGroup.js');
|
||||
var gpuUploadBufferImageResource = require('./uploaders/gpuUploadBufferImageResource.js');
|
||||
var gpuUploadCompressedTextureResource = require('./uploaders/gpuUploadCompressedTextureResource.js');
|
||||
var gpuUploadImageSource = require('./uploaders/gpuUploadImageSource.js');
|
||||
var gpuUploadVideoSource = require('./uploaders/gpuUploadVideoSource.js');
|
||||
var GpuMipmapGenerator = require('./utils/GpuMipmapGenerator.js');
|
||||
|
||||
"use strict";
|
||||
class GpuTextureSystem {
|
||||
constructor(renderer) {
|
||||
this.managedTextures = [];
|
||||
this._gpuSources = /* @__PURE__ */ Object.create(null);
|
||||
this._gpuSamplers = /* @__PURE__ */ Object.create(null);
|
||||
this._bindGroupHash = /* @__PURE__ */ Object.create(null);
|
||||
this._textureViewHash = /* @__PURE__ */ Object.create(null);
|
||||
this._uploads = {
|
||||
image: gpuUploadImageSource.gpuUploadImageResource,
|
||||
buffer: gpuUploadBufferImageResource.gpuUploadBufferImageResource,
|
||||
video: gpuUploadVideoSource.gpuUploadVideoResource,
|
||||
compressed: gpuUploadCompressedTextureResource.gpuUploadCompressedTextureResource
|
||||
};
|
||||
this._renderer = renderer;
|
||||
}
|
||||
contextChange(gpu) {
|
||||
this._gpu = gpu;
|
||||
}
|
||||
initSource(source) {
|
||||
if (source.autoGenerateMipmaps) {
|
||||
const biggestDimension = Math.max(source.pixelWidth, source.pixelHeight);
|
||||
source.mipLevelCount = Math.floor(Math.log2(biggestDimension)) + 1;
|
||||
}
|
||||
let usage = GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST;
|
||||
if (source.uploadMethodId !== "compressed") {
|
||||
usage |= GPUTextureUsage.RENDER_ATTACHMENT;
|
||||
usage |= GPUTextureUsage.COPY_SRC;
|
||||
}
|
||||
const blockData = gpuUploadCompressedTextureResource.blockDataMap[source.format] || { blockBytes: 4, blockWidth: 1, blockHeight: 1 };
|
||||
const width = Math.ceil(source.pixelWidth / blockData.blockWidth) * blockData.blockWidth;
|
||||
const height = Math.ceil(source.pixelHeight / blockData.blockHeight) * blockData.blockHeight;
|
||||
const textureDescriptor = {
|
||||
label: source.label,
|
||||
size: { width, height },
|
||||
format: source.format,
|
||||
sampleCount: source.sampleCount,
|
||||
mipLevelCount: source.mipLevelCount,
|
||||
dimension: source.dimension,
|
||||
usage
|
||||
};
|
||||
const gpuTexture = this._gpu.device.createTexture(textureDescriptor);
|
||||
this._gpuSources[source.uid] = gpuTexture;
|
||||
if (!this.managedTextures.includes(source)) {
|
||||
source.on("update", this.onSourceUpdate, this);
|
||||
source.on("resize", this.onSourceResize, this);
|
||||
source.on("destroy", this.onSourceDestroy, this);
|
||||
source.on("unload", this.onSourceUnload, this);
|
||||
source.on("updateMipmaps", this.onUpdateMipmaps, this);
|
||||
this.managedTextures.push(source);
|
||||
}
|
||||
this.onSourceUpdate(source);
|
||||
return gpuTexture;
|
||||
}
|
||||
onSourceUpdate(source) {
|
||||
const gpuTexture = this.getGpuSource(source);
|
||||
if (!gpuTexture)
|
||||
return;
|
||||
if (this._uploads[source.uploadMethodId]) {
|
||||
this._uploads[source.uploadMethodId].upload(source, gpuTexture, this._gpu);
|
||||
}
|
||||
if (source.autoGenerateMipmaps && source.mipLevelCount > 1) {
|
||||
this.onUpdateMipmaps(source);
|
||||
}
|
||||
}
|
||||
onSourceUnload(source) {
|
||||
const gpuTexture = this._gpuSources[source.uid];
|
||||
if (gpuTexture) {
|
||||
this._gpuSources[source.uid] = null;
|
||||
gpuTexture.destroy();
|
||||
}
|
||||
}
|
||||
onUpdateMipmaps(source) {
|
||||
if (!this._mipmapGenerator) {
|
||||
this._mipmapGenerator = new GpuMipmapGenerator.GpuMipmapGenerator(this._gpu.device);
|
||||
}
|
||||
const gpuTexture = this.getGpuSource(source);
|
||||
this._mipmapGenerator.generateMipmap(gpuTexture);
|
||||
}
|
||||
onSourceDestroy(source) {
|
||||
source.off("update", this.onSourceUpdate, this);
|
||||
source.off("unload", this.onSourceUnload, this);
|
||||
source.off("destroy", this.onSourceDestroy, this);
|
||||
source.off("resize", this.onSourceResize, this);
|
||||
source.off("updateMipmaps", this.onUpdateMipmaps, this);
|
||||
this.managedTextures.splice(this.managedTextures.indexOf(source), 1);
|
||||
this.onSourceUnload(source);
|
||||
}
|
||||
onSourceResize(source) {
|
||||
const gpuTexture = this._gpuSources[source.uid];
|
||||
if (!gpuTexture) {
|
||||
this.initSource(source);
|
||||
} else if (gpuTexture.width !== source.pixelWidth || gpuTexture.height !== source.pixelHeight) {
|
||||
this._textureViewHash[source.uid] = null;
|
||||
this._bindGroupHash[source.uid] = null;
|
||||
this.onSourceUnload(source);
|
||||
this.initSource(source);
|
||||
}
|
||||
}
|
||||
_initSampler(sampler) {
|
||||
this._gpuSamplers[sampler._resourceId] = this._gpu.device.createSampler(sampler);
|
||||
return this._gpuSamplers[sampler._resourceId];
|
||||
}
|
||||
getGpuSampler(sampler) {
|
||||
return this._gpuSamplers[sampler._resourceId] || this._initSampler(sampler);
|
||||
}
|
||||
getGpuSource(source) {
|
||||
return this._gpuSources[source.uid] || this.initSource(source);
|
||||
}
|
||||
/**
|
||||
* this returns s bind group for a specific texture, the bind group contains
|
||||
* - the texture source
|
||||
* - the texture style
|
||||
* - the texture matrix
|
||||
* This is cached so the bind group should only be created once per texture
|
||||
* @param texture - the texture you want the bindgroup for
|
||||
* @returns the bind group for the texture
|
||||
*/
|
||||
getTextureBindGroup(texture) {
|
||||
return this._bindGroupHash[texture.uid] ?? this._createTextureBindGroup(texture);
|
||||
}
|
||||
_createTextureBindGroup(texture) {
|
||||
const source = texture.source;
|
||||
this._bindGroupHash[texture.uid] = new BindGroup.BindGroup({
|
||||
0: source,
|
||||
1: source.style,
|
||||
2: new UniformGroup.UniformGroup({
|
||||
uTextureMatrix: { type: "mat3x3<f32>", value: texture.textureMatrix.mapCoord }
|
||||
})
|
||||
});
|
||||
return this._bindGroupHash[texture.uid];
|
||||
}
|
||||
getTextureView(texture) {
|
||||
const source = texture.source;
|
||||
return this._textureViewHash[source.uid] ?? this._createTextureView(source);
|
||||
}
|
||||
_createTextureView(texture) {
|
||||
this._textureViewHash[texture.uid] = this.getGpuSource(texture).createView();
|
||||
return this._textureViewHash[texture.uid];
|
||||
}
|
||||
generateCanvas(texture) {
|
||||
const renderer = this._renderer;
|
||||
const commandEncoder = renderer.gpu.device.createCommandEncoder();
|
||||
const canvas = adapter.DOMAdapter.get().createCanvas();
|
||||
canvas.width = texture.source.pixelWidth;
|
||||
canvas.height = texture.source.pixelHeight;
|
||||
const context = canvas.getContext("webgpu");
|
||||
context.configure({
|
||||
device: renderer.gpu.device,
|
||||
// eslint-disable-next-line max-len
|
||||
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC,
|
||||
format: adapter.DOMAdapter.get().getNavigator().gpu.getPreferredCanvasFormat(),
|
||||
alphaMode: "premultiplied"
|
||||
});
|
||||
commandEncoder.copyTextureToTexture({
|
||||
texture: renderer.texture.getGpuSource(texture.source),
|
||||
origin: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
}, {
|
||||
texture: context.getCurrentTexture()
|
||||
}, {
|
||||
width: canvas.width,
|
||||
height: canvas.height
|
||||
});
|
||||
renderer.gpu.device.queue.submit([commandEncoder.finish()]);
|
||||
return canvas;
|
||||
}
|
||||
getPixels(texture) {
|
||||
const webGPUCanvas = this.generateCanvas(texture);
|
||||
const canvasAndContext = CanvasPool.CanvasPool.getOptimalCanvasAndContext(webGPUCanvas.width, webGPUCanvas.height);
|
||||
const context = canvasAndContext.context;
|
||||
context.drawImage(webGPUCanvas, 0, 0);
|
||||
const { width, height } = webGPUCanvas;
|
||||
const imageData = context.getImageData(0, 0, width, height);
|
||||
const pixels = new Uint8ClampedArray(imageData.data.buffer);
|
||||
CanvasPool.CanvasPool.returnCanvasAndContext(canvasAndContext);
|
||||
return { pixels, width, height };
|
||||
}
|
||||
destroy() {
|
||||
this.managedTextures.slice().forEach((source) => this.onSourceDestroy(source));
|
||||
this.managedTextures = null;
|
||||
for (const k of Object.keys(this._bindGroupHash)) {
|
||||
const key = Number(k);
|
||||
const bindGroup = this._bindGroupHash[key];
|
||||
bindGroup?.destroy();
|
||||
this._bindGroupHash[key] = null;
|
||||
}
|
||||
this._gpu = null;
|
||||
this._mipmapGenerator = null;
|
||||
this._gpuSources = null;
|
||||
this._bindGroupHash = null;
|
||||
this._textureViewHash = null;
|
||||
this._gpuSamplers = null;
|
||||
}
|
||||
}
|
||||
/** @ignore */
|
||||
GpuTextureSystem.extension = {
|
||||
type: [
|
||||
Extensions.ExtensionType.WebGPUSystem
|
||||
],
|
||||
name: "texture"
|
||||
};
|
||||
|
||||
exports.GpuTextureSystem = GpuTextureSystem;
|
||||
//# sourceMappingURL=GpuTextureSystem.js.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/GpuTextureSystem.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/GpuTextureSystem.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
218
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/GpuTextureSystem.mjs
generated
vendored
Normal file
218
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/GpuTextureSystem.mjs
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
import { DOMAdapter } from '../../../../environment/adapter.mjs';
|
||||
import { ExtensionType } from '../../../../extensions/Extensions.mjs';
|
||||
import { UniformGroup } from '../../shared/shader/UniformGroup.mjs';
|
||||
import { CanvasPool } from '../../shared/texture/CanvasPool.mjs';
|
||||
import { BindGroup } from '../shader/BindGroup.mjs';
|
||||
import { gpuUploadBufferImageResource } from './uploaders/gpuUploadBufferImageResource.mjs';
|
||||
import { gpuUploadCompressedTextureResource, blockDataMap } from './uploaders/gpuUploadCompressedTextureResource.mjs';
|
||||
import { gpuUploadImageResource } from './uploaders/gpuUploadImageSource.mjs';
|
||||
import { gpuUploadVideoResource } from './uploaders/gpuUploadVideoSource.mjs';
|
||||
import { GpuMipmapGenerator } from './utils/GpuMipmapGenerator.mjs';
|
||||
|
||||
"use strict";
|
||||
class GpuTextureSystem {
|
||||
constructor(renderer) {
|
||||
this.managedTextures = [];
|
||||
this._gpuSources = /* @__PURE__ */ Object.create(null);
|
||||
this._gpuSamplers = /* @__PURE__ */ Object.create(null);
|
||||
this._bindGroupHash = /* @__PURE__ */ Object.create(null);
|
||||
this._textureViewHash = /* @__PURE__ */ Object.create(null);
|
||||
this._uploads = {
|
||||
image: gpuUploadImageResource,
|
||||
buffer: gpuUploadBufferImageResource,
|
||||
video: gpuUploadVideoResource,
|
||||
compressed: gpuUploadCompressedTextureResource
|
||||
};
|
||||
this._renderer = renderer;
|
||||
}
|
||||
contextChange(gpu) {
|
||||
this._gpu = gpu;
|
||||
}
|
||||
initSource(source) {
|
||||
if (source.autoGenerateMipmaps) {
|
||||
const biggestDimension = Math.max(source.pixelWidth, source.pixelHeight);
|
||||
source.mipLevelCount = Math.floor(Math.log2(biggestDimension)) + 1;
|
||||
}
|
||||
let usage = GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST;
|
||||
if (source.uploadMethodId !== "compressed") {
|
||||
usage |= GPUTextureUsage.RENDER_ATTACHMENT;
|
||||
usage |= GPUTextureUsage.COPY_SRC;
|
||||
}
|
||||
const blockData = blockDataMap[source.format] || { blockBytes: 4, blockWidth: 1, blockHeight: 1 };
|
||||
const width = Math.ceil(source.pixelWidth / blockData.blockWidth) * blockData.blockWidth;
|
||||
const height = Math.ceil(source.pixelHeight / blockData.blockHeight) * blockData.blockHeight;
|
||||
const textureDescriptor = {
|
||||
label: source.label,
|
||||
size: { width, height },
|
||||
format: source.format,
|
||||
sampleCount: source.sampleCount,
|
||||
mipLevelCount: source.mipLevelCount,
|
||||
dimension: source.dimension,
|
||||
usage
|
||||
};
|
||||
const gpuTexture = this._gpu.device.createTexture(textureDescriptor);
|
||||
this._gpuSources[source.uid] = gpuTexture;
|
||||
if (!this.managedTextures.includes(source)) {
|
||||
source.on("update", this.onSourceUpdate, this);
|
||||
source.on("resize", this.onSourceResize, this);
|
||||
source.on("destroy", this.onSourceDestroy, this);
|
||||
source.on("unload", this.onSourceUnload, this);
|
||||
source.on("updateMipmaps", this.onUpdateMipmaps, this);
|
||||
this.managedTextures.push(source);
|
||||
}
|
||||
this.onSourceUpdate(source);
|
||||
return gpuTexture;
|
||||
}
|
||||
onSourceUpdate(source) {
|
||||
const gpuTexture = this.getGpuSource(source);
|
||||
if (!gpuTexture)
|
||||
return;
|
||||
if (this._uploads[source.uploadMethodId]) {
|
||||
this._uploads[source.uploadMethodId].upload(source, gpuTexture, this._gpu);
|
||||
}
|
||||
if (source.autoGenerateMipmaps && source.mipLevelCount > 1) {
|
||||
this.onUpdateMipmaps(source);
|
||||
}
|
||||
}
|
||||
onSourceUnload(source) {
|
||||
const gpuTexture = this._gpuSources[source.uid];
|
||||
if (gpuTexture) {
|
||||
this._gpuSources[source.uid] = null;
|
||||
gpuTexture.destroy();
|
||||
}
|
||||
}
|
||||
onUpdateMipmaps(source) {
|
||||
if (!this._mipmapGenerator) {
|
||||
this._mipmapGenerator = new GpuMipmapGenerator(this._gpu.device);
|
||||
}
|
||||
const gpuTexture = this.getGpuSource(source);
|
||||
this._mipmapGenerator.generateMipmap(gpuTexture);
|
||||
}
|
||||
onSourceDestroy(source) {
|
||||
source.off("update", this.onSourceUpdate, this);
|
||||
source.off("unload", this.onSourceUnload, this);
|
||||
source.off("destroy", this.onSourceDestroy, this);
|
||||
source.off("resize", this.onSourceResize, this);
|
||||
source.off("updateMipmaps", this.onUpdateMipmaps, this);
|
||||
this.managedTextures.splice(this.managedTextures.indexOf(source), 1);
|
||||
this.onSourceUnload(source);
|
||||
}
|
||||
onSourceResize(source) {
|
||||
const gpuTexture = this._gpuSources[source.uid];
|
||||
if (!gpuTexture) {
|
||||
this.initSource(source);
|
||||
} else if (gpuTexture.width !== source.pixelWidth || gpuTexture.height !== source.pixelHeight) {
|
||||
this._textureViewHash[source.uid] = null;
|
||||
this._bindGroupHash[source.uid] = null;
|
||||
this.onSourceUnload(source);
|
||||
this.initSource(source);
|
||||
}
|
||||
}
|
||||
_initSampler(sampler) {
|
||||
this._gpuSamplers[sampler._resourceId] = this._gpu.device.createSampler(sampler);
|
||||
return this._gpuSamplers[sampler._resourceId];
|
||||
}
|
||||
getGpuSampler(sampler) {
|
||||
return this._gpuSamplers[sampler._resourceId] || this._initSampler(sampler);
|
||||
}
|
||||
getGpuSource(source) {
|
||||
return this._gpuSources[source.uid] || this.initSource(source);
|
||||
}
|
||||
/**
|
||||
* this returns s bind group for a specific texture, the bind group contains
|
||||
* - the texture source
|
||||
* - the texture style
|
||||
* - the texture matrix
|
||||
* This is cached so the bind group should only be created once per texture
|
||||
* @param texture - the texture you want the bindgroup for
|
||||
* @returns the bind group for the texture
|
||||
*/
|
||||
getTextureBindGroup(texture) {
|
||||
return this._bindGroupHash[texture.uid] ?? this._createTextureBindGroup(texture);
|
||||
}
|
||||
_createTextureBindGroup(texture) {
|
||||
const source = texture.source;
|
||||
this._bindGroupHash[texture.uid] = new BindGroup({
|
||||
0: source,
|
||||
1: source.style,
|
||||
2: new UniformGroup({
|
||||
uTextureMatrix: { type: "mat3x3<f32>", value: texture.textureMatrix.mapCoord }
|
||||
})
|
||||
});
|
||||
return this._bindGroupHash[texture.uid];
|
||||
}
|
||||
getTextureView(texture) {
|
||||
const source = texture.source;
|
||||
return this._textureViewHash[source.uid] ?? this._createTextureView(source);
|
||||
}
|
||||
_createTextureView(texture) {
|
||||
this._textureViewHash[texture.uid] = this.getGpuSource(texture).createView();
|
||||
return this._textureViewHash[texture.uid];
|
||||
}
|
||||
generateCanvas(texture) {
|
||||
const renderer = this._renderer;
|
||||
const commandEncoder = renderer.gpu.device.createCommandEncoder();
|
||||
const canvas = DOMAdapter.get().createCanvas();
|
||||
canvas.width = texture.source.pixelWidth;
|
||||
canvas.height = texture.source.pixelHeight;
|
||||
const context = canvas.getContext("webgpu");
|
||||
context.configure({
|
||||
device: renderer.gpu.device,
|
||||
// eslint-disable-next-line max-len
|
||||
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC,
|
||||
format: DOMAdapter.get().getNavigator().gpu.getPreferredCanvasFormat(),
|
||||
alphaMode: "premultiplied"
|
||||
});
|
||||
commandEncoder.copyTextureToTexture({
|
||||
texture: renderer.texture.getGpuSource(texture.source),
|
||||
origin: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
}, {
|
||||
texture: context.getCurrentTexture()
|
||||
}, {
|
||||
width: canvas.width,
|
||||
height: canvas.height
|
||||
});
|
||||
renderer.gpu.device.queue.submit([commandEncoder.finish()]);
|
||||
return canvas;
|
||||
}
|
||||
getPixels(texture) {
|
||||
const webGPUCanvas = this.generateCanvas(texture);
|
||||
const canvasAndContext = CanvasPool.getOptimalCanvasAndContext(webGPUCanvas.width, webGPUCanvas.height);
|
||||
const context = canvasAndContext.context;
|
||||
context.drawImage(webGPUCanvas, 0, 0);
|
||||
const { width, height } = webGPUCanvas;
|
||||
const imageData = context.getImageData(0, 0, width, height);
|
||||
const pixels = new Uint8ClampedArray(imageData.data.buffer);
|
||||
CanvasPool.returnCanvasAndContext(canvasAndContext);
|
||||
return { pixels, width, height };
|
||||
}
|
||||
destroy() {
|
||||
this.managedTextures.slice().forEach((source) => this.onSourceDestroy(source));
|
||||
this.managedTextures = null;
|
||||
for (const k of Object.keys(this._bindGroupHash)) {
|
||||
const key = Number(k);
|
||||
const bindGroup = this._bindGroupHash[key];
|
||||
bindGroup?.destroy();
|
||||
this._bindGroupHash[key] = null;
|
||||
}
|
||||
this._gpu = null;
|
||||
this._mipmapGenerator = null;
|
||||
this._gpuSources = null;
|
||||
this._bindGroupHash = null;
|
||||
this._textureViewHash = null;
|
||||
this._gpuSamplers = null;
|
||||
}
|
||||
}
|
||||
/** @ignore */
|
||||
GpuTextureSystem.extension = {
|
||||
type: [
|
||||
ExtensionType.WebGPUSystem
|
||||
],
|
||||
name: "texture"
|
||||
};
|
||||
|
||||
export { GpuTextureSystem };
|
||||
//# sourceMappingURL=GpuTextureSystem.mjs.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/GpuTextureSystem.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/GpuTextureSystem.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/GpuTextureUploader.d.ts
generated
vendored
Normal file
7
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/GpuTextureUploader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/// <reference types="@webgpu/types" />
|
||||
import type { TextureSource } from '../../../shared/texture/sources/TextureSource';
|
||||
import type { GPU } from '../../GpuDeviceSystem';
|
||||
export interface GpuTextureUploader<T extends TextureSource = TextureSource> {
|
||||
type: string;
|
||||
upload(source: T, gpuTexture: GPUTexture, gpu: GPU): void;
|
||||
}
|
4
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/GpuTextureUploader.js
generated
vendored
Normal file
4
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/GpuTextureUploader.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
//# sourceMappingURL=GpuTextureUploader.js.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/GpuTextureUploader.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/GpuTextureUploader.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"GpuTextureUploader.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
2
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/GpuTextureUploader.mjs
generated
vendored
Normal file
2
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/GpuTextureUploader.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=GpuTextureUploader.mjs.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/GpuTextureUploader.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/GpuTextureUploader.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"GpuTextureUploader.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
3
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.d.ts
generated
vendored
Normal file
3
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { BufferImageSource } from '../../../shared/texture/sources/BufferImageSource';
|
||||
import type { GpuTextureUploader } from './GpuTextureUploader';
|
||||
export declare const gpuUploadBufferImageResource: GpuTextureUploader<BufferImageSource>;
|
28
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.js
generated
vendored
Normal file
28
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
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
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"gpuUploadBufferImageResource.js","sources":["../../../../../../src/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.ts"],"sourcesContent":["import type { BufferImageSource } from '../../../shared/texture/sources/BufferImageSource';\nimport type { GPU } from '../../GpuDeviceSystem';\nimport type { GpuTextureUploader } from './GpuTextureUploader';\n\nexport const gpuUploadBufferImageResource = {\n\n type: 'image',\n\n upload(source: BufferImageSource, gpuTexture: GPUTexture, gpu: GPU)\n {\n const resource = source.resource;\n\n const total = (source.pixelWidth | 0) * (source.pixelHeight | 0);\n\n const bytesPerPixel = resource.byteLength / total;\n\n gpu.device.queue.writeTexture(\n { texture: gpuTexture },\n resource,\n {\n offset: 0,\n rowsPerImage: source.pixelHeight,\n bytesPerRow: source.pixelHeight * bytesPerPixel,\n },\n {\n width: source.pixelWidth,\n height: source.pixelHeight,\n depthOrArrayLayers: 1,\n }\n );\n }\n} as GpuTextureUploader<BufferImageSource>;\n\n"],"names":[],"mappings":";;;AAIO,MAAM,4BAA+B,GAAA;AAAA,EAExC,IAAM,EAAA,OAAA;AAAA,EAEN,MAAA,CAAO,MAA2B,EAAA,UAAA,EAAwB,GAC1D,EAAA;AACI,IAAA,MAAM,WAAW,MAAO,CAAA,QAAA,CAAA;AAExB,IAAA,MAAM,KAAS,GAAA,CAAA,MAAA,CAAO,UAAa,GAAA,CAAA,KAAM,OAAO,WAAc,GAAA,CAAA,CAAA,CAAA;AAE9D,IAAM,MAAA,aAAA,GAAgB,SAAS,UAAa,GAAA,KAAA,CAAA;AAE5C,IAAA,GAAA,CAAI,OAAO,KAAM,CAAA,YAAA;AAAA,MACb,EAAE,SAAS,UAAW,EAAA;AAAA,MACtB,QAAA;AAAA,MACA;AAAA,QACI,MAAQ,EAAA,CAAA;AAAA,QACR,cAAc,MAAO,CAAA,WAAA;AAAA,QACrB,WAAA,EAAa,OAAO,WAAc,GAAA,aAAA;AAAA,OACtC;AAAA,MACA;AAAA,QACI,OAAO,MAAO,CAAA,UAAA;AAAA,QACd,QAAQ,MAAO,CAAA,WAAA;AAAA,QACf,kBAAoB,EAAA,CAAA;AAAA,OACxB;AAAA,KACJ,CAAA;AAAA,GACJ;AACJ;;;;"}
|
26
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.mjs
generated
vendored
Normal file
26
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.mjs
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
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
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export { gpuUploadBufferImageResource };
|
||||
//# sourceMappingURL=gpuUploadBufferImageResource.mjs.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"gpuUploadBufferImageResource.mjs","sources":["../../../../../../src/rendering/renderers/gpu/texture/uploaders/gpuUploadBufferImageResource.ts"],"sourcesContent":["import type { BufferImageSource } from '../../../shared/texture/sources/BufferImageSource';\nimport type { GPU } from '../../GpuDeviceSystem';\nimport type { GpuTextureUploader } from './GpuTextureUploader';\n\nexport const gpuUploadBufferImageResource = {\n\n type: 'image',\n\n upload(source: BufferImageSource, gpuTexture: GPUTexture, gpu: GPU)\n {\n const resource = source.resource;\n\n const total = (source.pixelWidth | 0) * (source.pixelHeight | 0);\n\n const bytesPerPixel = resource.byteLength / total;\n\n gpu.device.queue.writeTexture(\n { texture: gpuTexture },\n resource,\n {\n offset: 0,\n rowsPerImage: source.pixelHeight,\n bytesPerRow: source.pixelHeight * bytesPerPixel,\n },\n {\n width: source.pixelWidth,\n height: source.pixelHeight,\n depthOrArrayLayers: 1,\n }\n );\n }\n} as GpuTextureUploader<BufferImageSource>;\n\n"],"names":[],"mappings":";AAIO,MAAM,4BAA+B,GAAA;AAAA,EAExC,IAAM,EAAA,OAAA;AAAA,EAEN,MAAA,CAAO,MAA2B,EAAA,UAAA,EAAwB,GAC1D,EAAA;AACI,IAAA,MAAM,WAAW,MAAO,CAAA,QAAA,CAAA;AAExB,IAAA,MAAM,KAAS,GAAA,CAAA,MAAA,CAAO,UAAa,GAAA,CAAA,KAAM,OAAO,WAAc,GAAA,CAAA,CAAA,CAAA;AAE9D,IAAM,MAAA,aAAA,GAAgB,SAAS,UAAa,GAAA,KAAA,CAAA;AAE5C,IAAA,GAAA,CAAI,OAAO,KAAM,CAAA,YAAA;AAAA,MACb,EAAE,SAAS,UAAW,EAAA;AAAA,MACtB,QAAA;AAAA,MACA;AAAA,QACI,MAAQ,EAAA,CAAA;AAAA,QACR,cAAc,MAAO,CAAA,WAAA;AAAA,QACrB,WAAA,EAAa,OAAO,WAAc,GAAA,aAAA;AAAA,OACtC;AAAA,MACA;AAAA,QACI,OAAO,MAAO,CAAA,UAAA;AAAA,QACd,QAAQ,MAAO,CAAA,WAAA;AAAA,QACf,kBAAoB,EAAA,CAAA;AAAA,OACxB;AAAA,KACJ,CAAA;AAAA,GACJ;AACJ;;;;"}
|
8
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.d.ts
generated
vendored
Normal file
8
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { CompressedSource } from '../../../shared/texture/sources/CompressedSource';
|
||||
import type { GpuTextureUploader } from './GpuTextureUploader';
|
||||
export declare const blockDataMap: Record<string, {
|
||||
blockBytes: number;
|
||||
blockWidth: number;
|
||||
blockHeight: number;
|
||||
}>;
|
||||
export declare const gpuUploadCompressedTextureResource: GpuTextureUploader<CompressedSource>;
|
47
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.js
generated
vendored
Normal file
47
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
const blockDataMap = {
|
||||
"bc1-rgba-unorm": { blockBytes: 8, blockWidth: 4, blockHeight: 4 },
|
||||
"bc2-rgba-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
|
||||
"bc3-rgba-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
|
||||
"bc7-rgba-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
|
||||
"etc1-rgb-unorm": { blockBytes: 8, blockWidth: 4, blockHeight: 4 },
|
||||
"etc2-rgba8unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
|
||||
"astc-4x4-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 }
|
||||
};
|
||||
const defaultBlockData = { blockBytes: 4, blockWidth: 1, blockHeight: 1 };
|
||||
const gpuUploadCompressedTextureResource = {
|
||||
type: "compressed",
|
||||
upload(source, gpuTexture, gpu) {
|
||||
let mipWidth = source.pixelWidth;
|
||||
let mipHeight = source.pixelHeight;
|
||||
const blockData = blockDataMap[source.format] || defaultBlockData;
|
||||
for (let i = 0; i < source.resource.length; i++) {
|
||||
const levelBuffer = source.resource[i];
|
||||
const bytesPerRow = Math.ceil(mipWidth / blockData.blockWidth) * blockData.blockBytes;
|
||||
gpu.device.queue.writeTexture(
|
||||
{
|
||||
texture: gpuTexture,
|
||||
mipLevel: i
|
||||
},
|
||||
levelBuffer,
|
||||
{
|
||||
offset: 0,
|
||||
bytesPerRow
|
||||
},
|
||||
{
|
||||
width: Math.ceil(mipWidth / blockData.blockWidth) * blockData.blockWidth,
|
||||
height: Math.ceil(mipHeight / blockData.blockHeight) * blockData.blockHeight,
|
||||
depthOrArrayLayers: 1
|
||||
}
|
||||
);
|
||||
mipWidth = Math.max(mipWidth >> 1, 1);
|
||||
mipHeight = Math.max(mipHeight >> 1, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.blockDataMap = blockDataMap;
|
||||
exports.gpuUploadCompressedTextureResource = gpuUploadCompressedTextureResource;
|
||||
//# sourceMappingURL=gpuUploadCompressedTextureResource.js.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"gpuUploadCompressedTextureResource.js","sources":["../../../../../../src/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.ts"],"sourcesContent":["import type { CompressedSource } from '../../../shared/texture/sources/CompressedSource';\nimport type { GPU } from '../../GpuDeviceSystem';\nimport type { GpuTextureUploader } from './GpuTextureUploader';\n\nexport const blockDataMap: Record<string, {blockBytes: number, blockWidth: number, blockHeight: number}> = {\n 'bc1-rgba-unorm': { blockBytes: 8, blockWidth: 4, blockHeight: 4 },\n 'bc2-rgba-unorm': { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n 'bc3-rgba-unorm': { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n 'bc7-rgba-unorm': { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n 'etc1-rgb-unorm': { blockBytes: 8, blockWidth: 4, blockHeight: 4 },\n 'etc2-rgba8unorm': { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n 'astc-4x4-unorm': { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n};\n\nconst defaultBlockData = { blockBytes: 4, blockWidth: 1, blockHeight: 1 };\n\nexport const gpuUploadCompressedTextureResource = {\n\n type: 'compressed',\n\n upload(source: CompressedSource, gpuTexture: GPUTexture, gpu: GPU)\n {\n let mipWidth = source.pixelWidth;\n let mipHeight = source.pixelHeight;\n\n const blockData = blockDataMap[source.format] || defaultBlockData;\n\n for (let i = 0; i < source.resource.length; i++)\n {\n const levelBuffer = source.resource[i];\n\n const bytesPerRow = Math.ceil(mipWidth / blockData.blockWidth) * blockData.blockBytes;\n\n gpu.device.queue.writeTexture(\n {\n texture: gpuTexture,\n mipLevel: i\n },\n levelBuffer,\n {\n offset: 0,\n bytesPerRow,\n },\n {\n width: Math.ceil(mipWidth / blockData.blockWidth) * blockData.blockWidth,\n height: Math.ceil(mipHeight / blockData.blockHeight) * blockData.blockHeight,\n depthOrArrayLayers: 1,\n }\n );\n\n mipWidth = Math.max(mipWidth >> 1, 1);\n mipHeight = Math.max(mipHeight >> 1, 1);\n }\n }\n} as GpuTextureUploader<CompressedSource>;\n\n"],"names":[],"mappings":";;;AAIO,MAAM,YAA8F,GAAA;AAAA,EACvG,kBAAkB,EAAE,UAAA,EAAY,GAAG,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AAAA,EACjE,kBAAkB,EAAE,UAAA,EAAY,IAAI,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AAAA,EAClE,kBAAkB,EAAE,UAAA,EAAY,IAAI,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AAAA,EAClE,kBAAkB,EAAE,UAAA,EAAY,IAAI,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AAAA,EAClE,kBAAkB,EAAE,UAAA,EAAY,GAAG,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AAAA,EACjE,mBAAmB,EAAE,UAAA,EAAY,IAAI,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AAAA,EACnE,kBAAkB,EAAE,UAAA,EAAY,IAAI,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AACtE,EAAA;AAEA,MAAM,mBAAmB,EAAE,UAAA,EAAY,GAAG,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA,CAAA;AAEjE,MAAM,kCAAqC,GAAA;AAAA,EAE9C,IAAM,EAAA,YAAA;AAAA,EAEN,MAAA,CAAO,MAA0B,EAAA,UAAA,EAAwB,GACzD,EAAA;AACI,IAAA,IAAI,WAAW,MAAO,CAAA,UAAA,CAAA;AACtB,IAAA,IAAI,YAAY,MAAO,CAAA,WAAA,CAAA;AAEvB,IAAA,MAAM,SAAY,GAAA,YAAA,CAAa,MAAO,CAAA,MAAM,CAAK,IAAA,gBAAA,CAAA;AAEjD,IAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,MAAO,CAAA,QAAA,CAAS,QAAQ,CAC5C,EAAA,EAAA;AACI,MAAM,MAAA,WAAA,GAAc,MAAO,CAAA,QAAA,CAAS,CAAC,CAAA,CAAA;AAErC,MAAA,MAAM,cAAc,IAAK,CAAA,IAAA,CAAK,WAAW,SAAU,CAAA,UAAU,IAAI,SAAU,CAAA,UAAA,CAAA;AAE3E,MAAA,GAAA,CAAI,OAAO,KAAM,CAAA,YAAA;AAAA,QACb;AAAA,UACI,OAAS,EAAA,UAAA;AAAA,UACT,QAAU,EAAA,CAAA;AAAA,SACd;AAAA,QACA,WAAA;AAAA,QACA;AAAA,UACI,MAAQ,EAAA,CAAA;AAAA,UACR,WAAA;AAAA,SACJ;AAAA,QACA;AAAA,UACI,OAAO,IAAK,CAAA,IAAA,CAAK,WAAW,SAAU,CAAA,UAAU,IAAI,SAAU,CAAA,UAAA;AAAA,UAC9D,QAAQ,IAAK,CAAA,IAAA,CAAK,YAAY,SAAU,CAAA,WAAW,IAAI,SAAU,CAAA,WAAA;AAAA,UACjE,kBAAoB,EAAA,CAAA;AAAA,SACxB;AAAA,OACJ,CAAA;AAEA,MAAA,QAAA,GAAW,IAAK,CAAA,GAAA,CAAI,QAAY,IAAA,CAAA,EAAG,CAAC,CAAA,CAAA;AACpC,MAAA,SAAA,GAAY,IAAK,CAAA,GAAA,CAAI,SAAa,IAAA,CAAA,EAAG,CAAC,CAAA,CAAA;AAAA,KAC1C;AAAA,GACJ;AACJ;;;;;"}
|
44
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.mjs
generated
vendored
Normal file
44
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.mjs
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
const blockDataMap = {
|
||||
"bc1-rgba-unorm": { blockBytes: 8, blockWidth: 4, blockHeight: 4 },
|
||||
"bc2-rgba-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
|
||||
"bc3-rgba-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
|
||||
"bc7-rgba-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
|
||||
"etc1-rgb-unorm": { blockBytes: 8, blockWidth: 4, blockHeight: 4 },
|
||||
"etc2-rgba8unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 },
|
||||
"astc-4x4-unorm": { blockBytes: 16, blockWidth: 4, blockHeight: 4 }
|
||||
};
|
||||
const defaultBlockData = { blockBytes: 4, blockWidth: 1, blockHeight: 1 };
|
||||
const gpuUploadCompressedTextureResource = {
|
||||
type: "compressed",
|
||||
upload(source, gpuTexture, gpu) {
|
||||
let mipWidth = source.pixelWidth;
|
||||
let mipHeight = source.pixelHeight;
|
||||
const blockData = blockDataMap[source.format] || defaultBlockData;
|
||||
for (let i = 0; i < source.resource.length; i++) {
|
||||
const levelBuffer = source.resource[i];
|
||||
const bytesPerRow = Math.ceil(mipWidth / blockData.blockWidth) * blockData.blockBytes;
|
||||
gpu.device.queue.writeTexture(
|
||||
{
|
||||
texture: gpuTexture,
|
||||
mipLevel: i
|
||||
},
|
||||
levelBuffer,
|
||||
{
|
||||
offset: 0,
|
||||
bytesPerRow
|
||||
},
|
||||
{
|
||||
width: Math.ceil(mipWidth / blockData.blockWidth) * blockData.blockWidth,
|
||||
height: Math.ceil(mipHeight / blockData.blockHeight) * blockData.blockHeight,
|
||||
depthOrArrayLayers: 1
|
||||
}
|
||||
);
|
||||
mipWidth = Math.max(mipWidth >> 1, 1);
|
||||
mipHeight = Math.max(mipHeight >> 1, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export { blockDataMap, gpuUploadCompressedTextureResource };
|
||||
//# sourceMappingURL=gpuUploadCompressedTextureResource.mjs.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"gpuUploadCompressedTextureResource.mjs","sources":["../../../../../../src/rendering/renderers/gpu/texture/uploaders/gpuUploadCompressedTextureResource.ts"],"sourcesContent":["import type { CompressedSource } from '../../../shared/texture/sources/CompressedSource';\nimport type { GPU } from '../../GpuDeviceSystem';\nimport type { GpuTextureUploader } from './GpuTextureUploader';\n\nexport const blockDataMap: Record<string, {blockBytes: number, blockWidth: number, blockHeight: number}> = {\n 'bc1-rgba-unorm': { blockBytes: 8, blockWidth: 4, blockHeight: 4 },\n 'bc2-rgba-unorm': { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n 'bc3-rgba-unorm': { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n 'bc7-rgba-unorm': { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n 'etc1-rgb-unorm': { blockBytes: 8, blockWidth: 4, blockHeight: 4 },\n 'etc2-rgba8unorm': { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n 'astc-4x4-unorm': { blockBytes: 16, blockWidth: 4, blockHeight: 4 },\n};\n\nconst defaultBlockData = { blockBytes: 4, blockWidth: 1, blockHeight: 1 };\n\nexport const gpuUploadCompressedTextureResource = {\n\n type: 'compressed',\n\n upload(source: CompressedSource, gpuTexture: GPUTexture, gpu: GPU)\n {\n let mipWidth = source.pixelWidth;\n let mipHeight = source.pixelHeight;\n\n const blockData = blockDataMap[source.format] || defaultBlockData;\n\n for (let i = 0; i < source.resource.length; i++)\n {\n const levelBuffer = source.resource[i];\n\n const bytesPerRow = Math.ceil(mipWidth / blockData.blockWidth) * blockData.blockBytes;\n\n gpu.device.queue.writeTexture(\n {\n texture: gpuTexture,\n mipLevel: i\n },\n levelBuffer,\n {\n offset: 0,\n bytesPerRow,\n },\n {\n width: Math.ceil(mipWidth / blockData.blockWidth) * blockData.blockWidth,\n height: Math.ceil(mipHeight / blockData.blockHeight) * blockData.blockHeight,\n depthOrArrayLayers: 1,\n }\n );\n\n mipWidth = Math.max(mipWidth >> 1, 1);\n mipHeight = Math.max(mipHeight >> 1, 1);\n }\n }\n} as GpuTextureUploader<CompressedSource>;\n\n"],"names":[],"mappings":";AAIO,MAAM,YAA8F,GAAA;AAAA,EACvG,kBAAkB,EAAE,UAAA,EAAY,GAAG,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AAAA,EACjE,kBAAkB,EAAE,UAAA,EAAY,IAAI,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AAAA,EAClE,kBAAkB,EAAE,UAAA,EAAY,IAAI,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AAAA,EAClE,kBAAkB,EAAE,UAAA,EAAY,IAAI,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AAAA,EAClE,kBAAkB,EAAE,UAAA,EAAY,GAAG,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AAAA,EACjE,mBAAmB,EAAE,UAAA,EAAY,IAAI,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AAAA,EACnE,kBAAkB,EAAE,UAAA,EAAY,IAAI,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA;AACtE,EAAA;AAEA,MAAM,mBAAmB,EAAE,UAAA,EAAY,GAAG,UAAY,EAAA,CAAA,EAAG,aAAa,CAAE,EAAA,CAAA;AAEjE,MAAM,kCAAqC,GAAA;AAAA,EAE9C,IAAM,EAAA,YAAA;AAAA,EAEN,MAAA,CAAO,MAA0B,EAAA,UAAA,EAAwB,GACzD,EAAA;AACI,IAAA,IAAI,WAAW,MAAO,CAAA,UAAA,CAAA;AACtB,IAAA,IAAI,YAAY,MAAO,CAAA,WAAA,CAAA;AAEvB,IAAA,MAAM,SAAY,GAAA,YAAA,CAAa,MAAO,CAAA,MAAM,CAAK,IAAA,gBAAA,CAAA;AAEjD,IAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,MAAO,CAAA,QAAA,CAAS,QAAQ,CAC5C,EAAA,EAAA;AACI,MAAM,MAAA,WAAA,GAAc,MAAO,CAAA,QAAA,CAAS,CAAC,CAAA,CAAA;AAErC,MAAA,MAAM,cAAc,IAAK,CAAA,IAAA,CAAK,WAAW,SAAU,CAAA,UAAU,IAAI,SAAU,CAAA,UAAA,CAAA;AAE3E,MAAA,GAAA,CAAI,OAAO,KAAM,CAAA,YAAA;AAAA,QACb;AAAA,UACI,OAAS,EAAA,UAAA;AAAA,UACT,QAAU,EAAA,CAAA;AAAA,SACd;AAAA,QACA,WAAA;AAAA,QACA;AAAA,UACI,MAAQ,EAAA,CAAA;AAAA,UACR,WAAA;AAAA,SACJ;AAAA,QACA;AAAA,UACI,OAAO,IAAK,CAAA,IAAA,CAAK,WAAW,SAAU,CAAA,UAAU,IAAI,SAAU,CAAA,UAAA;AAAA,UAC9D,QAAQ,IAAK,CAAA,IAAA,CAAK,YAAY,SAAU,CAAA,WAAW,IAAI,SAAU,CAAA,WAAA;AAAA,UACjE,kBAAoB,EAAA,CAAA;AAAA,SACxB;AAAA,OACJ,CAAA;AAEA,MAAA,QAAA,GAAW,IAAK,CAAA,GAAA,CAAI,QAAY,IAAA,CAAA,EAAG,CAAC,CAAA,CAAA;AACpC,MAAA,SAAA,GAAY,IAAK,CAAA,GAAA,CAAI,SAAa,IAAA,CAAA,EAAG,CAAC,CAAA,CAAA;AAAA,KAC1C;AAAA,GACJ;AACJ;;;;"}
|
3
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.d.ts
generated
vendored
Normal file
3
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { TextureSource } from '../../../shared/texture/sources/TextureSource';
|
||||
import type { GpuTextureUploader } from './GpuTextureUploader';
|
||||
export declare const gpuUploadImageResource: GpuTextureUploader<TextureSource<any>>;
|
25
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.js
generated
vendored
Normal file
25
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
const gpuUploadImageResource = {
|
||||
type: "image",
|
||||
upload(source, gpuTexture, gpu) {
|
||||
const resource = source.resource;
|
||||
if (!resource)
|
||||
return;
|
||||
const width = Math.min(gpuTexture.width, source.resourceWidth || source.pixelWidth);
|
||||
const height = Math.min(gpuTexture.height, source.resourceHeight || source.pixelHeight);
|
||||
const premultipliedAlpha = source.alphaMode === "premultiply-alpha-on-upload";
|
||||
gpu.device.queue.copyExternalImageToTexture(
|
||||
{ source: resource },
|
||||
{ texture: gpuTexture, premultipliedAlpha },
|
||||
{
|
||||
width,
|
||||
height
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
exports.gpuUploadImageResource = gpuUploadImageResource;
|
||||
//# sourceMappingURL=gpuUploadImageSource.js.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"gpuUploadImageSource.js","sources":["../../../../../../src/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.ts"],"sourcesContent":["import type { TextureSource } from '../../../shared/texture/sources/TextureSource';\nimport type { GPU } from '../../GpuDeviceSystem';\nimport type { GpuTextureUploader } from './GpuTextureUploader';\n\nexport const gpuUploadImageResource = {\n\n type: 'image',\n\n upload(source: TextureSource, gpuTexture: GPUTexture, gpu: GPU)\n {\n const resource = source.resource as ImageBitmap | HTMLCanvasElement | OffscreenCanvas;\n\n if (!resource) return;\n\n const width = Math.min(gpuTexture.width, source.resourceWidth || source.pixelWidth);\n const height = Math.min(gpuTexture.height, source.resourceHeight || source.pixelHeight);\n\n const premultipliedAlpha = source.alphaMode === 'premultiply-alpha-on-upload';\n\n gpu.device.queue.copyExternalImageToTexture(\n { source: resource },\n { texture: gpuTexture, premultipliedAlpha },\n {\n width,\n height,\n }\n );\n }\n} as GpuTextureUploader<TextureSource>;\n\n"],"names":[],"mappings":";;;AAIO,MAAM,sBAAyB,GAAA;AAAA,EAElC,IAAM,EAAA,OAAA;AAAA,EAEN,MAAA,CAAO,MAAuB,EAAA,UAAA,EAAwB,GACtD,EAAA;AACI,IAAA,MAAM,WAAW,MAAO,CAAA,QAAA,CAAA;AAExB,IAAA,IAAI,CAAC,QAAA;AAAU,MAAA,OAAA;AAEf,IAAM,MAAA,KAAA,GAAQ,KAAK,GAAI,CAAA,UAAA,CAAW,OAAO,MAAO,CAAA,aAAA,IAAiB,OAAO,UAAU,CAAA,CAAA;AAClF,IAAM,MAAA,MAAA,GAAS,KAAK,GAAI,CAAA,UAAA,CAAW,QAAQ,MAAO,CAAA,cAAA,IAAkB,OAAO,WAAW,CAAA,CAAA;AAEtF,IAAM,MAAA,kBAAA,GAAqB,OAAO,SAAc,KAAA,6BAAA,CAAA;AAEhD,IAAA,GAAA,CAAI,OAAO,KAAM,CAAA,0BAAA;AAAA,MACb,EAAE,QAAQ,QAAS,EAAA;AAAA,MACnB,EAAE,OAAS,EAAA,UAAA,EAAY,kBAAmB,EAAA;AAAA,MAC1C;AAAA,QACI,KAAA;AAAA,QACA,MAAA;AAAA,OACJ;AAAA,KACJ,CAAA;AAAA,GACJ;AACJ;;;;"}
|
23
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.mjs
generated
vendored
Normal file
23
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.mjs
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
const gpuUploadImageResource = {
|
||||
type: "image",
|
||||
upload(source, gpuTexture, gpu) {
|
||||
const resource = source.resource;
|
||||
if (!resource)
|
||||
return;
|
||||
const width = Math.min(gpuTexture.width, source.resourceWidth || source.pixelWidth);
|
||||
const height = Math.min(gpuTexture.height, source.resourceHeight || source.pixelHeight);
|
||||
const premultipliedAlpha = source.alphaMode === "premultiply-alpha-on-upload";
|
||||
gpu.device.queue.copyExternalImageToTexture(
|
||||
{ source: resource },
|
||||
{ texture: gpuTexture, premultipliedAlpha },
|
||||
{
|
||||
width,
|
||||
height
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export { gpuUploadImageResource };
|
||||
//# sourceMappingURL=gpuUploadImageSource.mjs.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"gpuUploadImageSource.mjs","sources":["../../../../../../src/rendering/renderers/gpu/texture/uploaders/gpuUploadImageSource.ts"],"sourcesContent":["import type { TextureSource } from '../../../shared/texture/sources/TextureSource';\nimport type { GPU } from '../../GpuDeviceSystem';\nimport type { GpuTextureUploader } from './GpuTextureUploader';\n\nexport const gpuUploadImageResource = {\n\n type: 'image',\n\n upload(source: TextureSource, gpuTexture: GPUTexture, gpu: GPU)\n {\n const resource = source.resource as ImageBitmap | HTMLCanvasElement | OffscreenCanvas;\n\n if (!resource) return;\n\n const width = Math.min(gpuTexture.width, source.resourceWidth || source.pixelWidth);\n const height = Math.min(gpuTexture.height, source.resourceHeight || source.pixelHeight);\n\n const premultipliedAlpha = source.alphaMode === 'premultiply-alpha-on-upload';\n\n gpu.device.queue.copyExternalImageToTexture(\n { source: resource },\n { texture: gpuTexture, premultipliedAlpha },\n {\n width,\n height,\n }\n );\n }\n} as GpuTextureUploader<TextureSource>;\n\n"],"names":[],"mappings":";AAIO,MAAM,sBAAyB,GAAA;AAAA,EAElC,IAAM,EAAA,OAAA;AAAA,EAEN,MAAA,CAAO,MAAuB,EAAA,UAAA,EAAwB,GACtD,EAAA;AACI,IAAA,MAAM,WAAW,MAAO,CAAA,QAAA,CAAA;AAExB,IAAA,IAAI,CAAC,QAAA;AAAU,MAAA,OAAA;AAEf,IAAM,MAAA,KAAA,GAAQ,KAAK,GAAI,CAAA,UAAA,CAAW,OAAO,MAAO,CAAA,aAAA,IAAiB,OAAO,UAAU,CAAA,CAAA;AAClF,IAAM,MAAA,MAAA,GAAS,KAAK,GAAI,CAAA,UAAA,CAAW,QAAQ,MAAO,CAAA,cAAA,IAAkB,OAAO,WAAW,CAAA,CAAA;AAEtF,IAAM,MAAA,kBAAA,GAAqB,OAAO,SAAc,KAAA,6BAAA,CAAA;AAEhD,IAAA,GAAA,CAAI,OAAO,KAAM,CAAA,0BAAA;AAAA,MACb,EAAE,QAAQ,QAAS,EAAA;AAAA,MACnB,EAAE,OAAS,EAAA,UAAA,EAAY,kBAAmB,EAAA;AAAA,MAC1C;AAAA,QACI,KAAA;AAAA,QACA,MAAA;AAAA,OACJ;AAAA,KACJ,CAAA;AAAA,GACJ;AACJ;;;;"}
|
3
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.d.ts
generated
vendored
Normal file
3
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { VideoSource } from '../../../shared/texture/sources/VideoSource';
|
||||
import type { GpuTextureUploader } from './GpuTextureUploader';
|
||||
export declare const gpuUploadVideoResource: GpuTextureUploader<VideoSource>;
|
14
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.js
generated
vendored
Normal file
14
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var gpuUploadImageSource = require('./gpuUploadImageSource.js');
|
||||
|
||||
"use strict";
|
||||
const gpuUploadVideoResource = {
|
||||
type: "video",
|
||||
upload(source, gpuTexture, gpu) {
|
||||
gpuUploadImageSource.gpuUploadImageResource.upload(source, gpuTexture, gpu);
|
||||
}
|
||||
};
|
||||
|
||||
exports.gpuUploadVideoResource = gpuUploadVideoResource;
|
||||
//# sourceMappingURL=gpuUploadVideoSource.js.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"gpuUploadVideoSource.js","sources":["../../../../../../src/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.ts"],"sourcesContent":["import { gpuUploadImageResource } from './gpuUploadImageSource';\n\nimport type { VideoSource } from '../../../shared/texture/sources/VideoSource';\nimport type { GPU } from '../../GpuDeviceSystem';\nimport type { GpuTextureUploader } from './GpuTextureUploader';\n\nexport const gpuUploadVideoResource = {\n\n type: 'video',\n\n upload(source: VideoSource, gpuTexture: GPUTexture, gpu: GPU)\n {\n gpuUploadImageResource.upload(source, gpuTexture, gpu);\n }\n} as GpuTextureUploader<VideoSource>;\n\n"],"names":["gpuUploadImageResource"],"mappings":";;;;;AAMO,MAAM,sBAAyB,GAAA;AAAA,EAElC,IAAM,EAAA,OAAA;AAAA,EAEN,MAAA,CAAO,MAAqB,EAAA,UAAA,EAAwB,GACpD,EAAA;AACI,IAAuBA,2CAAA,CAAA,MAAA,CAAO,MAAQ,EAAA,UAAA,EAAY,GAAG,CAAA,CAAA;AAAA,GACzD;AACJ;;;;"}
|
12
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.mjs
generated
vendored
Normal file
12
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.mjs
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { gpuUploadImageResource } from './gpuUploadImageSource.mjs';
|
||||
|
||||
"use strict";
|
||||
const gpuUploadVideoResource = {
|
||||
type: "video",
|
||||
upload(source, gpuTexture, gpu) {
|
||||
gpuUploadImageResource.upload(source, gpuTexture, gpu);
|
||||
}
|
||||
};
|
||||
|
||||
export { gpuUploadVideoResource };
|
||||
//# sourceMappingURL=gpuUploadVideoSource.mjs.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"gpuUploadVideoSource.mjs","sources":["../../../../../../src/rendering/renderers/gpu/texture/uploaders/gpuUploadVideoSource.ts"],"sourcesContent":["import { gpuUploadImageResource } from './gpuUploadImageSource';\n\nimport type { VideoSource } from '../../../shared/texture/sources/VideoSource';\nimport type { GPU } from '../../GpuDeviceSystem';\nimport type { GpuTextureUploader } from './GpuTextureUploader';\n\nexport const gpuUploadVideoResource = {\n\n type: 'video',\n\n upload(source: VideoSource, gpuTexture: GPUTexture, gpu: GPU)\n {\n gpuUploadImageResource.upload(source, gpuTexture, gpu);\n }\n} as GpuTextureUploader<VideoSource>;\n\n"],"names":[],"mappings":";;;AAMO,MAAM,sBAAyB,GAAA;AAAA,EAElC,IAAM,EAAA,OAAA;AAAA,EAEN,MAAA,CAAO,MAAqB,EAAA,UAAA,EAAwB,GACpD,EAAA;AACI,IAAuB,sBAAA,CAAA,MAAA,CAAO,MAAQ,EAAA,UAAA,EAAY,GAAG,CAAA,CAAA;AAAA,GACzD;AACJ;;;;"}
|
22
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.d.ts
generated
vendored
Normal file
22
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/// <reference types="@webgpu/types" />
|
||||
/**
|
||||
* A class which generates mipmaps for a GPUTexture.
|
||||
* Thanks to @toji for the original implementation
|
||||
* https://github.com/toji/web-texture-tool/blob/main/src/webgpu-mipmap-generator.js
|
||||
* @memberof rendering
|
||||
* @ignore
|
||||
*/
|
||||
export declare class GpuMipmapGenerator {
|
||||
device: GPUDevice;
|
||||
sampler: GPUSampler;
|
||||
pipelines: Record<string, GPURenderPipeline>;
|
||||
mipmapShaderModule: any;
|
||||
constructor(device: GPUDevice);
|
||||
private _getMipmapPipeline;
|
||||
/**
|
||||
* Generates mipmaps for the given GPUTexture from the data in level 0.
|
||||
* @param {module:External.GPUTexture} texture - Texture to generate mipmaps for.
|
||||
* @returns {module:External.GPUTexture} - The originally passed texture
|
||||
*/
|
||||
generateMipmap(texture: GPUTexture): GPUTexture;
|
||||
}
|
158
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.js
generated
vendored
Normal file
158
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.js
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
'use strict';
|
||||
|
||||
"use strict";
|
||||
class GpuMipmapGenerator {
|
||||
constructor(device) {
|
||||
this.device = device;
|
||||
this.sampler = device.createSampler({ minFilter: "linear" });
|
||||
this.pipelines = {};
|
||||
}
|
||||
_getMipmapPipeline(format) {
|
||||
let pipeline = this.pipelines[format];
|
||||
if (!pipeline) {
|
||||
if (!this.mipmapShaderModule) {
|
||||
this.mipmapShaderModule = this.device.createShaderModule({
|
||||
code: (
|
||||
/* wgsl */
|
||||
`
|
||||
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) position : vec4<f32>,
|
||||
@location(0) texCoord : vec2<f32>,
|
||||
};
|
||||
|
||||
@vertex
|
||||
fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
|
||||
var output : VertexOutput;
|
||||
output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
|
||||
output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
|
||||
return output;
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var imgSampler : sampler;
|
||||
@group(0) @binding(1) var img : texture_2d<f32>;
|
||||
|
||||
@fragment
|
||||
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
||||
return textureSample(img, imgSampler, texCoord);
|
||||
}
|
||||
`
|
||||
)
|
||||
});
|
||||
}
|
||||
pipeline = this.device.createRenderPipeline({
|
||||
layout: "auto",
|
||||
vertex: {
|
||||
module: this.mipmapShaderModule,
|
||||
entryPoint: "vertexMain"
|
||||
},
|
||||
fragment: {
|
||||
module: this.mipmapShaderModule,
|
||||
entryPoint: "fragmentMain",
|
||||
targets: [{ format }]
|
||||
}
|
||||
});
|
||||
this.pipelines[format] = pipeline;
|
||||
}
|
||||
return pipeline;
|
||||
}
|
||||
/**
|
||||
* Generates mipmaps for the given GPUTexture from the data in level 0.
|
||||
* @param {module:External.GPUTexture} texture - Texture to generate mipmaps for.
|
||||
* @returns {module:External.GPUTexture} - The originally passed texture
|
||||
*/
|
||||
generateMipmap(texture) {
|
||||
const pipeline = this._getMipmapPipeline(texture.format);
|
||||
if (texture.dimension === "3d" || texture.dimension === "1d") {
|
||||
throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");
|
||||
}
|
||||
let mipTexture = texture;
|
||||
const arrayLayerCount = texture.depthOrArrayLayers || 1;
|
||||
const renderToSource = texture.usage & GPUTextureUsage.RENDER_ATTACHMENT;
|
||||
if (!renderToSource) {
|
||||
const mipTextureDescriptor = {
|
||||
size: {
|
||||
width: Math.ceil(texture.width / 2),
|
||||
height: Math.ceil(texture.height / 2),
|
||||
depthOrArrayLayers: arrayLayerCount
|
||||
},
|
||||
format: texture.format,
|
||||
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT,
|
||||
mipLevelCount: texture.mipLevelCount - 1
|
||||
};
|
||||
mipTexture = this.device.createTexture(mipTextureDescriptor);
|
||||
}
|
||||
const commandEncoder = this.device.createCommandEncoder({});
|
||||
const bindGroupLayout = pipeline.getBindGroupLayout(0);
|
||||
for (let arrayLayer = 0; arrayLayer < arrayLayerCount; ++arrayLayer) {
|
||||
let srcView = texture.createView({
|
||||
baseMipLevel: 0,
|
||||
mipLevelCount: 1,
|
||||
dimension: "2d",
|
||||
baseArrayLayer: arrayLayer,
|
||||
arrayLayerCount: 1
|
||||
});
|
||||
let dstMipLevel = renderToSource ? 1 : 0;
|
||||
for (let i = 1; i < texture.mipLevelCount; ++i) {
|
||||
const dstView = mipTexture.createView({
|
||||
baseMipLevel: dstMipLevel++,
|
||||
mipLevelCount: 1,
|
||||
dimension: "2d",
|
||||
baseArrayLayer: arrayLayer,
|
||||
arrayLayerCount: 1
|
||||
});
|
||||
const passEncoder = commandEncoder.beginRenderPass({
|
||||
colorAttachments: [{
|
||||
view: dstView,
|
||||
storeOp: "store",
|
||||
loadOp: "clear",
|
||||
clearValue: { r: 0, g: 0, b: 0, a: 0 }
|
||||
}]
|
||||
});
|
||||
const bindGroup = this.device.createBindGroup({
|
||||
layout: bindGroupLayout,
|
||||
entries: [{
|
||||
binding: 0,
|
||||
resource: this.sampler
|
||||
}, {
|
||||
binding: 1,
|
||||
resource: srcView
|
||||
}]
|
||||
});
|
||||
passEncoder.setPipeline(pipeline);
|
||||
passEncoder.setBindGroup(0, bindGroup);
|
||||
passEncoder.draw(3, 1, 0, 0);
|
||||
passEncoder.end();
|
||||
srcView = dstView;
|
||||
}
|
||||
}
|
||||
if (!renderToSource) {
|
||||
const mipLevelSize = {
|
||||
width: Math.ceil(texture.width / 2),
|
||||
height: Math.ceil(texture.height / 2),
|
||||
depthOrArrayLayers: arrayLayerCount
|
||||
};
|
||||
for (let i = 1; i < texture.mipLevelCount; ++i) {
|
||||
commandEncoder.copyTextureToTexture({
|
||||
texture: mipTexture,
|
||||
mipLevel: i - 1
|
||||
}, {
|
||||
texture,
|
||||
mipLevel: i
|
||||
}, mipLevelSize);
|
||||
mipLevelSize.width = Math.ceil(mipLevelSize.width / 2);
|
||||
mipLevelSize.height = Math.ceil(mipLevelSize.height / 2);
|
||||
}
|
||||
}
|
||||
this.device.queue.submit([commandEncoder.finish()]);
|
||||
if (!renderToSource) {
|
||||
mipTexture.destroy();
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
|
||||
exports.GpuMipmapGenerator = GpuMipmapGenerator;
|
||||
//# sourceMappingURL=GpuMipmapGenerator.js.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
156
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.mjs
generated
vendored
Normal file
156
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.mjs
generated
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
"use strict";
|
||||
class GpuMipmapGenerator {
|
||||
constructor(device) {
|
||||
this.device = device;
|
||||
this.sampler = device.createSampler({ minFilter: "linear" });
|
||||
this.pipelines = {};
|
||||
}
|
||||
_getMipmapPipeline(format) {
|
||||
let pipeline = this.pipelines[format];
|
||||
if (!pipeline) {
|
||||
if (!this.mipmapShaderModule) {
|
||||
this.mipmapShaderModule = this.device.createShaderModule({
|
||||
code: (
|
||||
/* wgsl */
|
||||
`
|
||||
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) position : vec4<f32>,
|
||||
@location(0) texCoord : vec2<f32>,
|
||||
};
|
||||
|
||||
@vertex
|
||||
fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
|
||||
var output : VertexOutput;
|
||||
output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
|
||||
output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
|
||||
return output;
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var imgSampler : sampler;
|
||||
@group(0) @binding(1) var img : texture_2d<f32>;
|
||||
|
||||
@fragment
|
||||
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
|
||||
return textureSample(img, imgSampler, texCoord);
|
||||
}
|
||||
`
|
||||
)
|
||||
});
|
||||
}
|
||||
pipeline = this.device.createRenderPipeline({
|
||||
layout: "auto",
|
||||
vertex: {
|
||||
module: this.mipmapShaderModule,
|
||||
entryPoint: "vertexMain"
|
||||
},
|
||||
fragment: {
|
||||
module: this.mipmapShaderModule,
|
||||
entryPoint: "fragmentMain",
|
||||
targets: [{ format }]
|
||||
}
|
||||
});
|
||||
this.pipelines[format] = pipeline;
|
||||
}
|
||||
return pipeline;
|
||||
}
|
||||
/**
|
||||
* Generates mipmaps for the given GPUTexture from the data in level 0.
|
||||
* @param {module:External.GPUTexture} texture - Texture to generate mipmaps for.
|
||||
* @returns {module:External.GPUTexture} - The originally passed texture
|
||||
*/
|
||||
generateMipmap(texture) {
|
||||
const pipeline = this._getMipmapPipeline(texture.format);
|
||||
if (texture.dimension === "3d" || texture.dimension === "1d") {
|
||||
throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");
|
||||
}
|
||||
let mipTexture = texture;
|
||||
const arrayLayerCount = texture.depthOrArrayLayers || 1;
|
||||
const renderToSource = texture.usage & GPUTextureUsage.RENDER_ATTACHMENT;
|
||||
if (!renderToSource) {
|
||||
const mipTextureDescriptor = {
|
||||
size: {
|
||||
width: Math.ceil(texture.width / 2),
|
||||
height: Math.ceil(texture.height / 2),
|
||||
depthOrArrayLayers: arrayLayerCount
|
||||
},
|
||||
format: texture.format,
|
||||
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT,
|
||||
mipLevelCount: texture.mipLevelCount - 1
|
||||
};
|
||||
mipTexture = this.device.createTexture(mipTextureDescriptor);
|
||||
}
|
||||
const commandEncoder = this.device.createCommandEncoder({});
|
||||
const bindGroupLayout = pipeline.getBindGroupLayout(0);
|
||||
for (let arrayLayer = 0; arrayLayer < arrayLayerCount; ++arrayLayer) {
|
||||
let srcView = texture.createView({
|
||||
baseMipLevel: 0,
|
||||
mipLevelCount: 1,
|
||||
dimension: "2d",
|
||||
baseArrayLayer: arrayLayer,
|
||||
arrayLayerCount: 1
|
||||
});
|
||||
let dstMipLevel = renderToSource ? 1 : 0;
|
||||
for (let i = 1; i < texture.mipLevelCount; ++i) {
|
||||
const dstView = mipTexture.createView({
|
||||
baseMipLevel: dstMipLevel++,
|
||||
mipLevelCount: 1,
|
||||
dimension: "2d",
|
||||
baseArrayLayer: arrayLayer,
|
||||
arrayLayerCount: 1
|
||||
});
|
||||
const passEncoder = commandEncoder.beginRenderPass({
|
||||
colorAttachments: [{
|
||||
view: dstView,
|
||||
storeOp: "store",
|
||||
loadOp: "clear",
|
||||
clearValue: { r: 0, g: 0, b: 0, a: 0 }
|
||||
}]
|
||||
});
|
||||
const bindGroup = this.device.createBindGroup({
|
||||
layout: bindGroupLayout,
|
||||
entries: [{
|
||||
binding: 0,
|
||||
resource: this.sampler
|
||||
}, {
|
||||
binding: 1,
|
||||
resource: srcView
|
||||
}]
|
||||
});
|
||||
passEncoder.setPipeline(pipeline);
|
||||
passEncoder.setBindGroup(0, bindGroup);
|
||||
passEncoder.draw(3, 1, 0, 0);
|
||||
passEncoder.end();
|
||||
srcView = dstView;
|
||||
}
|
||||
}
|
||||
if (!renderToSource) {
|
||||
const mipLevelSize = {
|
||||
width: Math.ceil(texture.width / 2),
|
||||
height: Math.ceil(texture.height / 2),
|
||||
depthOrArrayLayers: arrayLayerCount
|
||||
};
|
||||
for (let i = 1; i < texture.mipLevelCount; ++i) {
|
||||
commandEncoder.copyTextureToTexture({
|
||||
texture: mipTexture,
|
||||
mipLevel: i - 1
|
||||
}, {
|
||||
texture,
|
||||
mipLevel: i
|
||||
}, mipLevelSize);
|
||||
mipLevelSize.width = Math.ceil(mipLevelSize.width / 2);
|
||||
mipLevelSize.height = Math.ceil(mipLevelSize.height / 2);
|
||||
}
|
||||
}
|
||||
this.device.queue.submit([commandEncoder.finish()]);
|
||||
if (!renderToSource) {
|
||||
mipTexture.destroy();
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
|
||||
export { GpuMipmapGenerator };
|
||||
//# sourceMappingURL=GpuMipmapGenerator.mjs.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/GpuMipmapGenerator.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.d.ts
generated
vendored
Normal file
2
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import type { TEXTURE_FORMATS } from '../../../shared/texture/const';
|
||||
export declare function getSupportedGPUCompressedTextureFormats(): Promise<TEXTURE_FORMATS[]>;
|
81
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.js
generated
vendored
Normal file
81
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
|
||||
var adapter = require('../../../../../environment/adapter.js');
|
||||
|
||||
"use strict";
|
||||
let supportedGPUCompressedTextureFormats;
|
||||
async function getSupportedGPUCompressedTextureFormats() {
|
||||
if (supportedGPUCompressedTextureFormats)
|
||||
return supportedGPUCompressedTextureFormats;
|
||||
const adapter$1 = await adapter.DOMAdapter.get().getNavigator().gpu.requestAdapter();
|
||||
supportedGPUCompressedTextureFormats = [
|
||||
...adapter$1.features.has("texture-compression-bc") ? [
|
||||
// BC compressed formats usable if "texture-compression-bc" is both
|
||||
// supported by the device/user agent and enabled in requestDevice.
|
||||
"bc1-rgba-unorm",
|
||||
"bc1-rgba-unorm-srgb",
|
||||
"bc2-rgba-unorm",
|
||||
"bc2-rgba-unorm-srgb",
|
||||
"bc3-rgba-unorm",
|
||||
"bc3-rgba-unorm-srgb",
|
||||
"bc4-r-unorm",
|
||||
"bc4-r-snorm",
|
||||
"bc5-rg-unorm",
|
||||
"bc5-rg-snorm",
|
||||
"bc6h-rgb-ufloat",
|
||||
"bc6h-rgb-float",
|
||||
"bc7-rgba-unorm",
|
||||
"bc7-rgba-unorm-srgb"
|
||||
] : [],
|
||||
...adapter$1.features.has("texture-compression-etc2") ? [
|
||||
// ETC2 compressed formats usable if "texture-compression-etc2" is both
|
||||
// supported by the device/user agent and enabled in requestDevice.
|
||||
"etc2-rgb8unorm",
|
||||
"etc2-rgb8unorm-srgb",
|
||||
"etc2-rgb8a1unorm",
|
||||
"etc2-rgb8a1unorm-srgb",
|
||||
"etc2-rgba8unorm",
|
||||
"etc2-rgba8unorm-srgb",
|
||||
"eac-r11unorm",
|
||||
"eac-r11snorm",
|
||||
"eac-rg11unorm",
|
||||
"eac-rg11snorm"
|
||||
] : [],
|
||||
...adapter$1.features.has("texture-compression-astc") ? [
|
||||
// ASTC compressed formats usable if "texture-compression-astc" is both
|
||||
// supported by the device/user agent and enabled in requestDevice.
|
||||
"astc-4x4-unorm",
|
||||
"astc-4x4-unorm-srgb",
|
||||
"astc-5x4-unorm",
|
||||
"astc-5x4-unorm-srgb",
|
||||
"astc-5x5-unorm",
|
||||
"astc-5x5-unorm-srgb",
|
||||
"astc-6x5-unorm",
|
||||
"astc-6x5-unorm-srgb",
|
||||
"astc-6x6-unorm",
|
||||
"astc-6x6-unorm-srgb",
|
||||
"astc-8x5-unorm",
|
||||
"astc-8x5-unorm-srgb",
|
||||
"astc-8x6-unorm",
|
||||
"astc-8x6-unorm-srgb",
|
||||
"astc-8x8-unorm",
|
||||
"astc-8x8-unorm-srgb",
|
||||
"astc-10x5-unorm",
|
||||
"astc-10x5-unorm-srgb",
|
||||
"astc-10x6-unorm",
|
||||
"astc-10x6-unorm-srgb",
|
||||
"astc-10x8-unorm",
|
||||
"astc-10x8-unorm-srgb",
|
||||
"astc-10x10-unorm",
|
||||
"astc-10x10-unorm-srgb",
|
||||
"astc-12x10-unorm",
|
||||
"astc-12x10-unorm-srgb",
|
||||
"astc-12x12-unorm",
|
||||
"astc-12x12-unorm-srgb"
|
||||
] : []
|
||||
];
|
||||
return supportedGPUCompressedTextureFormats;
|
||||
}
|
||||
|
||||
exports.getSupportedGPUCompressedTextureFormats = getSupportedGPUCompressedTextureFormats;
|
||||
//# sourceMappingURL=getSupportedGPUCompressedTextureFormats.js.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.js.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getSupportedGPUCompressedTextureFormats.js","sources":["../../../../../../src/rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.ts"],"sourcesContent":["import { DOMAdapter } from '../../../../../environment/adapter';\n\nimport type { TEXTURE_FORMATS } from '../../../shared/texture/const';\n\nlet supportedGPUCompressedTextureFormats: TEXTURE_FORMATS[];\n\nexport async function getSupportedGPUCompressedTextureFormats(): Promise<TEXTURE_FORMATS[]>\n{\n if (supportedGPUCompressedTextureFormats) return supportedGPUCompressedTextureFormats;\n\n const adapter = await DOMAdapter.get().getNavigator().gpu.requestAdapter();\n\n supportedGPUCompressedTextureFormats = [\n ...adapter.features.has('texture-compression-bc') ? [\n // BC compressed formats usable if \"texture-compression-bc\" is both\n // supported by the device/user agent and enabled in requestDevice.\n 'bc1-rgba-unorm',\n 'bc1-rgba-unorm-srgb',\n 'bc2-rgba-unorm',\n 'bc2-rgba-unorm-srgb',\n 'bc3-rgba-unorm',\n 'bc3-rgba-unorm-srgb',\n 'bc4-r-unorm',\n 'bc4-r-snorm',\n 'bc5-rg-unorm',\n 'bc5-rg-snorm',\n 'bc6h-rgb-ufloat',\n 'bc6h-rgb-float',\n 'bc7-rgba-unorm',\n 'bc7-rgba-unorm-srgb',\n ] : [],\n ...adapter.features.has('texture-compression-etc2') ? [\n // ETC2 compressed formats usable if \"texture-compression-etc2\" is both\n // supported by the device/user agent and enabled in requestDevice.\n 'etc2-rgb8unorm',\n 'etc2-rgb8unorm-srgb',\n 'etc2-rgb8a1unorm',\n 'etc2-rgb8a1unorm-srgb',\n 'etc2-rgba8unorm',\n 'etc2-rgba8unorm-srgb',\n 'eac-r11unorm',\n 'eac-r11snorm',\n 'eac-rg11unorm',\n 'eac-rg11snorm',\n ] : [],\n ...adapter.features.has('texture-compression-astc') ? [\n // ASTC compressed formats usable if \"texture-compression-astc\" is both\n // supported by the device/user agent and enabled in requestDevice.\n 'astc-4x4-unorm',\n 'astc-4x4-unorm-srgb',\n 'astc-5x4-unorm',\n 'astc-5x4-unorm-srgb',\n 'astc-5x5-unorm',\n 'astc-5x5-unorm-srgb',\n 'astc-6x5-unorm',\n 'astc-6x5-unorm-srgb',\n 'astc-6x6-unorm',\n 'astc-6x6-unorm-srgb',\n 'astc-8x5-unorm',\n 'astc-8x5-unorm-srgb',\n 'astc-8x6-unorm',\n 'astc-8x6-unorm-srgb',\n 'astc-8x8-unorm',\n 'astc-8x8-unorm-srgb',\n 'astc-10x5-unorm',\n 'astc-10x5-unorm-srgb',\n 'astc-10x6-unorm',\n 'astc-10x6-unorm-srgb',\n 'astc-10x8-unorm',\n 'astc-10x8-unorm-srgb',\n 'astc-10x10-unorm',\n 'astc-10x10-unorm-srgb',\n 'astc-12x10-unorm',\n 'astc-12x10-unorm-srgb',\n 'astc-12x12-unorm',\n 'astc-12x12-unorm-srgb',\n ] : [],\n ] as TEXTURE_FORMATS[];\n\n return supportedGPUCompressedTextureFormats;\n}\n"],"names":["adapter","DOMAdapter"],"mappings":";;;;;AAIA,IAAI,oCAAA,CAAA;AAEJ,eAAsB,uCACtB,GAAA;AACI,EAAI,IAAA,oCAAA;AAAsC,IAAO,OAAA,oCAAA,CAAA;AAEjD,EAAM,MAAAA,SAAA,GAAU,MAAMC,kBAAW,CAAA,GAAA,GAAM,YAAa,EAAA,CAAE,IAAI,cAAe,EAAA,CAAA;AAEzE,EAAuC,oCAAA,GAAA;AAAA,IACnC,GAAGD,SAAA,CAAQ,QAAS,CAAA,GAAA,CAAI,wBAAwB,CAAI,GAAA;AAAA;AAAA;AAAA,MAGhD,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,aAAA;AAAA,MACA,aAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,iBAAA;AAAA,MACA,gBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,QACA,EAAC;AAAA,IACL,GAAGA,SAAA,CAAQ,QAAS,CAAA,GAAA,CAAI,0BAA0B,CAAI,GAAA;AAAA;AAAA;AAAA,MAGlD,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,kBAAA;AAAA,MACA,uBAAA;AAAA,MACA,iBAAA;AAAA,MACA,sBAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,eAAA;AAAA,MACA,eAAA;AAAA,QACA,EAAC;AAAA,IACL,GAAGA,SAAA,CAAQ,QAAS,CAAA,GAAA,CAAI,0BAA0B,CAAI,GAAA;AAAA;AAAA;AAAA,MAGlD,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,iBAAA;AAAA,MACA,sBAAA;AAAA,MACA,iBAAA;AAAA,MACA,sBAAA;AAAA,MACA,iBAAA;AAAA,MACA,sBAAA;AAAA,MACA,kBAAA;AAAA,MACA,uBAAA;AAAA,MACA,kBAAA;AAAA,MACA,uBAAA;AAAA,MACA,kBAAA;AAAA,MACA,uBAAA;AAAA,QACA,EAAC;AAAA,GACT,CAAA;AAEA,EAAO,OAAA,oCAAA,CAAA;AACX;;;;"}
|
79
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.mjs
generated
vendored
Normal file
79
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.mjs
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
import { DOMAdapter } from '../../../../../environment/adapter.mjs';
|
||||
|
||||
"use strict";
|
||||
let supportedGPUCompressedTextureFormats;
|
||||
async function getSupportedGPUCompressedTextureFormats() {
|
||||
if (supportedGPUCompressedTextureFormats)
|
||||
return supportedGPUCompressedTextureFormats;
|
||||
const adapter = await DOMAdapter.get().getNavigator().gpu.requestAdapter();
|
||||
supportedGPUCompressedTextureFormats = [
|
||||
...adapter.features.has("texture-compression-bc") ? [
|
||||
// BC compressed formats usable if "texture-compression-bc" is both
|
||||
// supported by the device/user agent and enabled in requestDevice.
|
||||
"bc1-rgba-unorm",
|
||||
"bc1-rgba-unorm-srgb",
|
||||
"bc2-rgba-unorm",
|
||||
"bc2-rgba-unorm-srgb",
|
||||
"bc3-rgba-unorm",
|
||||
"bc3-rgba-unorm-srgb",
|
||||
"bc4-r-unorm",
|
||||
"bc4-r-snorm",
|
||||
"bc5-rg-unorm",
|
||||
"bc5-rg-snorm",
|
||||
"bc6h-rgb-ufloat",
|
||||
"bc6h-rgb-float",
|
||||
"bc7-rgba-unorm",
|
||||
"bc7-rgba-unorm-srgb"
|
||||
] : [],
|
||||
...adapter.features.has("texture-compression-etc2") ? [
|
||||
// ETC2 compressed formats usable if "texture-compression-etc2" is both
|
||||
// supported by the device/user agent and enabled in requestDevice.
|
||||
"etc2-rgb8unorm",
|
||||
"etc2-rgb8unorm-srgb",
|
||||
"etc2-rgb8a1unorm",
|
||||
"etc2-rgb8a1unorm-srgb",
|
||||
"etc2-rgba8unorm",
|
||||
"etc2-rgba8unorm-srgb",
|
||||
"eac-r11unorm",
|
||||
"eac-r11snorm",
|
||||
"eac-rg11unorm",
|
||||
"eac-rg11snorm"
|
||||
] : [],
|
||||
...adapter.features.has("texture-compression-astc") ? [
|
||||
// ASTC compressed formats usable if "texture-compression-astc" is both
|
||||
// supported by the device/user agent and enabled in requestDevice.
|
||||
"astc-4x4-unorm",
|
||||
"astc-4x4-unorm-srgb",
|
||||
"astc-5x4-unorm",
|
||||
"astc-5x4-unorm-srgb",
|
||||
"astc-5x5-unorm",
|
||||
"astc-5x5-unorm-srgb",
|
||||
"astc-6x5-unorm",
|
||||
"astc-6x5-unorm-srgb",
|
||||
"astc-6x6-unorm",
|
||||
"astc-6x6-unorm-srgb",
|
||||
"astc-8x5-unorm",
|
||||
"astc-8x5-unorm-srgb",
|
||||
"astc-8x6-unorm",
|
||||
"astc-8x6-unorm-srgb",
|
||||
"astc-8x8-unorm",
|
||||
"astc-8x8-unorm-srgb",
|
||||
"astc-10x5-unorm",
|
||||
"astc-10x5-unorm-srgb",
|
||||
"astc-10x6-unorm",
|
||||
"astc-10x6-unorm-srgb",
|
||||
"astc-10x8-unorm",
|
||||
"astc-10x8-unorm-srgb",
|
||||
"astc-10x10-unorm",
|
||||
"astc-10x10-unorm-srgb",
|
||||
"astc-12x10-unorm",
|
||||
"astc-12x10-unorm-srgb",
|
||||
"astc-12x12-unorm",
|
||||
"astc-12x12-unorm-srgb"
|
||||
] : []
|
||||
];
|
||||
return supportedGPUCompressedTextureFormats;
|
||||
}
|
||||
|
||||
export { getSupportedGPUCompressedTextureFormats };
|
||||
//# sourceMappingURL=getSupportedGPUCompressedTextureFormats.mjs.map
|
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.mjs.map
generated
vendored
Normal file
1
node_modules/pixi.js/lib/rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"getSupportedGPUCompressedTextureFormats.mjs","sources":["../../../../../../src/rendering/renderers/gpu/texture/utils/getSupportedGPUCompressedTextureFormats.ts"],"sourcesContent":["import { DOMAdapter } from '../../../../../environment/adapter';\n\nimport type { TEXTURE_FORMATS } from '../../../shared/texture/const';\n\nlet supportedGPUCompressedTextureFormats: TEXTURE_FORMATS[];\n\nexport async function getSupportedGPUCompressedTextureFormats(): Promise<TEXTURE_FORMATS[]>\n{\n if (supportedGPUCompressedTextureFormats) return supportedGPUCompressedTextureFormats;\n\n const adapter = await DOMAdapter.get().getNavigator().gpu.requestAdapter();\n\n supportedGPUCompressedTextureFormats = [\n ...adapter.features.has('texture-compression-bc') ? [\n // BC compressed formats usable if \"texture-compression-bc\" is both\n // supported by the device/user agent and enabled in requestDevice.\n 'bc1-rgba-unorm',\n 'bc1-rgba-unorm-srgb',\n 'bc2-rgba-unorm',\n 'bc2-rgba-unorm-srgb',\n 'bc3-rgba-unorm',\n 'bc3-rgba-unorm-srgb',\n 'bc4-r-unorm',\n 'bc4-r-snorm',\n 'bc5-rg-unorm',\n 'bc5-rg-snorm',\n 'bc6h-rgb-ufloat',\n 'bc6h-rgb-float',\n 'bc7-rgba-unorm',\n 'bc7-rgba-unorm-srgb',\n ] : [],\n ...adapter.features.has('texture-compression-etc2') ? [\n // ETC2 compressed formats usable if \"texture-compression-etc2\" is both\n // supported by the device/user agent and enabled in requestDevice.\n 'etc2-rgb8unorm',\n 'etc2-rgb8unorm-srgb',\n 'etc2-rgb8a1unorm',\n 'etc2-rgb8a1unorm-srgb',\n 'etc2-rgba8unorm',\n 'etc2-rgba8unorm-srgb',\n 'eac-r11unorm',\n 'eac-r11snorm',\n 'eac-rg11unorm',\n 'eac-rg11snorm',\n ] : [],\n ...adapter.features.has('texture-compression-astc') ? [\n // ASTC compressed formats usable if \"texture-compression-astc\" is both\n // supported by the device/user agent and enabled in requestDevice.\n 'astc-4x4-unorm',\n 'astc-4x4-unorm-srgb',\n 'astc-5x4-unorm',\n 'astc-5x4-unorm-srgb',\n 'astc-5x5-unorm',\n 'astc-5x5-unorm-srgb',\n 'astc-6x5-unorm',\n 'astc-6x5-unorm-srgb',\n 'astc-6x6-unorm',\n 'astc-6x6-unorm-srgb',\n 'astc-8x5-unorm',\n 'astc-8x5-unorm-srgb',\n 'astc-8x6-unorm',\n 'astc-8x6-unorm-srgb',\n 'astc-8x8-unorm',\n 'astc-8x8-unorm-srgb',\n 'astc-10x5-unorm',\n 'astc-10x5-unorm-srgb',\n 'astc-10x6-unorm',\n 'astc-10x6-unorm-srgb',\n 'astc-10x8-unorm',\n 'astc-10x8-unorm-srgb',\n 'astc-10x10-unorm',\n 'astc-10x10-unorm-srgb',\n 'astc-12x10-unorm',\n 'astc-12x10-unorm-srgb',\n 'astc-12x12-unorm',\n 'astc-12x12-unorm-srgb',\n ] : [],\n ] as TEXTURE_FORMATS[];\n\n return supportedGPUCompressedTextureFormats;\n}\n"],"names":[],"mappings":";;;AAIA,IAAI,oCAAA,CAAA;AAEJ,eAAsB,uCACtB,GAAA;AACI,EAAI,IAAA,oCAAA;AAAsC,IAAO,OAAA,oCAAA,CAAA;AAEjD,EAAM,MAAA,OAAA,GAAU,MAAM,UAAW,CAAA,GAAA,GAAM,YAAa,EAAA,CAAE,IAAI,cAAe,EAAA,CAAA;AAEzE,EAAuC,oCAAA,GAAA;AAAA,IACnC,GAAG,OAAA,CAAQ,QAAS,CAAA,GAAA,CAAI,wBAAwB,CAAI,GAAA;AAAA;AAAA;AAAA,MAGhD,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,aAAA;AAAA,MACA,aAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,iBAAA;AAAA,MACA,gBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,QACA,EAAC;AAAA,IACL,GAAG,OAAA,CAAQ,QAAS,CAAA,GAAA,CAAI,0BAA0B,CAAI,GAAA;AAAA;AAAA;AAAA,MAGlD,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,kBAAA;AAAA,MACA,uBAAA;AAAA,MACA,iBAAA;AAAA,MACA,sBAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,eAAA;AAAA,MACA,eAAA;AAAA,QACA,EAAC;AAAA,IACL,GAAG,OAAA,CAAQ,QAAS,CAAA,GAAA,CAAI,0BAA0B,CAAI,GAAA;AAAA;AAAA;AAAA,MAGlD,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,qBAAA;AAAA,MACA,iBAAA;AAAA,MACA,sBAAA;AAAA,MACA,iBAAA;AAAA,MACA,sBAAA;AAAA,MACA,iBAAA;AAAA,MACA,sBAAA;AAAA,MACA,kBAAA;AAAA,MACA,uBAAA;AAAA,MACA,kBAAA;AAAA,MACA,uBAAA;AAAA,MACA,kBAAA;AAAA,MACA,uBAAA;AAAA,QACA,EAAC;AAAA,GACT,CAAA;AAEA,EAAO,OAAA,oCAAA,CAAA;AACX;;;;"}
|
Reference in New Issue
Block a user