A GPU image rendering method and system based on embedded devices
By normalizing the overlapping regions by determining their greatest common divisor during GPU rendering and then using a hardware acceleration module to overlay the normalized regions, the rendering speed reduction and stuttering issues caused by the linear pipeline mechanism are resolved, resulting in more efficient rendering.
Patent Information
- Application Number
- CN202411864567.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-12-18
AI Technical Summary
In existing GPU rendering technologies, the linear pipeline mechanism causes multiple images to be superimposed in the same area, increasing rendering tasks and GPU resource consumption, which may lead to reduced rendering speed and stuttering, and requires waiting for the entire frame to be processed before the entire frame is drawn.
By determining the target greatest common divisor of the overlapping areas of vertex and texture regions, normalization is performed. The normalized regions are then superimposed using a hardware acceleration module, reducing GPU workload and improving rendering efficiency.
While reducing the workload of the GPU, it improves rendering speed and efficiency, avoids rendering stutters, and enhances overall rendering performance.
Smart Images

Figure CN119850401B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing, and in particular to a GPU image rendering method and system based on embedded devices. Background Technology
[0002] Currently, GPU rendering is mainly performed through vertex shaders and texture shaders. Vertex shaders are responsible for handling the geometry and position of objects, i.e., determining the drawing area, while texture shaders are responsible for handling the texture and color of objects, i.e., drawing the image.
[0003] The GPU rendering pipeline follows a linear pipeline mechanism. This mechanism requires first loading the vertex shader's position information, and then further processing the texture shader based on the vertex shader's calculation results to achieve the rendering of object textures and colors. However, this mechanism has its drawbacks: on the one hand, it can lead to the superposition of multiple images in the same area, significantly increasing the rendering task for that area and consuming a huge amount of GPU resources, potentially approaching or even exceeding the GPU's rendering performance limit. This not only reduces rendering speed but may also cause noticeable stuttering. On the other hand, the linear pipeline mechanism requires waiting for all vertex shaders and texture shaders in the current frame to complete their processing before confirming that the current frame's rendering work is finished. Therefore, if the rendering task in a certain area is exceptionally heavy, the rendering time of the entire frame will be correspondingly delayed. Summary of the Invention
[0004] This application provides a GPU image rendering method and system based on embedded devices, which can improve rendering speed while reducing GPU workload.
[0005] In a first aspect, this application provides a GPU image rendering method based on an embedded device, including:
[0006] Receive the first vertex data and the first texture data preset by the first vertex shader, and determine the first vertex region and the first texture region in the image to be rendered using the first vertex data and the first texture data, respectively.
[0007] Based on the first vertex region and the first texture region, an overlapping region is determined, and the target greatest common divisor of the first vertex region, the first texture region, and the overlapping region is calculated. Based on the target greatest common divisor, the first vertex region and the first texture region are normalized respectively to obtain several normalized regions.
[0008] The normalized regions are superimposed using a hardware acceleration module to obtain target texture information, which is then drawn onto a window for display using a GPU.
[0009] This application embodiment uses first vertex data and first texture data to determine the first vertex region and the first texture region in the image to be rendered, respectively, to separate the first vertex region and the first texture region in the image to be rendered, facilitating subsequent processing of the first vertex region and the first texture region separately. By determining the overlapping region of the first vertex region and the first texture region, it is convenient to subsequently determine the target greatest common divisor of the first vertex region, the first texture region and the overlapping region, and then facilitate the normalization processing of the first vertex region and the first texture region by using the target greatest common divisor, thereby obtaining normalized regions of the same size. This facilitates the subsequent rapid rendering of blocks of each normalized region by the GPU, improving rendering efficiency. By superimposing the normalized regions through the hardware acceleration module, the first texture data of each normalized region can be quickly superimposed to obtain target texture information, which facilitates the subsequent rapid drawing of the target texture information into the window. At the same time, the hardware acceleration module performs block rendering, which can reduce the workload of the GPU and improve rendering efficiency. Compared with the prior art, this application can improve the rendering speed while reducing the workload of the GPU.
[0010] Furthermore, calculating the target greatest common divisor of the first vertex region, the first texture region, and the overlapping region specifically involves:
[0011] The greatest common divisor of the first vertex region and the first texture region is calculated by the Euclidean algorithm to obtain the initial common divisor.
[0012] The target greatest common divisor is obtained by calculating the initial common divisor and the greatest common divisor of the overlapping regions using the Euclidean algorithm.
[0013] By determining the target greatest common divisor of the first vertex region, the first texture region, and the overlapping region, it is easier to normalize the first vertex region and the first texture region using the target greatest common divisor, thereby obtaining normalized regions of the same size. This facilitates the GPU to quickly render the blocks of each normalized region, improving rendering efficiency.
[0014] Furthermore, the normalization process is performed on the first vertex region and the first texture region based on the target greatest common divisor to obtain several normalized regions, specifically as follows:
[0015] The size of the normalized image container is determined based on the target greatest common divisor;
[0016] Determine the number of normalized image containers that the first vertex region and the first texture region can accommodate, respectively.
[0017] Based on the size and the quantity, the first vertex region and the first texture region are normalized to obtain several normalized regions.
[0018] This normalizes the first vertex region and the first texture region by using the greatest common divisor of the target, resulting in normalized regions of the same size. This facilitates the GPU to quickly render blocks in each normalized region, improving rendering efficiency.
[0019] Furthermore, the step of superimposing the normalized regions using a hardware acceleration module to obtain the target texture information specifically involves:
[0020] Pre-create a second texture region;
[0021] The normalized regions are superimposed onto the second texture region using a hardware acceleration module, and the alpha values of regions in the second texture region that do not belong to the normalized regions are set to zero to obtain the target texture information.
[0022] By using a hardware acceleration module to overlay the normalized regions, the first texture data of each normalized region can be quickly superimposed to obtain the target texture information, which then facilitates the rapid rendering of the target texture information into the window.
[0023] Furthermore, the step of rendering the target texture information onto the window for display using the GPU specifically involves:
[0024] Based on the target texture information, determine the second vertex data and the second texture data, and based on the second vertex data and the second texture data, determine the corresponding second vertex region and the second texture region;
[0025] The second vertex shader is determined based on the second vertex region and the second texture region;
[0026] The GPU renders the target texture information based on the second vertex shader to obtain the display interface.
[0027] By quickly drawing the target texture information into the window and simultaneously performing block rendering by the hardware acceleration module, the workload of the GPU can be reduced and rendering efficiency can be improved.
[0028] Secondly, this application provides a GPU image rendering system based on an embedded device, comprising: a first processing module, a second processing module, and a rendering module;
[0029] The first processing module is used to receive first vertex data and first texture data preset by the first vertex shader, and to determine the first vertex region and the first texture region in the image to be rendered using the first vertex data and the first texture data, respectively.
[0030] The second processing module is used to determine the overlapping region based on the first vertex region and the first texture region, calculate the target greatest common divisor of the first vertex region, the first texture region and the overlapping region, and normalize the first vertex region and the first texture region based on the target greatest common divisor to obtain several normalized regions.
[0031] The rendering module is used to superimpose the normalized regions through the hardware acceleration module to obtain target texture information, and to draw the target texture information onto the window for display through the GPU.
[0032] This application embodiment uses first vertex data and first texture data to determine the first vertex region and the first texture region in the image to be rendered, respectively, to separate the first vertex region and the first texture region in the image to be rendered, facilitating subsequent processing of the first vertex region and the first texture region separately. By determining the overlapping region of the first vertex region and the first texture region, it is convenient to subsequently determine the target greatest common divisor of the first vertex region, the first texture region and the overlapping region, and then facilitate the normalization processing of the first vertex region and the first texture region by using the target greatest common divisor, thereby obtaining normalized regions of the same size. This facilitates the subsequent rapid rendering of blocks of each normalized region by the GPU, improving rendering efficiency. By superimposing the normalized regions through the hardware acceleration module, the first texture data of each normalized region can be quickly superimposed to obtain target texture information, which facilitates the subsequent rapid drawing of the target texture information into the window. At the same time, the hardware acceleration module performs block rendering, which can reduce the workload of the GPU and improve rendering efficiency. Compared with the prior art, this application can improve the rendering speed while reducing the workload of the GPU.
[0033] Furthermore, the second processing module includes: a first computing unit and a second computing unit;
[0034] The first calculation unit is used to calculate the greatest common divisor of the first vertex region and the first texture region by using the Euclidean algorithm to obtain the initial common divisor;
[0035] The second calculation unit is used to calculate the initial common divisor and the greatest common divisor of the overlapping region by using the Euclidean algorithm to obtain the target greatest common divisor.
[0036] Furthermore, the second processing module also includes: a first determining unit, a second determining unit, and a normalization unit;
[0037] The first determining unit is used to determine the size of the normalized image container based on the target greatest common divisor;
[0038] The second determining unit is used to determine the number of normalized image containers that can be accommodated in the first vertex region and the first texture region, respectively.
[0039] The normalization unit is used to normalize the first vertex region and the first texture region based on the size and the quantity, respectively, to obtain several normalized regions.
[0040] Furthermore, the rendering module includes: a creation unit and an overlay unit;
[0041] The creation unit is used to pre-create the second texture region;
[0042] The overlay unit is used to overlay each of the normalized regions onto the second texture region through a hardware acceleration module, and set the alpha value corresponding to the regions in the second texture region that do not belong to each of the normalized regions to zero, thereby obtaining the target texture information.
[0043] Furthermore, the rendering module also includes: a third determining unit, a merging unit, and a rendering unit;
[0044] The third determining unit is used to determine the second vertex data and the second texture data based on the target texture information, and to determine the corresponding second vertex region and the second texture region based on the second vertex data and the second texture data.
[0045] The merging unit is used to determine the second vertex shader based on the second vertex region and the second texture region;
[0046] The rendering unit is used by the GPU to render the target texture information based on the second vertex shader to obtain the display interface. Attached Figure Description
[0047] Figure 1 This is a flowchart illustrating an embodiment of the GPU image rendering method based on embedded devices provided in this application;
[0048] Figure 2 This is a schematic diagram of the overlapping area provided in this application;
[0049] Figure 3 This is a schematic diagram illustrating the determination of the normalization region provided in this application;
[0050] Figure 4 This application provides a schematic diagram showing the overlay of various normalized regions;
[0051] Figure 5 This application provides a schematic diagram of the structure of an embodiment of a GPU image rendering system based on embedded devices. Detailed Implementation
[0052] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0053] It should be understood that the step numbers used in the text are for ease of description only and are not intended to limit the order in which the steps are performed.
[0054] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0055] The terms “comprising” and “including” indicate the presence of the described feature, whole, step, operation, element and / or component, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.
[0056] The term “and / or” refers to any combination of one or more of the associated listed items, as well as all possible combinations, and includes these combinations.
[0057] Currently, GPU rendering relies on vertex shaders (handling geometry and position) and texture shaders (handling texture and color). However, current GPU rendering follows a linear pipeline mechanism, meaning that vertex shader information is loaded first, followed by texture shader processing. This mechanism has two drawbacks: first, it can lead to the overlay of multiple images in the same area, significantly increasing the rendering workload and GPU resource consumption in that area, potentially slowing down rendering and causing stuttering; second, the linear process requires waiting for the entire frame to finish processing, and heavy workloads in any area can cause delays in the entire frame's rendering.
[0058] Next, the terms used in this application will be explained:
[0059] Artificial intelligence (AI) is a new branch of computer science that studies, develops, and applies theories, methods, technologies, and systems to simulate, extend, and expand human intelligence. It aims to understand the essence of intelligence and produce intelligent machines that can react in a way similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. AI can simulate the information processes of human consciousness and thought. Furthermore, AI utilizes digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceiving the environment, acquiring knowledge, and using that knowledge to achieve optimal results.
[0060] The Euclidean algorithm (also known as the Euclidean algorithm) is an efficient method for calculating the greatest common divisor (GCD) of two integers. For three or more integers, we can extend the Euclidean algorithm to calculate their GCD step by step.
[0061] Based on this, the embodiments of this application provide a GPU image rendering method and system based on embedded devices, which can improve rendering speed while reducing GPU workload.
[0062] This application provides a GPU image rendering method and system based on an embedded device, which will be described in detail through the following embodiments. First, the GPU image rendering method based on an embedded device in this application is described.
[0063] The GPU image rendering method based on embedded devices provided in this application relates to the field of power system communication. This GPU image rendering method based on embedded devices can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing a GPU image rendering method based on embedded devices, but is not limited to the above forms.
[0064] This application can also be used in numerous general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0065] Example 1
[0066] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the GPU image rendering method based on an embedded device provided in this application, including steps S101 to S103.
[0067] Step S101: Receive the first vertex data and first texture data preset by the first vertex shader, and determine the first vertex region and the first texture region in the image to be rendered using the first vertex data and the first texture data, respectively.
[0068] In some embodiments, it is necessary to predefine first vertex data and first texture data in the first vertex shader. The first vertex data includes, but is not limited to, vertex position, normal and color, etc., and the first texture data includes, but is not limited to, texture coordinates, color and pattern, etc.
[0069] In some embodiments, the first vertex region and the first texture region in the image to be rendered are determined by the first vertex data and the first texture data, respectively. Specifically, since the first vertex data defines the shape and object of the subsequent rendering object, the boundary of the first vertex region corresponding to the image to be rendered can be determined by calculating the first vertex data of the image to be rendered, while the first texture data can directly define the first texture region of the image to be rendered. That is, the first vertex shader will process the first vertex data and the first texture data separately.
[0070] Step S102: Based on the first vertex region and the first texture region, determine the overlapping region, calculate the target greatest common divisor of the first vertex region, the first texture region and the overlapping region, and normalize the first vertex region and the first texture region based on the target greatest common divisor to obtain several normalized regions.
[0071] In some embodiments, the overlapping region is determined based on the first vertex region and the first texture region. Specifically, after determining the first vertex region and the first texture region, it is necessary to determine the common part of the two regions in two-dimensional or three-dimensional space by comparing boundaries or using geometric algorithms, that is, to determine the overlapping region. A schematic diagram of the overlapping region provided in this application is shown below. Figure 2 As shown.
[0072] In some embodiments, calculating the target greatest common divisor (GCD) of the first vertex region, the first texture region, and the overlapping region specifically involves: calculating the GCD of the first vertex region and the first texture region using the Euclidean algorithm to obtain an initial GCD; and calculating the initial GCD and the GCD of the overlapping region using the Euclidean algorithm to obtain a target GCD. For example, and not limitingly, when the width of the first vertex region A is aw and its height is ah, the width of the first texture region B is bw and its height is bh, and the width of the overlapping region is cw and its height is ch, the GCD of the widths gw can be calculated based on aw, bw, and cw, and the GCD gh can be calculated based on ah, bh, and ch. Therefore, the target GCD is obtained for a region with a width of gw and a height of gh.
[0073] By determining the target greatest common divisor of the first vertex region, the first texture region, and the overlapping region, it is easier to normalize the first vertex region and the first texture region using the target greatest common divisor, thereby obtaining normalized regions of the same size. This facilitates the GPU to quickly render the blocks of each normalized region, improving rendering efficiency.
[0074] In some embodiments, the first vertex region and the first texture region are normalized based on the target greatest common divisor to obtain a plurality of normalized regions, including: determining the size of the normalized image container based on the target greatest common divisor; determining the number of normalized image containers that the first vertex region and the first texture region can accommodate; and normalizing the first vertex region and the first texture region based on the size and the number to obtain a plurality of normalized regions. Specifically, firstly, the size of the normalized image container for each region is determined based on the target greatest common divisor, i.e., an integer multiple of the region with width gw and height gh. Secondly, after determining the size of the normalized image container, the region size is divided by the size of the normalized image container, and the integer part is taken to determine how many normalized image containers can be accommodated in the first vertex region and the first texture region, as well as the possible remaining space (differential region). Finally, based on the determined size and number, the first vertex region and the first texture region are divided into multiple sub-regions with the size of the normalized image container as the unit, resulting in several normalized regions. All normalized regions have the same size. A schematic diagram of determining the normalized regions is shown below. Figure 3 As shown.
[0075] It should be noted that for the portion that can completely fill the normalized container, the original region (i.e., the first vertex region and the first texture region) can be directly divided into the corresponding normalized regions; for the remaining space (difference regions), you can choose to ignore them or merge them into the nearest normalized region, or process them in other ways (e.g., cropping, padding, or scaling) to ensure that all regions are correctly normalized.
[0076] This normalizes the first vertex region and the first texture region by using the greatest common divisor of the target, resulting in normalized regions of the same size. This facilitates the GPU to quickly render blocks in each normalized region, improving rendering efficiency.
[0077] Step S103: The normalized regions are superimposed using a hardware acceleration module to obtain target texture information, and the target texture information is drawn onto a window for display using a GPU.
[0078] In some embodiments, the target texture information is obtained by superimposing the normalized regions using a hardware acceleration module, including: pre-creating a second texture region; superimposing the normalized regions onto the second texture region using a hardware acceleration module, and setting the alpha value of regions in the second texture region that do not belong to the normalized regions to zero, thereby obtaining the target texture information. Specifically, a second texture region needs to be pre-created to accommodate all the normalized regions. Then, the normalized regions are superimposed onto the second texture region using a hardware acceleration module (G2D). After superimposition, all pixels in the second texture region need to be traversed to determine whether they belong to the normalized regions. If a pixel does not belong to a normalized region, its alpha value is set to 0, i.e., transparent filling is performed, resulting in an image with a transparent background but containing the target texture information. A schematic diagram of superimposing the normalized regions is shown below. Figure 4 As shown.
[0079] By using a hardware acceleration module to overlay the normalized regions, the first texture data of each normalized region can be quickly superimposed to obtain the target texture information, which then facilitates the rapid rendering of the target texture information into the window.
[0080] In some embodiments, the target texture information is drawn onto a window for display using a GPU, including: determining second vertex data and second texture data based on the target texture information, and determining corresponding second vertex regions and second texture regions based on the second vertex data and the second texture data; determining a second vertex shader based on the second vertex regions and the second texture regions; and rendering the target texture information using the second vertex shader to obtain a display interface. Specifically, after obtaining the target texture information, it is necessary to extract or calculate the second vertex data and second texture data for rendering from the target texture information, determine the corresponding second vertex regions and second texture regions based on the second vertex data and second texture data, and pass the second vertex regions and second texture regions to the GPU. Simultaneously, a second vertex shader and a corresponding fragment shader are written or configured to render the target texture information, and the GPU outputs the rendering results to the display device to form a user-visible display interface.
[0081] It should be noted that the rendering process typically includes stages such as vertex processing (done by the vertex shader), primitive assembly, fragment generation, fragment shading (done by the fragment shader), testing, and blending.
[0082] By quickly drawing the target texture information into the window and simultaneously performing block rendering by the hardware acceleration module, the workload of the GPU can be reduced and rendering efficiency can be improved.
[0083] This application embodiment uses first vertex data and first texture data to determine the first vertex region and the first texture region in the image to be rendered, respectively, to separate the first vertex region and the first texture region in the image to be rendered, facilitating subsequent processing of the first vertex region and the first texture region separately. By determining the overlapping region of the first vertex region and the first texture region, it is convenient to subsequently determine the target greatest common divisor of the first vertex region, the first texture region and the overlapping region, and then facilitate the normalization processing of the first vertex region and the first texture region by using the target greatest common divisor, thereby obtaining normalized regions of the same size. This facilitates the subsequent rapid rendering of blocks of each normalized region by the GPU, improving rendering efficiency. By superimposing the normalized regions through the hardware acceleration module, the first texture data of each normalized region can be quickly superimposed to obtain target texture information, which facilitates the subsequent rapid drawing of the target texture information into the window. At the same time, the hardware acceleration module performs block rendering, which can reduce the workload of the GPU and improve rendering efficiency. Compared with the prior art, this application can improve the rendering speed while reducing the workload of the GPU.
[0084] Example 2
[0085] Please refer to Figure 5 , Figure 5 This is a schematic diagram of the structure of an embodiment of the GPU image rendering system based on an embedded device provided in this application, including a first processing module 100, a second processing module 200 and a rendering module 300;
[0086] The first processing module 100 is used to receive first vertex data and first texture data preset by the first vertex shader, and to determine the first vertex region and the first texture region in the image to be rendered by the first vertex data and the first texture data, respectively.
[0087] In some embodiments, it is necessary to predefine first vertex data and first texture data in the first vertex shader. The first vertex data includes, but is not limited to, vertex position, normal and color, etc., and the first texture data includes, but is not limited to, texture coordinates, color and pattern, etc.
[0088] In some embodiments, the first vertex region and the first texture region in the image to be rendered are determined by the first vertex data and the first texture data, respectively. Specifically, since the first vertex data defines the shape and object of the subsequent rendering object, the boundary of the first vertex region corresponding to the image to be rendered can be determined by calculating the first vertex data of the image to be rendered, while the first texture data can directly define the first texture region of the image to be rendered. That is, the first vertex shader will process the first vertex data and the first texture data separately.
[0089] The second processing module 200 is used to determine the overlapping region based on the first vertex region and the first texture region, calculate the target greatest common divisor of the first vertex region, the first texture region and the overlapping region, and normalize the first vertex region and the first texture region based on the target greatest common divisor to obtain several normalized regions.
[0090] In some embodiments, the overlapping region is determined based on the first vertex region and the first texture region. Specifically, after determining the first vertex region and the first texture region, it is necessary to determine the common part of the two regions in two-dimensional or three-dimensional space by comparing boundaries or using geometric algorithms, that is, to determine the overlapping region. A schematic diagram of the overlapping region provided in this application is shown below. Figure 2 As shown.
[0091] In some embodiments, the second processing module 200 includes: a first calculation unit and a second calculation unit; the first calculation unit is used to calculate the greatest common divisor (GCD) of the first vertex region and the first texture region using the Euclidean algorithm to obtain an initial GCD; the second calculation unit is used to calculate the initial GCD and the GCD of the overlapping region using the Euclidean algorithm to obtain a target GCD. Exemplarily, but not limitingly, when the width of the first vertex region A is aw and the height is ah, the width of the first texture region B is bw and the height is bh, and the width of the overlapping region is cw and the height is ch, the GCD of the width gw can be calculated based on aw, bw, and cw, and the GCD gh can be calculated based on ah, bh, and ch. Therefore, the target GCD is obtained for a region with a width of gw and a height of gh.
[0092] By determining the target greatest common divisor of the first vertex region, the first texture region, and the overlapping region, it is easier to normalize the first vertex region and the first texture region using the target greatest common divisor, thereby obtaining normalized regions of the same size. This facilitates the GPU to quickly render the blocks of each normalized region, improving rendering efficiency.
[0093] In some embodiments, the second processing module 200 further includes: a first determining unit, a second determining unit, and a normalization unit; the first determining unit is configured to determine the size of the normalized image container based on the target greatest common divisor; the second determining unit is configured to determine the number of normalized image containers that can be accommodated in the first vertex region and the first texture region, respectively; the normalization unit is configured to perform normalization processing on the first vertex region and the first texture region based on the size and the number, respectively, to obtain a plurality of normalized regions. Specifically, firstly, the size of the normalized image container for each region is determined based on the target greatest common divisor, i.e., an integer multiple of the region with width gw and height gh. Secondly, after determining the size of the normalized image container, the region size is divided by the size of the normalized image container, and the integer part is taken to determine how many normalized image containers can be accommodated in the first vertex region and the first texture region, as well as the possible remaining space (differential region). Finally, based on the determined size and number, the first vertex region and the first texture region are divided into multiple sub-regions with the size of the normalized image container as the unit, resulting in several normalized regions. All normalized regions have the same size. A schematic diagram of determining the normalized regions is shown below. Figure 3 As shown.
[0094] It should be noted that for the portion that can completely fill the normalized container, the original region (i.e., the first vertex region and the first texture region) can be directly divided into the corresponding normalized regions; for the remaining space (difference regions), you can choose to ignore them or merge them into the nearest normalized region, or process them in other ways (e.g., cropping, padding, or scaling) to ensure that all regions are correctly normalized.
[0095] This normalizes the first vertex region and the first texture region by using the greatest common divisor of the target, resulting in normalized regions of the same size. This facilitates the GPU to quickly render blocks in each normalized region, improving rendering efficiency.
[0096] The rendering module 300 is used to superimpose the normalized regions through the hardware acceleration module to obtain target texture information, and to draw the target texture information onto the window for display through the GPU.
[0097] In some embodiments, the rendering module 300 includes: a creation unit and an overlay unit; the creation unit is used to pre-create a second texture region; the overlay unit is used to overlay each of the normalized regions onto the second texture region through a hardware acceleration module, and set the alpha value corresponding to the regions in the second texture region that do not belong to each of the normalized regions to zero, thereby obtaining target texture information. Specifically, a second texture region needs to be pre-created to accommodate all the normalized regions. Then, the normalized regions are overlaid onto the second texture region through a hardware acceleration module (G2D). After overlay, all pixels in the second texture region need to be traversed to determine whether they belong to each of the normalized regions. If they do not belong to each of the normalized regions, the alpha value corresponding to that pixel is set to 0, i.e., transparent filling is performed, thereby obtaining an image with a transparent background but containing target texture information. A schematic diagram of overlaying each normalized region is shown below. Figure 4 As shown.
[0098] By using a hardware acceleration module to overlay the normalized regions, the first texture data of each normalized region can be quickly superimposed to obtain the target texture information, which then facilitates the rapid rendering of the target texture information into the window.
[0099] In some embodiments, the rendering module 300 further includes: a third determining unit, a merging unit, and a rendering unit; the third determining unit is used to determine second vertex data and second texture data based on the target texture information, and to determine corresponding second vertex regions and second texture regions based on the second vertex data and the second texture data; the merging unit is used to determine a second vertex shader based on the second vertex regions and the second texture regions; the rendering unit is used for the GPU to render the target texture information based on the second vertex shader to obtain a display interface. Specifically, after obtaining the target texture information, it is necessary to extract or calculate the second vertex data and second texture data for rendering from the target texture information, and determine the corresponding second vertex regions and second texture regions based on the second vertex data and second texture data, and pass the second vertex regions and second texture regions to the GPU. At the same time, the second vertex shader and the corresponding fragment shader are written or configured to render the target texture information, and the GPU outputs the rendering results to the display device to form a display interface visible to the user.
[0100] It should be noted that the rendering process typically includes stages such as vertex processing (done by the vertex shader), primitive assembly, fragment generation, fragment shading (done by the fragment shader), testing, and blending.
[0101] By quickly drawing the target texture information into the window and simultaneously performing block rendering by the hardware acceleration module, the workload of the GPU can be reduced and rendering efficiency can be improved.
[0102] This application embodiment uses first vertex data and first texture data to determine the first vertex region and the first texture region in the image to be rendered, respectively, to separate the first vertex region and the first texture region in the image to be rendered, facilitating subsequent processing of the first vertex region and the first texture region separately. By determining the overlapping region of the first vertex region and the first texture region, it is convenient to subsequently determine the target greatest common divisor of the first vertex region, the first texture region and the overlapping region, and then facilitate the normalization processing of the first vertex region and the first texture region by using the target greatest common divisor, thereby obtaining normalized regions of the same size. This facilitates the subsequent rapid rendering of blocks of each normalized region by the GPU, improving rendering efficiency. By superimposing the normalized regions through the hardware acceleration module, the first texture data of each normalized region can be quickly superimposed to obtain target texture information, which facilitates the subsequent rapid drawing of the target texture information into the window. At the same time, the hardware acceleration module performs block rendering, which can reduce the workload of the GPU and improve rendering efficiency. Compared with the prior art, this application can improve the rendering speed while reducing the workload of the GPU.
[0103] The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the method in this embodiment, depending on actual needs.
[0104] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0105] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of this application. It should be understood that the above descriptions are merely specific embodiments of this application and are not intended to limit the scope of protection of this application.
[0106] In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application for those skilled in the art.
Claims
1. A GPU image rendering method based on embedded devices, characterized in that, include: Receive the first vertex data and the first texture data preset by the first vertex shader, and determine the first vertex region and the first texture region in the image to be rendered using the first vertex data and the first texture data, respectively. Based on the first vertex region and the first texture region, an overlapping region is determined. The target greatest common divisor (GCD) of the first vertex region, the first texture region, and the overlapping region is calculated. Based on the target GCD, the first vertex region and the first texture region are normalized to obtain several normalized regions. Specifically, calculating the target GCD of the first vertex region, the first texture region, and the overlapping region involves: calculating the GCD of the first vertex region and the first texture region using the Euclidean algorithm to obtain an initial GCD; and calculating the initial GCD and the GCD of the overlapping region using the Euclidean algorithm to obtain a target GCD. The normalized regions are superimposed using a hardware acceleration module to obtain target texture information, which is then drawn onto a window for display using a GPU.
2. The GPU image rendering method based on embedded devices according to claim 1, characterized in that, The first vertex region and the first texture region are normalized based on the target greatest common divisor to obtain several normalized regions, specifically: The size of the normalized image container is determined based on the target greatest common divisor; Determine the number of normalized image containers that the first vertex region and the first texture region can accommodate, respectively. Based on the size and the quantity, the first vertex region and the first texture region are normalized to obtain several normalized regions.
3. The GPU image rendering method based on embedded devices according to claim 1, characterized in that, The step of superimposing the normalized regions using a hardware acceleration module to obtain the target texture information specifically involves: Pre-create a second texture region; The normalized regions are superimposed onto the second texture region using a hardware acceleration module, and the alpha values of regions in the second texture region that do not belong to the normalized regions are set to zero to obtain the target texture information.
4. The GPU image rendering method based on embedded devices according to claim 1, characterized in that, The step of rendering the target texture information onto the window for display using the GPU specifically involves: Based on the target texture information, determine the second vertex data and the second texture data, and based on the second vertex data and the second texture data, determine the corresponding second vertex region and the second texture region; The second vertex shader is determined based on the second vertex region and the second texture region; The GPU renders the target texture information based on the second vertex shader to obtain the display interface.
5. A GPU image rendering system based on an embedded device, characterized in that, include: The system comprises a first processing module, a second processing module, and a rendering module. The first processing module is used to receive first vertex data and first texture data preset by the first vertex shader, and to determine the first vertex region and the first texture region in the image to be rendered using the first vertex data and the first texture data, respectively. The second processing module is configured to determine an overlapping region based on the first vertex region and the first texture region, calculate the target greatest common divisor (GCD) of the first vertex region, the first texture region, and the overlapping region, and normalize the first vertex region and the first texture region based on the target GCD to obtain several normalized regions. Specifically, calculating the target GCD of the first vertex region, the first texture region, and the overlapping region involves: calculating the GCD of the first vertex region and the first texture region using the Euclidean algorithm to obtain an initial GCD; and calculating the initial GCD and the GCD of the overlapping region using the Euclidean algorithm to obtain the target GCD. The rendering module is used to superimpose the normalized regions through the hardware acceleration module to obtain target texture information, and to draw the target texture information onto the window for display through the GPU.
6. The GPU image rendering system based on an embedded device according to claim 5, characterized in that, The second processing module further includes: a first determining unit, a second determining unit, and a normalization unit; The first determining unit is used to determine the size of the normalized image container based on the target greatest common divisor; The second determining unit is used to determine the number of normalized image containers that can be accommodated in the first vertex region and the first texture region, respectively. The normalization unit is used to normalize the first vertex region and the first texture region based on the size and the quantity, respectively, to obtain several normalized regions.
7. The GPU image rendering system based on an embedded device according to claim 5, characterized in that, The rendering module includes: a creation unit and an overlay unit; The creation unit is used to pre-create the second texture region; The overlay unit is used to overlay each of the normalized regions onto the second texture region through a hardware acceleration module, and set the alpha value of the region in the second texture region that does not belong to each of the normalized regions to zero, thereby obtaining the target texture information.
8. The GPU image rendering system based on an embedded device according to claim 5, characterized in that, The rendering module further includes: a third determining unit, a merging unit, and a rendering unit; The third determining unit is used to determine the second vertex data and the second texture data based on the target texture information, and to determine the corresponding second vertex region and the second texture region based on the second vertex data and the second texture data. The merging unit is used to determine the second vertex shader based on the second vertex region and the second texture region; The rendering unit is used by the GPU to render the target texture information based on the second vertex shader to obtain the display interface.
Citation Information
Patent Citations
GPU-based three-dimensional image data rendering method and device
CN113012269A
Image rendering method and apparatus, computer device, and storage medium
US20230033306A1