Shenzhen Kai Mo Rui Electronic Technology Co. LTDShenzhen Kai Mo Rui Electronic Technology Co. LTD

News

The basic workflow of GPU image processing

Source:Shenzhen Kai Mo Rui Electronic Technology Co. LTD2026-07-28

 

Modern GPUs provide two programmable parallel processing units: the vertex processor and the fragment processor. When using a GPU to perform general-purpose computing tasks such as image processing, the primary task is to map the problem to be solved onto the graphics rendering pipeline supported by the GPU.

The conventional approach involves representing the input data for computational tasks using graphical rendering elements such as vertex positions, colors, normal vectors, or textures. The corresponding processing algorithms are then broken down into a series of execution steps and rewritten as vertex shaders or fragment shaders for the GPU. Next, a 3D API is called to perform the graphics rendering operation, and the fragment shader is invoked to carry out the necessary processing. Finally, the rendered results are stored in the frame buffer.The result is the output data of the algorithm.

Although there are many different digital image processing algorithms, and their specific implementation processes vary considerably, when leveraging GPUs for parallel processing, several common key technical issues need to be addressed—such as data loading, feedback of computation results, and result storage.

Below, we will analyze these common issues and propose corresponding solutions.

1. Data loading

In the GPU’s streaming programming model, all data must be loaded and processed in the form of “streams” and accessed via an abstract 3D API. When using a GPU for image processing, the most direct and efficient method for loading data is to package the images to be processed into textures and load and process them while drawing quadrilaterals. To ensure that the fragment program on the GPU can process the texture image pixel by pixel, the projection transformation must be set to an orthographic projection, and the viewport of the view transformation must be the same size as the texture. This ensures that each fragment after rasterization corresponds one-to-one with each texel in the texture. As for other parameters in image-processing algorithms, if the amount of data is small, they can be directly set via interface functions; if there are many parameters, they should also be packed into textures and transferred to the GPU. During the packing process, full advantage should be taken of the four channels—R, G, B, and A—that texture images possess.

2. Feedback and saving of calculation results

The application draws textured quadrilaterals by invoking the 3D API and then activates a fragment program on the GPU for image processing. The direct rendering output of the GPU fragment shader is a frame buffer, which corresponds to a window on the computer screen traditionally used to hold pixels that are to be displayed on the screen. However, in GPU stream computing, this frame buffer can also be used to store computation results. Although the CPU can directly read from and write to this frame buffer via the 3D API, copying the rendered results from the frame buffer into system memory for storage, the size of the frame buffer is limited by the window size. Moreover, due to the bandwidth limitations of the AGP bus (2.1 GB/s), transferring data from the video memory to the system...

GPU rendering of image transformations mainly involves the following steps:

1.Set 1 input texture;

2.Sample the texture from the input texture;

3.Set the transformation matrix;

4.In the vertex shader, multiply the input vertex by the transformation matrix;

5.Output image data;

1785201687112604.png

Related News

Professional Engineer

24-hour online serviceSubmit requirements and quickly customize solutions for you

+8613798538021