Interface rendering method and device, storage medium and electronic device
By obtaining and adjusting the shading rate parameters in the interface graphics API instructions, the high power consumption and promotion difficulty of variable rate shading technology in the prior art are solved, and lower power consumption and wider rendering applications are achieved.
Patent Information
- Application Number
- CN202111187922.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-12
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2041-10-12
AI Technical Summary
The existing variable rate shading technology consumes a high power consumption in image rendering, and cannot dynamically adjust the shading rate of the specified area. It is difficult to promote, requiring the participation of image suppliers.
By obtaining the graphics API instructions for the interface, determining the type of the interface, and adjusting the shading rate parameters in the graphics API instructions for the three-dimensional area to achieve rendering of the interface.
The power consumption of interface rendering by variable-rate shading technology is reduced, and the use range of rendering is improved. It does not require the participation of interface developers, and directly adjusts the shading rate at the terminal.
Smart Images

Figure CN113936089B_ABST
Abstract
Description
Background Art
[0002] Variable Rate Shading (VRS) is a function that improves rendering performance and quality by changing the shading rate of different regions of a frame. The existing technology is that the program developer sets the shading rate through software algorithms and image post-processing technology and then applies it to the entire frame.
[0003] However, the existing method of rendering images using variable rate shading has high energy consumption and cannot change the shading rate of a specified area. At the same time, the existing method of rendering images using variable rate shading requires the participation of image suppliers and is difficult to promote.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The purpose of the present disclosure is to provide an interface rendering method, an interface rendering device, a computer-readable medium and an electronic device, thereby reducing the power of rendering the interface using variable rate shading at least to a certain extent and increasing the scope of use of the above-mentioned rendering of the interface using variable rate shading.
[0006] According to a first aspect of the present disclosure, there is provided an interface rendering method, comprising: obtaining a graphics API instruction of the interface, and determining the type of the interface according to the graphics API instruction; in response to the interface being of the first type, obtaining a graphics API instruction corresponding to a three-dimensional area in the interface in the graphics API instruction; and adjusting a shading rate parameter in the graphics API instruction corresponding to the three-dimensional area to render the interface.
[0007] According to a second aspect of the present disclosure, an interface rendering device is provided, comprising: an acquisition module, used to acquire a graphics API instruction of the interface, and determine the type of the interface according to the graphics API instruction; a response module, used to respond to the interface being of a first type, and acquire a graphics API instruction corresponding to a three-dimensional area in the interface from the graphics API instruction; and a rendering module, used to adjust a shading rate parameter in the graphics API instruction corresponding to the three-dimensional area to render the interface.
[0008] According to a third aspect of the present disclosure, a computer-readable medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented.
[0009] According to a fourth aspect of the present disclosure, there is provided an electronic device, including:
[0010] One or more processors; and a memory for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the above method.
[0011] An interface rendering method provided by an embodiment of the present disclosure obtains a graphics API instruction of the interface, and determines the type of the interface according to the graphics API instruction; in response to the interface being of the first type, obtains in the graphics API instruction a graphics API instruction corresponding to a three-dimensional area in the interface; and adjusts a shading rate parameter in the graphics API instruction corresponding to the three-dimensional area to render the interface. Compared with the prior art, on the one hand, by directly obtaining the graphics API instruction of the interface to be displayed, the shading rate can be controlled from the driver layer, solving the problem of high functional loss. On the other hand, by rendering the interface according to the graphics API instruction of the interface, when rendering, only the graphics API instruction of the interface during GPU processing needs to be intercepted, and the interface developer does not need to be involved. The shading rate can be adjusted directly from the terminal perspective, increasing the available range of the above-mentioned interface rendering method.
[0012] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0014] Figure 1 A schematic diagram showing an exemplary system architecture to which embodiments of the present disclosure may be applied;
[0015] Figure 2 A schematic diagram showing an electronic device to which the embodiments of the present disclosure can be applied;
[0016] Figure 3 A flowchart of an interface rendering method in an exemplary embodiment of the present disclosure is schematically shown;
[0017] Figure 4 A data flow diagram of an interface rendering method in an exemplary embodiment of the present disclosure is schematically shown;
[0018] Figure 5 The following is a schematic diagram schematically showing the composition of an interface rendering device in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0019] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0020] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0021] Figure 1 A schematic diagram of a system architecture of an exemplary application environment to which an interface rendering method and device according to an embodiment of the present disclosure can be applied is shown.
[0022] like Figure 1 As shown, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The terminal devices 101, 102, 103 may be various electronic devices with image processing functions, including but not limited to desktop computers, portable computers, smart phones, tablet computers, etc. It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.
[0023] The interface rendering method provided in the embodiment of the present disclosure is generally executed by the terminal devices 101, 102, and 103, and accordingly, the interface rendering device is generally arranged in the terminal devices 101, 102, and 103. However, it is easy for those skilled in the art to understand that the interface rendering method provided in the embodiment of the present disclosure can also be executed by the server 105, and accordingly, the interface rendering device can also be arranged in the server 105, which is not particularly limited in the present exemplary embodiment. For example, in an exemplary embodiment, the user can obtain the graphics API instruction for the interface included in the terminal devices 101, 102, and 103, and then upload the graphics API instruction to the server 105. The server generates the graphics API instruction corresponding to the adjusted third-dimensional area through the interface rendering method provided in the embodiment of the present disclosure, and transmits the graphics API instruction corresponding to the adjusted three-dimensional area to the terminal devices 101, 102, 103, etc. so that the terminal devices 101, 102, 103, etc. complete the rendering of the above-mentioned interface.
[0024] An exemplary embodiment of the present disclosure provides an electronic device for implementing an interface rendering method, which may be Figure 1 The terminal device 101, 102, 103 or the server 105 in the embodiment. The electronic device at least includes a processor and a memory, the memory is used to store executable instructions of the processor, and the processor is configured to execute the interface rendering method by executing the executable instructions.
[0025] In an exemplary implementation of the present disclosure, the terminal devices 101, 102, and 103 may all be mobile terminals. Figure 2 Taking the mobile terminal 200 in FIG. 1 as an example, the structure of the electronic device is exemplarily described. It should be understood by those skilled in the art that, in addition to the components specifically used for mobile purposes, Figure 2 The structure in the figure can also be applied to fixed type devices. In other embodiments, the mobile terminal 200 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure can be implemented in hardware, software, or a combination of software and hardware. The interface connection relationship between the components is only shown schematically and does not constitute a structural limitation of the mobile terminal 200. In other embodiments, the mobile terminal 200 may also adopt the same Figure 2 Different interface connection methods, or a combination of multiple interface connection methods.
[0026] like Figure 2As shown, the mobile terminal 200 may specifically include: a processor 210, an internal memory 221, an external memory interface 222, a Universal Serial Bus (USB) interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 271, a receiver 272, a microphone 273, an earphone interface 274, a sensor module 280, a display screen 290, a camera module 291, an indicator 292, a motor 293, a button 294, and a subscriber identification module (SIM) card interface 295, etc. The sensor module 280 may include a depth sensor 2801, a pressure sensor 2802, a gyroscope sensor 2803, etc.
[0027] The processor 210 may include one or more processing units, for example, the processor 210 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor and / or a neural network processor (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0028] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the mobile terminal 200 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0029] The processor 210 is provided with a memory. The memory can store instructions for implementing six modular functions: detection instructions, connection instructions, information management instructions, analysis instructions, data transmission instructions, and notification instructions, and the execution is controlled by the processor 210.
[0030] The charging management module 240 is used to receive charging input from the charger. The power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210. The power management module 241 receives input from the battery 242 and / or the charging management module 240 to power the processor 210, the internal memory 221, the display screen 290, the camera module 291 and the wireless communication module 260.
[0031] The wireless communication function of the mobile terminal 200 can be implemented through antenna 1, antenna 2, mobile communication module 250, wireless communication module 260, modulation and demodulation processor and baseband processor. Among them, antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals; mobile communication module 250 can provide solutions for wireless communication including 2G / 3G / 4G / 5G applied on mobile terminal 200; modulation and demodulation processor can include modulator and demodulator; wireless communication module 260 can provide solutions for wireless communication including wireless local area network (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT) and the like applied on mobile terminal 200. In some embodiments, antenna 1 of mobile terminal 200 is coupled with mobile communication module 250, and antenna 2 is coupled with wireless communication module 260, so that mobile terminal 200 can communicate with network and other devices through wireless communication technology.
[0032] The mobile terminal 200 implements the display function through a GPU, a display screen 290, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 290 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 210 may include one or more GPUs that execute program instructions to generate or change display information.
[0033] The mobile terminal 200 can realize the shooting function through the ISP, the camera module 291, the video codec, the GPU, the display screen 290 and the application processor, etc. Among them, the ISP is used to process the data fed back by the camera module 291; the camera module 291 is used to capture static images or videos; the digital signal processor is used to process digital signals, and can process other digital signals in addition to digital image signals; the video codec is used to compress or decompress digital videos, and the mobile terminal 200 can also support one or more video codecs.
[0034] The external memory interface 222 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile terminal 200. The external memory card communicates with the processor 210 through the external memory interface 222 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0035] The internal memory 221 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 221 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the mobile terminal 200 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 221 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash memory (Universal Flash Storage, UFS), etc. The processor 210 executes various functional applications and data processing of the mobile terminal 200 by running instructions stored in the internal memory 221 and / or instructions stored in a memory provided in the processor.
[0036] The mobile terminal 200 can implement audio functions such as music playing and recording through the audio module 270 , the speaker 271 , the receiver 272 , the microphone 273 , the earphone interface 274 and the application processor.
[0037] The depth sensor 2801 is used to obtain the depth information of the scene. In some embodiments, the depth sensor can be arranged in the camera module 291.
[0038] The pressure sensor 2802 is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 2802 can be arranged on the display screen 290. There are many types of pressure sensors 2802, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc.
[0039] The gyro sensor 2803 can be used to determine the motion posture of the mobile terminal 200. In some embodiments, the angular velocity of the mobile terminal 200 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 2803. The gyro sensor 2803 can be used for shooting anti-shake, navigation, somatosensory game scenes, etc.
[0040] In addition, sensors with other functions may be set in the sensor module 280 according to actual needs, such as an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0041] The mobile terminal 200 may also include other devices that provide auxiliary functions. For example, the key 294 includes a power key, a volume key, etc., and the user can generate key signal input related to the user settings and function control of the mobile terminal 200 through key input. For example, the indicator 292, the motor 293, the SIM card interface 295, etc.
[0042] In the related art, variable rate shading (VRS) is a function that improves rendering performance and quality by changing the shading rate of different areas of the frame. In the traditional rendering process, a fragment shader needs to be run once to render a pixel in the frame buffer, while VRS can combine several pixels into a pixel block, and run the fragment shader once to render all pixels in the pixel block. The existing technology is to set the shading rate through software algorithms and image post-processing technology, and then apply it to the entire frame.
[0043] The related technology is to achieve accelerated shading of the entire frame by using software recognition algorithms and image post-processing technology during the game drawing process. Although the software-based method mentioned above can save GPU overhead, it increases the CPU load and fails to fundamentally save the power consumption of the entire machine. Secondly, the method in the related technology is only applicable to the entire frame and cannot change the shading rate of the specified area. Finally, the existing VRS requires the participation of game manufacturers, which makes it difficult to promote.
[0044] The interface rendering method and the interface rendering device according to the exemplary embodiments of the present disclosure are described in detail below.
[0045] Figure 3 The flowchart of an interface rendering method in this exemplary embodiment includes the following steps:
[0046] Step S310, obtaining a graphics API instruction of the interface, and determining the type of the interface according to the graphics API instruction;
[0047] Step S320, in response to the interface being of the first type, obtaining, from the graphics API instruction, a graphics API instruction corresponding to the three-dimensional area in the interface;
[0048] Step S330, adjusting the shading rate parameter in the graphics API instruction corresponding to the three-dimensional area to render the interface.
[0049] Compared with the existing technology, on the one hand, directly obtaining the graphics API instructions of the interface to be displayed can control the shading rate from the driver layer, solving the problem of high functional loss. On the other hand, the interface is rendered according to the graphics API instructions of the interface. When rendering, only the graphics API instructions of the interface during GPU processing need to be intercepted. Without the participation of the interface developer, the shading rate can be adjusted directly from the terminal perspective, which increases the applicable range of the above interface rendering method.
[0050] The above steps are described in detail below.
[0051] In step S310, a graphics API instruction of the interface is obtained, and the type of the interface is determined according to the graphics API instruction.
[0052] In this example implementation, a graphics API (Application Programming Interface) instruction corresponding to the interface may be intercepted by a hook function, and the type of the interface may be determined according to the graphics API instruction, wherein the graphics API instruction includes a texture corresponding to the interface. The type of the interface may be determined according to the texture of the interface.
[0053] Specifically, the interface can be of the first type or the second type, and the first texture query table corresponding to the first type interface can be determined first. Determine whether the interface is of the first type based on the texture name of the interface and the first texture query table. If the texture name of the interface is in the first texture query table, the interface is determined to be of the first type. If the texture name corresponding to the interface is not in the first texture query table, the interface is determined to be of the second type. The first type can correspond to a battle scene in a game, a battle scene in a video, etc., and can also be customized according to user needs, which is not specifically limited in this example implementation.
[0054] In another example implementation of the present disclosure, when determining the type of the above interface, the second texture query table corresponding to the second type of interface may be first determined. If the texture name of the above interface is in the second texture query table, the above interface is determined to be the second type. If the texture name of the above interface is not in the second texture query table, the above interface is determined to be the first type. The second type may correspond to a non-combat scene in a game, a non-combat scene in a video, etc., and may also be customized according to user needs, which is not specifically limited in this example implementation.
[0055] For example, in a game scene, such as a MOBA game, the first type may be a scene in the game, and the second type may be a scene before the game starts, that is, the first texture query table may include texture names corresponding to the skills of each game character. For another example, in a racing game, the first texture query table may include texture names corresponding to the acceleration button, texture names corresponding to the turn button, etc.
[0056] In step S320, in response to the interface being of the first type, a graphics API instruction corresponding to the three-dimensional area in the interface is obtained from the graphics API instruction.
[0057] In an example implementation of the present disclosure, when it is determined that the above-mentioned interface is of the first type, a graphics API instruction corresponding to the three-dimensional area corresponding to the three-dimensional area in the interface may be obtained from the above-mentioned graphics API instruction.
[0058] Specifically, the distance between each element in the above-mentioned interface and the virtual camera can be first determined according to the above-mentioned graphics API instructions, and then which elements and which areas are three-dimensional areas can be determined according to the above-mentioned distances. Specifically, if the distance between the same area of the above-mentioned interface and the virtual camera is different, then the above-mentioned area is a three-dimensional area. Then, the graphics API instructions corresponding to the above-mentioned three-dimensional area are determined in the graphics API instructions of the above-mentioned interface. For example, if the distances between each part of an element in the above-mentioned interface and the above-mentioned virtual camera are different, the area where the element is located can be defined as a three-dimensional area, and the graphics API instructions corresponding to the element can be defined as graphics API instructions corresponding to the three-dimensional area. For another example, if the distances between each part of an area in the above-mentioned interface and the above-mentioned virtual camera are different, the area can be positioned as a three-dimensional area, and the graphics API instructions corresponding to the area can be defined as graphics API instructions corresponding to the three-dimensional area.
[0059] In step S330, a shading rate parameter in a graphics API instruction corresponding to the three-dimensional area is adjusted to render the interface.
[0060] In this example implementation, after determining the graphics API instruction corresponding to the three-dimensional area, the shading rate in the three-dimensional area can be determined according to the distance, wherein the shading rate is positively correlated with the distance, wherein the shading rate and the distance can be linearly correlated or nonlinearly correlated, and can also be customized according to user needs, which is not specifically limited in this example implementation. For example, the distance can be divided into multiple gradients, each gradient corresponds to a shading rate, wherein the coverage of the distance gradient can be customized according to user needs, which is not specifically limited in this example implementation.
[0061] For example, for shooting games, for the background area other than the operating interface and virtual game characters, the farther the background objects are, the slower the shading rate, and the closer the background objects are, the faster the shading rate; for team competition games, the shading rate of the peripheral area outside a certain radius of the screen focus can be gradually reduced from the center to the edge.
[0062] In this example implementation, after the shading rate is determined, a shading rate parameter in the graphics API instruction corresponding to the three-dimensional area may be adjusted according to the shading rate.
[0063] In another example implementation, the image quality requirement of the above-mentioned interface may be first obtained, and then the above-mentioned shading rate may be calculated based on the above-mentioned image quality requirement, and then the shading rate parameter in the graphics API instruction corresponding to the three-dimensional area may be adjusted. The image quality requirement corresponding to the above-mentioned three-dimensional area may be pre-configured, and then the shading rate of the three-dimensional area may be determined based on the image quality requirement, wherein the above-mentioned shading rate is negatively correlated with the above-mentioned image quality requirement, and the higher the image quality requirement, the lower the shading rate, wherein the above-mentioned shading rate and the above-mentioned image quality requirement may be linearly correlated or nonlinearly correlated, and may also be customized according to user needs, which is not specifically limited in this example implementation.
[0064] In this example implementation, it is also possible to first obtain the initial element in the three-dimensional area in the graphics API instruction corresponding to the three-dimensional area, and then obtain a preconfigured adjustment element list; update the graphics API instruction corresponding to the three-dimensional area according to the adjustment element list and the initial element, so that the graphics API instruction corresponding to the three-dimensional area corresponding to the initial element in the adjustment element list is adjusted to the graphics API instruction corresponding to the two-dimensional area. The elements in the above adjustment element table may include some unimportant elements, such as a virtual joystick in a shooting game, skill buttons, and the game character itself; the types of elements in the above adjustment element table may also be customized according to user needs, which is not specifically limited in this example implementation.
[0065] In an example implementation of the present disclosure, it is also possible to obtain a graphics API instruction corresponding to a two-dimensional area in the interface in the graphics API instruction, and configure the shading rate parameter in the graphics API instruction corresponding to the two-dimensional area to a first preset value. Specifically, the parameter value corresponding to the graphics API instruction corresponding to the preconfigured two-dimensional area may be first obtained; and the graphics API instruction corresponding to the two-dimensional area may be obtained in the graphics API instruction according to the parameter value. That is, the graphics API instructions corresponding to the above interface are traversed according to the above parameter value compared with the above interface, and the graphics API instructions corresponding to the two-dimensional area with the same parameter value are determined in the graphics API instructions corresponding to the interface. Among them, the above parameter value may include a hash value or image texture of an image tag bound to the graphics API instruction corresponding to the two-dimensional area, and the above parameter value may also be customized according to user needs, which is not specifically limited in the present example implementation.
[0066] In an example implementation of the present disclosure, if the above interface is of the second type, the shading rate parameters in the graphics API instructions of the above interface are all configured to the first preset value. There is no need to configure different values for the shading rate of non-combat scenes, which does not affect the user experience and reduces the amount of calculation when rendering the interface.
[0067] In this example implementation, the first preset value may be 1*1, or may be customized according to user needs, which is not specifically limited in this example implementation.
[0068] In an exemplary embodiment of the present disclosure, referring to Figure 4 As shown, the above interface rendering method relies on a processor to be implemented, and the processor may include a GPU graphics API instruction interception unit 410 , a UI recognition unit 420 , a ROI scene recognition unit 430 and a VRS startup unit 440 .
[0069] In this example implementation, the GPU graphics API instruction interception unit 410 may utilize a hook function to intercept graphics API instructions corresponding to the above interface, wherein the intercepted graphics APIs include but are not limited to OpenGL, OpenGL ES, Vulkan, DirectX, Metal, and the like.
[0070] In this example implementation, the UI recognition unit 420 is used to recognize UI objects in the scene. Because VRS does not apply to any UI controls in the scene. Hook the graphics API related to the texture and image tags to obtain the parameter values of the graphics API instructions. The label (identification) or hash (hash) value of the currently bound texture or image tag is obtained through these parameter values. These label and hash values are compared with the label and hash values of the UI controls in the screen to determine whether to start drawing the UI at present, that is, the graphics API instructions corresponding to the two-dimensional area are obtained in the graphics API instructions according to the parameter values corresponding to the graphics API instructions corresponding to the pre-configured two-dimensional area.
[0071] In this example implementation, the ROI scene recognition unit 430 is used to identify three-dimensional objects in the scene that can use VRS. Hook the graphics API instructions related to texture and depth to obtain the input and output parameters of the API instructions. The object currently being drawn and the distance from the object to the camera are obtained through these input and output parameters, and the graphics API instructions corresponding to the three-dimensional area are determined from the above graphics API instructions.
[0072] In this example implementation, when the above-mentioned graphics API instructions are graphics API instructions corresponding to a three-dimensional area, the VRS startup unit 440 can use the variable shading rate extension instructions provided by the chip company (Qualcomm or MTK) to start VRS before executing each rendering instruction, and adjust the shading rate in the graphics API instructions corresponding to the three-dimensional area according to image quality requirements.
[0073] In summary, in this exemplary embodiment, on the one hand, by directly obtaining the graphics API instructions of the interface to be displayed, the shading rate can be controlled from the driver layer, solving the problem of high functional loss. On the other hand, the interface is rendered according to the graphics API instructions of the interface. When rendering, only the graphics API instructions of the interface during GPU processing need to be intercepted, and the shading rate can be adjusted directly from the terminal perspective without the involvement of the interface developer, which increases the applicable range of the above interface rendering method.
[0074] It should be noted that the above figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0075] For further reference, Figure 5 As shown, in the implementation of this example, an interface rendering device 500 is also provided, including an acquisition module 510, a response module 520 and a rendering module 530. Among them:
[0076] The acquisition module 510 can be used to obtain the graphics API instructions of the interface and determine the type of the interface based on the graphics API instructions; specifically, a hook function can be used to intercept the graphics API instructions corresponding to the interface, and then obtain the texture bound to the graphics API instructions; determine the type of the interface based on the texture.
[0077] The response module 520 can be used to respond to the interface being of the first type, and obtain the graphics API instructions corresponding to the three-dimensional area in the interface in the graphics API instructions; specifically, the distance between each element of the interface and the virtual camera can be determined according to the graphics API instructions; and the graphics API instructions corresponding to the three-dimensional area are obtained in the graphics API instructions according to the distance.
[0078] The rendering module 530 can be used to adjust the shading rate parameter in the graphics API instruction corresponding to the three-dimensional area to complete the rendering of the interface. Specifically, the shading rate of each element is determined according to the distance, wherein the shading rate is positively correlated with the distance; and the shading rate in the graphics API instruction corresponding to the three-dimensional area is adjusted using a variable rate shading technology according to the shading rate of each element.
[0079] The rendering module 530 may also configure the shading rate in the graphics API instruction to the first preset value in response to the interface being of the second type, so as to render the interface.
[0080] In this example implementation, the rendering module 530 may also obtain a graphics API instruction corresponding to the two-dimensional area in the interface from the graphics API instruction; and configure the shading rate in the graphics API instruction corresponding to the two-dimensional area to a first preset value. Specifically, obtain a parameter value corresponding to the preconfigured graphics API instruction corresponding to the two-dimensional area; and obtain the graphics API instruction corresponding to the two-dimensional area from the graphics API instruction according to the parameter value, wherein the parameter value may include a hash value or image texture of an image tag bound to the graphics API instruction corresponding to the two-dimensional area.
[0081] In an example implementation of the present disclosure, the response module 520 may also be used to obtain an initial element in a three-dimensional area bound to a graphics API instruction corresponding to the three-dimensional area; obtain an adjustment element list; and update the graphics API instruction corresponding to the three-dimensional area according to the adjustment element list and the initial element, so that the graphics API instruction corresponding to the initial element in the adjustment element list is determined to be a graphics API instruction corresponding to the two-dimensional area.
[0082] The specific details of each module in the above device have been described in detail in the implementation method of the method part. The undisclosed details can be found in the implementation method of the method part, so they will not be repeated here.
[0083] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as "circuits", "modules" or "systems".
[0084] The exemplary embodiments of the present disclosure also provide a computer-readable storage medium on which a program product capable of implementing the above-mentioned method of the present specification is stored. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section of the present specification.
[0085] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0086] In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0087] In addition, program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0088] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0089] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. An interface rendering method, characterized in that: The interface rendering method comprises: Obtaining a graphics API instruction of the interface, and determining a type of the interface according to the graphics API instruction; In response to the interface being of the first type, determining the distance between each element of the interface and the virtual camera according to the graphics API instruction, and obtaining the graphics API instruction corresponding to the three-dimensional area in the interface from the graphics API instruction according to the distance; The shading rate of each of the elements is determined according to the distance, wherein the shading rate is positively correlated with the distance; and the shading rate parameter in the graphics API instruction corresponding to the three-dimensional area is adjusted according to the shading rate of each of the elements.
2. The method according to claim 1, characterized in that The method further comprises: In response to the interface being of the second type, all shading rate parameters in the graphics API instruction are configured as first preset values to render the interface.
3. The method according to claim 1, characterized in that The method further comprises: Obtaining, from the graphics API instructions, graphics API instructions corresponding to the two-dimensional area in the interface; The shading rate parameter in the graphics API instruction corresponding to the two-dimensional area is configured as a first preset value.
4. The method according to claim 3, characterized in that The step of obtaining the graphics API instruction corresponding to the two-dimensional area in the interface from the graphics API instruction includes: Get the parameter value corresponding to the graphics API instruction corresponding to the pre-configured two-dimensional area; Obtain a graphics API instruction corresponding to the two-dimensional area from the graphics API instruction according to the parameter value.
5. The method according to claim 4, characterized in that The parameter value includes a hash value or an image texture of an image tag bound to a graphics API instruction corresponding to the two-dimensional area.
6. The method according to claim 3, characterized in that Before adjusting the shading rate parameter in the graphics API instruction corresponding to the three-dimensional area, the method further includes: Get the initial element in the three-dimensional area bound in the graphics API instruction corresponding to the three-dimensional area; Get a list of adjustment elements; The graphics API instruction corresponding to the three-dimensional area is updated according to the adjustment element list and the initial element, so that the graphics API instruction corresponding to the initial element in the adjustment element list is determined as the graphics API instruction corresponding to the two-dimensional area.
7. The method according to claim 1, characterized in that The graphics API instructions for obtaining the interface include: A hook function is used to intercept the graphics API instructions corresponding to the interface.
8. The method according to claim 1, characterized in that The determining the type of the interface according to the graphics API instruction includes: Get the texture bound to the graphics API instruction; The graphics API instruction determines the type of the interface according to the texture.
9. An interface rendering device, characterized in that: The interface rendering device comprises: An acquisition module, used for acquiring a graphics API instruction of the interface, and determining the type of the interface according to the graphics API instruction; A response module, in response to the interface being of the first type, determines the distance between each element of the interface and the virtual camera according to the graphics API instruction, and obtains the graphics API instruction corresponding to the three-dimensional area in the interface from the graphics API instruction according to the distance; A rendering module is used to determine a shading rate of each of the elements according to the distance, wherein the shading rate is positively correlated with the distance; and to adjust a shading rate parameter in a graphics API instruction corresponding to the three-dimensional area according to the shading rate of each of the elements.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the interface rendering method according to any one of claims 1 to 8 is implemented.
11. An electronic device, characterized in that: include: processor; as well as A memory for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the interface rendering method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Motion adaptive rendering using variable rate shading
CN110868580A
Image rendering calculation method and device, storage medium and terminal
CN112529995A