private void GetFourierSize(out int size, out bool isCpu) { switch (this.fourierSize) { case FOURIER_SIZE.LOW_32_CPU: size = 32; isCpu = true; break; case FOURIER_SIZE.LOW_32_GPU: size = 32; isCpu = false; break; case FOURIER_SIZE.MEDIUM_64_CPU: size = 64; isCpu = true; break; case FOURIER_SIZE.MEDIUM_64_GPU: size = 64; isCpu = false; break; case FOURIER_SIZE.HIGH_128_CPU: size = 128; isCpu = true; break; case FOURIER_SIZE.HIGH_128_GPU: size = 128; isCpu = false; break; case FOURIER_SIZE.ULTRA_256_GPU: size = 256; isCpu = false; break; case FOURIER_SIZE.EXTREME_512_GPU: size = 512; isCpu = false; break; default: size = 64; isCpu = true; break; } bool flag = SystemInfo.graphicsShaderLevel >= 50 && SystemInfo.supportsComputeShaders; if (!isCpu && !this.disableReadBack && !flag) { Ocean.LogWarning("You card does not support dx11. Fourier can not be GPU. Changing to CPU. Disable read backs to use GPU but with no height querys."); this.fourierSize = FOURIER_SIZE.MEDIUM_64_CPU; size = 64; isCpu = true; } }
public void CreateAndCacheCondition(FOURIER_SIZE fourierSize) { int num; bool flag; this.GetFourierSize(out num, out flag); this.CreateAndCacheCondition(num, this.windSpeed, this.m_ocean.windDir, this.waveAge); }
/// <summary> /// Gets the size of the fourier transform and if the displacements /// are run on the CPU or GPU. /// </summary> void GetFourierSize(out int size, out bool isCpu) { switch((int)fourierSize) { case (int)FOURIER_SIZE.LOW_32_CPU: size = 32; isCpu = true; break; case (int)FOURIER_SIZE.LOW_32_GPU: size = 32; isCpu = false; break; case (int)FOURIER_SIZE.MEDIUM_64_CPU: size = 64; isCpu = true; break; case (int)FOURIER_SIZE.MEDIUM_64_GPU: size = 64; isCpu = false; break; case (int)FOURIER_SIZE.HIGH_128_CPU: size = 128; isCpu = true; break; case (int)FOURIER_SIZE.HIGH_128_GPU: size = 128; isCpu = false; break; case (int)FOURIER_SIZE.ULTRA_256_GPU: size = 256; isCpu = false; break; case (int)FOURIER_SIZE.EXTREME_512_GPU: size = 512; isCpu = false; break; default: size = 64; isCpu = true; break; } bool supportDX11 = SystemInfo.graphicsShaderLevel >= 50 && SystemInfo.supportsComputeShaders; if(!isCpu && !disableReadBack && !supportDX11) { Ocean.LogWarning("You card does not support dx11. Fourier can not be GPU. Changing to CPU. Disable read backs to use GPU but with no height querys."); fourierSize = FOURIER_SIZE.MEDIUM_64_CPU; size = 64; isCpu = true; } }
/// <summary> /// Creates a condition from the settings and adds to cache. /// Just takes the fourier size and uses current settings for the rest. /// </summary> public void CreateAndCacheCondition(FOURIER_SIZE fourierSize) { int size; bool isCpu; GetFourierSize(out size, out isCpu); CreateAndCacheCondition(size, windSpeed, m_ocean.windDir, waveAge); }