示例#1
0
 void SetCSData()
 {
     CS.SetVector("nozzle_ralative_center", nozzle_relative_center);
     CS.SetVector("nozzle_center", nozzle_center_in_shader);
     CS.SetFloat("nozzle_radius", nozzle_radius);
     CS.SetVector("nozzle_dir", nozzle_dir);
     CS.SetVector("nozzle_topleft", topleft);
     CS.SetFloat("nozzle_length", nozzle_length);
     CS.SetVector("nozzle_velocity", nozzle_velocity / isf.hbar);
     CS.SetVector("nozzle_right", nozzle_right);
     CS.SetVector("nozzle_up", nozzle_up);
     CS.SetVector("size", isf.size);
     CS.SetInts("res", isf.GetGrids());
     CS.SetInts("grids", isf.GetGrids());
 }
示例#2
0
    public void InitComputeShader()
    {
        kernelClamp = new int[(int)GPUThreads.T_KINDS];

        ParticleMan.InitMultiKindKernels(CS, "Clamp", out kernelClamp);
        ParticleMan.InitMultiKindKernels(CS, "InitPsiMask", out kernelInitPsiMask);

        kernelFlushPsiMask        = CS.FindKernel("FlushPsiMask");
        kernelInitInkCollisionPsi = CS.FindKernel("InitInkCollisionPsi");
        kernelUpdatePsiGlobal     = CS.FindKernel("UpdatePsiGlobal");

        CS.SetVector("size", isf.size);
        int[] res = isf.GetGrids();
        CS.SetInts("res", res);
        CS.SetInts("grids", res);
    }
示例#3
0
    public void InitComputeShader()
    {
        kernelCreateNozzleMask = CS.FindKernel("CreateNozzleMask");
        kernelNozzleUpdatePsi  = CS.FindKernel("NozzleUpdatePsi");

        kernelZeroOutDebugOutput = CS.FindKernel("ZeroOutDebugOutput");
        kernelBlitDebugMask      = CS.FindKernel("BlitDebugMask");
        kernelNozzleClamp[(int)(GPUThreads.T64 & GPUThreads.T_INDEX)]   = CS.FindKernel("NozzleClamp64");
        kernelNozzleClamp[(int)(GPUThreads.T256 & GPUThreads.T_INDEX)]  = CS.FindKernel("NozzleClamp256");
        kernelNozzleClamp[(int)(GPUThreads.T1024 & GPUThreads.T_INDEX)] = CS.FindKernel("NozzleClamp");

        kernelInitNozzle = CS.FindKernel("InitNozzle");
        kernelCreateShpereObstacleMask = CS.FindKernel("CreateShpereObstacleMask");
        CS.SetVector("size", isf.size);
        int[] res = isf.GetGrids();
        CS.SetInts("res", res);
    }
示例#4
0
    void InitComputeShader()
    {
        kernelCreateCylinderPsi = CS.FindKernel("CreateCylinderPsi");
        kernelInitPsi           = CS.FindKernel("InitPsi");
        ParticleMan.InitMultiKindKernels(CS, "InitParticles", out kernelInitParticles);

        CS.SetVector("size", isf.size);
        int[] res = isf.GetGrids();
        CS.SetInts("res", res);
        CS.SetInts("grids", res);
    }
示例#5
0
    public void Emulate()
    {
        if (DataManaging == ManagingMode.CenterPool)
        {
            if (CurN + IncN < MaxN)
            {
                CurN += IncN;
            }
        }

        CS.SetVector("grid_size", isf.GetGridSize());
        CS.SetInts("grids", isf.GetGrids());
        CS.SetFloat("dt", isf.estimate_dt);

        foreach (var part in AllCurrentParticles())
        {
            int kernel = kernelEnumlateParticle[part.kernId];
            CS.SetTexture(kernel, "Velocity", isf.GetVelocity());
            CS.SetBuffer(kernel, "ParticlePostion", part.buf);
            CS.Dispatch(kernel, part.count / part.threads, 1, 1);
        }
    }