import { RenderPass } from "../framework/RenderPass.js"; import Shader from "../framework/WebGpu.js"; export class RowFFTPass extends RenderPass { async create( ) { this.shader = new Shader( this.device ); await this.shader.setup( "shaders/fft_row.wgsl" ); const oceanBlock = this.pipeline.getBlockByName( "ocean" ); const spectrumPass = oceanBlock.getPass( "Spectrum" ); const spectrumReal = spectrumPass.shader.getBuffer( "spectrumReal" ); const spectrumImag = spectrumPass.shader.getBuffer( "spectrumImag" ); await this.shader.setBuffer( "inputReal", spectrumReal ); await this.shader.setBuffer( "inputImag", spectrumImag ); this.shader.setVariable( "outputReal", this.pipeline.memory.rowReal ); this.shader.setVariable( "outputImag", this.pipeline.memory.rowImag ); this.shader.setVariable( "params", this.pipeline.memory.computeParams ); } bindBuffers( ) { this.shader.setVariable( "params", this.pipeline.memory.computeParams ); } async execute( ) { const groups = this.pipeline.gridSize; await this.shader.execute( groups, 1, 1 ); } }