예제 #1
0
        void Start()
        {
            Debug.Assert(source.width == mask.width && source.width == target.width);
            Debug.Assert(source.height == mask.height && source.height == target.height);

            tex = new RenderTexture(source.width, source.height, 0);
            tex.enableRandomWrite = true;
            tex.Create();

            kernelPoisson = compute.FindKernel("PoissonBlending");
            kernelInit    = compute.FindKernel("Init");

            threads = compute.GetThreadGroupSize(kernelPoisson);
            Debug.Assert(source.width % threads.x == 0);
            Debug.Assert(source.height % threads.y == 0);
        }
예제 #2
0
        void Start()
        {
            tex = new RenderTexture(source.width, source.height, 0);
            tex.enableRandomWrite = true;
            tex.Create();

            int kernel = compute.FindKernel("CSMain");

            uint3 groups = compute.GetThreadGroupSize(kernel);

            Debug.Assert(source.width % groups.x == 0);
            Debug.Assert(source.height % groups.y == 0);

            compute.SetTexture(kernel, "Source", source, 0);
            compute.SetTexture(kernel, "Result", tex);

            compute.Dispatch(kernel, tex.width / (int)groups.x, tex.height / (int)groups.y, 1);
        }