Image rendering method, graphics processor, graphics processing system, device and equipment
By receiving the drawing command submitted by the CPU, we judge whether texture sampling needs to be performed, and geometric processing and attribute interpolation calculation are performed when not needed, and the chip attribute information is stored, which solves the page-missing error caused by inaccurate prediction camera position in the prior art. and the problem of waste video memory space, achieving more efficient image rendering.
Patent Information
- Application Number
- CN202211088150.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-07
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2042-09-07
AI Technical Summary
In the prior art, the application predicts that the camera position is inaccurate, causing the GPU to sample texture data that is not loaded into the video memory during texture sampling, resulting in a page-missing error. Since the GPU needs to convert coordinates to the vertices of the rendered object, the video memory space is caused. waste.
By receiving the drawing command submitted by the CPU, obtaining status information, determining whether texture sampling needs to be performed. If not, geometric processing and attribute interpolation calculation will be performed, the chip attribute information will be stored in the video memory, and feedback information will be sent to the CPU to load the corresponding Texture data; If sampling is required, the texture data and attribute information will be read directly from the video memory and input into the chip shader to process it to reduce memory space waste and page-missing errors.
It avoids page-missing errors in GPU during texture sampling, reduces the waste of video memory space, improves image rendering efficiency, and ensures that the GPU only loads the necessary texture data.
Smart Images

Figure CN117670642B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image rendering technology, and in particular to an image rendering method, a graphics processor, a graphics processing system, a device and equipment. Background Art
[0002] Texture sampling is an important part of the image rendering process, and due to the large amount of texture data, it is usually difficult to load all texture data into the video memory. In the related art, in order to load the texture data actually needed by the GPU into the video memory as much as possible, the application running on the CPU will predict the camera position and load the texture data corresponding to the objects that may need to be rendered into the video memory based on the predicted camera position.
[0003] However, if the camera position predicted by the application is inaccurate, the GPU may sample texture data that has not been loaded into the video memory during texture sampling, resulting in a page fault. On the other hand, during the rendering process, the GPU needs to perform coordinate transformation on the vertices of the rendered object, and the application cannot know the result of the GPU coordinate transformation. Therefore, the application needs to load all the texture data that the GPU may use into the video memory, which will cause a certain amount of video memory space waste. Summary of the invention
[0004] The purpose of the present disclosure is to provide an image rendering method, a graphics processor, a graphics processing system, an apparatus and a device, aiming to avoid page faults and reduce the waste of video memory space.
[0005] According to one aspect of the present disclosure, there is provided an image rendering method, which is applied to a GPU, and the method comprises:
[0006] Receive the drawing command submitted by the CPU and obtain the status information corresponding to the drawing command;
[0007] When the state information indicates that texture sampling does not need to be performed, geometric processing and attribute interpolation calculation are performed on the object to be rendered to determine multiple attribute information of each fragment, and the multiple attribute information of each fragment is stored in the video memory, and feedback information is sent to the CPU so that the CPU loads corresponding texture data into the video memory according to the texture index information included in the attribute information; wherein the multiple attribute information includes texture index information;
[0008] When the status information indicates that texture sampling needs to be performed, texture data and multiple attribute information of each fragment are read from the video memory, and the read texture data and multiple attribute information of each fragment are input into the fragment shader for processing.
[0009] In a feasible implementation of the present disclosure, the state information includes a sampling flag, and the sampling flag is used to indicate whether texture sampling needs to be performed; after obtaining the state information corresponding to the drawing command, the method further includes:
[0010] Determine whether texture sampling needs to be performed based on the sampling flag in the status information.
[0011] In a feasible implementation of the present disclosure, before sending the feedback information to the CPU, the method further includes:
[0012] Write the storage address of multiple attribute information of each fragment in the video memory into the status information;
[0013] According to the target address carried by the drawing command, the state information after writing the storage address is stored in the video memory.
[0014] In a feasible implementation of the present disclosure, texture data and multiple attribute information of each fragment are read from the video memory, including:
[0015] Reading texture data from the video memory according to the texture video memory address in the status information; wherein the texture video memory address is written into the status information by the CPU according to the address of the texture data in the video memory;
[0016] According to the attribute information storage address in the state information, multiple attribute information of each fragment is read from the video memory.
[0017] In a feasible implementation of the present disclosure, there are multiple pieces of state information corresponding to the drawing command, each piece of state information corresponds to an object to be rendered, each piece of state information includes a sampling identifier, and the sampling identifier included in each piece of state information is used to indicate whether texture sampling needs to be performed on the corresponding object to be rendered;
[0018] After obtaining the status information corresponding to the drawing command, the method further includes:
[0019] Determine whether texture sampling needs to be performed on the corresponding object to be rendered according to the sampling identifier in each state information;
[0020] When the state information indicates that texture sampling does not need to be performed, geometry processing and attribute interpolation calculations are performed on the object to be rendered to determine multiple attribute information of each fragment, including:
[0021] When the drawing command corresponds to state information indicating that texture sampling does not need to be performed, geometry processing and attribute interpolation calculation are performed on the object to be rendered corresponding to the state information to determine multiple attribute information of each fragment.
[0022] In a feasible implementation of the present disclosure, when the state information indicates that texture sampling needs to be performed, texture data and multiple attribute information of each fragment are read from the video memory, including:
[0023] When the drawing command corresponds to status information indicating that texture sampling needs to be performed, for the object to be rendered corresponding to the status information, texture data corresponding to the object to be rendered and multiple attribute information of each fragment are read from the video memory.
[0024] In a feasible implementation of the present disclosure, when the state information indicates that texture sampling does not need to be performed, geometric processing and attribute interpolation calculation are performed on the object to be rendered to determine multiple attribute information of each fragment, and the multiple attribute information of each fragment is stored in the video memory, including:
[0025] When the state information indicates that texture sampling does not need to be performed, geometric processing and attribute interpolation calculation are performed on the object to be rendered to determine multiple attribute information of each fragment;
[0026] Perform depth detection on multiple fragments to retain unobstructed fragments;
[0027] The multiple attribute information of the unobstructed fragments is stored in the video memory.
[0028] According to another aspect of the present disclosure, a graphics processor is provided, comprising:
[0029] A command receiving module is used to receive drawing commands submitted by the CPU;
[0030] A status information acquisition module is used to obtain status information corresponding to a drawing command;
[0031] A geometry processing module, configured to perform geometry processing on the object to be rendered when the state information indicates that texture sampling does not need to be performed;
[0032] an interpolation calculation module, for performing attribute interpolation calculation on the object to be rendered to determine multiple attribute information of each fragment when the state information indicates that texture sampling does not need to be performed, and storing the multiple attribute information of each fragment in the video memory, and sending feedback information to the CPU so that the CPU loads corresponding texture data into the video memory according to the texture index information; wherein the multiple attribute information includes the texture index information;
[0033] The texture sampler is used to read texture data and multiple attribute information of each fragment from the video memory when the state information indicates that texture sampling needs to be performed, and input the read texture data and multiple attribute information of each fragment into the fragment shader for processing.
[0034] In a feasible implementation of the present disclosure, the state information includes a sampling identifier, which is used to indicate whether texture sampling needs to be performed. The texture sampler is further used to determine whether texture sampling needs to be performed according to the sampling identifier in the state information.
[0035] In a feasible implementation of the present disclosure, before sending feedback information to the CPU, the interpolation calculation module is also used to write the storage address of multiple attribute information of each fragment in the video memory into the status information, and store the status information after writing the storage address into the video memory according to the target address carried by the drawing command.
[0036] In a feasible implementation of the present disclosure, when a texture sampler reads texture data and multiple attribute information of each fragment from a video memory, it is specifically used to:
[0037] Reading texture data from the video memory according to the texture video memory address in the status information; wherein the texture video memory address is written into the status information by the CPU according to the address of the texture data in the video memory;
[0038] According to the attribute information storage address in the state information, multiple attribute information of each fragment is read from the video memory.
[0039] In a feasible implementation of the present disclosure, there are multiple pieces of state information corresponding to the drawing command, each piece of state information corresponds to an object to be rendered, each piece of state information includes a sampling identifier, and the sampling identifier included in each piece of state information is used to indicate whether texture sampling needs to be performed on the corresponding object to be rendered;
[0040] The texture sampler is also used to determine whether it is necessary to perform texture sampling on the corresponding object to be rendered according to the sampling identifier in each state information;
[0041] When the geometry processing module performs geometry processing on the object to be rendered, the geometry processing module is specifically used to perform geometry processing on the object to be rendered corresponding to the state information when the drawing command corresponds to the state information indicating that texture sampling does not need to be performed;
[0042] When performing attribute interpolation calculation on the object to be rendered, the interpolation calculation module is specifically used to perform attribute interpolation calculation on the object to be rendered corresponding to the state information when the drawing command corresponds to state information indicating that texture sampling does not need to be performed.
[0043] In a feasible implementation of the present disclosure, when the texture sampler reads texture data and multiple attribute information of each fragment from the video memory, it is specifically used to read the texture data and multiple attribute information of each fragment corresponding to the object to be rendered and corresponding to the state information from the video memory when a drawing command corresponds to state information indicating that texture sampling needs to be executed.
[0044] In a feasible implementation of the present disclosure, the graphics processor further includes:
[0045] A depth detection module, used to perform depth detection on multiple fragments to retain unobstructed fragments;
[0046] When storing multiple attribute information of each fragment into the video memory, the interpolation calculation module is specifically used to store multiple attribute information of unobstructed fragments into the video memory.
[0047] According to another aspect of the present disclosure, a graphics processing system is further provided. The graphics processing system includes the graphics processor in any one of the above embodiments.
[0048] According to another aspect of the present disclosure, an electronic device is also provided, which includes the above-mentioned graphics processing system. In some usage scenarios, the product form of the electronic device is embodied as a graphics card; in other usage scenarios, the product form of the electronic device is embodied as a CPU motherboard.
[0049] According to another aspect of the present disclosure, an electronic device is also provided, which includes the above-mentioned electronic device. In some usage scenarios, the product form of the electronic device is a portable electronic device, such as a smart phone, a tablet computer, a VR device, etc.; in some usage scenarios, the product form of the electronic device is a personal computer, a game console, etc.
[0050] According to another aspect of the present disclosure, there is also provided an image rendering method, the method comprising:
[0051] Submitting a drawing command to the GPU, the drawing command corresponding to first state information for indicating that texture sampling does not need to be performed, so that the GPU performs geometric processing and attribute interpolation calculation on the object to be rendered to determine multiple attribute information of each fragment, and stores the multiple attribute information of each fragment in a video memory; wherein the multiple attribute information includes texture index information;
[0052] In response to the feedback information from the GPU, the corresponding texture data is loaded into the video memory according to the texture index information;
[0053] Submit a drawing command to the GPU again, the drawing command corresponding to the second state information for indicating that texture sampling needs to be performed, so that the GPU reads the texture data and multiple attribute information of each fragment from the video memory, and inputs the read texture data and multiple attribute information of each fragment into the fragment shader for processing.
[0054] In a feasible implementation of the present disclosure, before submitting a drawing command to the GPU, the method further includes:
[0055] First state information is configured, where the first state information includes a first sampling identifier, and the first sampling identifier is used to indicate that texture sampling does not need to be performed.
[0056] In a feasible implementation of the present disclosure, before submitting the drawing command to the GPU again, the method further includes:
[0057] The first sampling identifier in the first state information is replaced with the second sampling identifier to obtain the second state information, where the second sampling identifier is used to indicate that texture sampling needs to be performed; or, the second state information is configured, where the second state information includes the second sampling identifier, where the second sampling identifier is used to indicate that texture sampling needs to be performed.
[0058] In a feasible implementation of the present disclosure, in response to feedback information from the GPU, corresponding texture data is loaded into a video memory according to texture index information, including:
[0059] In response to the feedback information from the GPU, multiple attribute information of each fragment is read from the video memory according to the attribute information storage address recorded in the first state information, and the corresponding texture data is loaded into the video memory according to the texture index information in the multiple attribute information.
[0060] In a feasible implementation of the present disclosure, before submitting the drawing command to the GPU again, the method further includes:
[0061] The address of the texture data in the video memory is written into the second state information.
[0062] In a feasible implementation of the present disclosure, each drawing command submitted to the GPU corresponds to a plurality of state information, the plurality of state information including first state information and second state information, the first state information including a first sampling identifier for indicating that texture sampling does not need to be performed, the second state information including a second sampling identifier for indicating that texture sampling needs to be performed, and each state information corresponds to an object to be rendered;
[0063] Before submitting each drawing command to the GPU, the method also includes:
[0064] Replacing the first sampling identifier in the first state information corresponding to the last drawing command with the second sampling identifier to obtain the second state information;
[0065] Configuring first state information for a new object to be rendered, where the sampling identifier in the first state information is a first sampling identifier;
[0066] The obtained second state information and the configured first state information are used as a plurality of state information corresponding to the current drawing command. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1is a flowchart of an image rendering method provided by an embodiment of the present disclosure;
[0068] Figure 2 is a flowchart of the image rendering method provided by an embodiment of the present disclosure in the first stage;
[0069] Figure 3 is a flowchart of the image rendering method provided by an embodiment of the present disclosure in the second stage;
[0070] Figure 4 is a schematic diagram of the structure of a graphics processor provided by an embodiment of the present disclosure;
[0071] Figure 5 is a schematic diagram of an image rendering method provided by an embodiment of the present disclosure;
[0072] Figure 6 It is a schematic diagram of an image rendering method provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0073] Before introducing the embodiments of the present disclosure, it should be noted that some embodiments of the present disclosure are described as processing flows. Although the various operation steps of the flow may be given sequential step numbers, the operation steps therein may be implemented in parallel, concurrently or simultaneously.
[0074] In the embodiments of the present disclosure, the terms "first", "second", etc. may be used to describe various features, but these features should not be limited by these terms. These terms are used only to distinguish one feature from another.
[0075] The term “and / or” may be used in embodiments of the present disclosure. “And / or” includes any and all combinations of one or more of the associated features listed.
[0076] It should be understood that when describing the connection or communication relationship between two components, unless it is explicitly stated that the two components are directly connected or directly communicating, the connection or communication between the two components can be understood as direct connection or communication, or as indirect connection or communication through an intermediate component.
[0077] In order to make the technical solutions and advantages of the embodiments of the present disclosure more clearly understood, the exemplary embodiments of the present disclosure are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0078] In the related art, in order to load the texture data actually needed by the GPU into the video memory as much as possible, the application running on the CPU will predict the camera position, and load the texture data corresponding to the object that may need to be rendered into the video memory based on the predicted camera position. However, on the one hand, if the camera position predicted by the application is inaccurate, it may cause the GPU to sample texture data that has not been loaded into the video memory when performing texture sampling, thereby generating a page fault error. On the other hand, during the rendering process, the GPU needs to perform coordinate transformation on the vertices of the object to be rendered, and the application cannot know the result of the GPU coordinate transformation. Therefore, the application needs to load all the texture data that the GPU may use into the video memory, which will cause a certain amount of video memory space waste.
[0079] The purpose of the present disclosure is to provide an image rendering method, a graphics processor, a graphics processing system, an apparatus and a device to avoid page faults and reduce the waste of video memory space.
[0080] refer to Figure 1 , Figure 1 FIG. 1 is a flow chart of an image rendering method provided by an embodiment of the present disclosure, and the method is applied to a GPU. Figure 1 As shown, the method comprises the following steps:
[0081] S110: receiving a drawing command submitted by the CPU, and obtaining status information corresponding to the drawing command.
[0082] The drawing command may specifically be a drawcall command. In some specific implementations, the state information is configured by the CPU. When the CPU submits the drawcall command to the GPU, the state information or the address of the state information may be sent to the GPU. The GPU may directly obtain the state information carried by the drawcall command, or read the corresponding state information from the video memory according to the address carried by the drawcall command.
[0083] S120: When the status information indicates that texture sampling does not need to be performed, geometric processing and attribute interpolation calculations are performed on the object to be rendered to determine multiple attribute information of each fragment, and the multiple attribute information of each fragment is stored in the video memory, and feedback information is sent to the CPU so that the CPU loads corresponding texture data into the video memory according to the texture index information included in the attribute information; wherein the multiple attribute information includes texture index information.
[0084] In some specific embodiments, the GPU may perform geometric processing on the object to be rendered through programmable shaders and / or custom hardware, including but not limited to vertex coordinate conversion, clipping operations, backface culling, primitive assembly, etc. The GPU may perform attribute interpolation calculations on each fragment of the primitive through custom hardware (such as an interpolation calculation module), thereby determining multiple attribute information of each fragment.
[0085] Among them, the attributes of the multiple fragments are predefined fragment attributes, and the interpolation calculation module interpolates and calculates the corresponding attribute information of each fragment according to the attribute information of the primitive vertices for each predefined attribute. For example, the predefined attributes include depth value, texture index information and normal, then the interpolation calculation module interpolates and calculates the corresponding depth value for each fragment in the primitive according to the depth value of the primitive vertex, interpolates and calculates the corresponding texture index information for each fragment in the primitive according to the texture index information of the primitive vertex, and interpolates and calculates the corresponding normal for each fragment in the primitive according to the normal of the primitive vertex.
[0086] In some specific implementations, after the GPU stores multiple attribute information of each fragment into the video memory, it can send feedback information to the CPU by generating an interrupt, so that the CPU can load the corresponding texture data into the video memory according to the texture index information in the multiple attribute information of each fragment. The texture index information can be a texture virtual address, a tile number of a texture tile, or a texture coordinate, and the present disclosure does not limit the specific type of the texture index information.
[0087] In the present disclosure, the GPU cuts the parts of the object to be rendered that do not need to be displayed through geometric processing, and removes the hidden surface of the object to be rendered, so that the primitives obtained after geometric processing are more likely to be the primitives that need to be displayed. The GPU then performs pixel attribute interpolation calculations on each fragment in the primitive, thereby calculating multiple attribute information of the fragments that are more likely to be displayed. Then, the GPU sends feedback information to the CPU, so that the CPU can load the corresponding texture data into the video memory according to the texture index information in the multiple attribute information of each fragment. In this way, the CPU loads the texture data corresponding to the fragments that are more likely to be displayed into the video memory, which reduces the waste of video memory space on the one hand, and on the other hand, because the CPU loads the texture data according to the attribute information of the fragment determined by the GPU, rather than loading the texture data according to the CPU's own prediction of the camera, it can avoid the GPU from sampling the texture data that has not been loaded into the video memory when performing texture sampling, that is, avoiding page fault errors.
[0088] S130: When the status information indicates that texture sampling needs to be performed, texture data and multiple attribute information of each fragment are read from the video memory, and the read texture data and multiple attribute information of each fragment are input into the fragment shader for processing.
[0089] In some specific embodiments, when the status information indicates that texture sampling needs to be performed, the GPU directly skips (i.e., bypasses) geometry processing and attribute interpolation calculations, directly reads texture data and multiple attribute information of each fragment from the video memory, and inputs the read texture data and multiple attribute information of each fragment into the fragment shader for processing, thereby determining the color information of each fragment based on the texture data and multiple attribute information of each fragment through the fragment shader.
[0090] In the present disclosure, rendering is divided into two stages. In the first stage, the state information corresponding to the drawing command indicates that texture sampling does not need to be performed. The GPU performs geometric processing and attribute interpolation calculations on the object to be rendered to determine multiple attribute information of each fragment, thereby calculating multiple attribute information of the fragment that is more likely to be displayed. Then, the GPU sends feedback information to the CPU so that the CPU can load the corresponding texture data into the video memory according to the texture index information in the multiple attribute information of each fragment. In this way, the waste of video memory space can be reduced and page faults can be avoided. In the second stage, the state information corresponding to the drawing command indicates that texture sampling needs to be performed. Since the GPU has interpolated multiple attributes of each fragment in the first stage, the GPU only needs to read the texture data and multiple attribute information corresponding to each fragment from the video memory in the second stage, and send it to the fragment shader for processing, without the need to perform geometric processing and attribute interpolation calculations again, thereby simplifying the GPU process in the second stage.
[0091] In some specific implementations, the state information includes a sampling flag, and the sampling flag is used to indicate whether texture sampling needs to be performed. After obtaining the state information corresponding to the drawing command, the GPU determines whether texture sampling needs to be performed according to the sampling flag in the state information. If texture sampling does not need to be performed, the GPU performs the above step S120, and if texture sampling needs to be performed, the GPU performs the above step S130.
[0092] In specific implementation, the CPU can pre-configure state information and store the state information in the video memory. The state information includes a first sampling identifier or a second sampling identifier. The first sampling identifier indicates that texture sampling does not need to be performed, and the second sampling identifier indicates that texture sampling needs to be performed. The drawing command submitted by the CPU to the GPU carries the storage address of the state information in the video memory. After receiving the drawing command, the GPU can read the state information from the video memory according to the storage address carried by the drawing command, and determine whether texture sampling needs to be performed according to the sampling identifier in the state information.
[0093] In some specific implementations, after the GPU interpolates and calculates multiple attribute information of each fragment and stores the multiple attribute information of each fragment in the video memory, the GPU can write the storage address of the multiple attribute information of each fragment in the video memory into the status information, and store the status information after writing the storage address into the video memory according to the target address carried by the drawing command. In this way, after the CPU receives the feedback information, it can read the new status information from the video memory according to the target address, and query the storage address of the attribute information in the video memory from the new status information, and then read the multiple attribute information of each fragment from the video memory according to the storage address. The CPU can load the corresponding texture data into the video memory according to the texture index information in the multiple attribute information.
[0094] In some specific implementations, when the GPU reads the texture data and the multiple attribute information of each fragment from the video memory, it can specifically read the texture data from the video memory according to the texture video memory address in the state information; and read the multiple attribute information of each fragment from the video memory according to the attribute information storage address in the state information. The texture video memory address is written into the state information by the CPU according to the address of the texture data in the video memory.
[0095] In a specific implementation, after the CPU receives the feedback information from the GPU, it reads new status information from the video memory according to the aforementioned target address, and reads multiple attribute information of each fragment from the video memory according to the address of the attribute information recorded in the new status information in the video memory. The CPU loads the corresponding texture data into the video memory according to the texture index information in the multiple attribute information of each fragment. The CPU writes the address of the texture data in the video memory into the status information as the texture video memory address. Or the CPU configures new status information and writes the texture video memory address into the new status information. The CPU submits a drawing command to the GPU again, and the status information corresponding to the drawing command includes the texture video memory address, and the status information includes the aforementioned second sampling identifier.
[0096] After receiving the drawing command, the GPU determines that texture sampling needs to be performed according to the second sampling identifier included in the status information. In this case, the GPU reads the texture data from the video memory according to the texture video memory address in the status information. The GPU reads multiple attribute information of each fragment from the video memory according to the address of the attribute information recorded in the status information in the video memory. The GPU submits the read texture data and attribute information to the fragment shader, so that the fragment shader determines the color information of each fragment according to the texture data and attribute information.
[0097] refer to Figure 2 , Figure 2 FIG. 1 is a flow chart of the image rendering method provided by an embodiment of the present disclosure in the first stage. Figure 2 As shown, the process of the first stage is as follows:
[0098] S201: The application running in the CPU allocates a virtual address of the video memory for the texture data, but temporarily does not allocate a physical address of the video memory, that is, the application does not load the texture data into the video memory; the application configures state information, and writes the state information into the video memory.
[0099] The first stage status information includes at least the following information:
[0100] 1) The address of the texture data in the video memory. Since the texture has not been loaded into the video memory in the first stage, the address at this time is a virtual address.
[0101] 2) A sampling identifier for indicating whether to perform texture sampling, such as a first sampling identifier or a second sampling identifier, is used by the GPU to identify whether to read texture data from the video memory. If the sampling identifier is the first sampling identifier, the GPU does not read texture data from the video memory, that is, texture sampling will not be performed. If the sampling identifier is the second sampling identifier, the GPU will read texture data from the video memory, that is, texture sampling will be performed. In the first stage, the sampling identifier in the status information is the first sampling identifier, indicating that texture sampling will not be performed.
[0102] 3) The video memory address of the attribute information. Since the GPU has not yet performed attribute interpolation calculation when the application configures the state information, the video memory address of the attribute information is empty at this time, that is, the video memory address of the attribute information is not recorded in the state information.
[0103] S202: When submitting a drawing command to the GPU, the application sends the address of the state information in the video memory to the GPU.
[0104] S203: After receiving the drawing command, the GPU reads the status information from the video memory according to the address of the status information in the video memory, and determines that texture sampling is not required at this stage according to the first sampling identifier included in the status information.
[0105] S204: The GPU performs geometric processing and attribute interpolation calculation on the object to be rendered to determine multiple attribute information of each fragment, and stores the multiple attribute information of each fragment in the video memory.
[0106] S205: The GPU writes the address of the attribute information in the video memory (i.e., the video memory address of the attribute information) into the state information to update the state information, and writes the updated state information into the video memory according to the target address provided by the application. The target address may be equal to or not equal to the address of the state information carried by the drawing command. If the target address is equal to the address of the state information carried by the drawing command, the updated state information will be stored in the location of the original state information in the video memory. If the target address is not equal to the address of the state information carried by the drawing command, the updated state information will not be stored in the location of the original state information in the video memory, but will be stored in a new location corresponding to the target address.
[0107] S206: The GPU sends feedback information to the CPU through an interrupt mechanism.
[0108] S207: The application program running in the CPU reads the updated status information from the video memory according to the target address.
[0109] S208: The application reads the attribute information of each fragment from the video memory according to the video memory address of the attribute information recorded in the updated state information, and loads the corresponding texture data into the video memory according to the texture index information in the attribute information.
[0110] S209: the application records the address of the texture data in the video memory (ie, the video memory physical address of the texture data) in the state information, and replaces the first sampling identifier in the state information with the second sampling identifier. The application stores the latest state information in the video memory.
[0111] refer to Figure 3 , Figure 3 FIG. 1 is a flow chart of the image rendering method provided by an embodiment of the present disclosure in the second stage. Figure 3 As shown, the process of the second stage is as follows:
[0112] S301: When submitting a drawing command to the GPU, the application sends the address of the latest status information in the video memory to the GPU.
[0113] S302: After receiving the drawing command, the GPU reads the status information from the video memory according to the address of the status information in the video memory, and determines that texture sampling is required at this stage according to the second sampling identifier included in the status information.
[0114] S303: The GPU skips the steps of geometry processing and attribute interpolation calculation, and directly calls the texture sampler, which reads the texture data from the video memory according to the address of the texture data in the video memory recorded in the state information. Alternatively, the texture sampler reads the attribute information of each fragment from the video memory according to the storage address of the attribute information recorded in the state information, and then reads the texture data from the video memory according to the texture index information in the attribute information.
[0115] S304: The texture sampler submits the read texture data and the attribute information of each fragment to the fragment shader running in the GPU, so that the fragment shader determines the color information of each fragment according to the texture data and the attribute information of each fragment.
[0116] In some specific implementations, when the GPU performs pixel attribute interpolation calculation for each fragment, it first interpolates and calculates the texture index information of each fragment according to the texture index information of the primitive vertex. After calculating the texture index information of each fragment, the GPU stores the texture index information of each fragment to the first address in the video memory, records the first address to the status information, and then sends feedback information to the CPU. After the GPU sends the feedback information, it continues to perform attribute interpolation calculations on other attributes of each fragment (such as depth value, normal, tangent), etc., and calculates the other attributes calculated by interpolation and stores them to the second address in the video memory. After receiving the feedback information, the CPU reads the texture index information of each fragment from the video memory according to the first address recorded in the status information, and loads the corresponding texture data into the video memory according to the texture index information. After the CPU loads the texture data, it submits the drawing command to the GPU again. In this specific implementation, while the CPU is loading the texture data, the GPU performs interpolation calculations on the remaining attribute information, which is conducive to improving the image rendering efficiency.
[0117] In some specific implementations, there are multiple pieces of state information corresponding to the drawing command, each piece of state information corresponds to an object to be rendered, and each piece of state information includes a sampling identifier, and the sampling identifier included in each piece of state information is used to indicate whether texture sampling needs to be performed on the corresponding object to be rendered. After receiving the drawing command submitted by the CPU, the GPU can also determine whether texture sampling needs to be performed on the corresponding object to be rendered according to the sampling identifier in each piece of state information.
[0118] The objects to be rendered may be models and primitives to be rendered. The models to be rendered refer to the models that need to be displayed in the current perspective. For example, in the game rendering scene, if the game protagonist, opponent character, referee character and arena need to be rendered in the current perspective, then the game protagonist, opponent character, referee character and arena are the models to be rendered.
[0119] For example, in some cases, each frame includes multiple models, and the multiple models are rendered in sequence according to a preset rendering order, and each drawing command corresponds to the state information of the second stage of the model rendered last time and the state information of the first stage of the model rendered this time. For ease of understanding, assume that the current frame includes three models A, B, and C. The first drawing command submitted by the CPU corresponds to the state information of model A in the first stage. After receiving the first drawing command, the GPU determines that it is not necessary to perform texture sampling on model A based on its corresponding state information. The second drawing command submitted by the CPU corresponds to the state information of model A in the second stage and the state information of model B in the first stage. After receiving the second drawing command, the GPU determines that it is necessary to perform texture sampling on model A and it is not necessary to perform texture sampling on model B based on its corresponding state information. The third drawing command submitted by the CPU corresponds to the state information of model B in the second stage and the state information of model C in the first stage. After receiving the third drawing command, the GPU determines that it is necessary to perform texture sampling on model B and it is not necessary to perform texture sampling on model C based on its corresponding state information. The fourth drawing command submitted by the CPU corresponds to the state information of model C in the second stage. After receiving the fourth drawing command, the GPU determines that it is necessary to perform texture sampling on model C based on its corresponding state information.
[0120] Or, for example, in other cases, a drawing command is used to render multiple primitives, each of which corresponds to a piece of state information. Each piece of state information includes a sampling flag, and the sampling flag included in each piece of state information is used to indicate whether texture sampling needs to be performed on the corresponding primitive.
[0121] When there are multiple pieces of status information corresponding to a drawing command, when executing the above step S120, the GPU may, specifically, when the drawing command corresponds to status information indicating that texture sampling does not need to be performed, perform geometry processing and attribute interpolation calculation on the object to be rendered corresponding to the status information to determine multiple attribute information of each fragment.
[0122] In the case where there are multiple pieces of status information corresponding to the drawing command, when the GPU executes the above step S130, if the drawing command corresponds to status information indicating that texture sampling needs to be performed, the GPU reads the texture data corresponding to the object to be rendered and multiple attribute information of each fragment from the video memory for the object to be rendered corresponding to the status information.
[0123] In some specific implementations, when the GPU executes step S120, it may specifically execute the following sub-steps:
[0124] S120 - 1 : When the state information indicates that texture sampling does not need to be performed, geometric processing and attribute interpolation calculation are performed on the object to be rendered to determine a plurality of attribute information of each fragment.
[0125] S120-2: Perform depth detection on multiple fragments to retain unobstructed fragments.
[0126] S120 - 3 : Storing multiple attribute information of unobstructed fragments into the video memory.
[0127] Among them, in sub-step S120-2, a depth search can be performed on multiple fragments based on the Early-z depth test method, so as to filter out the occluded fragments and retain only the unoccluded fragments. In this specific implementation, before the CPU loads the texture data, the depth detection is performed on the fragments to filter out the occluded fragments, so that the CPU will not load the texture data corresponding to the occluded fragments into the video memory, thereby further reducing the waste of video memory space.
[0128] refer to Figure 4 , Figure 4 Schematic diagram of the structure of a graphics processor provided by an embodiment of the present disclosure. Figure 4 The graphics processor shown is Figure 1 The image rendering method shown is based on the same inventive concept. To avoid repetition, a brief introduction to the graphics processor is given below. For the specific implementation of the graphics processor, reference can be made to the corresponding specific implementation of the image rendering method. Figure 4 As shown, the graphics processor includes:
[0129] The command receiving module 410 is used to receive the drawing command submitted by the CPU.
[0130] The status information acquisition module 420 is used to acquire the status information corresponding to the drawing command.
[0131] The geometry processing module 430 is used to perform geometry processing on the object to be rendered when the state information indicates that texture sampling does not need to be performed.
[0132] The interpolation calculation module 440 is used to perform attribute interpolation calculation on the object to be rendered to determine multiple attribute information of each fragment when the status information indicates that texture sampling does not need to be performed, and store the multiple attribute information of each fragment in the video memory, and send feedback information to the CPU so that the CPU loads the corresponding texture data into the video memory according to the texture index information; wherein the multiple attribute information includes texture index information.
[0133] The texture sampler 450 is used to read texture data and multiple attribute information of each fragment from the video memory when the status information indicates that texture sampling needs to be performed, and input the read texture data and multiple attribute information of each fragment into the fragment shader for processing.
[0134] Optionally, the state information includes a sampling identifier, and the sampling identifier is used to indicate whether texture sampling needs to be performed. The texture sampler is further used to determine whether texture sampling needs to be performed according to the sampling identifier in the state information.
[0135] Optionally, before sending feedback information to the CPU, the interpolation calculation module is also used to write the storage address of multiple attribute information of each fragment in the video memory into the status information, and store the status information after writing the storage address into the video memory according to the target address carried by the drawing command.
[0136] Optionally, when the texture sampler reads texture data and multiple attribute information of each fragment from the video memory, it is specifically used to: read the texture data from the video memory according to the texture video memory address in the status information; wherein the texture video memory address is written into the status information by the CPU according to the address of the texture data in the video memory; and read the multiple attribute information of each fragment from the video memory according to the attribute information storage address in the status information.
[0137] Optionally, there are multiple pieces of state information corresponding to the drawing command, each piece of state information corresponds to an object to be rendered, and each piece of state information includes a sampling identifier. The sampling identifier included in each piece of state information is used to indicate whether texture sampling needs to be performed on the corresponding object to be rendered.
[0138] The texture sampler is further used to determine whether texture sampling needs to be performed on the corresponding object to be rendered according to the sampling identifier in each state information.
[0139] When the geometry processing module performs geometry processing on the object to be rendered, the geometry processing module is specifically used to perform geometry processing on the object to be rendered corresponding to the state information when the drawing command corresponds to state information indicating that texture sampling does not need to be performed.
[0140] When performing attribute interpolation calculation on the object to be rendered, the interpolation calculation module is specifically used to perform attribute interpolation calculation on the object to be rendered corresponding to the state information when the drawing command corresponds to state information indicating that texture sampling does not need to be performed.
[0141] Optionally, when the texture sampler reads texture data and multiple attribute information of each fragment from the video memory, it is specifically used to read the texture data and multiple attribute information of each fragment corresponding to the object to be rendered and corresponding to the status information from the video memory when a drawing command corresponds to status information indicating that texture sampling needs to be performed.
[0142] The graphics processor also includes: a depth detection module, which is used to perform depth detection on multiple fragments to retain unobstructed fragments.
[0143] When storing multiple attribute information of each fragment into the video memory, the interpolation calculation module is specifically used to store multiple attribute information of unobstructed fragments into the video memory.
[0144] Based on the same inventive concept, the embodiment of the present disclosure also provides a graphics processing system, which can be a die (tube core), or a SOC (System on Chip) with multiple dies interconnected, or other organizational forms.
[0145] The following uses a die as an example to illustrate the architecture and working principle of the graphics processing system provided by the present disclosure.
[0146] exist Figure 5 In one embodiment shown, a single-die graphics processing system includes multiple GPU cores (ie, the graphics processors described in any of the above embodiments).
[0147] Each GPU core is used to process drawing commands, execute the image rendering pipeline according to the drawing commands, and can also be used to execute other calculation commands; multiple GPU cores complete the execution of drawing or other computing tasks as a whole. Each GPU core further includes: a computing unit, which is used to execute instructions compiled by the shader, and is a programmable module composed of a large number of ALUs; a cache, which is used to cache GPU core data to reduce memory access; a rasterization module, a fixed stage of the 3D rendering pipeline; a tiling module, which performs tiling processing on a frame in the TBR and TBDR GPU architectures; a geometry processing module, a fixed stage of the 3D rendering pipeline, which is used to perform coordinate conversion on vertex data and cut off the graphics elements that are outside the observation range or are not displayed on the back; a texture sampler, which is used to read texture data from the video memory and send the read texture data to the fragment shader for processing; a post-processing module, which is used to scale, crop, rotate, and other operations on the drawn image; a micro core, which is used for scheduling between various pipeline hardware modules on the GPU core, or for task scheduling of multiple GPU cores.
[0148] like Figure 5 As shown, the graphics processing system may also include:
[0149] The on-chip network is used for data exchange between various IP cores on the graphics processing system;
[0150] General DMA (Direct Memory Access) is used to perform data transfer between the host and the graphics processing system memory (such as the graphics card memory). For example, DMA is used to move the vertex data of 3D drawings from the host to the graphics processing system memory.
[0151] PCIe controller, an interface for communicating with the host, implements the PCIe protocol, and enables the graphics processing system to be connected to the host through the PCIe interface. The host runs programs such as the graphics API and graphics card driver;
[0152] The application processor is used to schedule tasks of various modules on the graphics processing system. For example, after the GPU renders a frame of image, it notifies the application processor, and the application processor then starts the display controller to display the image drawn by the GPU on the screen.
[0153] Memory controller, used to connect to the system memory and save data on the SOC;
[0154] Display controller, which controls the output of the frame buffer in the system memory to the display via the display interface (HDMI, DP, etc.);
[0155] Video decoding, which can decode the encoded video on the host hard disk into a displayable picture;
[0156] Video encoding can encode the original video code stream on the host hard disk into a specified format and return it to the host.
[0157] based on Figure 5 In the graphics processing system shown, in one embodiment, the GPU receives a drawing command submitted by the CPU based on the PCIe interface, and the GPU obtains the status information corresponding to the drawing command from the video memory. When the status information indicates that texture sampling does not need to be performed, the geometry processing module performs geometry processing on the object to be rendered, including vertex coordinate conversion, model clipping, backface culling, primitive assembly, etc. Then, the interpolation calculation module in the rasterization module performs attribute difference calculation on each fragment in the primitive for each primitive, wherein the attributes of each fragment include: depth value, texture attribute information, normal, tangent, etc. The interpolation calculation module stores the attribute information of each fragment in the video memory, and records the attribute information video memory address in the status information. The GPU gives a feedback to the CPU based on the interrupt mechanism, so that the CPU obtains the attribute information video memory address of each fragment from the status information, and reads the texture index information from the video memory according to the attribute information video memory address, and then loads the texture data to be sampled into the video memory according to the texture index information. The CPU also writes the texture video memory address of the texture data into the status information, and then the CPU sends the drawing command to the GPU again.
[0158] The GPU receives the drawing command submitted by the CPU based on the PCIe interface, and obtains the status information corresponding to the drawing command from the video memory. When the status information indicates that texture sampling needs to be performed, the geometry processing module does not perform the geometry processing operation, and the interpolation calculation module does not perform the attribute information interpolation calculation operation. Instead, the texture sampler directly reads the texture data from the video memory according to the texture video memory address in the status information. The texture sampler also reads multiple attribute information of each fragment from the video memory according to the attribute information storage address in the status information. The texture sampler sends the read texture data and attribute information to the fragment shader for processing, thereby determining the color of each fragment.
[0159] It should be pointed out that the above is only Figure 5 The specific structure shown is taken as an example to exemplify the implementation of the graphics processing system provided by the embodiment of the present disclosure. In practical applications, the specific implementation of the graphics processor that the graphics processing system may include can refer to any of the above embodiments, which will not be repeated here.
[0160] The embodiment of the present disclosure also provides an electronic device, which includes the above-mentioned graphics processing system. In some usage scenarios, the product form of the electronic device is embodied as a graphics card; in other usage scenarios, the product form of the electronic device is embodied as a CPU motherboard.
[0161] The disclosed embodiments also provide an electronic device, which includes the above-mentioned electronic device. In some usage scenarios, the product form of the electronic device is a portable electronic device, such as a smart phone, a tablet computer, a VR device, etc.; in some usage scenarios, the product form of the electronic device is a personal computer, a game console, a workstation, a server, etc.
[0162] refer to Figure 6 , Figure 6 It is a schematic diagram of an image rendering method provided by an embodiment of the present disclosure. The image rendering method can be executed by a CPU or an application running on the CPU. Figure 6 The image rendering method shown is similar to Figure 1 The image rendering method shown is based on the same inventive concept. To avoid repetition, the following Figure 6 The image rendering method shown in the figure is briefly introduced. For the specific implementation of this image rendering method, please refer to Figure 1 The corresponding specific implementation of the image rendering method in . Figure 6 As shown, the image rendering method includes:
[0163] S610: Submit a drawing command to the GPU, where the drawing command corresponds to first state information indicating that texture sampling does not need to be performed, so that the GPU performs geometric processing and attribute interpolation calculations on the object to be rendered to determine multiple attribute information of each fragment, and stores the multiple attribute information of each fragment into the video memory; wherein the multiple attribute information includes texture index information.
[0164] S620: In response to the feedback information from the GPU, load the corresponding texture data into the video memory according to the texture index information.
[0165] S630: Submit a drawing command to the GPU again, where the drawing command corresponds to second status information indicating that texture sampling needs to be performed, so that the GPU reads texture data and multiple attribute information of each fragment from the video memory, and inputs the read texture data and multiple attribute information of each fragment into the fragment shader for processing.
[0166] Optionally, before submitting the drawing command to the GPU, the method further includes: configuring first state information, the first state information including a first sampling flag, the first sampling flag being used to indicate that texture sampling does not need to be performed.
[0167] Optionally, before submitting the drawing command to the GPU again, the method also includes: replacing the first sampling identifier in the first state information with a second sampling identifier to obtain second state information, the second sampling identifier being used to indicate that texture sampling needs to be performed; or, configuring the second state information, the second state information including the second sampling identifier, the second sampling identifier being used to indicate that texture sampling needs to be performed.
[0168] Optionally, when executing step S620, it is possible to specifically respond to feedback information from the GPU, read multiple attribute information of each fragment from the video memory according to the attribute information storage address recorded in the first state information, and load corresponding texture data into the video memory according to texture index information in the multiple attribute information.
[0169] Optionally, before submitting the drawing command to the GPU again, the method further includes: writing the address of the texture data in the video memory into the second state information.
[0170] Optionally, each drawing command submitted to the GPU corresponds to multiple state information, the multiple state information including first state information and second state information, the first state information includes a first sampling identifier for indicating that texture sampling does not need to be performed, and the second state information includes a second sampling identifier for indicating that texture sampling needs to be performed, and each state information corresponds to an object to be rendered.
[0171] Before submitting a drawing command to the GPU each time, the method further includes: replacing a first sampling identifier in the first state information corresponding to a previous drawing command with a second sampling identifier to obtain second state information; configuring the first state information for a new object to be rendered, the sampling identifier in the first state information being the first sampling identifier; and using the obtained second state information and the configured first state information as multiple state information corresponding to the current drawing command.
[0172] Although the preferred embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present disclosure.
[0173] Obviously, those skilled in the art can make various changes and modifications to the present disclosure without departing from the spirit and scope of the present disclosure. Thus, if these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is also intended to include these modifications and variations.
Claims
1. An image rendering method, applied to a GPU, the method comprising: Receive a drawing command submitted by the CPU, and obtain status information corresponding to the drawing command; When the state information indicates that texture sampling does not need to be performed, geometric processing and attribute interpolation calculation are performed on the object to be rendered to determine multiple attribute information of each fragment, and the multiple attribute information of each fragment is stored in the video memory, and feedback information is sent to the CPU so that the CPU loads corresponding texture data into the video memory according to texture index information included in the attribute information; wherein the multiple attribute information includes texture index information; When the state information indicates that texture sampling needs to be performed, texture data and multiple attribute information of each fragment are read from the video memory, and the read texture data and multiple attribute information of each fragment are input into the fragment shader for processing.
2. The method according to claim 1, wherein the state information includes a sampling flag, and the sampling flag is used to indicate whether texture sampling needs to be performed; after obtaining the state information corresponding to the drawing command, the method further includes: Whether texture sampling needs to be performed is determined according to the sampling identifier in the state information.
3. The method according to claim 1 or 2, before sending the feedback information to the CPU, the method further comprises: Writing a plurality of attribute information of each fragment into the storage address in the video memory into the state information; According to the target address carried by the drawing command, the state information after being written into the storage address is stored in the video memory.
4. The method according to claim 3, wherein the reading of texture data and a plurality of attribute information of each fragment from the video memory comprises: Reading texture data from the video memory according to the texture video memory address in the state information; wherein the texture video memory address is written into the state information by the CPU according to the address of the texture data in the video memory; According to the attribute information storage address in the state information, multiple attribute information of each fragment is read from the video memory.
5. The method according to claim 1, wherein the drawing command corresponds to a plurality of pieces of state information, each piece of state information corresponds to an object to be rendered, each piece of state information includes a sampling identifier, and the sampling identifier included in each piece of state information is used to indicate whether texture sampling needs to be performed on the corresponding object to be rendered; After acquiring the status information corresponding to the drawing command, the method further includes: Determine whether texture sampling needs to be performed on the corresponding object to be rendered according to the sampling identifier in each state information; When the state information indicates that texture sampling does not need to be performed, geometric processing and attribute interpolation calculation are performed on the object to be rendered to determine multiple attribute information of each fragment, including: In the case where the drawing command corresponds to state information indicating that texture sampling does not need to be performed, geometry processing and attribute interpolation calculation are performed on the to-be-rendered object corresponding to the state information to determine a plurality of attribute information of each fragment.
6. The method according to claim 5, wherein when the state information indicates that texture sampling needs to be performed, reading texture data and a plurality of attribute information of each fragment from the video memory comprises: When the drawing command corresponds to status information indicating that texture sampling needs to be performed, for the object to be rendered corresponding to the status information, texture data corresponding to the object to be rendered and multiple attribute information of each fragment are read from the video memory.
7. The method according to claim 1, wherein when the state information indicates that texture sampling does not need to be performed, performing geometry processing and attribute interpolation calculation on the object to be rendered to determine a plurality of attribute information of each fragment, and storing the plurality of attribute information of each fragment in a video memory, comprises: When the state information indicates that texture sampling does not need to be performed, performing geometric processing and attribute interpolation calculation on the object to be rendered to determine a plurality of attribute information of each fragment; Perform depth detection on multiple fragments to retain unobstructed fragments; The plurality of attribute information of the unobstructed fragments is stored in the video memory.
8. A graphics processor, comprising: A command receiving module is used to receive drawing commands submitted by the CPU; A status information acquisition module, used to acquire status information corresponding to the drawing command; A geometry processing module, configured to perform geometry processing on the object to be rendered when the state information indicates that texture sampling does not need to be performed; an interpolation calculation module, configured to, when the state information indicates that texture sampling does not need to be performed, perform attribute interpolation calculation on the object to be rendered to determine a plurality of attribute information of each fragment, store the plurality of attribute information of each fragment into a video memory, and send feedback information to a CPU so that the CPU loads corresponding texture data into the video memory according to the texture index information; wherein the plurality of attribute information includes texture index information; A texture sampler is used to read texture data and multiple attribute information of each fragment from the video memory when the state information indicates that texture sampling needs to be performed, and input the read texture data and multiple attribute information of each fragment into the fragment shader for processing.
9. The graphics processor according to claim 8, wherein the state information includes a sampling flag, the sampling flag is used to indicate whether texture sampling needs to be performed, and the texture sampler is further used to determine whether texture sampling needs to be performed according to the sampling flag in the state information.
10. According to the graphics processor of claim 8 or 9, before sending feedback information to the CPU, the interpolation calculation module is also used to write multiple attribute information of each fragment into the storage address in the video memory into the status information, and store the status information after writing the storage address into the video memory according to the target address carried by the drawing command.
11. The graphics processor according to claim 10, wherein when the texture sampler reads the texture data and the plurality of attribute information of each fragment from the video memory, it is specifically used to: Reading texture data from the video memory according to the texture video memory address in the state information; wherein, The texture display memory address is written into the state information by the CPU according to the address of the texture data in the display memory; According to the attribute information storage address in the state information, multiple attribute information of each fragment is read from the video memory.
12. The graphics processor according to claim 8, wherein the drawing command corresponds to a plurality of pieces of state information, each piece of state information corresponds to an object to be rendered, each piece of state information includes a sampling identifier, and the sampling identifier included in each piece of state information is used to indicate whether texture sampling needs to be performed on the corresponding object to be rendered; The texture sampler is also used to determine whether it is necessary to perform texture sampling on the corresponding object to be rendered according to the sampling identifier in each state information; When the geometry processing module performs geometry processing on the object to be rendered, the geometry processing module is specifically used to perform geometry processing on the object to be rendered corresponding to the state information when the drawing command corresponds to state information indicating that texture sampling does not need to be performed; When the interpolation calculation module performs the attribute interpolation calculation on the object to be rendered, the interpolation calculation module is specifically used to perform the attribute interpolation calculation on the object to be rendered corresponding to the state information when the drawing command corresponds to the state information indicating that texture sampling does not need to be performed.
13. According to the graphics processor of claim 12, when the texture sampler reads the texture data and multiple attribute information of each fragment from the video memory, it is specifically used to read the texture data and multiple attribute information of each fragment corresponding to the object to be rendered and corresponding to the state information from the video memory when the drawing command corresponds to state information indicating that texture sampling needs to be performed.
14. The graphics processor according to claim 8, further comprising: A depth detection module, used to perform depth detection on multiple fragments to retain unobstructed fragments; When storing multiple attribute information of each fragment into the video memory, the interpolation calculation module is specifically used to store multiple attribute information of unobstructed fragments into the video memory.
15. A graphics processing system, comprising the graphics processor according to any one of claims 8 to 14.
16. An electronic device comprising the graphics processing system according to claim 15.
17. An electronic device comprising the electronic device according to claim 16.
18. An image rendering method, the method comprising: Submitting a drawing command to the GPU, the drawing command corresponding to first state information for indicating that texture sampling does not need to be performed, so that the GPU performs geometric processing and attribute interpolation calculation on the object to be rendered to determine multiple attribute information of each fragment, and stores the multiple attribute information of each fragment in a video memory; wherein the multiple attribute information includes texture index information; In response to feedback information from the GPU, and according to the texture index information, loading corresponding texture data into the video memory; Submitting a drawing command to the GPU again, the drawing command corresponding to second status information for indicating that texture sampling needs to be performed, so that the GPU reads the texture data and multiple attribute information of each fragment from the video memory, and inputs the read texture data and multiple attribute information of each fragment into a fragment shader for processing.
19. The method according to claim 18, before submitting the drawing command to the GPU, the method further comprises: The first state information is configured, where the first state information includes a first sampling identifier, where the first sampling identifier is used to indicate that texture sampling does not need to be performed.
20. The method according to claim 19, before submitting the drawing command to the GPU again, the method further comprises: The first sampling identifier in the first state information is replaced with a second sampling identifier to obtain the second state information, wherein the second sampling identifier is used to indicate that texture sampling needs to be performed; or the second state information is configured, wherein the second state information includes a second sampling identifier, and the second sampling identifier is used to indicate that texture sampling needs to be performed.
21. The method according to claim 18, wherein in response to the feedback information from the GPU, and according to the texture index information, loading the corresponding texture data into the video memory comprises: In response to the feedback information of the GPU, multiple attribute information of each fragment is read from the video memory according to the attribute information storage address recorded in the first state information, and corresponding texture data is loaded into the video memory according to the texture index information in the multiple attribute information.
22. The method according to claim 21, before submitting the drawing command to the GPU again, the method further comprises: The address of the texture data in the video memory is written into the second state information.
23. The method according to claim 18, wherein each drawing command submitted to the GPU corresponds to a plurality of state information, wherein the plurality of state information includes first state information and second state information, the first state information includes a first sampling flag for indicating that texture sampling does not need to be performed, and the second state information includes a second sampling flag for indicating that texture sampling needs to be performed, and each state information corresponds to an object to be rendered; Before submitting a drawing command to the GPU each time, the method further includes: Replacing the first sampling identifier in the first state information corresponding to the last drawing command with the second sampling identifier to obtain the second state information; Configuring the first state information for a new object to be rendered, wherein the sampling identifier in the first state information is a first sampling identifier; The obtained second state information and the configured first state information are used as a plurality of state information corresponding to the current drawing command.
Citation Information
Patent Citations
Game rendering method and device
CN105094920A
Character rendering method and character rendering apparatus
CN106296782A
Real-time efficient dyeing method and system in mobile game
CN107657648A
Graph processing method, device and apparatus and storage medium
CN110415161A
Image rendering method, device, and equipment and storage medium
CN112785676A
