Exemplo n.º 1
0
        public RenderEngine(int width, int height)
        {
            _width  = width;
            _height = height;

            _gpuHandle = new GPUHandle();
            _gpuHandle.Init();

            _renderProgram = new GPUProgram(_gpuHandle, "renderer.cl");
            _renderProgram.BuildProgram();
            _renderProgram.CreateKernel("render");

            _renderProgram.SetKernelArg("render", 0, _width);
            _renderProgram.SetKernelArg("render", 1, _height);

            Bitmap bg = (Bitmap)Image.FromFile("background.jpg");

            _backgroundImage = new GPUImage(_gpuHandle);
            _backgroundImage.WriteImage(bg, MemFlags.ReadOnly);

            int totalPixels = _width * _height;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Sets an image as a kernel argument
 /// </summary>
 /// <param name="kernel">Name of the kernel to set the image paratmeter of</param>
 /// <param name="argIndex">The argument index to set</param>
 /// <param name="image">The image to set the argument of</param>
 public void SetKernelArg(string kernel, uint argIndex, GPUImage image)
 {
     _error = Cl.SetKernelArg(_kernels[kernel], argIndex, image.ImageBufferHandle);
     CLException.CheckException(_error);
 }