From 84d8cb468bb11d5afa83ca3d56b57e4b0e5226d4 Mon Sep 17 00:00:00 2001 From: Christian Helgeson <62450112+cmhhelgeson@users.noreply.github.com> Date: Tue, 3 Jun 2025 12:00:34 -0700 Subject: [PATCH 1/4] init branch --- examples/webgpu_centroid_sampling.html | 12 ++++++------ src/constants.js | 4 ++-- .../webgl-fallback/nodes/GLSLNodeBuilder.js | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/webgpu_centroid_sampling.html b/examples/webgpu_centroid_sampling.html index d22aabffe63fe1..f562353ee36bde 100644 --- a/examples/webgpu_centroid_sampling.html +++ b/examples/webgpu_centroid_sampling.html @@ -158,8 +158,8 @@ }; - const withFlatFirstShader = createShader( THREE.InterpolationSamplingType.FLAT, THREE.InterpolationSamplingMode.FLAT_FIRST ); - const withFlatEitherShader = createShader( THREE.InterpolationSamplingType.FLAT, THREE.InterpolationSamplingMode.FLAT_EITHER ); + const withFlatFirstShader = createShader( THREE.InterpolationSamplingType.FLAT, THREE.InterpolationSamplingMode.FIRST ); + const withFlatEitherShader = createShader( THREE.InterpolationSamplingType.FLAT, THREE.InterpolationSamplingMode.EITHER ); const withSampleShader = Fn( () => { @@ -235,16 +235,16 @@ THREE.InterpolationSamplingMode.NORMAL, THREE.InterpolationSamplingMode.CENTROID, THREE.InterpolationSamplingMode.SAMPLE, - THREE.InterpolationSamplingMode.FLAT_FIRST, - THREE.InterpolationSamplingMode.FLAT_EITHER + 'flat first', + 'flat either' ] ).onChange( () => { const interpolationShaderLib = { [ THREE.InterpolationSamplingMode.NORMAL ]: withoutInterpolationShader, [ THREE.InterpolationSamplingMode.CENTROID ]: withInterpolationShader, [ THREE.InterpolationSamplingMode.SAMPLE ]: withSampleShader, - [ THREE.InterpolationSamplingMode.FLAT_FIRST ]: withFlatFirstShader, - [ THREE.InterpolationSamplingMode.FLAT_EITHER ]: withFlatEitherShader + [ 'flat first' ]: withFlatFirstShader, + [ 'flat either' ]: withFlatEitherShader }; const shader = interpolationShaderLib[ effectController.sampling ]; diff --git a/src/constants.js b/src/constants.js index 77bc2613c0583d..7a6334e3870b7e 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1612,8 +1612,8 @@ export const InterpolationSamplingMode = { NORMAL: 'normal', CENTROID: 'centroid', SAMPLE: 'sample', - FLAT_FIRST: 'flat first', - FLAT_EITHER: 'flat either' + FIRST: 'first', + EITHER: 'either' }; /** diff --git a/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js b/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js index da2f96f8911a88..9cf189671d22ba 100644 --- a/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +++ b/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js @@ -31,8 +31,8 @@ const interpolationTypeMap = { const interpolationModeMap = { 'centroid': 'centroid', - 'flat first': 'flat', - 'flat either': 'flat' + 'first': 'flat', + 'either': 'flat' }; const defaultPrecisions = ` From e0334829de27109818695c2af6ca62f6c260b8c4 Mon Sep 17 00:00:00 2001 From: Christian Helgeson <62450112+cmhhelgeson@users.noreply.github.com> Date: Tue, 3 Jun 2025 12:13:27 -0700 Subject: [PATCH 2/4] fix --- src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js b/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js index 9cf189671d22ba..bd1d59c3b0cdfe 100644 --- a/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +++ b/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js @@ -26,13 +26,11 @@ const supports = { const interpolationTypeMap = { perspective: 'smooth', - linear: 'noperspective' + linear: 'noperspective', }; const interpolationModeMap = { 'centroid': 'centroid', - 'first': 'flat', - 'either': 'flat' }; const defaultPrecisions = ` @@ -796,6 +794,8 @@ ${ flowData.code } if ( varying.interpolationType ) { + console.log( varying.interpolationType ); + const interpolationType = interpolationTypeMap[ varying.interpolationType ] || varying.interpolationType; const sampling = interpolationModeMap[ varying.interpolationSampling ] || ''; From 55061761cb58c785d269d993643ac52704f61146 Mon Sep 17 00:00:00 2001 From: Christian Helgeson <62450112+cmhhelgeson@users.noreply.github.com> Date: Tue, 3 Jun 2025 15:43:24 -0700 Subject: [PATCH 3/4] remove comment --- src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js b/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js index bd1d59c3b0cdfe..4c518407ba7dc7 100644 --- a/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +++ b/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js @@ -794,8 +794,6 @@ ${ flowData.code } if ( varying.interpolationType ) { - console.log( varying.interpolationType ); - const interpolationType = interpolationTypeMap[ varying.interpolationType ] || varying.interpolationType; const sampling = interpolationModeMap[ varying.interpolationSampling ] || ''; From 7b0484dc58e605f5186a9da3024ad3d759fa2c89 Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Wed, 4 Jun 2025 10:35:54 +0200 Subject: [PATCH 4/4] Update GLSLNodeBuilder.js Clean up. --- src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js b/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js index 4c518407ba7dc7..226d5d29c1599a 100644 --- a/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +++ b/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js @@ -26,11 +26,11 @@ const supports = { const interpolationTypeMap = { perspective: 'smooth', - linear: 'noperspective', + linear: 'noperspective' }; const interpolationModeMap = { - 'centroid': 'centroid', + 'centroid': 'centroid' }; const defaultPrecisions = `