Graph rendering method and device and computer program product

By simultaneously rendering multiple image components of HDR images in a single rendering channel, and using the collaborative work of vertex and fragment shaders, the problem of high rendering power consumption in the prior art is solved, achieving more efficient rendering performance and more stable system operation.

CN120070706APending Publication Date: 2025-05-30GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510123055.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-24
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

When the prior art renders HDR pictures and other similar pictures, the rendering power consumption is high, which affects system performance and stability.

Method used

By simultaneously rendering at least two image components of the image to be rendered in a single rendering channel, the element shape is determined using the vertex shader, and color filling and output is performed by the fragment shader, the number of times the element shape is determined is reduced, thereby saving rendering power consumption.

Benefits of technology

While maintaining rendering quality, it significantly reduces rendering power consumption, improves system performance and stability, reduces frame rate latency, and improves system scalability and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120070706A_ABST
    Figure CN120070706A_ABST
Patent Text Reader

Abstract

The invention provides a graph rendering method and device and a computer program product. The method comprises the following steps that: a vertex shader in a first processor determines a primitive shape on a screen or a picture canvas according to a predefined first vertex coordinate; a fragment shader in the first processor performs color filling on pixel points in the primitive shape according to a first image component and a second image component of an image to be rendered to determine a first color value, outputting the first color value to a first color attachment of a first frame buffer object as a rendering result of the first image component; and the fragment shader performs color filling on pixel points in the primitive shape according to the second image component, determines a second color value, and outputs the second color value to a second color attachment of the first frame buffer object as a rendering result of the second image component.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to electronic technology, including but not limited to graphic rendering methods and devices, computer program products. Background Art

[0002] Image editing supports the editing of various types of images (such as HDR images, etc.). HDR images have the ability to represent extremely high brightness and extremely dark details. For example, in a scene with sunlight, snow, and people, an HDR image can better represent the dazzling light of the sun and the strong reflection of sunlight on the snow, and at the same time, it can also clearly show the details of the dark part of the human face in backlight. However, when performing graphic rendering on HDR images and similar images, it will bring a large rendering power consumption overhead. Summary of the Invention

[0003] In a first aspect, an embodiment of this application provides an image rendering method, and the method includes: The vertex shader in the first processor determines the primitive shape on the screen or the picture canvas according to the predefined first vertex coordinates; the fragment shader in the first processor fills the pixel points within the primitive shape with colors according to the first image component and the second image component of the image to be rendered, determines the first color value, and outputs the first color value as the rendering result of the first image component to the first color attachment of the first frame buffer object; the fragment shader fills the pixel points within the primitive shape with colors according to the second image component, determines the second color value, and outputs the second color value as the rendering result of the second image component to the second color attachment of the first frame buffer object.

[0004] In a second aspect, an embodiment of this application provides a graphic rendering device, characterized in that the device includes a first processor; the first processor is configured to:

[0005] Execute a vertex shader, which is used to determine the primitive shape on the screen or the picture canvas according to the predefined first vertex coordinates;

[0006] Execute a fragment shader, which is used to fill the pixel points within the primitive shape with colors according to the first image component and the second image component of the image to be rendered, determine the first color value, and output the first color value as the rendering result of the first image component to the first color attachment of the first frame buffer object; and,

[0007] The fragment shader is further configured to fill the pixel points within the primitive shape with colors according to the second image component, determine the second color value, and output the second color value as the rendering result of the second image component to the second color attachment of the first frame buffer object.

[0008] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a first processor. The memory stores a computer program that can run on the first processor. When the first processor executes the program, the method described in the first aspect is implemented.

[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor or an electronic device, the method described in the first aspect is implemented.

[0010] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program or instruction. When the computer program or instruction is executed by a processor or an electronic device, the method described in the first aspect of the present application is implemented.

[0011] In a sixth aspect, an embodiment of the present application provides a computer program, which enables a processor or an electronic device to execute the method described in the first aspect.

[0012] In the embodiment of the present application, the rendering of at least two image components of the image to be rendered is implemented in one rendering pass. That is, the fragment shader implements the rendering of the first image component and outputs the rendering result (i.e., the first color value) to the first color attachment of the first buffer object; the fragment shader implements the rendering of the second image component and outputs the rendering result (i.e., the second color value) to the second color attachment of the first buffer object; and the rendering of the first image component and the rendering of the second image component are both implemented based on the primitive shape output by the vertex shader. Thus, during the process of implementing the rendering of at least two image components of the image to be rendered in one rendering pass, only one determination process of the primitive shape needs to be executed, thereby saving the rendering power consumption brought by rendering the image to be rendered.

[0013] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The accompanying drawings herein are incorporated into the specification and form a part of the specification. These drawings illustrate embodiments consistent with the present application and, together with the specification, are used to explain the technical solutions of the present application. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0015] The flowcharts shown in the accompanying drawings are merely illustrative and not necessarily include all the content and operations / steps, nor are they necessarily executed in the described order. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined, so the actual execution order may change according to the actual situation.

[0016] Figure 1 It is a schematic diagram of the rendering process of HDR images in the related art;

[0017] Figure 2 It is a schematic diagram of the implementation process of the graphics rendering method provided by the embodiment of the present application Figure 1 ;

[0018] Figure 3 It is a further schematic diagram of the implementation process of step 201 provided by the embodiment of the present application;

[0019] Figure 4 It is a schematic diagram of the implementation process of determining the first texture coordinate provided by the embodiment of the present application;

[0020] Figure 5 It is a schematic diagram of the implementation process of determining the first color value provided by the embodiment of the present application;

[0021] Figure 6 It is a schematic diagram of the steps further included in the graphics rendering method provided by the embodiment of the present application;

[0022] Figure 7 It is a schematic diagram of the implementation process of the graphics rendering method provided by the embodiment of the present application Figure 2 ;

[0023] Figure 8 It is a schematic diagram of multi-target rendering provided by the embodiment of the present application;

[0024] Figure 9 It is a schematic diagram of a single rendering pass provided by the embodiment of the present application;

[0025] Figure 10 It is a schematic diagram of preparing vertex data in geometric data provided by the embodiment of the present application;

[0026] Figure 11 It is a schematic diagram of preparing uv coordinate data in geometric data provided by the embodiment of the present application;

[0027] Figure 12 It is a schematic diagram of rasterization provided by the present application;

[0028] Figure 13 It is a schematic diagram of the structure of the graphics rendering device provided by the embodiment of the present application;

[0029] Figure 14Schematic structural diagram of the electronic device provided by the embodiments of the present application. Detailed implementation manners

[0030] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the following will further describe the specific technical solutions of the present application in detail with reference to the accompanying drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.

[0031] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0032] In the following descriptions, references to "some embodiments", "this embodiment", "embodiments of the present application" and examples, etc., describe subsets of all possible embodiments. However, it can be understood that "some embodiments" can be the same subsets or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0033] The descriptions such as "first, second, third" etc. appearing in the embodiments of the present application are only for clearly describing the objects, without any order, and do not represent special limitations on the number of devices in the embodiments of the present application. That is, the descriptions such as "first, second, third" etc. have no specific meaning and cannot constitute any limitation to the embodiments of the present application.

[0034] Before further elaborating on the embodiments of the present application, the nouns and terms that may be involved in the embodiments of the present application will be described first. The nouns and terms involved in the embodiments of the present application are applicable to the following explanations.

[0035] Vertex Buffer Object (VBO), a mechanism for packing all vertex-related data of a model from the CPU into the GPU;

[0036] Vertex Array Object (VAO), an attribute description mechanism for describing how the data packed in the VBO should be interpreted by the GPU;

[0037] Frame Buffer Object (FBO), a mechanism for organizing rendering targets. It can pack all the targets that need to be output in one rendering into one object for management;

[0038] Shader, a rendering program executed on the GPU, usually includes a Vertex Shader responsible for geometric shape processing, a Fragment Shader responsible for pixel color filling, a Compute Shader responsible for data calculation, etc.;

[0039] Render Pass, the process of completing a full drawing and outputting to a specified target (such as the screen or buffer) is called a render pass; usually, a Vertex Shader and a Fragment Shader work together in a render pass;

[0040] Color Attachment, an output attachment on the FBO, which is used to specify a target (such as a texture or buffer) that can receive the color output of the render pass;

[0041] Depth Attachment, an output attachment on the FBO, which is used to specify a target (such as a buffer) that can receive the depth information output of the render pass;

[0042] Stencil Attachment, an output attachment on the FBO, which is used to specify a target (such as a buffer) that can receive the stencil information output of the render pass;

[0043] Texture, a piece of memory used to carry pixel data;

[0044] High-Dynamic Range (HDR) image, an image processed by special technology, which can show richer colors and details than ordinary images;

[0045] Standard Dynamic Range (SDR) image, an image made based on standard dynamic range technology, with a smaller information size compared to HDR (High-Dynamic Range) and a higher popularity;

[0046] Gainmap image, an image used to store brightness information, which records the brightness difference at each pixel point, that is, the brightness gain of the HDR image relative to the SDR (Standard Dynamic Range) image. When the device supports HDR display, it combines the SDR image (usually called the main image or base image) and the Gainmap image to render a high-dynamic range image.

[0047] To facilitate the understanding of the technical solutions of the embodiments of the present application, the related technologies of the embodiments of the present application are described below. The following related technologies can be arbitrarily combined with the technical solutions of the embodiments of the present application as optional solutions, and they all fall within the protection scope of the embodiments of the present application.

[0048] In image editing, the editing of HDR images is supported. Such images have the ability to represent extremely high brightness and extremely dark details. For example, in a scene with sunlight, snow, and people, an HDR image can better represent the dazzling light of the sun and the strong reflection of sunlight on the snow, and at the same time, it can also clearly show the details of the dark part of the human face in the backlight.

[0049] An HDR image is composed of two images inside, namely an SDR image expressing the original color and a Gainmap image expressing the illumination brightness. The information recorded by the two images is superimposed on each other, and then an extraordinary brightness expression ability can be presented when the HDR image is displayed.

[0050] When editing such an HDR image, it is necessary to process the SDR image and the Gainmap Figure 1 simultaneously. For example, when erasing the sun, it is necessary to remove the sun from the sky in the SDR image, and in the Gainmap image, it is also necessary to cover the strong illumination at the position of the sun with the illumination intensity of the surrounding sky.

[0051] In the related technology, for the rendering of HDR images, since the HDR image contains two parts, namely the SDR image and the Gainmap image, each time an image effect (such as a filter, etc.) is applied to the HDR image, it is necessary to perform an image effect rendering on the SDR image and the Gainmap image in the HDR image respectively in sequence. That is, one effect actually requires two image effect renderings. In the related technology, forward rendering is used as the basic rendering process for HDR image processing. Figure 1 It is a schematic diagram of the rendering process of HDR images in the related technology; as Figure 1 shown, taking frame 0 as an example, the SDR image and the Gainmap image are respectively rendered, that is, two rendering operations / rendering channels are performed on the HDR image and then sent for display.

[0052] The inventors of the present application found the following problems through research and analysis of the above related technologies:

[0053] (1) One effect requires two renderings, which takes twice as much time and the power consumption also increases by nearly one time;

[0054] (2) When previewing the HDR effect, if you want to maintain the interface flow, there are requirements for the frame rate. Mobile devices usually require a minimum of 60fps to achieve a basic flow, so the rendering of each frame of the picture must be completed within 16.66ms. In theory, only one rendering operation is required for one frame of the image, but in fact, two rendering operations are performed for the rendering process of the HDR image, which obviously increases the processing load within one frame. Then the time remaining in one frame to execute other tasks (such as interface animation tasks) will become less, which reduces the scalability of the system;

[0055] (3) In one frame, if after rendering the SDR picture, due to some unexpected situations, the task of rendering the Gainmap picture cannot be executed or is delayed, it will cause unpredictable behavior in the effect preview due to the lack of necessary picture resources, thus reducing the robustness of the system.

[0056] Based on this, the embodiments of the present application provide the following graphics rendering methods, devices, equipment, etc.

[0057] Figure 2 Schematic diagram of the implementation process of the graphics rendering method provided by the embodiments of the present application Figure 1 As Figure 2 shown, the method includes the following steps 201 to step 203:

[0058] Step 201, the vertex shader in the first processor determines the primitive shape on the screen or the picture canvas according to the predefined first vertex coordinates;

[0059] Step 202, the fragment shader in the first processor fills the pixel points within the primitive shape with colors according to the first image component and the second image component of the image to be rendered, determines the first color value, and outputs the first color value as the rendering result of the first image component to the first color attachment of the first frame buffer object;

[0060] Step 203, the fragment shader fills the pixel points within the primitive shape with colors according to the second image component, determines the second color value, and outputs the second color value as the rendering result of the second image component to the second color attachment of the first frame buffer object.

[0061] It can be understood that the vertex shader and the fragment shader are two programs in a render pass. For the convenience of description, this render pass will be referred to as the first render pass below. Of course, the first render pass does not refer to a specific render pass, and this render pass can be any render pass in the first processor. In the embodiments of the present application, the frame buffer bound to the first render pass is the first frame buffer object, and the first frame buffer object includes multiple color attachments.

[0062] In the embodiment of the present application, rendering of at least two image components of an image to be rendered is implemented in a single rendering pass. That is, the fragment shader implements rendering of the first image component through step 202 and outputs the rendering result (i.e., the first color value) to the first color attachment of the first buffer object; the fragment shader implements rendering of the second image component through step 203 and outputs the rendering result (i.e., the second color value) to the second color attachment of the first buffer object; and both step 202 and step 203 are implemented based on the primitive shape output by the vertex shader. Thus, during the process of implementing rendering of at least two image components of the image to be rendered in a single rendering pass, only one determination process of the primitive shape needs to be performed, thereby saving the rendering power consumption brought by rendering the image to be rendered.

[0063] The following further describes optional implementation manners of each of the above steps and related terms, etc.

[0064] Step 201, the vertex shader in the first processor determines the primitive shape on the screen or the picture canvas according to the predefined first vertex coordinates.

[0065] Further, in some embodiments, as Figure 3 shown, step 201 may include the following steps 301 and 302:

[0066] Step 301, the vertex shader transforms the first vertex coordinates into the coordinate system of the screen or the picture canvas to obtain second vertex coordinates.

[0067] In the embodiment of the present application, there is no limitation on the method for the vertex shader to transform the first vertex coordinates into the coordinate system of the screen or the picture canvas. Exemplarily, the vertex shader may transform the first vertex coordinates according to the MVP matrix to obtain corresponding second vertex coordinates; wherein, the MVP matrix is determined based on the model matrix, the view matrix, and the projection matrix. For example, the MVP matrix is the product of the model matrix, the view matrix, and the projection matrix.

[0068] Step 302, the vertex shader determines the primitive shape on the screen or the picture canvas according to the second vertex coordinates.

[0069] In the embodiment of the present application, the predefined first vertex coordinates include the vertex coordinates of the predefined model. Therefore, the predefined first vertex coordinates include the coordinates of multiple vertices. Additionally, vertex indices of each first vertex coordinate may be predefined. In this way, in step 302, the vertex shader may assemble the primitive shape according to these vertex indices and the second vertex coordinates transformed from the first vertex coordinates.

[0070] To facilitate the fragment shader to sample the pixel colors to be displayed on the screen or the picture canvas from the first image component and the second image component, in some embodiments, the method further includes: the vertex shader determines, according to the primitive shape, the first texture coordinates corresponding to the pixel points within the primitive shape, so that the fragment shader samples the corresponding third color value from the first image component according to the first texture coordinates of each pixel point within the primitive shape, and the vertex shader samples the corresponding fourth color value from the second image component according to the first texture coordinates of each pixel point within the primitive shape.

[0071] For how to specifically implement the determination of the first texture coordinates, further, in some embodiments, as Figure 4 shown, the vertex shader determines, according to the primitive shape, the first texture coordinates of the pixel points within the primitive shape, which may include the following steps 401 to 404:

[0072] Step 401, the vertex shader determines the second texture coordinates corresponding to the first vertex coordinate on the first image component or the second image component;

[0073] Step 402, the vertex shader determines the third texture coordinates of the second texture coordinates on the screen or the picture canvas.

[0074] In the embodiments of the present application, the method for the vertex shader to transform the second texture coordinates into the coordinate system of the screen or the picture canvas is not limited. Exemplarily, the vertex shader may transform the second texture coordinates according to the MVP matrix to determine the third texture coordinates of the second texture coordinates in the coordinate system of the screen or the picture canvas; wherein, the MVP matrix is determined based on the model matrix, the view matrix and the projection matrix, for example, the MVP matrix is the product of the model matrix, the view matrix and the projection matrix.

[0075] Step 403, the vertex shader determines the linear relationship between the pixel coordinates of the pixel points within the primitive shape on the screen or the picture canvas and the second vertex coordinate of the primitive shape;

[0076] Step 404, the vertex shader determines the first texture coordinates of the pixel points within the primitive shape according to the linear relationship and the third texture coordinates corresponding to the vertex coordinates of the primitive shape.

[0077] It can be understood that on the screen or the picture canvas, there is a linear relationship between the pixel coordinates of the pixel points within the primitive shape and the vertex coordinates of the primitive shape. The pixel coordinates of any pixel point within the primitive shape can be determined based on the coordinates of several vertices on the primitive. And the first texture coordinate has a corresponding relationship with the vertex coordinates of the primitive shape. Therefore, the first texture coordinate corresponding to the pixel coordinates of any pixel point within the primitive shape also has the same linear relationship with the third texture coordinate corresponding to the vertex coordinates of the primitive shape. Therefore, through step 404, the first texture coordinate of the pixel points within the primitive shape can be obtained.

[0078] Step 202, the fragment shader in the first processor fills the pixel points within the primitive shape with colors according to the first image component and the second image component of the image to be rendered, determines the first color value, and outputs the first color value as the rendering result of the first image component to the first color attachment of the first frame buffer object.

[0079] In the embodiments of the present application, the first color value may be the result after color filling, or the first color value may be obtained by further processing the result after color filling.

[0080] In the embodiments of the present application, the first frame buffer object is bound to the first rendering pass, and the first rendering pass includes the vertex shader and the fragment shader.

[0081] As described above, the vertex shader determines the first texture coordinate corresponding to the pixel points within the primitive shape according to the primitive shape on the screen or the picture canvas. Correspondingly, in some embodiments, for the fragment shader in step 202 to fill the pixel points within the primitive shape with colors according to the first image component and the second image component of the image to be rendered and determine the first color value, as Figure 5 shown, it may further include the following steps 501 to 503:

[0082] Step 501, the fragment shader samples the third color value corresponding to the first texture coordinate on the first image component;

[0083] Step 502, the fragment shader samples the fourth color value corresponding to the first texture coordinate on the second image component;

[0084] Step 503, the fragment shader determines the first color value according to the third color value and the fourth color value.

[0085] Further, in some embodiments, step 503 may include: the fragment shader performs special effect processing on the third color value and the fourth color value according to the first effect parameter carried in the shader parameter to determine the first color value.

[0086] In an embodiment of the present application, the first color value may be the result of performing a special effect process on a third color value and a fourth color value based on a first effect parameter, or the first color value may also be obtained by further processing the result of the special effect process.

[0087] Step 203: The fragment shader fills the pixel points within the primitive shape with colors according to the second image component, determines a second color value, and outputs the second color value as the rendering result of the second image component to the second color attachment of the first frame buffer object.

[0088] In an embodiment of the present application, the second color value may be the result after color filling, or the second color value may also be obtained by further processing the result after color filling.

[0089] It can be understood that in the process of obtaining the first color value in step 202, for example Figure 5 As shown in the implementation process of obtaining the rendering result of the first image component, it can be seen that the data required for rendering the first image component includes not only the first image component but also the second image component. Therefore, in the process of obtaining the rendering result of the first image component, the fragment shader samples not only the third color value corresponding to the first texture coordinate on the first image component, but also the fourth color value corresponding to the first texture coordinate on the second image component.

[0090] Based on this, in order to save the power consumption overhead brought by obtaining the rendering result of the second image component, that is, to save the power consumption overhead of executing step 203, in some embodiments, for the fragment shader in step 203 to fill the pixel points within the primitive shape with colors according to the second image component and determine the second color value, it may further include: the fragment shader determines the second color value according to the fourth color value. That is, when obtaining the rendering result of the second image component, the fragment shader no longer samples the second image component for color, but uses the fourth color value obtained in step 202 to determine the second color value.

[0091] Furthermore, in some embodiments, for the fragment shader to determine the second color value according to the fourth color value, it may include: the fragment shader performs a special effect process on the fourth color value according to a second effect parameter carried in the shader parameter to determine the second color value. Wherein, the second effect parameter may be the same as or different from the first effect parameter.

[0092] In the embodiments of the present application, the second color value may be the result of performing a special effect process on the fourth color value, or may be obtained by further processing the result of the special effect process.

[0093] It can be understood that the Vertex Shader is responsible for processing geometric information and is used to combine model vertices into the shape outline (i.e., the primitive shape) on the final screen according to the written logic. The Fragment Shader is responsible for filling each pixel within the shape outline enclosed by the Vertex Shader with the required color points. Finally, the filled shapes are written into the corresponding color attachments in the first frame buffer object for output to the screen or for further use by the second processor.

[0094] As mentioned above, in the embodiments of the present application, the Vertex Shader and the Fragment Shader are in one rendering pass, and this rendering pass is bound to the first frame buffer object. Through the above embodiments, the rendering results of the first image component and the second image component can be obtained simultaneously in one rendering pass, thus omitting the redundant and repeated steps in the related art of separately rendering each image component in multiple rendering passes when rendering a to-be-rendered image with at least two image components. Thereby, the rendering performance is improved, and problems such as lag, effect delay, and long save effect time caused by high rendering load in image editing are solved. Among them, the omitted redundant and repeated steps, such as the step of determining the primitive shape on the screen or the picture canvas mentioned above, for the input data required to obtain the rendering results of the first image component and the second image component, such as the primitive shape, only the determination of the primitive shape needs to be performed once. In addition, in a complete image rendering pipeline, other operations before obtaining the rendering results of the first image component and the second image component can also be performed only once, thereby saving the rendering power consumption of the to-be-rendered image and improving the rendering efficiency of the to-be-rendered image.

[0095] Exemplarily, in some embodiments, as Figure 6 shown, the method further includes the following steps 601 and 602:

[0096] Step 601, the second processor determines the shader parameters required for the to-be-rendered image;

[0097] Among them, the shader parameters include one or more of the following parameters: first geometric data, attribute description information of the first geometric data, an identifier of the vertex shader, an identifier of the fragment shader, a first image component, and a second image component; wherein, the first geometric data includes the first vertex coordinates and the second texture coordinates; the identifier of the vertex shader is used to indicate which vertex shader to enable; the identifier of the fragment shader is used to indicate which fragment shader to enable.

[0098] In one implementation, the attribute description information of the first geometric data records state information related to vertices, such as the format of the first vertex coordinates and the format of the second texture coordinates, etc., which is used to help the first processor interpret / parse the packed first vertex coordinates and first texture coordinates.

[0099] In some embodiments, the second processor determines the first geometric data, including: the second processor prepares second geometric data, the second geometric data includes the first vertex coordinates and the second texture coordinates; and the second processor packs the second geometric data into the first geometric data according to a data structure that the first processor can parse.

[0100] Exemplarily, in some embodiments, the second processor packs the second geometric data into the first geometric data according to a data structure that the first processor can parse, including: the second processor packs the second geometric data into the first geometric data through a VBO mechanism.

[0101] Step 602, the second processor passes the shader parameters to the first processor and submits a first command to the first processor; the first command is used to indicate rendering the image to be rendered according to the shader parameters.

[0102] In the embodiments of the present application, the first command is not limited, as long as it can indicate that the first processor renders the image to be rendered according to the passed shader parameters. For example, in OpenGL, the first command is drawcall (rendering call). In addition, the rendering result of the image to be rendered includes the rendering result of the first image component of the image to be rendered and the rendering result of the second image component of the image to be rendered. In one example, the rendering result of the image to be rendered is the superimposed result of the rendering results of the at least two image components.

[0103] It can be understood that in the embodiments of the present application, such as Figure 6As shown, the method further includes the above steps 601 and 602. Combining with the embodiments of the foregoing graphics rendering method, in the two rendering processes of obtaining the rendering result of the first image component and obtaining the rendering result of the second image component, only one execution of steps 601 and 602 is required, saving the number of executions of the same steps that need to be performed for rendering these two image components separately, thereby being beneficial to saving the rendering power consumption of the to-be-rendered image and improving the rendering performance of the to-be-rendered image.

[0104] In the embodiments of the present application, the type of the first processor is not limited. The processor can be various types of processors with graphics rendering capabilities. For example, the first processor is a graphics processing unit (GPU), and the second processor is a central processing unit (CPU).

[0105] In the embodiments of the present application, the type of the to-be-rendered image is not restricted and can be various types of images composed of at least two superimposed image components. Exemplarily, the to-be-rendered image is a High-Dynamic Range (HDR) image, the first image component is a Standard Dynamic Range (SDR) image, and the second image component is a Gainmap image.

[0106] The possible implementation solutions of the graphics rendering method described in the above one or more embodiments are described by way of example as follows.

[0107] The inventors of the present application found in research and analysis that there is a correlation in content between the SDR image and the Gainmap image that need to be rendered in HDR picture editing, that is, the parameters required for rendering these two images are basically the same. Based on this, the embodiments of the present application provide a graphics rendering method. Figure 7 It is a schematic implementation flow of the graphics rendering method provided by the embodiments of the present application. Figure 2 ; As Figure 7 shown, all the parameters required for rendering the two pictures, the SDR image and the Gainmap, can be passed into the GPU at one time. Subsequently, the GPU can use these parameters to complete the rendering tasks of the two pictures through calculation, thereby saving the computational overhead and the like brought by the repeated actions in the two renderings.

[0108] The following describes how to complete the rendering tasks of the two pictures simultaneously in one rendering pass.

[0109] The multi-target rendering technology (MRT) has the ability to output multiple contents simultaneously in a single rendering pass. These output contents can be pictures or data such as Buffers. In the embodiments of this application, the purpose of simultaneously outputting two pictures in a single rendering is achieved based on MRT.

[0110] Figure 8 This is a schematic diagram of multi-target rendering provided by the embodiments of this application; as Figure 8 shown, in the GPU, the program that performs operations is the shader program. In a single rendering pass, there are usually two programs, the vertex shader and the fragment shader, working together. The Vertex Shader is responsible for processing geometric information and combining the model vertices (including the first vertex coordinates) passed into the GPU into the shape outline (i.e., the primitive shape) on the final screen according to the written logic. The Fragment Shader is responsible for filling each pixel within the shape outline surrounded by the Vertex Shader with the required color points. Finally, the filled shapes are written into the corresponding color attachments of the first frame buffer object (FBO) to be output to the screen or the CPU side for further use.

[0111] As Figure 8 shown, it can be seen that the attachments of the Frame buffer Object (abbreviated as FBO) contain multiple color attachments. If textures that can carry the picture content are pre-specified for all the color attachments, and at the same time, in the Fragment Shader, the corresponding colors are output for each color attachment in each FBO, then multiple pictures can be rendered simultaneously in a single rendering pass.

[0112] The following details Figure 8 the meanings of each process:

[0113] ■ The Vertex Shader receives vertex and texture coordinate (uv) data (i.e., the first vertex coordinate and the second texture coordinate) contained in the VBO. At the same time, it performs an algebraic linear transformation on each vertex and texture coordinate using the received transformation matrix (MVP Matrix), enabling it to transform the vertex and texture coordinate to a new position according to the translation, scaling, and rotation specified in the transformation matrix. At this time, the geometric shape that needs to be formed on the screen or the final output picture canvas is determined.

[0114] ■ After the Fragment Shader receives the incoming SDR image (SDR Image) and Gainmap (Gainmap), it samples the pixel colors at the required positions in the SDR image and Gainmap using the processed texture coordinates (uv) passed by the Vertex Shader. At the same time, the Fragment Shader performs special effects processing on the sampled colors using the received effect arguments (Effect Argumetns), and writes the processed colors to the Color Attachment[0] attachment of the FBO through the Output SDR Fragment variable (i.e., the first color value); among them, Color Attachment[0] can be understood as the first color attachment.

[0115] ■ Similarly, the Fragment Shader will also perform a mixing calculation on the sampled Gainmap colors (i.e., the fourth color value) and the effect arguments (Effect Argumetns) according to a certain algorithm to obtain the Gainmap colors to be output (i.e., the second color value), and write them to the Color Attachment[1] attachment of the FBO through the Output Gain Fragment variable; among them, the Color Attachment[1] attachment can be understood as the second color attachment.

[0116] ■ Finally, the Output SDR Texture and Output Gainmap Texture on the color attachment (Color Attachment) of the FBO are obtained for further use.

[0117] The following describes which repeated actions can be omitted in two renderings in a single render pass.

[0118] Figure 9 This is a schematic diagram of a single render pass provided by an embodiment of the present application; as Figure 9 shown, a single render pass can be split into Figure 9 the 9 steps shown. However, when rendering the SDR image and Gainmap, only the (8)th step is different, and the rest of the steps are repetitive and wasteful work. Therefore, the multi-target rendering technology can omit a large number of repeated steps, resulting in a significant performance improvement.

[0119] Among them:

[0120] In step (1), the CPU preparing geometric data means preparing geometric data of geometric shapes, such as vertices and texture coordinates.

[0121] Figure 10Schematic diagram of preparing vertex data in the geometric data provided by the embodiments of the present application; as Figure 10 shown, prepare the vertex data of a rectangle with a length and width of 1 unit, and enclose two right-angled isosceles triangle patches (i.e., primitives) in the order of 0, 1, 2, 1, 2, 3. Among them, patch 0 (face0) is the triangle formed by vertices 0, 1, and 2, with coordinates (-0.5, 0.5, 0), (0.5, 0.5, 0), (-0.5, -0.5, 0) respectively. Patch 1 (face1) is the triangle formed by vertices 1, 2, and 3, with coordinates (0.5, 0.5, 0), (-0.5, -0.5, 0), (0.5, -0.5, 0) respectively.

[0122] Figure 11 Schematic diagram of preparing uv coordinate data in the geometric data provided by the embodiments of the present application; as Figure 11 shown, at the same time, prepare the position coordinates (percentage coordinates: 0.0 = 0%, 1.0 = 100%) where each vertex is mapped to the picture. The uv coordinates corresponding to vertices 0, 1, and 2 of patch 0 (face0) are (0.0, 1.0), (1.0, 1.0), (0.0, 0.0) respectively. The uv coordinates corresponding to vertices 1, 2, and 3 of patch 1 (face1) are (1.0, 1.0), (0.0, 0.0), (1.0, 0.0) respectively.

[0123] Based on this, in the rasterization of geometry stage in step (7), Figure 12 Schematic diagram of rasterization provided by the embodiments of the present application; as Figure 12 shown, in the rasterization stage, combine the geometric shape and fill the pixel points within the shape; specifically, for the combined geometric shape, it is implemented through the vertex shader, that is, in the vertex shader, new geometric vertices mapped from the model coordinate system to the screen coordinate system are obtained through vertex’ = vertex * MVP matrix, and these vertices still enclose two triangles (i.e., an example of the primitive shape) on the screen in the order of 0, 1, 2, 1, 2, 3. For the pixel points within the filled shape, it is specifically implemented through the fragment shader, that is, in the fragment shader, each pixel point that needs to be filled with color will be interpolated by OpenGL to obtain the uv coordinate corresponding to the pixel point position, denoted as uv’. The pixel point color on the texture image is sampled from the uv’ coordinate interpolated by OpenGL and filled into the pixel points of the primitive.

[0124] Step (2), generate VBO; Drawing is performed in the GPU, and the preparation of geometric data is done in the CPU. The GPU needs to read this geometric data from the CPU, so the CPU needs to generate VBO data that can be parsed / read by the GPU; that is, the CPU writes the geometric data into a specific storage area of the GPU according to the data structure that the GPU can parse.

[0125] Step (3), pack VAO; VAO records the state information related to vertices, such as the format of vertex positions, the format of texture coordinates, etc., which is used to help the GPU parse / read the vertex coordinates and texture coordinates in the VBO; In one implementation, the vertex coordinates are packed into a VBO, and the texture coordinates are also packed into a VBO. All the VBOs and their interpretation descriptions are packed together into a VAO;

[0126] Step (4), enable the Shader program, that is, specify which Shader programs to enable; The relationship with the previous steps is that the parameters input by these programs during runtime are VAO; Therefore, in step (5), input shader parameters, including: VAO; As Figure 8 shown, the input parameters on the left side of the Vertex Shader include: vertex, texture coordinate (uv), transformation matrix (MVP Matrix), and SDR Image, Gainmap, and effect arguments.

[0127] Step (6), submit the render drawcall; The previous steps (1)-(5) are actually specifying various operation commands / parameters; After specifying these parameters, a command can be sent to the GPU to tell the GPU how to render the input image (that is, tell the GPU these specified parameters).

[0128] Test data from GPU manufacturers shows that the rendering time of MRT is reduced by approximately 37.6% compared to two forward renders.

[0129] It can be understood that the above-mentioned graphics rendering method provided by the embodiments of this application has the following benefits:

[0130] (1) There is only one render within a frame, which improves rendering performance, reduces the time consumption, and reduces power consumption;

[0131] (2) Reduces the load within a frame, leaving more time for other tasks such as animations, improving the system's demand scalability;

[0132] (3) The two renders are combined into one overall render, avoiding the embarrassing situation where half of the rendering task is successful and half fails. Moreover, if the overall rendering fails, it can be retried as a whole, and the task scheduling is also more concise and less error-prone.

[0133] It should be noted that the above possible implementation uses the multi-target rendering technology provided by the FBO mechanism in OpenGL to simultaneously render the SDR image and the Gainmap image in one rendering pass, omitting the redundant and repetitive steps of separately rendering the SDR image and the Gainmap image in two separate rendering passes in traditional rendering, thereby improving the rendering performance and solving problems such as lag, effect latency, and long save effect time caused by high rendering load per frame in the editor.

[0134] In the embodiments of the present application, on Android, similar technologies can also be implemented using Vulkan-based rendering.

[0135] In the embodiments of the present application, on Windows, similar technologies can be implemented using DirectX-based rendering.

[0136] In the embodiments of the present application, on iOS or MacOS, similar technologies can be implemented using Metal-based rendering.

[0137] In the embodiments of the present application, on the Web, similar technologies can be implemented using WebGL and WebGPU-based rendering.

[0138] In the embodiments of the present application, these graphics and image APIs such as OpenGL, OpenGLES, Vulkan, DirectX (3D), Metal, WebGL, and WebGPU all have the technology to complete multi-target rendering using a mechanism similar to FBO, and these APIs can also be applied in the fields of image and video editing.

[0139] It should be noted that although the steps of the method in the present application are described in a specific order in the drawings, this does not require or imply that these steps must be executed in that specific order, or that all the steps shown must be executed to achieve the desired result. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution, etc.; or, the steps in different embodiments can be combined into a new technical solution.

[0140] Based on the foregoing embodiments, the embodiments of the present application provide a graphics rendering device.

[0141] Figure 13 For the structural schematic diagram of the graphics rendering device provided by the embodiments of the present application; as Figure 13As shown, the graphics rendering device 130 includes a first processor 1301; wherein: The first processor 1301 is configured to:

[0142] Execute a vertex shader, which is used to determine the primitive shape on the screen or the picture canvas according to the predefined first vertex coordinates;

[0143] Execute a fragment shader, which is used to fill the pixel points within the primitive shape with colors according to the first image component and the second image component of the image to be rendered, determine a first color value, and output the first color value as the rendering result of the first image component to the first color attachment of the first frame buffer object; and,

[0144] The fragment shader is further used to fill the pixel points within the primitive shape with colors according to the second image component, determine a second color value, and output the second color value as the rendering result of the second image component to the second color attachment of the first frame buffer object.

[0145] In some embodiments, the vertex shader is used to: transform the first vertex coordinates into the coordinate system of the screen or the picture canvas to obtain second vertex coordinates; determine the primitive shape according to the second vertex coordinates.

[0146] Further, in some embodiments, the vertex shader is further used to determine the first texture coordinates corresponding to the pixel points within the primitive shape according to the primitive shape.

[0147] In some embodiments, the fragment shader is used to: sample a third color value corresponding to the first texture coordinates on the first image component; sample a fourth color value corresponding to the first texture coordinates on the second image component; determine the first color value according to the third color value and the fourth color value.

[0148] In some embodiments, the fragment shader is used for the fragment shader to determine the second color value according to the fourth color value.

[0149] In some embodiments, the vertex shader is used to: determine the second texture coordinates corresponding to the first vertex coordinates on the first image component or the second image component; determine the third texture coordinates of the second texture coordinates on the screen or the picture canvas; determine the linear relationship between the pixel coordinates of the pixel points within the primitive shape on the screen or the picture canvas and the second vertex coordinates of the primitive shape; determine the first texture coordinates of the pixel points within the primitive shape according to the linear relationship and the third texture coordinates corresponding to the second vertex coordinates of the primitive shape.

[0150] In some embodiments, such as Figure 13 shown, the graphics rendering device 130 further includes a second processor 1302; wherein, the second processor 1302 is configured to: determine the shader parameters required for the image to be rendered; the shader parameters include the following parameters: first geometric data, attribute description information of the first geometric data, an identifier of the vertex shader, an identifier of the fragment shader, the first image component, the second image component; wherein, the first geometric data includes the first vertex coordinates and the second texture coordinates; pass the shader parameters to the first processor 1301, and submit a first command to the first processor 1301; the first command is used to instruct to render the image to be rendered according to the shader parameters.

[0151] Further, in some embodiments, the second processor 1302 is configured to: prepare second geometric data, the second geometric data includes the first vertex coordinates and the second texture coordinates; and pack the second geometric data into the first geometric data according to a data structure that can be parsed by the first processor 1301.

[0152] Exemplarily, in some embodiments, the second processor 1302 is configured to: pack the second geometric data into the first geometric data through a VBO mechanism.

[0153] In some embodiments, the shader parameters further include a first effect parameter; the fragment shader is used to: perform a special effect process on the third color value and the fourth color value according to the first effect parameter to determine the first color value.

[0154] In some embodiments, the shader parameters further include a second effect parameter; the fragment shader is used to: perform a special effect process on the fourth color value according to the second effect parameter to determine the second color value.

[0155] In the embodiments of the present application, no limitation is imposed on the first processor 1301 and the second processor 1302. For example, the first processor 1301 is a GPU and the second processor 1302 is a CPU.

[0156] In the embodiments of the present application, the vertex shader and the fragment shader can be understood as shader programs.

[0157] The description of the above device embodiments is similar to the description of the above method embodiments, and has beneficial effects similar to those of the method embodiments. For the technical details not disclosed in the device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.

[0158] It should be noted that the division of modules in the embodiments of the present application is illustrative, merely a logical function division, and there may be other division methods in actual implementation. In addition, in each embodiment of the present application, each functional unit may be integrated in a processing unit, may exist separately physically, or two or more units may be integrated in one unit. The above integrated unit may be implemented in the form of hardware, or in the form of a software functional unit, or in the form of a combination of software and hardware.

[0159] It should be noted that in the embodiments of the present application, if the above method is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application, in essence or the part that contributes to the related technology, may be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing an electronic device to execute all or part of the methods described in the embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), magnetic disks, or optical discs that can store program codes. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0160] The embodiments of the present application provide an electronic device. Figure 14 is a schematic structural diagram of the electronic device provided by the embodiments of the present application; as Figure 14 shown, the electronic device 140 includes a memory 1401 and a first processor 1301. The memory 1401 stores a computer program that can run on the first processor 1301. When the first processor 1301 executes the program, it implements the steps executed by the first processor 1301 in the method provided in the above embodiments.

[0161] In some embodiments, the electronic device 140 further includes a second processor 1302. The memory 1401 stores a computer program that can run on the second processor 1302. When the second processor 1302 executes the program, it implements the steps executed by the second processor 1302 in the method provided in the above embodiments.

[0162] It should be noted that the memory 1401 is configured to store instructions and applications executable by the first processor 1301 and the second processor 1302, and can also cache data to be processed or already processed by various modules in the first processor 1301, the second processor 1302, and the electronic device 140 (for example, image data, audio data, voice communication data, and video communication data), which can be implemented by flash memory (FLASH) or random access memory (Random Access Memory, RAM).

[0163] In the embodiments of the present application, there is no limitation on the type of the electronic device, and the electronic device can be various devices with graphics rendering capabilities. For example, the electronic device can be a smart phone, a laptop computer, a tablet computer, a drone, etc.

[0164] The embodiments of the present application also provide a computer-readable storage medium for storing a computer program.

[0165] Optionally, the computer-readable storage medium can be applied to the electronic device in the embodiments of the present application, and the computer program causes the processor or the electronic device to execute the various methods in the embodiments of the present application. For the sake of brevity, details are not described herein again.

[0166] The embodiments of the present application also provide a computer program product including computer program instructions.

[0167] Optionally, the computer program product can be applied to the electronic device in the embodiments of the present application, and the computer program instructions cause the processor or the electronic device to execute the various methods in the embodiments of the present application. For the sake of brevity, details are not described herein again.

[0168] The embodiments of the present application also provide a computer program.

[0169] Optionally, the computer program can be applied to the electronic device in the embodiments of the present application. When the computer program runs on the processor or the electronic device, it causes the processor or the electronic device to execute the various methods in the embodiments of the present application. For the sake of brevity, details are not described herein again.

[0170] It should be pointed out here that the descriptions of the above electronic device, storage medium, computer program product, and computer program embodiments are similar to the descriptions of the above method embodiments and have similar beneficial effects to the method embodiments. For the technical details not disclosed in the embodiments of the electronic device, storage medium, computer program product, and computer program of the present application, please refer to the descriptions of the method embodiments of the present application for understanding.

[0171] It should be understood that the "one embodiment" or "an embodiment" or "some embodiments" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, the "in one embodiment" or "in an embodiment" or "in some embodiments" that appear throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the magnitudes of the serial numbers of the above processes do not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application. The serial numbers of the embodiments of the present application above are only for description and do not represent the advantages or disadvantages of the embodiments. The descriptions of the above embodiments tend to emphasize the differences between the embodiments, and their similarities or similarities can be referred to each other. For the sake of brevity, they will not be elaborated herein.

[0172] The term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, object A and / or object B can represent: object A exists alone, object A and object B exist simultaneously, and object B exists alone.

[0173] It should be noted that in this article, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, the element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.

[0174] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The above-described embodiments are merely illustrative. For example, the division of the modules is only a logical function division, and there can be other division methods in actual implementation, such as: multiple modules or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed with each other can be through some interfaces, and the indirect coupling or communication connection of the devices or modules can be electrical, mechanical or other forms.

[0175] The modules described above as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network elements; some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0176] In addition, each functional module in the embodiments of the present application may be fully integrated in a processing unit, or each module may be separately used as a unit, or two or more modules may be integrated in a unit; the above-mentioned integrated modules may be implemented in the form of hardware or in the form of a combination of hardware and software functional units.

[0177] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps including the above method embodiments; and the foregoing storage medium includes: removable storage devices, read-only memory (ROM), magnetic disks, or optical disks and other various media that can store program codes.

[0178] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application essentially or the part that contributes to the related technology can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions to enable an electronic device to execute all or part of the methods described in the various embodiments of the present application. And the foregoing storage medium includes: removable storage devices, ROM, magnetic disks, or optical disks and other various media that can store program codes.

[0179] The methods disclosed in the several method embodiments provided in the present application can be arbitrarily combined without conflict to obtain new method embodiments.

[0180] The features disclosed in the several product embodiments provided in the present application can be arbitrarily combined without conflict to obtain new product embodiments.

[0181] The features disclosed in the several method or device embodiments provided in the present application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0182] As described above, it is only the implementation mode of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or substitutions, which should all be covered within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims described above.

Claims

1. A graphics rendering method, characterized in that: The method comprises: The vertex shader in the first processor determines the shape of the primitive on the screen or picture canvas according to the predefined first vertex coordinates; The fragment shader in the first processor fills the pixels in the primitive shape with colors according to the first image component and the second image component of the image to be rendered, determines a first color value, and outputs the first color value as a rendering result of the first image component to a first color attachment of the first frame buffer object; The fragment shader fills the pixels within the primitive shape with color according to the second image component, determines a second color value, and outputs the second color value as a rendering result of the second image component to a second color attachment of the first frame buffer object.

2. The method according to claim 1, characterized in that: The vertex shader determines the shape of a primitive on a screen or a picture canvas according to a predefined first vertex coordinate, including: The vertex shader transforms the first vertex coordinates into the coordinate system of the screen or the picture canvas to obtain second vertex coordinates; The vertex shader determines the primitive shape according to the second vertex coordinates.

3. The method according to claim 2, characterized in that The method further comprises: the vertex shader determining, according to the primitive shape, first texture coordinates corresponding to pixels within the primitive shape; The fragment shader in the first processor fills the pixel points in the primitive shape with color according to the first image component and the second image component of the image to be rendered to determine the first color value, including: The fragment shader samples a third color value corresponding to the first texture coordinate on the first image component; The fragment shader samples a fourth color value corresponding to the first texture coordinate on the second image component; The fragment shader determines the first color value based on the third color value and the fourth color value.

4. The method according to claim 3, characterized in that The fragment shader fills the pixel points in the primitive shape with color according to the second image component to determine the second color value, including: The fragment shader determines the second color value based on the fourth color value.

5. The method according to claim 3, characterized in that: The vertex shader determines, according to the primitive shape, a first texture coordinate corresponding to a pixel point within the primitive shape, including: The vertex shader determines a second texture coordinate corresponding to the first vertex coordinate on the first image component or the second image component; The vertex shader determines a third texture coordinate of the second texture coordinate on the screen or the picture canvas; The vertex shader determines a linear relationship between a pixel coordinate of a pixel point within the primitive shape on the screen or the picture canvas and a second vertex coordinate of the primitive shape; The vertex shader determines a first texture coordinate of a pixel point within the primitive shape according to the linear relationship and a third texture coordinate corresponding to a second vertex coordinate of the primitive shape.

6. The method according to claim 5, characterized in that The method further comprises: The second processor determines shader parameters required for the image to be rendered; the shader parameters include one or more of the following parameters: first geometric data, attribute description information of the first geometric data, an identifier of the vertex shader, an identifier of the fragment shader, the first image component, and the second image component; wherein the first geometric data includes the first vertex coordinates and the second texture coordinates; The second processor transmits the shader parameters to the first processor and submits a first command to the first processor; the first command is used to instruct to render the image to be rendered according to the shader parameters.

7. The method according to claim 6, characterized in that The second processor determines the first geometric data, including: The second processor prepares second geometric data, the second geometric data including the first vertex coordinates and the second texture coordinates; The second processor packs the second geometric data into the first geometric data according to a data structure that can be parsed by the first processor.

8. The method according to claim 7, characterized in that The second processor packs the second geometric data into the first geometric data according to a data structure that can be parsed by the first processor, including: The second processor packs the second geometric data into the first geometric data through a VBO mechanism.

9. The method according to claim 6, characterized in that The shader parameters also include a first effect parameter; The fragment shader determines the first color value according to the third color value and the fourth color value, including: The fragment shader performs special effect processing on the third color value and the fourth color value according to the first effect parameter to determine the first color value.

10. The method according to claim 6, characterized in that The shader parameters also include a second effect parameter; The fragment shader determines the second color value according to the fourth color value, including: The fragment shader performs special effect processing on the fourth color value according to the second effect parameter to determine the second color value.

11. A graphics rendering device, characterized in that: The apparatus comprises a first processor; the first processor is configured to: Executing a vertex shader, wherein the vertex shader is used to determine a primitive shape on a screen or a picture canvas according to a predefined first vertex coordinate; Executing a fragment shader, wherein the fragment shader is used to fill the pixel points in the primitive shape with color according to the first image component and the second image component of the image to be rendered, determine a first color value, and output the first color value as a rendering result of the first image component to a first color attachment of the first frame buffer object; as well as, The fragment shader is also used to fill the pixels within the primitive shape with color according to the second image component, determine a second color value, and output the second color value as a rendering result of the second image component to a second color attachment of the first frame buffer object.

12. A computer program product, characterized in that The computer program product comprises a computer program or instructions, and when the computer program or instructions are executed by a processor or an electronic device, the method according to any one of claims 1 to 10 is implemented.