Exemplo n.º 1
0
        public void UpdateWave(float dt)
        {
            _wavet += dt;

            if (!(_wavet >= _waveTimeStep))
            {
                return;
            }

            CloseCurrentBuffer();

            _waveSwapChain.Swap();

            while (_wavet > _waveTimeStep)
            {
                _wavet -= _waveTimeStep;
            }

            ImmediateContext.ComputeShader.Set(_compShader);
            ImmediateContext.ComputeShader.SetConstantBuffer(0, _wavesCBBuffer);
            ImmediateContext.ComputeShader.SetShaderResources(0, _waveSwapChain.PastSolution);
            ImmediateContext.ComputeShader.SetUnorderedAccessView(0, _waveSwapChain.CurrentSolution);

            ImmediateContext.Dispatch((int)_wavesCB.ColumnCount / BLOCK_SIZE + 1, (int)_wavesCB.RowCount / BLOCK_SIZE + 1, 1);

            ImmediateContext.ComputeShader.SetUnorderedAccessView(0, null);
            ImmediateContext.ComputeShader.SetShaderResource(0, null);
            ImmediateContext.ComputeShader.Set(null);
        }