public static int[] GetBitReversedArrayOfSize(int N)
        {
            var bitReversedArray = new int[N];

            for (int j = 0; j < N; j++)
            {
                bitReversedArray[j] = NumberDistributions.BitReverse(j, N);
            }

            return(bitReversedArray);
        }
Esempio n. 2
0
        public void Initialize()
        {
            if (!Mathf.IsPowerOfTwo(N))
            {
                // throw new Exception("Texture must be a power of two");
            }

            int logN = (int)Mathf.Log(N, 2);

            BitReversedBuffer = new ComputeBuffer(N, sizeof(int));
            BitReversedBuffer.SetData(NumberDistributions.GetBitReversedArrayOfSize(N));

            Pong0Texture = Pong0Texture.Initialize(new Vector2(N, N));
            Pong1Texture = Pong1Texture.Initialize(new Vector2(N, N));

            FindKernels();
            SetShaderVariables();
        }