import { RenderPass } from "/framework/RenderPass.js"; import Shader from "/framework/WebGpu.js"; export class ColFFTPass extends RenderPass { async create( ) { this.shader = new Shader( this.device ); await this.shader.setup( "shaders/fft_col.wgsl" ); const oceanBlock = this.pipeline.getBlockByName( "ocean" ); const rowPass = oceanBlock.getPass( "RowFFT" ); const rowReal = rowPass.shader.getBuffer( "outputReal" ); const rowImag = rowPass.shader.getBuffer( "outputImag" ); await this.shader.setBuffer( "inputReal", rowReal ); await this.shader.setBuffer( "inputImag", rowImag ); this.shader.setVariable( "outputReal", this.pipeline.memory.colReal ); this.shader.setVariable( "outputImag", this.pipeline.memory.colImag ); this.shader.setVariable( "heightField", this.pipeline.memory.heightField ); 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 ); } }