@flighthq/effects-wgpu 0.5.1-next.1069.554a2ac → 0.5.1-next.1201.9b49dee
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/wgpuBevelEffect.d.ts +2 -2
- package/dist/wgpuBevelEffect.d.ts.map +1 -1
- package/dist/wgpuBevelEffect.js +7 -7
- package/dist/wgpuBevelEffect.js.map +1 -1
- package/dist/wgpuBitmapDisplacementEffect.d.ts +2 -2
- package/dist/wgpuBitmapDisplacementEffect.d.ts.map +1 -1
- package/dist/wgpuBitmapDisplacementEffect.js.map +1 -1
- package/dist/wgpuBlendEffect.d.ts +4 -4
- package/dist/wgpuBlendEffect.d.ts.map +1 -1
- package/dist/wgpuBlendEffect.js.map +1 -1
- package/dist/wgpuBloomEffect.d.ts +2 -2
- package/dist/wgpuBloomEffect.d.ts.map +1 -1
- package/dist/wgpuBloomEffect.js +7 -7
- package/dist/wgpuBloomEffect.js.map +1 -1
- package/dist/wgpuBlurEffect.d.ts +3 -3
- package/dist/wgpuBlurEffect.d.ts.map +1 -1
- package/dist/wgpuBlurEffect.js +5 -5
- package/dist/wgpuBlurEffect.js.map +1 -1
- package/dist/wgpuCameraMotionBlurEffect.d.ts +2 -2
- package/dist/wgpuCameraMotionBlurEffect.d.ts.map +1 -1
- package/dist/wgpuCameraMotionBlurEffect.js.map +1 -1
- package/dist/wgpuChromaticAberrationEffect.d.ts +2 -2
- package/dist/wgpuChromaticAberrationEffect.d.ts.map +1 -1
- package/dist/wgpuChromaticAberrationEffect.js.map +1 -1
- package/dist/wgpuColorLutPass.d.ts +2 -2
- package/dist/wgpuColorLutPass.d.ts.map +1 -1
- package/dist/wgpuColorLutPass.js.map +1 -1
- package/dist/wgpuColorMatrixPass.d.ts +2 -2
- package/dist/wgpuColorMatrixPass.d.ts.map +1 -1
- package/dist/wgpuColorMatrixPass.js.map +1 -1
- package/dist/wgpuCompositeEffect.d.ts +2 -2
- package/dist/wgpuCompositeEffect.d.ts.map +1 -1
- package/dist/wgpuCompositeEffect.js.map +1 -1
- package/dist/wgpuContactShadowsEffect.d.ts +2 -2
- package/dist/wgpuContactShadowsEffect.d.ts.map +1 -1
- package/dist/wgpuContactShadowsEffect.js.map +1 -1
- package/dist/wgpuConvolutionEffect.d.ts +2 -2
- package/dist/wgpuConvolutionEffect.d.ts.map +1 -1
- package/dist/wgpuConvolutionEffect.js.map +1 -1
- package/dist/wgpuCrtEffect.d.ts +2 -2
- package/dist/wgpuCrtEffect.d.ts.map +1 -1
- package/dist/wgpuCrtEffect.js.map +1 -1
- package/dist/wgpuDirectionalBlurEffect.d.ts +2 -2
- package/dist/wgpuDirectionalBlurEffect.d.ts.map +1 -1
- package/dist/wgpuDirectionalBlurEffect.js.map +1 -1
- package/dist/wgpuDisplacementEffect.d.ts +2 -2
- package/dist/wgpuDisplacementEffect.d.ts.map +1 -1
- package/dist/wgpuDisplacementEffect.js.map +1 -1
- package/dist/wgpuDitherEffect.d.ts +2 -2
- package/dist/wgpuDitherEffect.d.ts.map +1 -1
- package/dist/wgpuDitherEffect.js.map +1 -1
- package/dist/wgpuDropShadowEffect.d.ts +2 -2
- package/dist/wgpuDropShadowEffect.d.ts.map +1 -1
- package/dist/wgpuDropShadowEffect.js +7 -7
- package/dist/wgpuDropShadowEffect.js.map +1 -1
- package/dist/wgpuEffectBlitShader.d.ts +4 -4
- package/dist/wgpuEffectBlitShader.d.ts.map +1 -1
- package/dist/wgpuEffectBlitShader.js.map +1 -1
- package/dist/wgpuEffectBoxBlur.d.ts +2 -2
- package/dist/wgpuEffectBoxBlur.d.ts.map +1 -1
- package/dist/wgpuEffectBoxBlur.js.map +1 -1
- package/dist/wgpuEffectPass.d.ts +5 -5
- package/dist/wgpuEffectPass.d.ts.map +1 -1
- package/dist/wgpuEffectPass.js +14 -11
- package/dist/wgpuEffectPass.js.map +1 -1
- package/dist/wgpuEffectTexelScale.d.ts +3 -2
- package/dist/wgpuEffectTexelScale.d.ts.map +1 -1
- package/dist/wgpuEffectTexelScale.js +8 -2
- package/dist/wgpuEffectTexelScale.js.map +1 -1
- package/dist/wgpuEffectTintShader.d.ts +4 -4
- package/dist/wgpuEffectTintShader.d.ts.map +1 -1
- package/dist/wgpuEffectTintShader.js.map +1 -1
- package/dist/wgpuFilmGrainEffect.d.ts +2 -2
- package/dist/wgpuFilmGrainEffect.d.ts.map +1 -1
- package/dist/wgpuFilmGrainEffect.js.map +1 -1
- package/dist/wgpuFxaaEffect.d.ts +2 -2
- package/dist/wgpuFxaaEffect.d.ts.map +1 -1
- package/dist/wgpuFxaaEffect.js.map +1 -1
- package/dist/wgpuGlitchEffect.d.ts +2 -2
- package/dist/wgpuGlitchEffect.d.ts.map +1 -1
- package/dist/wgpuGlitchEffect.js.map +1 -1
- package/dist/wgpuGodRaysEffect.d.ts +2 -2
- package/dist/wgpuGodRaysEffect.d.ts.map +1 -1
- package/dist/wgpuGodRaysEffect.js.map +1 -1
- package/dist/wgpuGradientBevelEffect.d.ts +2 -2
- package/dist/wgpuGradientBevelEffect.d.ts.map +1 -1
- package/dist/wgpuGradientBevelEffect.js +7 -7
- package/dist/wgpuGradientBevelEffect.js.map +1 -1
- package/dist/wgpuGradientGlowEffect.d.ts +2 -2
- package/dist/wgpuGradientGlowEffect.d.ts.map +1 -1
- package/dist/wgpuGradientGlowEffect.js +7 -7
- package/dist/wgpuGradientGlowEffect.js.map +1 -1
- package/dist/wgpuHalftoneEffect.d.ts +2 -2
- package/dist/wgpuHalftoneEffect.d.ts.map +1 -1
- package/dist/wgpuHalftoneEffect.js.map +1 -1
- package/dist/wgpuInnerGlowEffect.d.ts +2 -2
- package/dist/wgpuInnerGlowEffect.d.ts.map +1 -1
- package/dist/wgpuInnerGlowEffect.js +7 -7
- package/dist/wgpuInnerGlowEffect.js.map +1 -1
- package/dist/wgpuInnerShadowEffect.d.ts +2 -2
- package/dist/wgpuInnerShadowEffect.d.ts.map +1 -1
- package/dist/wgpuInnerShadowEffect.js +7 -7
- package/dist/wgpuInnerShadowEffect.js.map +1 -1
- package/dist/wgpuKuwaharaEffect.d.ts +2 -2
- package/dist/wgpuKuwaharaEffect.d.ts.map +1 -1
- package/dist/wgpuKuwaharaEffect.js.map +1 -1
- package/dist/wgpuLensDirtEffect.d.ts +2 -2
- package/dist/wgpuLensDirtEffect.d.ts.map +1 -1
- package/dist/wgpuLensDirtEffect.js +7 -7
- package/dist/wgpuLensDirtEffect.js.map +1 -1
- package/dist/wgpuLensDistortionEffect.d.ts +2 -2
- package/dist/wgpuLensDistortionEffect.d.ts.map +1 -1
- package/dist/wgpuLensDistortionEffect.js.map +1 -1
- package/dist/wgpuLensFlareEffect.d.ts +2 -2
- package/dist/wgpuLensFlareEffect.d.ts.map +1 -1
- package/dist/wgpuLensFlareEffect.js.map +1 -1
- package/dist/wgpuMedianEffect.d.ts +2 -2
- package/dist/wgpuMedianEffect.d.ts.map +1 -1
- package/dist/wgpuMedianEffect.js.map +1 -1
- package/dist/wgpuMotionBlurEffect.d.ts +2 -2
- package/dist/wgpuMotionBlurEffect.d.ts.map +1 -1
- package/dist/wgpuMotionBlurEffect.js.map +1 -1
- package/dist/wgpuOuterGlowEffect.d.ts +2 -2
- package/dist/wgpuOuterGlowEffect.d.ts.map +1 -1
- package/dist/wgpuOuterGlowEffect.js +7 -7
- package/dist/wgpuOuterGlowEffect.js.map +1 -1
- package/dist/wgpuOutlineEffect.d.ts +2 -2
- package/dist/wgpuOutlineEffect.d.ts.map +1 -1
- package/dist/wgpuOutlineEffect.js.map +1 -1
- package/dist/wgpuPixelateEffect.d.ts +2 -2
- package/dist/wgpuPixelateEffect.d.ts.map +1 -1
- package/dist/wgpuPixelateEffect.js.map +1 -1
- package/dist/wgpuPosterizeEffect.d.ts +2 -2
- package/dist/wgpuPosterizeEffect.d.ts.map +1 -1
- package/dist/wgpuPosterizeEffect.js.map +1 -1
- package/dist/wgpuRadialBlurEffect.d.ts +2 -2
- package/dist/wgpuRadialBlurEffect.d.ts.map +1 -1
- package/dist/wgpuRadialBlurEffect.js.map +1 -1
- package/dist/wgpuRenderEffectPipeline.d.ts +3 -3
- package/dist/wgpuRenderEffectPipeline.d.ts.map +1 -1
- package/dist/wgpuRenderEffectPipeline.js +58 -43
- package/dist/wgpuRenderEffectPipeline.js.map +1 -1
- package/dist/wgpuScanlinesEffect.d.ts +2 -2
- package/dist/wgpuScanlinesEffect.d.ts.map +1 -1
- package/dist/wgpuScanlinesEffect.js.map +1 -1
- package/dist/wgpuScreenSpaceFogEffect.d.ts +2 -2
- package/dist/wgpuScreenSpaceFogEffect.d.ts.map +1 -1
- package/dist/wgpuScreenSpaceFogEffect.js.map +1 -1
- package/dist/wgpuSharpenEffect.d.ts +2 -2
- package/dist/wgpuSharpenEffect.d.ts.map +1 -1
- package/dist/wgpuSharpenEffect.js.map +1 -1
- package/dist/wgpuSketchEffect.d.ts +2 -2
- package/dist/wgpuSketchEffect.d.ts.map +1 -1
- package/dist/wgpuSketchEffect.js.map +1 -1
- package/dist/wgpuSmaaEffect.d.ts +2 -2
- package/dist/wgpuSmaaEffect.d.ts.map +1 -1
- package/dist/wgpuSmaaEffect.js.map +1 -1
- package/dist/wgpuSsaoEffect.d.ts +2 -2
- package/dist/wgpuSsaoEffect.d.ts.map +1 -1
- package/dist/wgpuSsaoEffect.js.map +1 -1
- package/dist/wgpuTiltShiftEffect.d.ts +2 -2
- package/dist/wgpuTiltShiftEffect.d.ts.map +1 -1
- package/dist/wgpuTiltShiftEffect.js.map +1 -1
- package/dist/wgpuToneMapEffect.d.ts +2 -2
- package/dist/wgpuToneMapEffect.d.ts.map +1 -1
- package/dist/wgpuToneMapEffect.js.map +1 -1
- package/dist/wgpuVignetteEffect.d.ts +2 -2
- package/dist/wgpuVignetteEffect.d.ts.map +1 -1
- package/dist/wgpuVignetteEffect.js.map +1 -1
- package/dist/wgpuWhiteBalanceEffect.d.ts +2 -2
- package/dist/wgpuWhiteBalanceEffect.d.ts.map +1 -1
- package/dist/wgpuWhiteBalanceEffect.js.map +1 -1
- package/package.json +10 -10
- package/src/enableWgpuRenderEffectGuards.test.ts +8 -6
- package/src/wgpuBevelEffect.test.ts +13 -6
- package/src/wgpuBitmapDisplacementEffect.test.ts +8 -3
- package/src/wgpuBlendEffect.test.ts +3 -3
- package/src/wgpuColorLutPass.test.ts +7 -2
- package/src/wgpuColorMatrixPass.test.ts +2 -2
- package/src/wgpuDropShadowEffect.test.ts +2 -2
- package/src/wgpuEffectBlitShader.test.ts +3 -3
- package/src/wgpuEffectPass.test.ts +20 -18
- package/src/wgpuEffectTexelScale.test.ts +26 -2
- package/src/wgpuGodRaysEffect.test.ts +3 -3
- package/src/wgpuGradientBevelEffect.test.ts +14 -6
- package/src/wgpuHalftoneEffect.test.ts +3 -3
- package/src/wgpuInnerGlowEffect.test.ts +2 -2
- package/src/wgpuInnerShadowEffect.test.ts +2 -2
- package/src/wgpuLensDirtEffect.test.ts +7 -7
- package/src/wgpuLogicalEffectResolution.test.ts +12 -7
- package/src/wgpuOuterGlowEffect.test.ts +2 -2
- package/src/wgpuRadialBlurEffect.test.ts +3 -3
- package/src/wgpuRenderEffectPipeline.test.ts +71 -52
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wgpuTiltShiftEffect.js","sourceRoot":"","sources":["../src/wgpuTiltShiftEffect.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,sGAAsG;AACtG,iGAAiG;AACjG,kGAAkG;AAClG,MAAM,UAAU,0BAA0B,CACxC,KAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"wgpuTiltShiftEffect.js","sourceRoot":"","sources":["../src/wgpuTiltShiftEffect.ts"],"names":[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E,GAAG,CAAC,IAAI,EAAE,MAAyB,CAAC,CAAC;AACzF,CAAC,CAAC;AAEF,MAAM,UAAU,2BAA2B,CAAC,KAAsB;IAChE,wBAAwB,CAAC,KAAK,EAAE,iBAAiB,EAAE,gCAAgC,CAAC,CAAC;AACvF,CAAC;AAED,uGAAuG;AACvG,MAAM,wBAAwB,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2B1C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ToneMapEffect, WgpuRenderEffectRunner, WgpuRenderState,
|
|
2
|
-
export declare function applyToneMapEffectToWgpu(state: WgpuRenderState, source: Readonly<
|
|
1
|
+
import type { ToneMapEffect, WgpuRenderEffectRunner, WgpuRenderState, WgpuTextureRenderTarget } from '@flighthq/types/contract';
|
|
2
|
+
export declare function applyToneMapEffectToWgpu(state: WgpuRenderState, source: Readonly<WgpuTextureRenderTarget>, dest: Readonly<WgpuTextureRenderTarget>, effect: Readonly<ToneMapEffect>): void;
|
|
3
3
|
export declare const defaultWgpuToneMapEffectRunner: WgpuRenderEffectRunner;
|
|
4
4
|
export declare function registerWgpuToneMapEffect(state: WgpuRenderState): void;
|
|
5
5
|
//# sourceMappingURL=wgpuToneMapEffect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wgpuToneMapEffect.d.ts","sourceRoot":"","sources":["../src/wgpuToneMapEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"wgpuToneMapEffect.d.ts","sourceRoot":"","sources":["../src/wgpuToneMapEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AASlC,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EACzC,IAAI,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EACvC,MAAM,EAAE,QAAQ,CAAC,aAAa,CAAC,GAC9B,IAAI,CASN;AAED,eAAO,MAAM,8BAA8B,EAAE,sBAE5C,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAEtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wgpuToneMapEffect.js","sourceRoot":"","sources":["../src/wgpuToneMapEffect.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,uGAAuG;AACvG,8FAA8F;AAC9F,6EAA6E;AAC7E,MAAM,UAAU,wBAAwB,CACtC,KAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"wgpuToneMapEffect.js","sourceRoot":"","sources":["../src/wgpuToneMapEffect.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,uGAAuG;AACvG,8FAA8F;AAC9F,6EAA6E;AAC7E,MAAM,UAAU,wBAAwB,CACtC,KAAsB,EACtB,MAAyC,EACzC,IAAuC,EACvC,MAA+B;IAE/B,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC;IAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,EAAE,WAAW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enderState, source: Readonly<
|
|
1
|
+
import type { VignetteEffect, WgpuRenderEffectRunner, WgpuRenderState, WgpuTextureRenderTarget } from '@flighthq/types/contract';
|
|
2
|
+
export declare function applyVignetteEffectToWgpu(state: WgpuRenderState, source: Readonly<WgpuTextureRenderTarget>, dest: Readonly<WgpuTextureRenderTarget>, effect: Readonly<VignetteEffect>): void;
|
|
3
3
|
export declare const defaultWgpuVignetteEffectRunner: WgpuRenderEffectRunner;
|
|
4
4
|
export declare function registerWgpuVignetteEffect(state: WgpuRenderState): void;
|
|
5
5
|
//# sourceMappingURL=wgpuVignetteEffect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wgpuVignetteEffect.d.ts","sourceRoot":"","sources":["../src/wgpuVignetteEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"wgpuVignetteEffect.d.ts","sourceRoot":"","sources":["../src/wgpuVignetteEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAWlC,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EACzC,IAAI,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EACvC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC,GAC/B,IAAI,CAmBN;AAED,eAAO,MAAM,+BAA+B,EAAE,sBAE7C,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAEvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wgpuVignetteEffect.js","sourceRoot":"","sources":["../src/wgpuVignetteEffect.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CA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AG,CAAC;IAC/B,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAC;IAClG,kBAAkB,CAAC,KAAK,EAAE,MAAiC,EAAE,IAA+B,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;QAC9G,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;QACnB,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;QAChB,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;QAClB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,+BAA+B,GAA2B,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;IACrF,yBAAyB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,MAAwB,CAAC,CAAC;AACvF,CAAC,CAAC;AAEF,MAAM,UAAU,0BAA0B,CAAC,KAAsB;IAC/D,wBAAwB,CAAC,KAAK,EAAE,gBAAgB,EAAE,+BAA+B,CAAC,CAAC;AACrF,CAAC;AAED,qGAAqG;AACrG,sFAAsF;AACtF,MAAM,sBAAsB,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;EAoBxC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { WgpuRenderEffectRunner, WgpuRenderState,
|
|
2
|
-
export declare function applyWhiteBalanceEffectToWgpu(state: WgpuRenderState, source: Readonly<
|
|
1
|
+
import type { WgpuRenderEffectRunner, WgpuRenderState, WgpuTextureRenderTarget, WhiteBalanceEffect } from '@flighthq/types/contract';
|
|
2
|
+
export declare function applyWhiteBalanceEffectToWgpu(state: WgpuRenderState, source: Readonly<WgpuTextureRenderTarget>, dest: Readonly<WgpuTextureRenderTarget>, effect: Readonly<WhiteBalanceEffect>): void;
|
|
3
3
|
export declare const defaultWgpuWhiteBalanceEffectRunner: WgpuRenderEffectRunner;
|
|
4
4
|
export declare function registerWgpuWhiteBalanceEffect(state: WgpuRenderState): void;
|
|
5
5
|
//# sourceMappingURL=wgpuWhiteBalanceEffect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wgpuWhiteBalanceEffect.d.ts","sourceRoot":"","sources":["../src/wgpuWhiteBalanceEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"wgpuWhiteBalanceEffect.d.ts","sourceRoot":"","sources":["../src/wgpuWhiteBalanceEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EACf,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAOlC,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EACzC,IAAI,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EACvC,MAAM,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACnC,IAAI,CAQN;AAED,eAAO,MAAM,mCAAmC,EAAE,sBAEjD,CAAC;AAEF,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAE3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wgpuWhiteBalanceEffect.js","sourceRoot":"","sources":["../src/wgpuWhiteBalanceEffect.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;A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,CAAC;AAC7F,CAAC;AAED,0CAA0C;AAC1C,MAAM,2BAA2B,GAAG,UAAU,CAAC;;;;;;;;;;;;;;EAc7C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/effects-wgpu",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.1201.9b49dee",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/adjustments": "0.5.1-next.
|
|
42
|
-
"@flighthq/color": "0.5.1-next.
|
|
43
|
-
"@flighthq/effects": "0.5.1-next.
|
|
44
|
-
"@flighthq/entity": "0.5.1-next.
|
|
45
|
-
"@flighthq/geometry": "0.5.1-next.
|
|
46
|
-
"@flighthq/log": "0.5.1-next.
|
|
47
|
-
"@flighthq/render-wgpu": "0.5.1-next.
|
|
48
|
-
"@flighthq/registry": "0.5.1-next.
|
|
49
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/adjustments": "0.5.1-next.1201.9b49dee",
|
|
42
|
+
"@flighthq/color": "0.5.1-next.1201.9b49dee",
|
|
43
|
+
"@flighthq/effects": "0.5.1-next.1201.9b49dee",
|
|
44
|
+
"@flighthq/entity": "0.5.1-next.1201.9b49dee",
|
|
45
|
+
"@flighthq/geometry": "0.5.1-next.1201.9b49dee",
|
|
46
|
+
"@flighthq/log": "0.5.1-next.1201.9b49dee",
|
|
47
|
+
"@flighthq/render-wgpu": "0.5.1-next.1201.9b49dee",
|
|
48
|
+
"@flighthq/registry": "0.5.1-next.1201.9b49dee",
|
|
49
|
+
"@flighthq/types": "0.5.1-next.1201.9b49dee"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@webgpu/types": "^0.1.70"
|
|
@@ -9,8 +9,10 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
acquireWgpuRenderTexture,
|
|
11
11
|
beginWgpuFrame,
|
|
12
|
+
beginWgpuScreenRenderPassForTest,
|
|
12
13
|
createWgpuRenderStateForTest,
|
|
13
14
|
createWgpuRenderTexturePool,
|
|
15
|
+
endWgpuRenderPass,
|
|
14
16
|
installWgpuMock,
|
|
15
17
|
writeWgpuRenderTextureTarget,
|
|
16
18
|
} from '@flighthq/render-wgpu/contract';
|
|
@@ -108,9 +110,9 @@ describe('enableWgpuRenderEffectGuards', () => {
|
|
|
108
110
|
] as unknown as Readonly<RenderEffect>[];
|
|
109
111
|
|
|
110
112
|
const entries = captureLog(() => {
|
|
111
|
-
|
|
112
|
-
beginWgpuRenderEffectPipeline(
|
|
113
|
-
|
|
113
|
+
const screenPass = beginWgpuScreenRenderPassForTest(state);
|
|
114
|
+
endWgpuRenderEffectPipeline(beginWgpuRenderEffectPipeline(screenPass, pipeline), pipeline, chain);
|
|
115
|
+
endWgpuRenderPass(screenPass);
|
|
114
116
|
});
|
|
115
117
|
|
|
116
118
|
expect(entries).toHaveLength(1);
|
|
@@ -120,9 +122,9 @@ describe('enableWgpuRenderEffectGuards', () => {
|
|
|
120
122
|
// Once per KIND, not once per frame: a chain missing the same effect every frame is one observation,
|
|
121
123
|
// and a warning that repeated per frame would be its own defect.
|
|
122
124
|
const again = captureLog(() => {
|
|
123
|
-
|
|
124
|
-
beginWgpuRenderEffectPipeline(
|
|
125
|
-
|
|
125
|
+
const screenPass = beginWgpuScreenRenderPassForTest(state);
|
|
126
|
+
endWgpuRenderEffectPipeline(beginWgpuRenderEffectPipeline(screenPass, pipeline), pipeline, chain);
|
|
127
|
+
endWgpuRenderPass(screenPass);
|
|
126
128
|
});
|
|
127
129
|
|
|
128
130
|
expect(again).toHaveLength(0);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { createBevelEffect } from '@flighthq/effects/contract';
|
|
2
2
|
import * as renderWgpuContractModule from '@flighthq/render-wgpu/contract';
|
|
3
3
|
import { createWgpuRenderStateForTest, installWgpuMock } from '@flighthq/render-wgpu/contract';
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
BevelEffect,
|
|
6
|
+
WgpuRenderState,
|
|
7
|
+
WgpuTextureRenderTarget,
|
|
8
|
+
WgpuRenderTargetPool,
|
|
9
|
+
} from '@flighthq/types/contract';
|
|
5
10
|
|
|
6
11
|
import { applyBevelEffectToWgpu, defaultWgpuBevelEffectRunner, registerWgpuBevelEffect } from './wgpuBevelEffect';
|
|
7
12
|
import * as wgpuEffectBlitShaderModule from './wgpuEffectBlitShader';
|
|
@@ -65,7 +70,7 @@ beforeEach(() => {
|
|
|
65
70
|
recorded.tints.push([color, alpha, strength]);
|
|
66
71
|
}) as never);
|
|
67
72
|
|
|
68
|
-
vi.spyOn(renderWgpuContractModule, '
|
|
73
|
+
vi.spyOn(renderWgpuContractModule, 'acquireWgpuTextureRenderTarget').mockImplementation(((
|
|
69
74
|
_state: unknown,
|
|
70
75
|
_pool: unknown,
|
|
71
76
|
descriptor: unknown,
|
|
@@ -74,8 +79,10 @@ beforeEach(() => {
|
|
|
74
79
|
recorded.acquired.push(target);
|
|
75
80
|
return target;
|
|
76
81
|
}) as never);
|
|
77
|
-
vi.spyOn(renderWgpuContractModule, '
|
|
78
|
-
|
|
82
|
+
vi.spyOn(renderWgpuContractModule, 'releaseWgpuTextureRenderTarget').mockImplementation(((
|
|
83
|
+
_pool: unknown,
|
|
84
|
+
target: unknown,
|
|
85
|
+
) => recorded.released.push(target)) as never);
|
|
79
86
|
});
|
|
80
87
|
|
|
81
88
|
afterEach(() => vi.restoreAllMocks());
|
|
@@ -99,7 +106,7 @@ function apply(effect: Readonly<Partial<BevelEffect>> = {}): readonly number[] {
|
|
|
99
106
|
height: SOURCE_HEIGHT,
|
|
100
107
|
view: {},
|
|
101
108
|
width: SOURCE_WIDTH,
|
|
102
|
-
} as unknown as
|
|
109
|
+
} as unknown as WgpuTextureRenderTarget;
|
|
103
110
|
applyBevelEffectToWgpu(
|
|
104
111
|
{} as unknown as WgpuRenderState,
|
|
105
112
|
target,
|
|
@@ -215,7 +222,7 @@ describe('applyBevelEffectToWgpu', () => {
|
|
|
215
222
|
describe('defaultWgpuBevelEffectRunner', () => {
|
|
216
223
|
it('routes the runner context through to the pass', () => {
|
|
217
224
|
recorded.composites.length = 0;
|
|
218
|
-
const target = { format: 'rgba8unorm', height: 8, view: {}, width: 8 } as unknown as
|
|
225
|
+
const target = { format: 'rgba8unorm', height: 8, view: {}, width: 8 } as unknown as WgpuTextureRenderTarget;
|
|
219
226
|
|
|
220
227
|
defaultWgpuBevelEffectRunner(
|
|
221
228
|
{ dest: target, pool: {}, source: target, state: {} } as never,
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { createBitmapDisplacementEffect } from '@flighthq/effects/contract';
|
|
2
2
|
import * as renderWgpuContract from '@flighthq/render-wgpu/contract';
|
|
3
3
|
import { createWgpuRenderStateForTest, installWgpuMock } from '@flighthq/render-wgpu/contract';
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
BitmapDisplacementEffect,
|
|
6
|
+
Texture2D,
|
|
7
|
+
WgpuRenderState,
|
|
8
|
+
WgpuTextureRenderTarget,
|
|
9
|
+
} from '@flighthq/types/contract';
|
|
5
10
|
import { ImageChannel } from '@flighthq/types/contract';
|
|
6
11
|
|
|
7
12
|
import {
|
|
@@ -24,8 +29,8 @@ const source = {
|
|
|
24
29
|
height: 64,
|
|
25
30
|
view: sourceView,
|
|
26
31
|
width: 128,
|
|
27
|
-
} as
|
|
28
|
-
const dest = { ...source, view: {} as GPUTextureView } as
|
|
32
|
+
} as WgpuTextureRenderTarget;
|
|
33
|
+
const dest = { ...source, view: {} as GPUTextureView } as WgpuTextureRenderTarget;
|
|
29
34
|
const map = {
|
|
30
35
|
colorSpace: 'linear',
|
|
31
36
|
dimension: '2d',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WgpuRenderState,
|
|
1
|
+
import type { WgpuRenderState, WgpuTextureRenderTarget } from '@flighthq/types/contract';
|
|
2
2
|
import { AdvancedBlendMode } from '@flighthq/types/contract';
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -16,8 +16,8 @@ function makeState(): WgpuRenderState {
|
|
|
16
16
|
return {} as WgpuRenderState;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function makeTarget():
|
|
20
|
-
return {} as
|
|
19
|
+
function makeTarget(): WgpuTextureRenderTarget {
|
|
20
|
+
return {} as WgpuTextureRenderTarget;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
describe('applyBlendEffectToWgpu', () => {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { installWgpuMock } from '@flighthq/render-wgpu/contract';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
ColorLut,
|
|
4
|
+
WgpuColorLutTextureCache,
|
|
5
|
+
WgpuRenderState,
|
|
6
|
+
WgpuTextureRenderTarget,
|
|
7
|
+
} from '@flighthq/types/contract';
|
|
3
8
|
|
|
4
9
|
import { applyColorLutPassToWgpu } from './wgpuColorLutPass';
|
|
5
10
|
import * as wgpuEffectPassModule from './wgpuEffectPass';
|
|
@@ -111,7 +116,7 @@ function apply(
|
|
|
111
116
|
cache: WgpuColorLutTextureCache,
|
|
112
117
|
format = 'rgba8unorm',
|
|
113
118
|
): void {
|
|
114
|
-
const target = { format, view: { id: 'sourceView' } } as unknown as
|
|
119
|
+
const target = { format, view: { id: 'sourceView' } } as unknown as WgpuTextureRenderTarget;
|
|
115
120
|
applyColorLutPassToWgpu(harness.state, target, target, lut, cache);
|
|
116
121
|
}
|
|
117
122
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WgpuRenderState,
|
|
1
|
+
import type { WgpuRenderState, WgpuTextureRenderTarget } from '@flighthq/types/contract';
|
|
2
2
|
|
|
3
3
|
import { applyColorMatrixPassToWgpu } from './wgpuColorMatrixPass';
|
|
4
4
|
import * as wgpuEffectPassModule from './wgpuEffectPass';
|
|
@@ -32,7 +32,7 @@ afterEach(() => vi.restoreAllMocks());
|
|
|
32
32
|
function packed(matrix: ReadonlyArray<number>): readonly number[] {
|
|
33
33
|
uniformState.uploads.length = 0;
|
|
34
34
|
vi.mocked(wgpuEffectProgramCacheModule.getWgpuEffectPipeline).mockClear();
|
|
35
|
-
const target = {} as unknown as
|
|
35
|
+
const target = {} as unknown as WgpuTextureRenderTarget;
|
|
36
36
|
applyColorMatrixPassToWgpu({} as unknown as WgpuRenderState, target, target, matrix);
|
|
37
37
|
return uniformState.uploads[0]!;
|
|
38
38
|
}
|
|
@@ -16,7 +16,7 @@ let nextTargetId = 0;
|
|
|
16
16
|
beforeEach(() => {
|
|
17
17
|
nextTargetId = 0;
|
|
18
18
|
|
|
19
|
-
vi.spyOn(renderWgpuContract, '
|
|
19
|
+
vi.spyOn(renderWgpuContract, 'acquireWgpuTextureRenderTarget').mockImplementation(((
|
|
20
20
|
_state: unknown,
|
|
21
21
|
_pool: unknown,
|
|
22
22
|
descriptor: Record<string, unknown>,
|
|
@@ -25,7 +25,7 @@ beforeEach(() => {
|
|
|
25
25
|
id: `scratch-${nextTargetId++}`,
|
|
26
26
|
texture: {},
|
|
27
27
|
})) as never);
|
|
28
|
-
vi.spyOn(renderWgpuContract, '
|
|
28
|
+
vi.spyOn(renderWgpuContract, 'releaseWgpuTextureRenderTarget').mockImplementation((() => {}) as never);
|
|
29
29
|
|
|
30
30
|
vi.spyOn(wgpuEffectBlitShaderMod, 'applyWgpuEffectBlitOffsetPass').mockImplementation((() => {}) as never);
|
|
31
31
|
vi.spyOn(wgpuEffectBlitShaderMod, 'applyWgpuEffectBlitPass').mockImplementation((() => {}) as never);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WgpuRenderState,
|
|
1
|
+
import type { WgpuRenderState, WgpuTextureRenderTarget } from '@flighthq/types/contract';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
applyWgpuEffectBlitOffsetPass,
|
|
@@ -41,8 +41,8 @@ function createState(): WgpuRenderState {
|
|
|
41
41
|
return {} as unknown as WgpuRenderState;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function createTarget(id: string):
|
|
45
|
-
return { height: SOURCE_HEIGHT, id, width: SOURCE_WIDTH } as unknown as
|
|
44
|
+
function createTarget(id: string): WgpuTextureRenderTarget {
|
|
45
|
+
return { height: SOURCE_HEIGHT, id, width: SOURCE_WIDTH } as unknown as WgpuTextureRenderTarget;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
function reset(): void {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as renderWgpuContract from '@flighthq/render-wgpu/contract';
|
|
2
|
-
import type { WgpuRenderState,
|
|
2
|
+
import type { WgpuRenderState, WgpuTextureRenderTarget } from '@flighthq/types/contract';
|
|
3
|
+
import { EntityRuntimeKey } from '@flighthq/types/contract';
|
|
3
4
|
|
|
4
5
|
import {
|
|
5
6
|
EFFECT_VERTEX_WGSL,
|
|
@@ -13,18 +14,9 @@ import {
|
|
|
13
14
|
initializeWgpuEffectPipeline,
|
|
14
15
|
} from './wgpuEffectPass';
|
|
15
16
|
|
|
16
|
-
let runtimeMockCurrent: unknown = null;
|
|
17
|
-
|
|
18
17
|
beforeAll(() => renderWgpuContract.installWgpuMock());
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
vi.spyOn(renderWgpuContract, 'getWgpuRenderStateRuntime').mockImplementation((() => runtimeMockCurrent) as never);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
afterEach(() => {
|
|
25
|
-
runtimeMockCurrent = null;
|
|
26
|
-
vi.restoreAllMocks();
|
|
27
|
-
});
|
|
19
|
+
afterEach(() => vi.restoreAllMocks());
|
|
28
20
|
|
|
29
21
|
interface Recorded {
|
|
30
22
|
bindGroups: { dynamicOffsets: number[] | undefined; group: unknown; index: number }[];
|
|
@@ -51,15 +43,19 @@ function createHarness(): { recorded: Recorded; state: WgpuRenderState } {
|
|
|
51
43
|
return pass;
|
|
52
44
|
}),
|
|
53
45
|
};
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
// The enclosing pass, standing in for the screen pass an effect chain composites into: a null
|
|
47
|
+
// destination resolves to ITS colorView, which is what makes "present to the canvas" a fact about the
|
|
48
|
+
// open pass rather than about a view cached on the state.
|
|
49
|
+
const enclosingPass = { colorView: { id: 'canvasView' }, encoder: null };
|
|
50
|
+
const runtime = {
|
|
56
51
|
commandEncoder,
|
|
52
|
+
passStack: [enclosingPass],
|
|
57
53
|
renderPass: null,
|
|
58
54
|
renderTargetViewport: { height: 64, width: 64 },
|
|
59
55
|
};
|
|
60
56
|
let nextBindGroup = 0;
|
|
61
57
|
const state = {
|
|
62
|
-
|
|
58
|
+
[EntityRuntimeKey]: runtime,
|
|
63
59
|
device: {
|
|
64
60
|
createBindGroup: vi.fn(() => ({ id: `bindGroup-${nextBindGroup++}` })),
|
|
65
61
|
createBindGroupLayout: vi.fn((descriptor: unknown) => ({ descriptor })),
|
|
@@ -77,8 +73,14 @@ function createHarness(): { recorded: Recorded; state: WgpuRenderState } {
|
|
|
77
73
|
return { recorded, state };
|
|
78
74
|
}
|
|
79
75
|
|
|
80
|
-
function createTarget(id: string):
|
|
81
|
-
return {
|
|
76
|
+
function createTarget(id: string): WgpuTextureRenderTarget {
|
|
77
|
+
return {
|
|
78
|
+
format: 'rgba8unorm',
|
|
79
|
+
height: 32,
|
|
80
|
+
id,
|
|
81
|
+
view: { id: `${id}-view` },
|
|
82
|
+
width: 64,
|
|
83
|
+
} as unknown as WgpuTextureRenderTarget;
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
// `select(whenFalse, whenTrue, condition)` in WGSL. Both arguments are read out of the shipped shader
|
|
@@ -342,10 +344,10 @@ describe('getWgpuEffectPassState', () => {
|
|
|
342
344
|
// AGENTS.md reserves throwing for exactly this, and the message names the call that was missed.
|
|
343
345
|
it('throws when there is no active command encoder', () => {
|
|
344
346
|
const harness = createHarness();
|
|
345
|
-
(
|
|
347
|
+
(renderWgpuContract.getWgpuRenderStateRuntime(harness.state) as { commandEncoder: unknown }).commandEncoder = null;
|
|
346
348
|
|
|
347
349
|
expect(() => getWgpuEffectPassState(harness.state).beginPass(createTarget('dest'), 'load')).toThrow(
|
|
348
|
-
'
|
|
350
|
+
'beginWgpuRenderPass',
|
|
349
351
|
);
|
|
350
352
|
});
|
|
351
353
|
});
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
import { EntityRuntimeKey } from '@flighthq/types/contract';
|
|
1
2
|
import { describe, expect, it } from 'vitest';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getWgpuEffectLogicalResolution,
|
|
6
|
+
getWgpuEffectLogicalWidth,
|
|
7
|
+
getWgpuRenderTargetTexelScale,
|
|
8
|
+
} from './wgpuEffectTexelScale';
|
|
4
9
|
|
|
5
10
|
describe('getWgpuEffectLogicalResolution', () => {
|
|
6
|
-
|
|
11
|
+
// Logical pixels are the open pass's viewport: a scratch target twice that wide holds two texels per
|
|
12
|
+
// logical pixel, whatever its own sample count says.
|
|
13
|
+
const state = { [EntityRuntimeKey]: { passStack: [{ viewport: { height: 600, width: 800 } }] } };
|
|
7
14
|
|
|
8
15
|
it('preserves native target dimensions', () => {
|
|
9
16
|
expect(
|
|
@@ -32,6 +39,23 @@ describe('getWgpuEffectLogicalResolution', () => {
|
|
|
32
39
|
});
|
|
33
40
|
});
|
|
34
41
|
|
|
42
|
+
describe('getWgpuEffectLogicalWidth', () => {
|
|
43
|
+
it('measures against the open pass viewport while a chain runs inside a frame', () => {
|
|
44
|
+
const state = { [EntityRuntimeKey]: { passStack: [{ viewport: { height: 600, width: 800 } }] } };
|
|
45
|
+
|
|
46
|
+
expect(getWgpuEffectLogicalWidth(state as never, { width: 1600 } as never)).toBe(800);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// The render-texture path applies effects with no enclosing pass: there the target IS the logical
|
|
50
|
+
// space, and measuring against a canvas that is not being drawn into would scale every distance by an
|
|
51
|
+
// unrelated ratio.
|
|
52
|
+
it('falls back to the target itself when no pass is open', () => {
|
|
53
|
+
const state = { [EntityRuntimeKey]: { passStack: [] } };
|
|
54
|
+
|
|
55
|
+
expect(getWgpuEffectLogicalWidth(state as never, { width: 16 } as never)).toBe(16);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
35
59
|
describe('getWgpuRenderTargetTexelScale', () => {
|
|
36
60
|
it('derives integer texel density from target and canvas widths', () => {
|
|
37
61
|
expect(getWgpuRenderTargetTexelScale(800, 800)).toBe(1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createGodRaysEffect } from '@flighthq/effects/contract';
|
|
2
2
|
import { createWgpuRenderStateForTest, installWgpuMock } from '@flighthq/render-wgpu/contract';
|
|
3
|
-
import type { GodRaysEffect, WgpuRenderState,
|
|
3
|
+
import type { GodRaysEffect, WgpuRenderState, WgpuTextureRenderTarget } from '@flighthq/types/contract';
|
|
4
4
|
|
|
5
5
|
import * as wgpuEffectPassModule from './wgpuEffectPass';
|
|
6
6
|
import * as wgpuEffectProgramCacheModule from './wgpuEffectProgramCache';
|
|
@@ -47,7 +47,7 @@ afterEach(() => vi.restoreAllMocks());
|
|
|
47
47
|
function apply(effect: Readonly<Partial<GodRaysEffect>> = {}): readonly number[] {
|
|
48
48
|
recorded.pipelines.length = 0;
|
|
49
49
|
recorded.uniforms.length = 0;
|
|
50
|
-
const target = { height: 64, view: {}, width: 64 } as unknown as
|
|
50
|
+
const target = { height: 64, view: {}, width: 64 } as unknown as WgpuTextureRenderTarget;
|
|
51
51
|
applyGodRaysEffectToWgpu({} as unknown as WgpuRenderState, target, target, createGodRaysEffect(effect));
|
|
52
52
|
return recorded.uniforms[0]!;
|
|
53
53
|
}
|
|
@@ -120,7 +120,7 @@ describe('applyGodRaysEffectToWgpu', () => {
|
|
|
120
120
|
describe('defaultWgpuGodRaysEffectRunner', () => {
|
|
121
121
|
it('routes the runner context through to the pass', () => {
|
|
122
122
|
recorded.uniforms.length = 0;
|
|
123
|
-
const target = { height: 8, view: {}, width: 8 } as unknown as
|
|
123
|
+
const target = { height: 8, view: {}, width: 8 } as unknown as WgpuTextureRenderTarget;
|
|
124
124
|
|
|
125
125
|
defaultWgpuGodRaysEffectRunner(
|
|
126
126
|
{ dest: target, pool: {}, source: target, state: {} } as never,
|
|
@@ -4,7 +4,7 @@ import { createWgpuRenderStateForTest, installWgpuMock } from '@flighthq/render-
|
|
|
4
4
|
import type {
|
|
5
5
|
GradientBevelEffect,
|
|
6
6
|
WgpuRenderState,
|
|
7
|
-
|
|
7
|
+
WgpuTextureRenderTarget,
|
|
8
8
|
WgpuRenderTargetPool,
|
|
9
9
|
} from '@flighthq/types/contract';
|
|
10
10
|
|
|
@@ -100,7 +100,7 @@ beforeEach(() => {
|
|
|
100
100
|
recorded.tints.push([color, alpha, strength]);
|
|
101
101
|
}) as never);
|
|
102
102
|
|
|
103
|
-
vi.spyOn(renderWgpuContractModule, '
|
|
103
|
+
vi.spyOn(renderWgpuContractModule, 'acquireWgpuTextureRenderTarget').mockImplementation(((
|
|
104
104
|
_state: unknown,
|
|
105
105
|
_pool: unknown,
|
|
106
106
|
descriptor: object,
|
|
@@ -109,8 +109,10 @@ beforeEach(() => {
|
|
|
109
109
|
recorded.acquired.push(target);
|
|
110
110
|
return target;
|
|
111
111
|
}) as never);
|
|
112
|
-
vi.spyOn(renderWgpuContractModule, '
|
|
113
|
-
|
|
112
|
+
vi.spyOn(renderWgpuContractModule, 'releaseWgpuTextureRenderTarget').mockImplementation(((
|
|
113
|
+
_pool: unknown,
|
|
114
|
+
target: unknown,
|
|
115
|
+
) => recorded.released.push(target)) as never);
|
|
114
116
|
});
|
|
115
117
|
|
|
116
118
|
afterEach(() => {
|
|
@@ -144,7 +146,7 @@ function apply(effect: Readonly<Partial<GradientBevelEffect>> = {}): void {
|
|
|
144
146
|
id: 'source',
|
|
145
147
|
view: {},
|
|
146
148
|
width: SOURCE_WIDTH,
|
|
147
|
-
} as unknown as
|
|
149
|
+
} as unknown as WgpuTextureRenderTarget;
|
|
148
150
|
applyGradientBevelEffectToWgpu(
|
|
149
151
|
state,
|
|
150
152
|
target,
|
|
@@ -252,7 +254,13 @@ describe('applyGradientBevelEffectToWgpu', () => {
|
|
|
252
254
|
describe('defaultWgpuGradientBevelEffectRunner', () => {
|
|
253
255
|
it('routes the runner context through to the pass', () => {
|
|
254
256
|
for (const key of Object.keys(recorded) as (keyof typeof recorded)[]) recorded[key].length = 0;
|
|
255
|
-
const target = {
|
|
257
|
+
const target = {
|
|
258
|
+
format: 'rgba8unorm',
|
|
259
|
+
height: 8,
|
|
260
|
+
id: 'source',
|
|
261
|
+
view: {},
|
|
262
|
+
width: 8,
|
|
263
|
+
} as unknown as WgpuTextureRenderTarget;
|
|
256
264
|
|
|
257
265
|
defaultWgpuGradientBevelEffectRunner(
|
|
258
266
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHalftoneEffect } from '@flighthq/effects/contract';
|
|
2
2
|
import { createWgpuRenderStateForTest, installWgpuMock } from '@flighthq/render-wgpu/contract';
|
|
3
|
-
import type { HalftoneEffect, WgpuRenderState,
|
|
3
|
+
import type { HalftoneEffect, WgpuRenderState, WgpuTextureRenderTarget } from '@flighthq/types/contract';
|
|
4
4
|
|
|
5
5
|
import * as wgpuEffectPassModule from './wgpuEffectPass';
|
|
6
6
|
import * as wgpuEffectProgramCacheModule from './wgpuEffectProgramCache';
|
|
@@ -56,7 +56,7 @@ const SOURCE_HEIGHT = 64;
|
|
|
56
56
|
function apply(effect: Readonly<Partial<HalftoneEffect>> = {}): readonly number[] {
|
|
57
57
|
recorded.pipelines.length = 0;
|
|
58
58
|
recorded.uniforms.length = 0;
|
|
59
|
-
const target = { height: SOURCE_HEIGHT, view: {}, width: SOURCE_WIDTH } as unknown as
|
|
59
|
+
const target = { height: SOURCE_HEIGHT, view: {}, width: SOURCE_WIDTH } as unknown as WgpuTextureRenderTarget;
|
|
60
60
|
applyHalftoneEffectToWgpu({} as unknown as WgpuRenderState, target, target, createHalftoneEffect(effect));
|
|
61
61
|
return recorded.uniforms[0]!;
|
|
62
62
|
}
|
|
@@ -172,7 +172,7 @@ describe('applyHalftoneEffectToWgpu', () => {
|
|
|
172
172
|
describe('defaultWgpuHalftoneEffectRunner', () => {
|
|
173
173
|
it('routes the runner context through to the pass', () => {
|
|
174
174
|
recorded.uniforms.length = 0;
|
|
175
|
-
const target = { height: 8, view: {}, width: 8 } as unknown as
|
|
175
|
+
const target = { height: 8, view: {}, width: 8 } as unknown as WgpuTextureRenderTarget;
|
|
176
176
|
|
|
177
177
|
defaultWgpuHalftoneEffectRunner(
|
|
178
178
|
{ dest: target, pool: {}, source: target, state: {} } as never,
|
|
@@ -16,7 +16,7 @@ let nextTargetId = 0;
|
|
|
16
16
|
beforeEach(() => {
|
|
17
17
|
nextTargetId = 0;
|
|
18
18
|
|
|
19
|
-
vi.spyOn(renderWgpuContract, '
|
|
19
|
+
vi.spyOn(renderWgpuContract, 'acquireWgpuTextureRenderTarget').mockImplementation(((
|
|
20
20
|
_state: unknown,
|
|
21
21
|
_pool: unknown,
|
|
22
22
|
descriptor: Record<string, unknown>,
|
|
@@ -25,7 +25,7 @@ beforeEach(() => {
|
|
|
25
25
|
id: `scratch-${nextTargetId++}`,
|
|
26
26
|
texture: {},
|
|
27
27
|
})) as never);
|
|
28
|
-
vi.spyOn(renderWgpuContract, '
|
|
28
|
+
vi.spyOn(renderWgpuContract, 'releaseWgpuTextureRenderTarget').mockImplementation((() => {}) as never);
|
|
29
29
|
|
|
30
30
|
vi.spyOn(wgpuEffectBlitShaderMod, 'applyWgpuEffectBlitPass').mockImplementation((() => {}) as never);
|
|
31
31
|
|
|
@@ -16,7 +16,7 @@ let nextTargetId = 0;
|
|
|
16
16
|
beforeEach(() => {
|
|
17
17
|
nextTargetId = 0;
|
|
18
18
|
|
|
19
|
-
vi.spyOn(renderWgpuContract, '
|
|
19
|
+
vi.spyOn(renderWgpuContract, 'acquireWgpuTextureRenderTarget').mockImplementation(((
|
|
20
20
|
_state: unknown,
|
|
21
21
|
_pool: unknown,
|
|
22
22
|
descriptor: Record<string, unknown>,
|
|
@@ -25,7 +25,7 @@ beforeEach(() => {
|
|
|
25
25
|
id: `scratch-${nextTargetId++}`,
|
|
26
26
|
texture: {},
|
|
27
27
|
})) as never);
|
|
28
|
-
vi.spyOn(renderWgpuContract, '
|
|
28
|
+
vi.spyOn(renderWgpuContract, 'releaseWgpuTextureRenderTarget').mockImplementation((() => {}) as never);
|
|
29
29
|
|
|
30
30
|
vi.spyOn(wgpuEffectBlitShaderMod, 'applyWgpuEffectBlitOffsetPass').mockImplementation((() => {}) as never);
|
|
31
31
|
vi.spyOn(wgpuEffectBlitShaderMod, 'applyWgpuEffectBlitPass').mockImplementation((() => {}) as never);
|