@@ -3,7 +3,10 @@ import { random } from '../../core/math/random.js';
33import { Vec3 } from '../../core/math/vec3.js' ;
44import {
55 FILTER_NEAREST ,
6- TEXTUREPROJECTION_OCTAHEDRAL , TEXTUREPROJECTION_CUBE
6+ TEXTUREPROJECTION_OCTAHEDRAL , TEXTUREPROJECTION_CUBE ,
7+ SHADERLANGUAGE_WGSL ,
8+ SHADERLANGUAGE_GLSL ,
9+ SEMANTIC_POSITION
710} from '../../platform/graphics/constants.js' ;
811import { DebugGraphics } from '../../platform/graphics/debug-graphics.js' ;
912import { DeviceCache } from '../../platform/graphics/device-cache.js' ;
@@ -15,6 +18,7 @@ import { getProgramLibrary } from '../shader-lib/get-program-library.js';
1518import { createShaderFromCode } from '../shader-lib/utils.js' ;
1619import { BlendState } from '../../platform/graphics/blend-state.js' ;
1720import { drawQuadWithShader } from './quad-render-utils.js' ;
21+ import { shaderChunksWGSL } from '../shader-lib/chunks-wgsl/chunks-wgsl.js' ;
1822
1923/**
2024 * @import { Vec4 } from '../../core/math/vec4.js'
@@ -439,17 +443,26 @@ function reprojectTexture(source, target, options = {}) {
439443 #define {NUM_SAMPLES_SQRT} ${ Math . round ( Math . sqrt ( numSamples ) ) . toFixed ( 1 ) }
440444 ` ;
441445
446+ const wgsl = device . isWebGPU ;
447+ const chunks = wgsl ? shaderChunksWGSL : shaderChunks ;
442448 const includes = new Map ( ) ;
443- includes . set ( 'decodePS' , shaderChunks . decodePS ) ;
444- includes . set ( 'encodePS' , shaderChunks . encodePS ) ;
449+ includes . set ( 'decodePS' , chunks . decodePS ) ;
450+ includes . set ( 'encodePS' , chunks . encodePS ) ;
445451
452+ const vert = chunks . reprojectVS ;
453+ const frag = chunks . reprojectPS ;
446454 shader = createShaderFromCode (
447455 device ,
448- shaderChunks . reprojectVS ,
449- `${ defines } \n${ shaderChunks . reprojectPS } ` ,
450- shaderKey ,
451- undefined , {
452- fragmentIncludes : includes
456+ vert ,
457+ `
458+ ${ defines }
459+ ${ frag }
460+ ` ,
461+ shaderKey , {
462+ vertex_position : SEMANTIC_POSITION
463+ } , {
464+ fragmentIncludes : includes ,
465+ shaderLanguage : wgsl ? SHADERLANGUAGE_WGSL : SHADERLANGUAGE_GLSL
453466 }
454467 ) ;
455468 }
0 commit comments