GPU image rendering method and system based on embedded device

By determining the target maximum common divisor of the overlapping area in GPU rendering for normalization, and using the hardware acceleration module to superimpose the normalized area, the problems of high GPU resource occupation and slow rendering speed in the prior art are solved, and a more efficient rendering effect is achieved.

CN119850401AActive Publication Date: 2025-04-18YEKER INFORMATION TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411864567.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-18
Estimated Expiration
2044-12-18

AI Technical Summary

Technical Problem

In the existing GPU rendering technology, the linear Pipe l ine mechanism causes multiple images to be superimposed in the same area, increasing the rendering task and GPU resource usage, which may lead to reduced rendering speed and lag, and wait for the full frame to be processed and delayed the drawing of the entire frame.

Method used

By determining the overlapping area of the vertex area and the texture area of the image to be rendered, the target maximum common divisor is calculated for normalization, and the normalized area is superimposed by the hardware acceleration module, reducing GPU workload and improving rendering efficiency.

Benefits of technology

While reducing the GPU workload, it improves rendering speed and efficiency, avoids rendering lags, and optimizes GPU resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119850401A_ABST
    Figure CN119850401A_ABST
Patent Text Reader

Abstract

The invention discloses a GPU image rendering method and system based on embedded equipment, and the method comprises the steps: receiving first vertex data and first texture data preset by a first vertex shader, and determining a first vertex region and a first texture region in a to-be-rendered image through the first vertex data and the first texture data; determining an overlapping region based on the first vertex region and the first texture region, calculating a target greatest common divisor of the first vertex region, the first texture region and the overlapping region, and performing normalization processing on the first vertex region and the first texture region based on the target greatest common divisor, obtaining a plurality of normalized regions; and superposing the normalized regions through a hardware acceleration module to obtain target texture information, and drawing the target texture information to a window for display through a GPU (Graphics Processing Unit). According to the method, the rendering speed can be improved while the workload of the GPU is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to a GPU image rendering method and system based on an embedded device. Background Art

[0002] Currently, GPU rendering is mainly performed through vertex shaders and texture shaders. The vertex shader is responsible for processing the geometric shape and position of the object, that is, determining the drawing area, and the texture shader is responsible for processing the texture and color of the object, that is, drawing the image.

[0003] In the GPU rendering process, a linear Pipeline mechanism is followed. This mechanism requires that the position information of the vertex shader be loaded first, and then the texture shader is further processed according to the calculation results of the vertex shader to realize the texture and color drawing of the object. However, this mechanism has its defects: on the one hand, this mechanism will cause multiple images to be superimposed in the same area, and the rendering tasks of the area will increase significantly and the occupied GPU resources will increase dramatically, which may approach or even exceed the upper limit of the GPU's rendering performance, which will not only reduce the rendering speed, but also may cause obvious stuttering; on the other hand, the linear Pipeline mechanism requires that all vertex shaders and texture shaders of the current frame must be processed after they are completed before confirming that the drawing work of the current frame has been completed. Therefore, if the rendering task of a certain area is extremely heavy, the drawing completion time of the entire frame will be delayed accordingly. Summary of the invention

[0005] The present application provides a GPU image rendering method and system based on an embedded device, which can reduce the GPU workload while increasing the rendering speed.

[0006] In a first aspect, the present application provides a GPU image rendering method based on an embedded device, comprising:

[0007] Receive first vertex data and first texture data preset by a first vertex shader, and determine a first vertex area and a first texture area in a to-be-rendered picture respectively through the first vertex data and the first texture data;

[0008] Based on the first vertex region and the first texture region, determining an overlapping region, calculating a target greatest common divisor of the first vertex region, the first texture region, and the overlapping region, and normalizing the first vertex region and the first texture region based on the target greatest common divisor to obtain a plurality of normalized regions;

[0009] The normalized regions are superimposed by a hardware acceleration module to obtain target texture information, and the target texture information is drawn to a window for display by a GPU.

[0010] The embodiment of the present application determines the first vertex area and the first texture area in the image to be rendered respectively through the first vertex data and the first texture data, so as to separate the first vertex area and the first texture area in the image to be rendered, so as to facilitate the subsequent processing of the first vertex area and the first texture area respectively; by determining the overlapping area of ​​the first vertex area and the first texture area, it is convenient to determine the target greatest common divisor of the first vertex area, the first texture area and the overlapping area, and then facilitate the normalization of the first vertex area and the first texture area through the target greatest common divisor, so as to obtain normalized areas of the same size, so as to facilitate the subsequent GPU to quickly render the blocks of each normalized area and improve the rendering efficiency; by superimposing each of the normalized areas through the hardware acceleration module, the first texture data of each normalized area can be quickly superimposed to obtain the target texture information, so as to facilitate the subsequent rapid drawing of the target texture information into the window, and the hardware acceleration module performs block rendering at the same time, which can reduce the workload of the GPU and improve the rendering efficiency. Compared with the prior art, the present application can improve the rendering speed while reducing the workload of the GPU.

[0011] Furthermore, the calculation of the target greatest common divisor of the first vertex area, the first texture area, and the overlapping area is specifically:

[0012] Calculate the greatest common divisor of the first vertex area and the first texture area by using the Euclidean algorithm to obtain an initial common divisor;

[0013] The initial common divisor and the greatest common divisor of the overlapping area are calculated by the Euclidean algorithm to obtain the target greatest common divisor.

[0014] In this way, by determining the target greatest common divisor of the first vertex area, the first texture area and the overlapping area, the first vertex area and the first texture area are normalized by the target greatest common divisor, thereby obtaining normalized areas of the same size, which facilitates the subsequent GPU to quickly render blocks of each normalized area and improve rendering efficiency.

[0015] Furthermore, the first vertex region and the first texture region are respectively normalized based on the target greatest common divisor to obtain a plurality of normalized regions, specifically:

[0016] determining a size of a normalized image container based on the target greatest common divisor;

[0017] respectively determining the number of normalized image containers that can be accommodated in the first vertex region and the first texture region;

[0018] The first vertex region and the first texture region are respectively normalized based on the size and the number to obtain a plurality of normalized regions.

[0019] In this way, the first vertex area and the first texture area are normalized by the target greatest common divisor, so as to obtain normalized areas of the same size, which facilitates the subsequent GPU to quickly render blocks of each normalized area and improves rendering efficiency.

[0020] Furthermore, the normalized regions are superimposed by the hardware acceleration module to obtain target texture information, specifically:

[0021] Pre-creating a second texture area;

[0022] Each of the normalized regions is superimposed on the second texture region through a hardware acceleration module, and an alpha value corresponding to a region in the second texture region that does not belong to each of the normalized regions is set to zero, so as to obtain target texture information.

[0023] In this way, by superimposing the normalized regions through the hardware acceleration module, the first texture data of the normalized regions can be quickly superimposed to obtain the target texture information, thereby facilitating the subsequent rapid drawing of the target texture information into the window.

[0024] Furthermore, the target texture information is drawn to a window for display by a GPU, specifically:

[0025] Determine second vertex data and second texture data based on the target texture information, and determine corresponding second vertex areas and second texture areas based on the second vertex data and the second texture data;

[0026] determining a second vertex shader based on the second vertex region and the second texture region;

[0027] The GPU renders the target texture information based on the second vertex shader to obtain a display interface.

[0028] In this way, by quickly drawing the target texture information into the window and performing block rendering by the hardware acceleration module, the workload of the GPU can be reduced and the rendering efficiency can be improved.

[0029] In a second aspect, the present 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;

[0030] The first processing module is used to receive first vertex data and first texture data preset by a first vertex shader, and determine a first vertex area and a first texture area in the image to be rendered respectively through the first vertex data and the first texture data;

[0031] The second processing module is used to determine an overlapping area based on the first vertex area and the first texture area, calculate a target greatest common divisor of the first vertex area, the first texture area and the overlapping area, and perform normalization processing on the first vertex area and the first texture area respectively based on the target greatest common divisor to obtain a plurality of normalized areas;

[0032] The rendering module is used to superimpose the normalized areas through the hardware acceleration module to obtain target texture information, and draw the target texture information to the window for display through the GPU.

[0033] The embodiment of the present application determines the first vertex area and the first texture area in the image to be rendered respectively through the first vertex data and the first texture data, so as to separate the first vertex area and the first texture area in the image to be rendered, so as to facilitate the subsequent processing of the first vertex area and the first texture area respectively; by determining the overlapping area of ​​the first vertex area and the first texture area, it is convenient to determine the target greatest common divisor of the first vertex area, the first texture area and the overlapping area, and then facilitate the normalization of the first vertex area and the first texture area through the target greatest common divisor, so as to obtain normalized areas of the same size, so as to facilitate the subsequent GPU to quickly render the blocks of each normalized area and improve the rendering efficiency; by superimposing each of the normalized areas through the hardware acceleration module, the first texture data of each normalized area can be quickly superimposed to obtain the target texture information, so as to facilitate the subsequent rapid drawing of the target texture information into the window, and the hardware acceleration module performs block rendering at the same time, which can reduce the workload of the GPU and improve the rendering efficiency. Compared with the prior art, the present application can improve the rendering speed while reducing the workload of the GPU.

[0034] Further, the second processing module includes: a first calculation unit and a second calculation unit;

[0035] The first calculation unit is used to calculate the greatest common divisor of the first vertex area and the first texture area by using the Euclidean algorithm to obtain an initial common divisor;

[0036] The second calculation unit is used to calculate the greatest common divisor of the initial common divisor and the overlapping area by using the Euclidean algorithm to obtain a target greatest common divisor.

[0037] Furthermore, the second processing module further includes: a first determining unit, a second determining unit and a normalizing unit;

[0038] The first determining unit is used to determine the size of the normalized image container based on the target greatest common divisor;

[0039] The second determining unit is used to determine the number of normalized image containers that can be accommodated in the first vertex area and the first texture area respectively;

[0040] The normalization unit is used to perform normalization processing on the first vertex region and the first texture region respectively based on the size and the number to obtain a plurality of normalized regions.

[0041] Further, the rendering module includes: a creation unit and an overlay unit;

[0042] The creation unit is used to pre-create a second texture area;

[0043] The superposition unit is used to superimpose each of the normalized areas onto the second texture area through a hardware acceleration module, and set the alpha value corresponding to the area in the second texture area that does not belong to each of the normalized areas to zero, so as to obtain target texture information.

[0044] Furthermore, the rendering module further includes: a third determining unit, a merging unit and a rendering unit;

[0045] The third determining unit is used to determine the second vertex data and the second texture data based on the target texture information, and determine the corresponding second vertex area and the second texture area based on the second vertex data and the second texture data;

[0046] The merging unit is configured to determine a second vertex shader based on the second vertex region and the second texture region;

[0047] 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. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 This is a flowchart of an embodiment of a GPU image rendering method based on an embedded device provided by the present application;

[0049] Figure 2 is a schematic diagram of the overlapping area provided by the present application;

[0050] Figure 3 is a schematic diagram of determining a normalized area provided by the present application;

[0051] Figure 4 A schematic diagram of superimposing normalized regions provided in the present application;

[0052] Figure 5 A schematic diagram of the structure of an embodiment of a GPU image rendering system based on an embedded device provided in the present application. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0054] It should be understood that the step numbers used in this article are only for the convenience of description and are not intended to limit the order in which the steps are executed.

[0055] It should be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, the singular forms "a", "an" and "the" are intended to include plural forms unless the context clearly indicates otherwise.

[0056] The terms “include” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0057] The term "and / or" means and includes any and all possible combinations of one or more of the associated listed items.

[0058] Currently, GPU rendering relies on vertex shaders (processing geometry and position) and texture shaders (processing texture and color). However, GPU rendering currently follows a linear pipeline mechanism, which means that vertex shader information is loaded first, and then texture shaders are processed. However, this mechanism has defects: first, this mechanism will cause multiple images to be superimposed in the same area, and the rendering tasks in this area will increase significantly and the GPU resources occupied will increase dramatically, which may reduce the rendering speed and cause freezes; second, the linear process needs to wait for the entire frame to be processed. If any area has heavy tasks, it will cause delays in drawing the entire frame.

[0059] Next, the nouns involved in this application are analyzed:

[0060] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0061] The Euclidean algorithm (also known as Euclid's algorithm) is an efficient way to calculate the greatest common divisor of two integers. For three or more integers, we can extend the Euclidean algorithm to gradually calculate the greatest common divisor between them.

[0062] Based on this, the embodiments of the present application provide a GPU image rendering method and system based on an embedded device, which can reduce the GPU workload while increasing the rendering speed.

[0063] The embodiments of the present application provide a method and system for GPU image rendering based on an embedded device, which are specifically described through the following embodiments. First, the method for GPU image rendering based on an embedded device in the embodiments of the present application is described.

[0064] The GPU image rendering method based on an embedded device provided in an embodiment of the present application relates to the field of power system communication. The GPU image rendering method based on an embedded device provided in an embodiment of the present application can be applied to a terminal, can also be applied to a server side, and can also be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements a GPU image rendering method based on an embedded device, etc., but is not limited to the above forms.

[0065] The present application can also be used in numerous general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present 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. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0066] Embodiment 1

[0067] Please refer to Figure 1 , Figure 1 It is a flowchart of an embodiment of a GPU image rendering method based on an embedded device provided by the present application, including steps S101 to S103;

[0068] Step S101, receiving first vertex data and first texture data preset by a first vertex shader, and determining a first vertex area and a first texture area in a to-be-rendered picture respectively through the first vertex data and the first texture data;

[0069] In some embodiments, first vertex data and first texture data need to be pre-defined in a first vertex shader, wherein 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.

[0070] In some embodiments, the first vertex data and the first texture data are used to determine the first vertex area and the first texture area in the image to be rendered, respectively. Specifically, since the first vertex data defines the shape and object of the subsequent rendering object, the boundary of the first vertex area corresponding to the image to be rendered can be determined by calculating the first vertex data of the image to be rendered, and the first texture data can directly define the first texture area of ​​the image to be rendered, that is, the first vertex shader will process the first vertex data and the first texture data separately.

[0071] Step S102, determining an overlapping area based on the first vertex area and the first texture area, calculating a target greatest common divisor of the first vertex area, the first texture area, and the overlapping area, and normalizing the first vertex area and the first texture area based on the target greatest common divisor to obtain a plurality of normalized areas;

[0072] In some embodiments, based on the first vertex region and the first texture region, an overlapping region is determined. Specifically, after the first vertex region and the first texture region are determined, it is necessary to determine the common part of the two regions in two-dimensional space or three-dimensional space by comparing boundaries or applying a geometric algorithm, that is, to determine the overlapping region. The schematic diagram of the overlapping region provided in this application is as follows: Figure 2 shown.

[0073] In some embodiments, the target greatest common divisor of the first vertex region, the first texture region, and the overlapping region is calculated, specifically: the greatest common divisor of the first vertex region and the first texture region is calculated by the Euclidean algorithm to obtain an initial common divisor; the target greatest common divisor is calculated by the Euclidean algorithm. By way of example and not limitation, 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 intersection region is cw and the height is ch, the greatest common divisor gw of the width can be calculated based on aw, bw, cw, and the greatest common divisor gh can be calculated based on ah, bh, ch, so the target greatest common divisor is obtained. The area with a width of gw and a height of gh.

[0074] In this way, by determining the target greatest common divisor of the first vertex area, the first texture area and the overlapping area, the first vertex area and the first texture area are normalized by the target greatest common divisor, thereby obtaining normalized areas of the same size, which facilitates the subsequent GPU to quickly render blocks of each normalized area and improve rendering efficiency.

[0075] In some embodiments, the first vertex region and the first texture region are respectively normalized based on the target greatest common divisor to obtain a plurality of normalized regions, including: determining a size of a 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 respectively; 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, first, the size of the normalized image container of each region is determined according to the target greatest common divisor, that is, an integer multiple of the region with a width of gw and a height of gh; secondly, after the size of the normalized image container is determined, the size of the region needs to be 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, and the remaining space (differential region) that may exist; finally, according to the determined size and number, the first vertex region and the first texture region are respectively divided into multiple sub-regions with the normalized image container size as a unit to obtain a plurality of normalized regions, wherein the sizes of the normalized regions are the same. The schematic diagram for determining the normalized region is as shown in FIG. Figure 3 shown.

[0076] It should be noted that, for the part that can completely fill the normalized container, the original area (that is, the first vertex area and the first texture area) can be directly divided into corresponding normalized areas; for the remaining space (difference area), you can choose to ignore them or merge them into the nearest normalized area, or process them in other ways (for example, cropping, filling or scaling) to ensure that all areas are correctly normalized.

[0077] In this way, the first vertex area and the first texture area are normalized by the target greatest common divisor, so as to obtain normalized areas of the same size, which facilitates the subsequent GPU to quickly render blocks of each normalized area and improves rendering efficiency.

[0078] Step S103, superimposing the normalized regions through a hardware acceleration module to obtain target texture information, and drawing the target texture information to a window for display through a GPU.

[0079] In some embodiments, each of the normalized regions is superimposed through a hardware acceleration module to obtain target texture information, including: pre-creating a second texture region; superimposing each of the normalized regions onto the second texture region through a hardware acceleration module, and setting the alpha value corresponding to the region in the second texture region that does not belong to each of the normalized regions to zero to obtain the target texture information. Specifically, it is necessary to pre-create a second texture region to accommodate all the normalized regions, and then superimpose the normalized regions onto the second texture region through a hardware acceleration module (G2D). After the superimposition is completed, it is necessary to traverse all pixels in the second texture region 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 the pixel is set to 0, that is, transparent filling is performed, thereby obtaining a picture with a transparent background but containing the target texture information. The schematic diagram of superimposing each normalized region is shown as follows. Figure 4 shown.

[0080] In this way, by superimposing the normalized regions through the hardware acceleration module, the first texture data of the normalized regions can be quickly superimposed to obtain the target texture information, thereby facilitating the subsequent rapid drawing of the target texture information into the window.

[0081] In some embodiments, the target texture information is drawn to a window for display by a GPU, including: determining second vertex data and second texture data based on the target texture information, and determining corresponding second vertex areas and second texture areas based on the second vertex data and the second texture data; determining a second vertex shader based on the second vertex area and the second texture area; the GPU renders 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, determine the corresponding second vertex area and second texture area based on the second vertex data and the second texture data, and pass the second vertex area and second texture area to the GPU, and write or configure the second vertex shader and the corresponding fragment shader to render the target texture information. At the same time, the GPU outputs the rendering result to the display device to form a display interface visible to the user.

[0082] It should be noted that the rendering process usually includes vertex processing (performed by vertex shader), primitive assembly, fragment generation, fragment shading (performed by fragment shader), testing and blending, etc.

[0083] In this way, by quickly drawing the target texture information into the window and performing block rendering by the hardware acceleration module, the workload of the GPU can be reduced and the rendering efficiency can be improved.

[0084] The embodiment of the present application determines the first vertex area and the first texture area in the image to be rendered respectively through the first vertex data and the first texture data, so as to separate the first vertex area and the first texture area in the image to be rendered, so as to facilitate the subsequent processing of the first vertex area and the first texture area respectively; by determining the overlapping area of ​​the first vertex area and the first texture area, it is convenient to determine the target greatest common divisor of the first vertex area, the first texture area and the overlapping area, and then facilitate the normalization of the first vertex area and the first texture area through the target greatest common divisor, so as to obtain normalized areas of the same size, so as to facilitate the subsequent GPU to quickly render the blocks of each normalized area and improve the rendering efficiency; by superimposing each of the normalized areas through the hardware acceleration module, the first texture data of each normalized area can be quickly superimposed to obtain the target texture information, so as to facilitate the subsequent rapid drawing of the target texture information into the window, and the hardware acceleration module performs block rendering at the same time, which can reduce the workload of the GPU and improve the rendering efficiency. Compared with the prior art, the present application can improve the rendering speed while reducing the workload of the GPU.

[0085] Embodiment 2

[0086] Please refer to Figure 5 , Figure 5 1 is a schematic diagram of a structure of an embodiment of a GPU image rendering system based on an embedded device provided by the present application, comprising a first processing module 100, a second processing module 200 and a rendering module 300;

[0087] The first processing module 100 is used to receive first vertex data and first texture data preset by a first vertex shader, and determine a first vertex area and a first texture area in a to-be-rendered image respectively through the first vertex data and the first texture data;

[0088] In some embodiments, first vertex data and first texture data need to be pre-defined in a first vertex shader, wherein 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.

[0089] In some embodiments, the first vertex data and the first texture data are used to determine the first vertex area and the first texture area in the image to be rendered, respectively. Specifically, since the first vertex data defines the shape and object of the subsequent rendering object, the boundary of the first vertex area corresponding to the image to be rendered can be determined by calculating the first vertex data of the image to be rendered, and the first texture data can directly define the first texture area of ​​the image to be rendered, that is, the first vertex shader will process the first vertex data and the first texture data separately.

[0090] The second processing module 200 is used to determine an overlapping area based on the first vertex area and the first texture area, calculate a target greatest common divisor of the first vertex area, the first texture area and the overlapping area, and perform normalization processing on the first vertex area and the first texture area respectively based on the target greatest common divisor to obtain a plurality of normalized areas;

[0091] In some embodiments, based on the first vertex region and the first texture region, an overlapping region is determined. Specifically, after the first vertex region and the first texture region are determined, it is necessary to determine the common part of the two regions in two-dimensional space or three-dimensional space by comparing boundaries or applying a geometric algorithm, that is, to determine the overlapping region. The schematic diagram of the overlapping region provided in this application is as follows: Figure 2 shown.

[0092] 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 of the first vertex area and the first texture area by the Euclidean algorithm to obtain an initial common divisor; the second calculation unit is used to calculate the greatest common divisor of the initial common divisor and the overlapping area by the Euclidean algorithm to obtain a target greatest common divisor. By way of example and not limitation, when the width of the first vertex area A is aw and the height is ah, the width of the first texture area B is bw and the height is bh, and the width of the intersection area is cw and the height is ch, the greatest common divisor gw of the width can be calculated based on aw, bw, cw, and the greatest common divisor gh can be calculated based on ah, bh, ch, so the target greatest common divisor is obtained. The area with a width of gw and a height of gh.

[0093] In this way, by determining the target greatest common divisor of the first vertex area, the first texture area and the overlapping area, the first vertex area and the first texture area are normalized by the target greatest common divisor, thereby obtaining normalized areas of the same size, which facilitates the subsequent GPU to quickly render blocks of each normalized area and improve rendering efficiency.

[0094] In some embodiments, the second processing module 200 also includes: a first determination unit, a second determination unit and a normalization unit; the first determination unit is used to determine the size of the normalized image container based on the target greatest common divisor; the second determination unit is used to respectively determine the number of normalized image containers that can be accommodated by the first vertex area and the first texture area; the normalization unit is used to respectively normalize the first vertex area and the first texture area based on the size and the number to obtain a plurality of normalized areas. Specifically, first, the size of the normalized image container of each region is determined according to the target greatest common divisor, that is, an integer multiple of the region with a width of gw and a height of gh; secondly, after the size of the normalized image container is determined, the size of the region needs to be 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, and the remaining space (differential region) that may exist; finally, according to the determined size and number, the first vertex region and the first texture region are respectively divided into multiple sub-regions with the normalized image container size as a unit to obtain a plurality of normalized regions, wherein the sizes of the normalized regions are the same. The schematic diagram for determining the normalized region is as shown in FIG. Figure 3 shown.

[0095] It should be noted that, for the part that can completely fill the normalized container, the original area (that is, the first vertex area and the first texture area) can be directly divided into corresponding normalized areas; for the remaining space (difference area), you can choose to ignore them or merge them into the nearest normalized area, or process them in other ways (for example, cropping, filling or scaling) to ensure that all areas are correctly normalized.

[0096] In this way, the first vertex area and the first texture area are normalized by the target greatest common divisor, so as to obtain normalized areas of the same size, which facilitates the subsequent GPU to quickly render blocks of each normalized area and improves rendering efficiency.

[0097] The rendering module 300 is used to superimpose the normalized regions through a hardware acceleration module to obtain target texture information, and draw the target texture information to a window for display through a GPU.

[0098] 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 area; the overlay unit is used to overlay each of the normalized areas onto the second texture area through a hardware acceleration module, and set the alpha value corresponding to the area in the second texture area that does not belong to each of the normalized areas to zero, so as to obtain target texture information. Specifically, it is necessary to pre-create a second texture area to accommodate all normalized areas, and then overlay the normalized areas onto the second texture area through a hardware acceleration module (G2D). After the overlay is completed, it is necessary to traverse all pixels in the second texture area to determine whether they belong to each of the normalized areas. If they do not belong to each of the normalized areas, the alpha value corresponding to the pixel is set to 0, that is, transparent filling is performed, thereby obtaining a picture with a transparent background but containing target texture information. The schematic diagram of overlaying each normalized area is shown as follows. Figure 4 shown.

[0099] In this way, by superimposing the normalized regions through the hardware acceleration module, the first texture data of the normalized regions can be quickly superimposed to obtain the target texture information, thereby facilitating the subsequent rapid drawing of the target texture information into the window.

[0100] In some embodiments, the rendering module 300 further includes: a third determination unit, a merging unit and a rendering unit; the third determination unit is used to determine the second vertex data and the second texture data based on the target texture information, and determine the corresponding second vertex area and the second texture area 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 area and the second texture area; 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 the second texture data for rendering from the target texture information, and determine the corresponding second vertex area and the second texture area according to the second vertex data and the second texture data, and pass the second vertex area and the second texture area to the GPU, and write or configure the second vertex shader and the corresponding fragment shader to render the target texture information, and the GPU outputs the rendering result to the display device to form a display interface visible to the user.

[0101] It should be noted that the rendering process usually includes vertex processing (performed by vertex shader), primitive assembly, fragment generation, fragment shading (performed by fragment shader), testing and blending, etc.

[0102] In this way, by quickly drawing the target texture information into the window and performing block rendering by the hardware acceleration module, the workload of the GPU can be reduced and the rendering efficiency can be improved.

[0103] The embodiment of the present application determines the first vertex area and the first texture area in the image to be rendered respectively through the first vertex data and the first texture data, so as to separate the first vertex area and the first texture area in the image to be rendered, so as to facilitate the subsequent processing of the first vertex area and the first texture area respectively; by determining the overlapping area of ​​the first vertex area and the first texture area, it is convenient to determine the target greatest common divisor of the first vertex area, the first texture area and the overlapping area, and then facilitate the normalization of the first vertex area and the first texture area through the target greatest common divisor, so as to obtain normalized areas of the same size, so as to facilitate the subsequent GPU to quickly render the blocks of each normalized area and improve the rendering efficiency; by superimposing each of the normalized areas through the hardware acceleration module, the first texture data of each normalized area can be quickly superimposed to obtain the target texture information, so as to facilitate the subsequent rapid drawing of the target texture information into the window, and the hardware acceleration module performs block rendering at the same time, which can reduce the workload of the GPU and improve the rendering efficiency. Compared with the prior art, the present application can improve the rendering speed while reducing the workload of the GPU.

[0104] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separated, i.e., may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the method of this embodiment.

[0105] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-monitorable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0106] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above description is only a specific embodiment of the present application and is not intended to limit the scope of protection of the present application.

[0107] It is particularly pointed out that for those skilled in the art, any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A GPU image rendering method based on an embedded device, characterized in that: include: Receive first vertex data and first texture data preset by a first vertex shader, and determine a first vertex area and a first texture area in a to-be-rendered picture respectively through the first vertex data and the first texture data; Based on the first vertex region and the first texture region, determining an overlapping region, calculating a target greatest common divisor of the first vertex region, the first texture region, and the overlapping region, and normalizing the first vertex region and the first texture region based on the target greatest common divisor to obtain a plurality of normalized regions; The normalized regions are superimposed by a hardware acceleration module to obtain target texture information, and the target texture information is drawn to a window for display by a GPU.

2. The GPU image rendering method based on embedded device according to claim 1, characterized in that: The calculating of the target greatest common divisor of the first vertex area, the first texture area, and the overlapping area is specifically: Calculate the greatest common divisor of the first vertex area and the first texture area by using the Euclidean algorithm to obtain an initial common divisor; The initial common divisor and the greatest common divisor of the overlapping area are calculated by the Euclidean algorithm to obtain the target greatest common divisor.

3. The GPU image rendering method based on embedded device according to claim 1, characterized in that: The first vertex region and the first texture region are respectively normalized based on the target greatest common divisor to obtain a plurality of normalized regions, specifically: determining a size of a normalized image container based on the target greatest common divisor; respectively determining the number of normalized image containers that can be accommodated in the first vertex region and the first texture region; The first vertex region and the first texture region are respectively normalized based on the size and the number to obtain a plurality of normalized regions.

4. The GPU image rendering method based on embedded device according to claim 1, characterized in that: The normalized regions are superimposed by the hardware acceleration module to obtain target texture information, specifically: Pre-creating a second texture area; Each of the normalized regions is superimposed on the second texture region through a hardware acceleration module, and an alpha value corresponding to a region in the second texture region that does not belong to each of the normalized regions is set to zero, so as to obtain target texture information.

5. The GPU image rendering method based on embedded device according to claim 1, characterized in that: Drawing the target texture information to a window for display by using a GPU is specifically as follows: Determine second vertex data and second texture data based on the target texture information, and determine corresponding second vertex areas and second texture areas based on the second vertex data and the second texture data; determining a second vertex shader 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 a display interface.

6. A GPU image rendering system based on an embedded device, characterized in that: include: 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 a first vertex shader, and determine a first vertex area and a first texture area in the image to be rendered respectively through the first vertex data and the first texture data; The second processing module is used to determine an overlapping area based on the first vertex area and the first texture area, calculate a target greatest common divisor of the first vertex area, the first texture area and the overlapping area, and perform normalization processing on the first vertex area and the first texture area respectively based on the target greatest common divisor to obtain a plurality of normalized areas; The rendering module is used to superimpose the normalized areas through the hardware acceleration module to obtain target texture information, and draw the target texture information to the window for display through the GPU.

7. The GPU image rendering system based on embedded devices according to claim 6, characterized in that: The second processing module includes: a first calculation unit and a second calculation unit; The first calculation unit is used to calculate the greatest common divisor of the first vertex area and the first texture area by using the Euclidean algorithm to obtain an initial common divisor; The second calculation unit is used to calculate the greatest common divisor of the initial common divisor and the overlapping area by using the Euclidean algorithm to obtain a target greatest common divisor.

8. The GPU image rendering system based on embedded devices according to claim 6, characterized in that: The second processing module further includes: a first determining unit, a second determining unit and a normalizing 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 area and the first texture area respectively; The normalization unit is used to perform normalization processing on the first vertex region and the first texture region respectively based on the size and the number to obtain a plurality of normalized regions.

9. The GPU image rendering system based on embedded devices according to claim 6, characterized in that: The rendering module includes: a creation unit and an overlay unit; The creation unit is used to pre-create a second texture area; The superposition unit is used to superimpose each of the normalized areas onto the second texture area through a hardware acceleration module, and to set the alpha value corresponding to the area in the second texture area that does not belong to each of the normalized areas to zero, so as to obtain target texture information.

10. The GPU image rendering system based on embedded devices according to claim 6, 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 determine the corresponding second vertex area and the second texture area based on the second vertex data and the second texture data; The merging unit is configured to determine a second vertex shader based on the second vertex region and the second texture region; 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.

Citation Information

Patent Citations

  • Image processing method and device, electronic equipment and storage medium

    CN112750176A

  • GPU-based three-dimensional image data rendering method and device

    CN113012269A

  • Medical image processing device, medical image processing method, and program

    CN113557714A

  • Image rendering method and apparatus, computer device, and storage medium

    US20230033306A1

  • Managing rendering targets for graphics processing units

    US9928637B1