From a0feaeb3f4502abcf391c9927054669060ac8bcd Mon Sep 17 00:00:00 2001 From: bbazukun123 Date: Thu, 8 Feb 2024 12:32:26 +0000 Subject: [PATCH 1/4] Chore: Minor Tool Fixes (#412) --- examples/src/DemoApplication.mjs | 2 +- scripts/screenshots/renderer.js | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/src/DemoApplication.mjs b/examples/src/DemoApplication.mjs index dda34f17c..7f9bde4c4 100644 --- a/examples/src/DemoApplication.mjs +++ b/examples/src/DemoApplication.mjs @@ -273,7 +273,7 @@ export default class DemoApplication extends PIXI.Application name: id, enabled: false, opened: false, - args: null, + args: undefined, fishOnly: false, global: false, oncreate: null, diff --git a/scripts/screenshots/renderer.js b/scripts/screenshots/renderer.js index 676a1387e..288449770 100644 --- a/scripts/screenshots/renderer.js +++ b/scripts/screenshots/renderer.js @@ -19,6 +19,8 @@ const outputOptions = { }, }; +const indexCount = 0; + const app = new Application(); app.init({ @@ -26,7 +28,7 @@ app.init({ height: outputOptions.height, backgroundColor: outputOptions.border.color, autoStart: false, - preference: 'webgl', + preference: 'webgpu', hello: true, }).then(() => { @@ -163,8 +165,15 @@ app.init({ app.render(); const canvas = app.renderer.extract.canvas(app.stage); + const canvas2 = document.createElement('canvas'); + + canvas2.width = canvas.width; + canvas2.height = canvas.height; + document.body.appendChild(canvas); - const context = canvas.getContext('2d'); + const context = canvas2.getContext('2d'); + + context.drawImage(canvas, 0, 0); context.scale(1, -1); const imageData = context.getImageData(0, 0, outputOptions.width, outputOptions.height); From 64b41147e1cd9578b818cd2741b0049fdf370777 Mon Sep 17 00:00:00 2001 From: bbazukun123 Date: Thu, 8 Feb 2024 13:03:21 +0000 Subject: [PATCH 2/4] Chore: Use Program.from for Caching (#438) --- src/adjustment/AdjustmentFilter.ts | 4 ++-- src/advanced-bloom/ExtractBrightnessFilter.ts | 4 ++-- src/bevel/BevelFilter.ts | 4 ++-- src/color-gradient/ColorGradientFilter.ts | 4 ++-- src/cross-hatch/CrossHatchFilter.ts | 4 ++-- src/crt/CRTFilter.ts | 4 ++-- src/glow/GlowFilter.ts | 4 ++-- src/grayscale/GrayscaleFilter.ts | 4 ++-- src/hsl-adjustment/HslAdjustmentFilter.ts | 4 ++-- src/tilt-shift/TiltShiftAxisFilter.ts | 4 ++-- src/twist/TwistFilter.ts | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/adjustment/AdjustmentFilter.ts b/src/adjustment/AdjustmentFilter.ts index beaa350f7..a9378dfd0 100644 --- a/src/adjustment/AdjustmentFilter.ts +++ b/src/adjustment/AdjustmentFilter.ts @@ -84,7 +84,7 @@ export class AdjustmentFilter extends Filter { options = { ...AdjustmentFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -95,7 +95,7 @@ export class AdjustmentFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'adjustment-filter' diff --git a/src/advanced-bloom/ExtractBrightnessFilter.ts b/src/advanced-bloom/ExtractBrightnessFilter.ts index 4830a0bfb..842b982a4 100644 --- a/src/advanced-bloom/ExtractBrightnessFilter.ts +++ b/src/advanced-bloom/ExtractBrightnessFilter.ts @@ -31,7 +31,7 @@ export class ExtractBrightnessFilter extends Filter { options = { ...ExtractBrightnessFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -42,7 +42,7 @@ export class ExtractBrightnessFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'extract-brightness-filter', diff --git a/src/bevel/BevelFilter.ts b/src/bevel/BevelFilter.ts index 925b107b0..b99d04f89 100644 --- a/src/bevel/BevelFilter.ts +++ b/src/bevel/BevelFilter.ts @@ -78,7 +78,7 @@ export class BevelFilter extends Filter const rotation = (options.rotation ?? 45) * DEG_TO_RAD; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -89,7 +89,7 @@ export class BevelFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'bevel-filter', diff --git a/src/color-gradient/ColorGradientFilter.ts b/src/color-gradient/ColorGradientFilter.ts index 6bf276fac..88ac5ffcf 100644 --- a/src/color-gradient/ColorGradientFilter.ts +++ b/src/color-gradient/ColorGradientFilter.ts @@ -97,7 +97,7 @@ export class ColorGradientFilter extends Filter throw new Error('ColorGradientFilter requires at least 2 color stops.'); } - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source, entryPoint: 'mainVertex', @@ -108,7 +108,7 @@ export class ColorGradientFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'color-gradient-filter', diff --git a/src/cross-hatch/CrossHatchFilter.ts b/src/cross-hatch/CrossHatchFilter.ts index 837e8c76b..5369ddef7 100644 --- a/src/cross-hatch/CrossHatchFilter.ts +++ b/src/cross-hatch/CrossHatchFilter.ts @@ -15,7 +15,7 @@ export class CrossHatchFilter extends Filter { constructor() { - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -26,7 +26,7 @@ export class CrossHatchFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'cross-hatch-filter', diff --git a/src/crt/CRTFilter.ts b/src/crt/CRTFilter.ts index 09d5fe8e9..bad27d434 100644 --- a/src/crt/CRTFilter.ts +++ b/src/crt/CRTFilter.ts @@ -116,7 +116,7 @@ export class CRTFilter extends Filter { options = { ...CRTFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -127,7 +127,7 @@ export class CRTFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'crt-filter', diff --git a/src/glow/GlowFilter.ts b/src/glow/GlowFilter.ts index ac1d0eb09..d81e5ad0d 100644 --- a/src/glow/GlowFilter.ts +++ b/src/glow/GlowFilter.ts @@ -92,7 +92,7 @@ export class GlowFilter extends Filter const distance = options.distance ?? 10; const quality = options.quality ?? 0.1; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -108,7 +108,7 @@ export class GlowFilter extends Filter * since we hard-assign them during creation to allow * for the values to be used in GLSL loops */ - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment: fragment .replace(/__ANGLE_STEP_SIZE__/gi, `${(1 / quality / distance).toFixed(7)}`) diff --git a/src/grayscale/GrayscaleFilter.ts b/src/grayscale/GrayscaleFilter.ts index 10db4c08a..9d90eaedf 100644 --- a/src/grayscale/GrayscaleFilter.ts +++ b/src/grayscale/GrayscaleFilter.ts @@ -15,7 +15,7 @@ export class GrayscaleFilter extends Filter { constructor() { - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -26,7 +26,7 @@ export class GrayscaleFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'grayscale-filter', diff --git a/src/hsl-adjustment/HslAdjustmentFilter.ts b/src/hsl-adjustment/HslAdjustmentFilter.ts index 8dfdc1179..15fc953bc 100644 --- a/src/hsl-adjustment/HslAdjustmentFilter.ts +++ b/src/hsl-adjustment/HslAdjustmentFilter.ts @@ -64,7 +64,7 @@ export class HslAdjustmentFilter extends Filter { options = { ...HslAdjustmentFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -75,7 +75,7 @@ export class HslAdjustmentFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'hsl-adjustment-filter', diff --git a/src/tilt-shift/TiltShiftAxisFilter.ts b/src/tilt-shift/TiltShiftAxisFilter.ts index eb0a544ea..abf16d25d 100644 --- a/src/tilt-shift/TiltShiftAxisFilter.ts +++ b/src/tilt-shift/TiltShiftAxisFilter.ts @@ -59,7 +59,7 @@ export class TiltShiftAxisFilter extends Filter { options = { ...TiltShiftAxisFilter.DEFAULT_OPTIONS, ...options } as TiltShiftAxisFilterOptions; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -70,7 +70,7 @@ export class TiltShiftAxisFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'tilt-shift-axis-filter', diff --git a/src/twist/TwistFilter.ts b/src/twist/TwistFilter.ts index c96ad5029..c96314bb7 100644 --- a/src/twist/TwistFilter.ts +++ b/src/twist/TwistFilter.ts @@ -56,7 +56,7 @@ export class TwistFilter extends Filter { options = { ...TwistFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -67,7 +67,7 @@ export class TwistFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'twist-filter', From 0e74f55ea9132ccadbf044d03782ce4da01d3d75 Mon Sep 17 00:00:00 2001 From: Matt Karl Date: Fri, 9 Feb 2024 15:44:43 -0500 Subject: [PATCH 3/4] Chore: Bump pixi.js to rc.9 (#440) --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a689139db..b18c4c287 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14014,9 +14014,9 @@ } }, "node_modules/pixi.js": { - "version": "8.0.0-rc.6", - "resolved": "https://registry.npmjs.org/pixi.js/-/pixi.js-8.0.0-rc.6.tgz", - "integrity": "sha512-NZM5f1FtnVfee+Hmp7UTgE4+2Y8GPDHWm7OcKOmjoQULQasQDPoIbEJFjUTenaZSXfboDgyWPy386llKmOgaMw==", + "version": "8.0.0-rc.9", + "resolved": "https://registry.npmjs.org/pixi.js/-/pixi.js-8.0.0-rc.9.tgz", + "integrity": "sha512-4xsCeu/qaiKU5zhIU8Ktj3PgHrLh7MGRqmm+7tqewIhGCqdlft2wwxPYmm3pOZczrnzwg+4vqv1QNNHL79vP0w==", "dev": true, "dependencies": { "@pixi/colord": "^2.9.6", From b512624786cd2be563875555d8edb568712e6a59 Mon Sep 17 00:00:00 2001 From: Matt Karl Date: Fri, 9 Feb 2024 15:45:17 -0500 Subject: [PATCH 4/4] Chore: Use Program.from for Caching, Part 2 (#439) --- src/advanced-bloom/AdvancedBloomFilter.ts | 4 ++-- src/ascii/AsciiFilter.ts | 4 ++-- src/bulge-pinch/BulgePinchFilter.ts | 4 ++-- src/color-map/ColorMapFilter.ts | 4 ++-- src/color-overlay/ColorOverlayFilter.ts | 4 ++-- src/color-replace/ColorReplaceFilter.ts | 4 ++-- src/convolution/ConvolutionFilter.ts | 4 ++-- src/dot/DotFilter.ts | 4 ++-- src/drop-shadow/DropShadowFilter.ts | 8 ++++---- src/emboss/EmbossFilter.ts | 4 ++-- src/glitch/GlitchFilter.ts | 4 ++-- src/godray/GodrayFilter.ts | 4 ++-- src/kawase-blur/KawaseBlurFilter.ts | 4 ++-- src/motion-blur/MotionBlurFilter.ts | 4 ++-- src/multi-color-replace/MultiColorReplaceFilter.ts | 4 ++-- src/old-film/OldFilmFilter.ts | 4 ++-- src/outline/OutlineFilter.ts | 4 ++-- src/pixelate/PixelateFilter.ts | 4 ++-- src/radial-blur/RadialBlurFilter.ts | 4 ++-- src/reflection/ReflectionFilter.ts | 4 ++-- src/rgb-split/RGBSplitFilter.ts | 4 ++-- src/shockwave/ShockwaveFilter.ts | 4 ++-- src/simple-lightmap/SimpleLightmapFilter.ts | 4 ++-- src/zoom-blur/ZoomBlurFilter.ts | 4 ++-- 24 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/advanced-bloom/AdvancedBloomFilter.ts b/src/advanced-bloom/AdvancedBloomFilter.ts index de8475f79..9bd17f2c4 100644 --- a/src/advanced-bloom/AdvancedBloomFilter.ts +++ b/src/advanced-bloom/AdvancedBloomFilter.ts @@ -77,7 +77,7 @@ export class AdvancedBloomFilter extends Filter { options = { ...AdvancedBloomFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -88,7 +88,7 @@ export class AdvancedBloomFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'advanced-bloom-filter', diff --git a/src/ascii/AsciiFilter.ts b/src/ascii/AsciiFilter.ts index f8216521c..73433da43 100644 --- a/src/ascii/AsciiFilter.ts +++ b/src/ascii/AsciiFilter.ts @@ -59,7 +59,7 @@ export class AsciiFilter extends Filter options = { ...AsciiFilter.DEFAULT_OPTIONS, ...options } as AsciiFilterOptions; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -70,7 +70,7 @@ export class AsciiFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'ascii-filter', diff --git a/src/bulge-pinch/BulgePinchFilter.ts b/src/bulge-pinch/BulgePinchFilter.ts index c4a440194..004af846c 100644 --- a/src/bulge-pinch/BulgePinchFilter.ts +++ b/src/bulge-pinch/BulgePinchFilter.ts @@ -54,7 +54,7 @@ export class BulgePinchFilter extends Filter { options = { ...BulgePinchFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -64,7 +64,7 @@ export class BulgePinchFilter extends Filter entryPoint: 'mainFragment', }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'bulge-pinch-filter', diff --git a/src/color-map/ColorMapFilter.ts b/src/color-map/ColorMapFilter.ts index 52c448290..60b8a1080 100644 --- a/src/color-map/ColorMapFilter.ts +++ b/src/color-map/ColorMapFilter.ts @@ -60,7 +60,7 @@ export class ColorMapFilter extends Filter if (!options.colorMap) throw Error('No color map texture source was provided to ColorMapFilter'); - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -71,7 +71,7 @@ export class ColorMapFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'color-map-filter', diff --git a/src/color-overlay/ColorOverlayFilter.ts b/src/color-overlay/ColorOverlayFilter.ts index e1e86a37c..187ccf03d 100644 --- a/src/color-overlay/ColorOverlayFilter.ts +++ b/src/color-overlay/ColorOverlayFilter.ts @@ -45,7 +45,7 @@ export class ColorOverlayFilter extends Filter { options = { ...ColorOverlayFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -56,7 +56,7 @@ export class ColorOverlayFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'color-overlay-filter', diff --git a/src/color-replace/ColorReplaceFilter.ts b/src/color-replace/ColorReplaceFilter.ts index 7f670aee6..df575fc3f 100644 --- a/src/color-replace/ColorReplaceFilter.ts +++ b/src/color-replace/ColorReplaceFilter.ts @@ -77,7 +77,7 @@ export class ColorReplaceFilter extends Filter { options = { ...ColorReplaceFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -88,7 +88,7 @@ export class ColorReplaceFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'color-replace-filter', diff --git a/src/convolution/ConvolutionFilter.ts b/src/convolution/ConvolutionFilter.ts index 42008521d..c02e70e81 100644 --- a/src/convolution/ConvolutionFilter.ts +++ b/src/convolution/ConvolutionFilter.ts @@ -62,7 +62,7 @@ export class ConvolutionFilter extends Filter const width = options.width ?? 200; const height = options.height ?? 200; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -73,7 +73,7 @@ export class ConvolutionFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'convolution-filter', diff --git a/src/dot/DotFilter.ts b/src/dot/DotFilter.ts index ad48e70ac..61de05dd9 100644 --- a/src/dot/DotFilter.ts +++ b/src/dot/DotFilter.ts @@ -58,7 +58,7 @@ export class DotFilter extends Filter uGrayScale: { value: options.grayscale ? 1 : 0, type: 'f32' }, }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -69,7 +69,7 @@ export class DotFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'dot-filter', diff --git a/src/drop-shadow/DropShadowFilter.ts b/src/drop-shadow/DropShadowFilter.ts index 5b22288a0..0086ba450 100644 --- a/src/drop-shadow/DropShadowFilter.ts +++ b/src/drop-shadow/DropShadowFilter.ts @@ -101,7 +101,7 @@ export class DropShadowFilter extends Filter { options = { ...DropShadowFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -112,7 +112,7 @@ export class DropShadowFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'drop-shadow-filter', @@ -140,7 +140,7 @@ export class DropShadowFilter extends Filter }); this._basePass = new Filter({ - gpuProgram: new GpuProgram({ + gpuProgram: GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -160,7 +160,7 @@ export class DropShadowFilter extends Filter entryPoint: 'mainFragment', }, }), - glProgram: new GlProgram({ + glProgram: GlProgram.from({ vertex, fragment: ` in vec2 vTextureCoord; diff --git a/src/emboss/EmbossFilter.ts b/src/emboss/EmbossFilter.ts index f4dc29703..1fb50a605 100644 --- a/src/emboss/EmbossFilter.ts +++ b/src/emboss/EmbossFilter.ts @@ -35,7 +35,7 @@ export class EmbossFilter extends Filter { options = { ...EmbossFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -46,7 +46,7 @@ export class EmbossFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'emboss-filter', diff --git a/src/glitch/GlitchFilter.ts b/src/glitch/GlitchFilter.ts index 4fa8f0dbe..5bd0b9f53 100644 --- a/src/glitch/GlitchFilter.ts +++ b/src/glitch/GlitchFilter.ts @@ -121,7 +121,7 @@ export class GlitchFilter extends Filter { options = { ...GlitchFilter.defaults, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -132,7 +132,7 @@ export class GlitchFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'glitch-filter', diff --git a/src/godray/GodrayFilter.ts b/src/godray/GodrayFilter.ts index 4a78f8695..2cf5609fb 100644 --- a/src/godray/GodrayFilter.ts +++ b/src/godray/GodrayFilter.ts @@ -99,7 +99,7 @@ export class GodrayFilter extends Filter { options = { ...GodrayFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -109,7 +109,7 @@ export class GodrayFilter extends Filter entryPoint: 'mainFragment', }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment: fragment.replace('${PERLIN}', perlin), name: 'god-ray-filter', diff --git a/src/kawase-blur/KawaseBlurFilter.ts b/src/kawase-blur/KawaseBlurFilter.ts index 1c41c0815..f6e192a0c 100644 --- a/src/kawase-blur/KawaseBlurFilter.ts +++ b/src/kawase-blur/KawaseBlurFilter.ts @@ -65,7 +65,7 @@ export class KawaseBlurFilter extends Filter { options = { ...KawaseBlurFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -75,7 +75,7 @@ export class KawaseBlurFilter extends Filter entryPoint: 'mainFragment', }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment: options?.clamp ? fragmentClamp : fragment, name: 'kawase-blur-filter', diff --git a/src/motion-blur/MotionBlurFilter.ts b/src/motion-blur/MotionBlurFilter.ts index 57d64701f..c110423a3 100644 --- a/src/motion-blur/MotionBlurFilter.ts +++ b/src/motion-blur/MotionBlurFilter.ts @@ -55,7 +55,7 @@ export class MotionBlurFilter extends Filter { options = { ...MotionBlurFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -66,7 +66,7 @@ export class MotionBlurFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'motion-blur-filter', diff --git a/src/multi-color-replace/MultiColorReplaceFilter.ts b/src/multi-color-replace/MultiColorReplaceFilter.ts index 5363d39bb..35f71eaae 100644 --- a/src/multi-color-replace/MultiColorReplaceFilter.ts +++ b/src/multi-color-replace/MultiColorReplaceFilter.ts @@ -78,7 +78,7 @@ export class MultiColorReplaceFilter extends Filter const maxColors = options.maxColors ?? options.replacements.length; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -89,7 +89,7 @@ export class MultiColorReplaceFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment: fragment.replace(/\$\{MAX_COLORS\}/g, (maxColors).toFixed(0)), name: 'multi-color-replace-filter', diff --git a/src/old-film/OldFilmFilter.ts b/src/old-film/OldFilmFilter.ts index 1e59a01e9..256a16e4f 100644 --- a/src/old-film/OldFilmFilter.ts +++ b/src/old-film/OldFilmFilter.ts @@ -103,7 +103,7 @@ export class OldFilmFilter extends Filter { options = { ...OldFilmFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -114,7 +114,7 @@ export class OldFilmFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'old-film-filter', diff --git a/src/outline/OutlineFilter.ts b/src/outline/OutlineFilter.ts index 8acd250b6..7d9e75462 100644 --- a/src/outline/OutlineFilter.ts +++ b/src/outline/OutlineFilter.ts @@ -83,7 +83,7 @@ export class OutlineFilter extends Filter const quality = options.quality ?? 0.1; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -94,7 +94,7 @@ export class OutlineFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment: fragment.replace(/\$\{ANGLE_STEP\}/, OutlineFilter.getAngleStep(quality).toFixed(7)), name: 'outline-filter', diff --git a/src/pixelate/PixelateFilter.ts b/src/pixelate/PixelateFilter.ts index d3f335071..cb7f0382c 100644 --- a/src/pixelate/PixelateFilter.ts +++ b/src/pixelate/PixelateFilter.ts @@ -29,7 +29,7 @@ export class PixelateFilter extends Filter uSize: { value: new Float32Array(2), type: 'vec2' }, }); - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -40,7 +40,7 @@ export class PixelateFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'pixelate-filter', diff --git a/src/radial-blur/RadialBlurFilter.ts b/src/radial-blur/RadialBlurFilter.ts index ae487af78..b90f69730 100644 --- a/src/radial-blur/RadialBlurFilter.ts +++ b/src/radial-blur/RadialBlurFilter.ts @@ -63,7 +63,7 @@ export class RadialBlurFilter extends Filter { options = { ...RadialBlurFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -74,7 +74,7 @@ export class RadialBlurFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'radial-blur-filter', diff --git a/src/reflection/ReflectionFilter.ts b/src/reflection/ReflectionFilter.ts index ea486c627..77dd1994b 100644 --- a/src/reflection/ReflectionFilter.ts +++ b/src/reflection/ReflectionFilter.ts @@ -83,7 +83,7 @@ export class ReflectionFilter extends Filter { options = { ...ReflectionFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -93,7 +93,7 @@ export class ReflectionFilter extends Filter entryPoint: 'mainFragment', }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'reflection-filter', diff --git a/src/rgb-split/RGBSplitFilter.ts b/src/rgb-split/RGBSplitFilter.ts index 3904f8eb1..2e4a42ac4 100644 --- a/src/rgb-split/RGBSplitFilter.ts +++ b/src/rgb-split/RGBSplitFilter.ts @@ -49,7 +49,7 @@ export class RGBSplitFilter extends Filter { options = { ...RGBSplitFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -60,7 +60,7 @@ export class RGBSplitFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'rgb-split-filter', diff --git a/src/shockwave/ShockwaveFilter.ts b/src/shockwave/ShockwaveFilter.ts index fc3834d33..a8c0a6688 100644 --- a/src/shockwave/ShockwaveFilter.ts +++ b/src/shockwave/ShockwaveFilter.ts @@ -87,7 +87,7 @@ export class ShockwaveFilter extends Filter { options = { ...ShockwaveFilter.DEFAULT_OPTIONS, ...options }; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -98,7 +98,7 @@ export class ShockwaveFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'shockwave-filter' diff --git a/src/simple-lightmap/SimpleLightmapFilter.ts b/src/simple-lightmap/SimpleLightmapFilter.ts index 75e32233a..85cd10d07 100644 --- a/src/simple-lightmap/SimpleLightmapFilter.ts +++ b/src/simple-lightmap/SimpleLightmapFilter.ts @@ -61,7 +61,7 @@ export class SimpleLightmapFilter extends Filter if (!options.lightMap) throw Error('No light map texture source was provided to SimpleLightmapFilter'); - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -71,7 +71,7 @@ export class SimpleLightmapFilter extends Filter entryPoint: 'mainFragment', }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment, name: 'simple-lightmap-filter', diff --git a/src/zoom-blur/ZoomBlurFilter.ts b/src/zoom-blur/ZoomBlurFilter.ts index 84d860ccb..56595429b 100644 --- a/src/zoom-blur/ZoomBlurFilter.ts +++ b/src/zoom-blur/ZoomBlurFilter.ts @@ -66,7 +66,7 @@ export class ZoomBlurFilter extends Filter const kernelSize = options.maxKernelSize ?? 32; - const gpuProgram = new GpuProgram({ + const gpuProgram = GpuProgram.from({ vertex: { source: wgslVertex, entryPoint: 'mainVertex', @@ -77,7 +77,7 @@ export class ZoomBlurFilter extends Filter }, }); - const glProgram = new GlProgram({ + const glProgram = GlProgram.from({ vertex, fragment: fragment.replace('${MAX_KERNEL_SIZE}', kernelSize.toFixed(1)), name: 'zoom-blur-filter',