Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global: Move some WebGPU modules from core to addons. #29511

Merged
merged 5 commits into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
import TempNode from '../core/TempNode.js';
import { nodeObject, Fn, float, vec4 } from '../tsl/TSLBase.js';
import { NodeUpdateType } from '../core/constants.js';
import { uv } from '../accessors/UV.js';
import { texture } from '../accessors/TextureNode.js';
import { passTexture } from './PassNode.js';
import { uniform } from '../core/UniformNode.js';
import { sign, max } from '../math/MathNode.js';
import { convertToTexture } from '../utils/RTTNode.js';
import QuadMesh from '../../renderers/common/QuadMesh.js';
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';

import { Vector2 } from '../../math/Vector2.js';
import { RenderTarget } from '../../core/RenderTarget.js';
import { RenderTarget, Vector2 } from 'three';
import { TempNode, nodeObject, Fn, float, vec4, NodeUpdateType, uv, texture, passTexture, uniform, sign, max, convertToTexture, QuadMesh, NodeMaterial } from 'three/tsl';

const _size = /*@__PURE__*/ new Vector2();

Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { Fn, nodeObject, vec4 } from '../tsl/TSLBase.js';
import { Matrix3 } from '../../math/Matrix3.js';
import { uniform } from '../core/UniformNode.js';
import { uv } from '../accessors/UV.js';
import { clamp, max } from '../math/MathNode.js';
import { Matrix3 } from 'three';
import { clamp, nodeObject, Fn, vec4, uv, uniform, max, NodeMaterial } from 'three/tsl';
import StereoCompositePassNode from './StereoCompositePassNode.js';
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';

class AnaglyphPassNode extends StereoCompositePassNode {

Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
import TempNode from '../core/TempNode.js';
import { nodeObject, Fn, float, vec2, vec3 } from '../tsl/TSLBase.js';
import { Loop } from '../utils/LoopNode.js';
import { uniform } from '../core/UniformNode.js';
import { NodeUpdateType } from '../core/constants.js';
import { threshold } from './ColorAdjustment.js';
import { uv } from '../accessors/UV.js';
import { passTexture } from './PassNode.js';
import { convertToTexture } from '../utils/RTTNode.js';
import QuadMesh from '../../renderers/common/QuadMesh.js';
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';

import { Vector2 } from '../../math/Vector2.js';
import { RenderTarget } from '../../core/RenderTarget.js';
import { RenderTarget, Vector2 } from 'three';
import { TempNode, nodeObject, Fn, float, NodeUpdateType, uv, passTexture, uniform, convertToTexture, QuadMesh, NodeMaterial, vec2, vec3, Loop, threshold } from 'three/tsl';

const _quadMesh = /*@__PURE__*/ new QuadMesh();

Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { float, Fn, vec3, vec4 } from '../tsl/TSLBase.js';
import { min, max, mix } from '../math/MathNode.js';
import { luminance } from './ColorAdjustment.js';
import { float, Fn, vec3, vec4, min, max, mix, luminance } from 'three/tsl';

export const bleach = /*@__PURE__*/ Fn( ( [ color, opacity = 1 ] ) => {

Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
import TempNode from '../core/TempNode.js';
import { Fn, nodeObject, float, vec4, int } from '../tsl/TSLBase.js';
import { mix, smoothstep } from '../math/MathNode.js';
import { luminance } from './ColorAdjustment.js';
import { uniform } from '../core/UniformNode.js';
import { uniformArray } from '../accessors/UniformArrayNode.js';
import { uv } from '../accessors/UV.js';
import { Color } from '../../math/Color.js';
import { passTexture } from './PassNode.js';
import { RenderTarget } from '../../core/RenderTarget.js';
import { HalfFloatType } from '../../constants.js';
import { NodeUpdateType } from '../core/constants.js';
import { Vector2 } from '../../math/Vector2.js';
import { Loop } from '../utils/LoopNode.js';
import { add } from '../math/OperatorNode.js';
import QuadMesh from '../../renderers/common/QuadMesh.js';
import { texture } from '../accessors/TextureNode.js';
import { Vector3 } from '../../math/Vector3.js';
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
import { Color, HalfFloatType, RenderTarget, Vector2, Vector3 } from 'three';
import { TempNode, nodeObject, Fn, float, NodeUpdateType, uv, passTexture, uniform, QuadMesh, NodeMaterial, Loop, texture, luminance, smoothstep, mix, vec4, uniformArray, add, int } from 'three/tsl';

const _quadMesh = /*@__PURE__*/ new QuadMesh();

Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
import TempNode from '../core/TempNode.js';
import { uv } from '../accessors/UV.js';
import { Fn, nodeObject, float, int, vec2, vec3, vec4, mat2, If } from '../tsl/TSLBase.js';
import { NodeUpdateType } from '../core/constants.js';
import { uniform } from '../core/UniformNode.js';
import { uniformArray } from '../accessors/UniformArrayNode.js';
import { abs, dot, sin, cos, PI, pow, max } from '../math/MathNode.js';
import { Loop } from '../utils/LoopNode.js';
import { luminance } from './ColorAdjustment.js';
import { textureSize } from '../accessors/TextureSizeNode.js';
import { convertToTexture } from '../utils/RTTNode.js';

import { Vector2 } from '../../math/Vector2.js';
import { Vector3 } from '../../math/Vector3.js';
import { Vector2, Vector3 } from 'three';
import { convertToTexture, TempNode, nodeObject, Fn, float, NodeUpdateType, uv, uniform, Loop, luminance, vec2, vec3, vec4, uniformArray, int, dot, max, pow, abs, If, textureSize, sin, cos, mat2, PI } from 'three/tsl';

class DenoiseNode extends TempNode {

Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import TempNode from '../core/TempNode.js';
import { uv } from '../accessors/UV.js';
import { Fn, nodeObject, vec2, vec4 } from '../tsl/TSLBase.js';
import { NodeUpdateType } from '../core/constants.js';
import { uniform } from '../core/UniformNode.js';
import { clamp } from '../math/MathNode.js';
import { convertToTexture } from '../utils/RTTNode.js';
import { convertToTexture, TempNode, nodeObject, Fn, NodeUpdateType, uv, uniform, vec2, vec4, clamp } from 'three/tsl';

class DepthOfFieldNode extends TempNode {

Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import TempNode from '../core/TempNode.js';
import { nodeObject, Fn, vec2, vec3, vec4 } from '../tsl/TSLBase.js';
import { uniform } from '../core/UniformNode.js';
import { uv } from '../accessors/UV.js';
import { sin, cos } from '../math/MathNode.js';
import { add } from '../math/OperatorNode.js';
import { screenSize } from './ScreenNode.js';

import { Vector2 } from '../../math/Vector2.js';
import { Vector2 } from 'three';
import { TempNode, nodeObject, Fn, uv, uniform, vec2, vec3, sin, cos, add, vec4, screenSize } from 'three/tsl';

class DotScreenNode extends TempNode {

Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import TempNode from '../core/TempNode.js';
import { uv } from '../accessors/UV.js';
import { Fn, nodeObject, float, vec2, vec4, int, If } from '../tsl/TSLBase.js';
import { NodeUpdateType } from '../core/constants.js';
import { uniform } from '../core/UniformNode.js';
import { abs, max, min, mix, pow } from '../math/MathNode.js';
import { sub } from '../math/OperatorNode.js';
import { Loop, Break } from '../utils/LoopNode.js';
import { convertToTexture } from '../utils/RTTNode.js';

import { Vector2 } from '../../math/Vector2.js';
import { Vector2 } from 'three';
import { TempNode, nodeObject, Fn, float, NodeUpdateType, uv, uniform, convertToTexture, vec2, vec4, If, Loop, int, max, min, pow, mix, Break, abs, sub } from 'three/tsl';

class FXAANode extends TempNode {

Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import TempNode from '../core/TempNode.js';
import { uv } from '../accessors/UV.js';
import { Fn, nodeProxy, vec4 } from '../tsl/TSLBase.js';
import { mix, fract, clamp, rand } from '../math/MathNode.js';
import { timerLocal } from '../utils/TimerNode.js';
import { TempNode, rand, Fn, fract, timerLocal, uv, clamp, mix, vec4, nodeProxy } from 'three/tsl';

class FilmNode extends TempNode {

Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
import TempNode from '../core/TempNode.js';
import { texture } from '../accessors/TextureNode.js';
import { textureSize } from '../accessors/TextureSizeNode.js';
import { uv } from '../accessors/UV.js';
import { nodeObject, Fn, mat3, vec2, vec3, vec4, float, int, If } from '../tsl/TSLBase.js';
import { NodeUpdateType } from '../core/constants.js';
import { uniform } from '../core/UniformNode.js';
import { DataTexture } from '../../textures/DataTexture.js';
import { Vector2 } from '../../math/Vector2.js';
import { Vector3 } from '../../math/Vector3.js';
import { PI, cos, sin, pow, clamp, abs, max, mix, sqrt, acos, dot, normalize, cross } from '../math/MathNode.js';
import { div, mul, add, sub } from '../math/OperatorNode.js';
import { Loop } from '../utils/LoopNode.js';
import { passTexture } from './PassNode.js';
import { RepeatWrapping } from '../../constants.js';
import QuadMesh from '../../renderers/common/QuadMesh.js';
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';

import { RenderTarget } from '../../core/RenderTarget.js';
import { Color } from '../../math/Color.js';
import { Color, DataTexture, RenderTarget, RepeatWrapping, Vector2, Vector3 } from 'three';
import { QuadMesh, TempNode, nodeObject, Fn, float, NodeUpdateType, uv, uniform, Loop, vec2, vec3, vec4, int, dot, max, pow, abs, If, textureSize, sin, cos, PI, texture, passTexture, mat3, add, normalize, mul, cross, div, mix, sqrt, sub, acos, clamp, NodeMaterial } from 'three/tsl';

const _quadMesh = /*@__PURE__*/ new QuadMesh();
const _currentClearColor = /*@__PURE__*/ new Color();
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import TempNode from '../core/TempNode.js';
import { nodeObject, Fn, float, vec2, vec4 } from '../tsl/TSLBase.js';
import { NodeUpdateType } from '../core/constants.js';
import { mul } from '../math/OperatorNode.js';
import { uv } from '../accessors/UV.js';
import { passTexture } from './PassNode.js';
import { uniform } from '../core/UniformNode.js';
import { convertToTexture } from '../utils/RTTNode.js';
import QuadMesh from '../../renderers/common/QuadMesh.js';

import { Vector2 } from '../../math/Vector2.js';
import { RenderTarget } from '../../core/RenderTarget.js';
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
import { RenderTarget, Vector2 } from 'three';
import { TempNode, nodeObject, Fn, float, NodeUpdateType, uv, uniform, convertToTexture, vec2, vec4, QuadMesh, passTexture, mul, NodeMaterial } from 'three/tsl';

// WebGPU: The use of a single QuadMesh for both gaussian blur passes results in a single RenderObject with a SampledTexture binding that
// alternates between source textures and triggers creation of new BindGroups and BindGroupLayouts every frame.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import TempNode from '../core/TempNode.js';
import { Fn, nodeObject, vec3, vec4, float } from '../tsl/TSLBase.js';
import { uniform } from '../core/UniformNode.js';
import { mix } from '../math/MathNode.js';
import { TempNode, nodeObject, Fn, float, uniform, vec3, vec4, mix } from 'three/tsl';

class Lut3DNode extends TempNode {

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { float, int, Fn } from '../tsl/TSLBase.js';
import { Loop } from '../utils/LoopNode.js';
import { uv } from '../accessors/UV.js';

import { Fn, float, uv, Loop, int } from 'three/tsl';

export const motionBlur = /*@__PURE__*/ Fn( ( [ inputNode, velocity, numSamples = int( 16 ) ] ) => {

Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { Fn, If, nodeObject, vec4 } from '../tsl/TSLBase.js';
import { uv } from '../accessors/UV.js';
import { mod } from '../math/MathNode.js';
import { screenCoordinate } from './ScreenNode.js';
import { nodeObject, Fn, vec4, uv, NodeMaterial, If, mod, screenCoordinate } from 'three/tsl';
import StereoCompositePassNode from './StereoCompositePassNode.js';
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';

class ParallaxBarrierPassNode extends StereoCompositePassNode {

Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
import TempNode from '../core/TempNode.js';
import { uv } from '../accessors/UV.js';
import { Fn, nodeObject, vec2, vec3, float, If } from '../tsl/TSLBase.js';
import { NodeUpdateType } from '../core/constants.js';
import { uniform } from '../core/UniformNode.js';
import { dot, clamp, smoothstep, sign, step, floor } from '../math/MathNode.js';
import { Vector4 } from '../../math/Vector4.js';
import { output, property } from '../core/PropertyNode.js';
import PassNode from './PassNode.js';
import { mrt } from '../core/MRTNode.js';
import { normalView } from '../accessors/Normal.js';
import { convertToTexture } from '../utils/RTTNode.js';

import { NearestFilter } from '../../constants.js';
import { NearestFilter, Vector4 } from 'three';
import { TempNode, nodeObject, Fn, float, NodeUpdateType, uv, uniform, convertToTexture, vec2, vec3, clamp, floor, dot, smoothstep, If, sign, step, mrt, output, normalView, PassNode, property } from 'three/tsl';

class PixelationNode extends TempNode {

Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import TempNode from '../core/TempNode.js';
import { nodeObject, Fn, vec2, vec4 } from '../tsl/TSLBase.js';
import { uniform } from '../core/UniformNode.js';
import { uv } from '../accessors/UV.js';
import { sin, cos } from '../math/MathNode.js';
import { convertToTexture } from '../utils/RTTNode.js';
import { TempNode, nodeObject, Fn, uv, uniform, vec2, sin, cos, vec4, convertToTexture } from 'three/tsl';

class RGBShiftNode extends TempNode {

Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import { nodeObject } from '../tsl/TSLBase.js';
import PassNode from './PassNode.js';
import { Color } from '../../math/Color.js';
import { Vector2 } from '../../math/Vector2.js';
import { AdditiveBlending } from '../../constants.js';
import { uniform } from '../core/UniformNode.js';
import QuadMesh from '../../renderers/common/QuadMesh.js';
import { texture } from '../accessors/TextureNode.js';
import { mrt, getTextureIndex } from '../core/MRTNode.js';
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
import { AdditiveBlending, Color, Vector2 } from 'three';
import { nodeObject, uniform, mrt, PassNode, QuadMesh, texture, NodeMaterial, getTextureIndex } from 'three/tsl';

const _size = /*@__PURE__*/ new Vector2();

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Fn, vec3, vec4 } from '../tsl/TSLBase.js';
import { dot } from '../math/MathNode.js';
import { dot, Fn, vec3, vec4 } from 'three/tsl';

export const sepia = /*@__PURE__*/ Fn( ( [ color ] ) => {

Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import TempNode from '../core/TempNode.js';
import { uv } from '../accessors/UV.js';
import { luminance } from './ColorAdjustment.js';
import { Fn, nodeObject, vec2, vec3, vec4, mat3 } from '../tsl/TSLBase.js';
import { NodeUpdateType } from '../core/constants.js';
import { uniform } from '../core/UniformNode.js';
import { add } from '../math/OperatorNode.js';
import { convertToTexture } from '../utils/RTTNode.js';

import { Vector2 } from '../../math/Vector2.js';
import { Vector2 } from 'three';
import { TempNode, nodeObject, Fn, NodeUpdateType, uv, uniform, convertToTexture, vec2, vec3, vec4, mat3, luminance, add } from 'three/tsl';

class SobelOperatorNode extends TempNode {

Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@

import PassNode from './PassNode.js';
import { StereoCamera } from '../../cameras/StereoCamera.js';
import { HalfFloatType, LinearFilter, NearestFilter } from '../../constants.js';
import { RenderTarget } from '../../core/RenderTarget.js';
import { texture } from '../accessors/TextureNode.js';
import { Vector2 } from '../../math/Vector2.js';
import QuadMesh from '../../renderers/common/QuadMesh.js';
import { RenderTarget, StereoCamera, HalfFloatType, LinearFilter, NearestFilter, Vector2 } from 'three';
import { PassNode, QuadMesh, texture } from 'three/tsl';

const _size = /*@__PURE__*/ new Vector2();
const _quadMesh = /*@__PURE__*/ new QuadMesh();
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { nodeObject } from '../tsl/TSLBase.js';
import PassNode from './PassNode.js';
import { Vector2 } from '../../math/Vector2.js';
import { StereoCamera } from '../../cameras/StereoCamera.js';
import { StereoCamera, Vector2 } from 'three';
import { PassNode, nodeObject } from 'three/tsl';

const _size = /*@__PURE__*/ new Vector2();

Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import TempNode from '../core/TempNode.js';
import { uv } from '../accessors/UV.js';
import { Fn, nodeObject, float, int, vec4, If } from '../tsl/TSLBase.js';
import { clamp, mix } from '../math/MathNode.js';
import { sub } from '../math/OperatorNode.js';
import { convertToTexture } from '../utils/RTTNode.js';
import { TempNode, nodeObject, Fn, float, uv, convertToTexture, vec4, If, int, clamp, sub, mix } from 'three/tsl';

class TransitionNode extends TempNode {

3 changes: 2 additions & 1 deletion examples/misc_controls_fly.html
Original file line number Diff line number Diff line change
@@ -40,7 +40,8 @@
<script type="module">

import * as THREE from 'three';
import { pass, film } from 'three/tsl';
import { pass } from 'three/tsl';
import { film } from 'three/addons/tsl/display/FilmNode.js';

import Stats from 'three/addons/libs/stats.module.js';
import { FlyControls } from 'three/addons/controls/FlyControls.js';
3 changes: 2 additions & 1 deletion examples/webgpu_backdrop_water.html
Original file line number Diff line number Diff line change
@@ -25,7 +25,8 @@
<script type="module">

import * as THREE from 'three';
import { color, vec2, pass, linearDepth, normalWorld, gaussianBlur, triplanarTexture, texture, objectPosition, screenUV, viewportLinearDepth, viewportDepthTexture, viewportSharedTexture, mx_worley_noise_float, positionWorld, timerLocal } from 'three/tsl';
import { color, vec2, pass, linearDepth, normalWorld, triplanarTexture, texture, objectPosition, screenUV, viewportLinearDepth, viewportDepthTexture, viewportSharedTexture, mx_worley_noise_float, positionWorld, timerLocal } from 'three/tsl';
import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js';

import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';

4 changes: 3 additions & 1 deletion examples/webgpu_display_stereo.html
Original file line number Diff line number Diff line change
@@ -26,7 +26,9 @@

import * as THREE from 'three';

import { stereoPass, anaglyphPass, parallaxBarrierPass } from 'three/tsl';
import { stereoPass } from 'three/addons/tsl/display/StereoPassNode.js';
import { anaglyphPass } from 'three/addons/tsl/display/AnaglyphPassNode.js';
import { parallaxBarrierPass } from 'three/addons/tsl/display/ParallaxBarrierPassNode.js';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { Timer } from 'three/addons/misc/Timer.js';
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
3 changes: 2 additions & 1 deletion examples/webgpu_mrt_mask.html
Original file line number Diff line number Diff line change
@@ -26,7 +26,8 @@
<script type="module">

import * as THREE from 'three';
import { color, screenUV, mrt, output, gaussianBlur, pass, vec4 } from 'three/tsl';
import { color, screenUV, mrt, output, pass, vec4 } from 'three/tsl';
import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js';

import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';

4 changes: 3 additions & 1 deletion examples/webgpu_postprocessing.html
Original file line number Diff line number Diff line change
@@ -20,7 +20,9 @@
<script type="module">

import * as THREE from 'three';
import { pass, dotScreen, rgbShift } from 'three/tsl';
import { pass } from 'three/tsl';
import { dotScreen } from 'three/addons/tsl/display/DotScreenNode.js';
import { rgbShift } from 'three/addons/tsl/display/RGBShiftNode.js';

let camera, renderer, postProcessing;
let object;
Loading