Rendering method and device, electronic device and computer-readable storage medium

By using a rendering data processing solution based on compiled language in the mini game platform, the problems of low JavaScript efficiency and numerous WebGL interface calls are solved, and efficient 3D game rendering performance is improved.

CN113076152BActive Publication Date: 2024-10-01TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010005836.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-01-03
Publication Date
2024-10-01
Estimated Expiration
2040-01-03

AI Technical Summary

Technical Problem

When implementing high-quality 3D game rendering on existing mini-game platforms, they are limited by the inefficiency of JavaScript's interpreted language and numerous WebGL interface calls, resulting in performance bottlenecks and limiting the development of games.

Method used

Obtain rendering data from JavaScript applications through applications based on compiled languages ​​(such as C/C++), parse and perform rendering operations, call the abstract WebGL interface as rendering data, and hand over the rendering tasks to higher-performance compiled languages.

Benefits of technology

It significantly improves the rendering performance, reduces the performance requirements for the JavaScript system, improves the overall rendering capability, and can meet the rendering needs of high-quality 3D games.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113076152B_ABST
    Figure CN113076152B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure provide a rendering method and device, an electronic device, and a computer-readable storage medium, which belong to the field of computer technology. The method comprises: a first application based on a compiled language obtains rendering data of an object to be rendered from a second application based on a scripting language, and the first application is installed on a terminal device; the rendering data is parsed by the first application; the first application performs rendering of the object to be rendered according to the parsed rendering data. The solution provided by the embodiments of the present disclosure uses the first application based on a compiled language to render the rendering data submitted by the second application based on a scripting language, which can greatly improve the rendering performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a rendering method and device, an electronic device, and a computer-readable storage medium. Background Art

[0002] Mini games developed based on the browser environment have been widely used on mobile terminals such as mobile phones because they do not need to be downloaded and can be played directly online. With the vigorous development of mini game platforms, more and more game developers choose to use mini game platforms to publish their game works. Game developers and game players have higher and higher requirements for the quality of mini games, but due to the technical framework of mini games in related technologies, performance bottlenecks are becoming increasingly prominent, which technically restricts the development of mini games.

[0003] For the basic framework design of the mini-game platform, there are two main directions in the relevant technologies:

[0004] The first is to use WebView (web view, used to display a web page) H5 (mobile web page) as the operating environment. This solution is to open a browser page in the APP (application, here it is assumed to be the client provided by the mini-game platform), and the mini-game runs in the browser environment. The disadvantage of this solution is that the mini-game platform that provides the browser environment cannot control the game content of the game developer. In the Internet environment, the mini-game platform has a greater risk.

[0005] The second is that the client provided by the mini-game platform implements the standard WebGL (Web Graphics Library) 1.0 interface and other interfaces equivalent to the H5 environment, and injects them into a JavaScript (a lightweight, interpreted programming language with function priority, hereinafter referred to as JS) running environment provided by the client, and the game developed by the game developer runs in this closed environment. Under this solution, the mini-game platform can fully control the behavior of the game developer, so most mini-game platforms adopt this architecture.

[0006] However, in the second solution mentioned above, in order to allow game developers to develop mini-games according to their own needs, the mini-games themselves are developed based on scripting languages ​​such as JS. When it is necessary to implement the rendering function of the game scene in the mini-game, the JS system provided by the mini-game platform calls the WebGL API (Application programming interface) implemented by the APP to achieve rendering. For example, taking drawing a cup in a mini-game as an example, a large number of WebGL interfaces need to be called. Since the JS system itself has a lot of logic to be implemented, more steps need to be executed in the rendering process. At the same time, since the JS language is based on an interpreted language, its own operating efficiency is very low. When achieving high-quality 3D (3-dimension) game screen rendering, there are major performance issues. Therefore, the mini-games on various platforms are currently almost all 2D games.

[0007] Therefore, a new rendering method and device, electronic device and computer-readable storage medium are needed.

[0008] 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. Summary of the invention

[0009] The embodiments of the present disclosure provide a rendering method and device, an electronic device, and a computer-readable storage medium, which can greatly improve rendering performance.

[0010] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0011] An embodiment of the present disclosure provides a rendering method, the method comprising: a first application based on a compiled language obtains rendering data of an object to be rendered from a second application based on a scripting language, the first application being installed on a terminal device; parsing the rendering data by the first application; and the first application performing rendering of the object to be rendered according to the parsed rendering data.

[0012] An embodiment of the present disclosure provides a rendering device, which includes: a rendering data acquisition unit, which is used for a first application based on a compiled language to acquire rendering data of an object to be rendered from a second application based on a scripting language, wherein the first application is installed on a terminal device; a rendering data parsing unit, which is used for parsing the rendering data through the first application; and an object rendering execution unit, which is used for the first application to execute rendering of the object to be rendered according to the parsed rendering data.

[0013] In some exemplary embodiments of the present disclosure, the rendering data includes a target view handle. The device further includes: a view description information acquisition unit, used for the first application to acquire view description information of the object to be rendered from the second application, the view description information including a target frame buffer and operations on the target frame buffer; a view creation unit, used to call a view allocation function provided by the first application, and create a view and its view handle according to the view description information; a view handle return unit, used to return the view handle to the second application, wherein the view handle includes the target view handle.

[0014] In some exemplary embodiments of the present disclosure, the rendering data also includes a target cropping handle. The device further includes: a drawing area information acquisition unit, which is used for the first application to acquire the drawing area restriction information of the object to be rendered from the second application; a cropping area creation unit, which is used to call the area allocation function provided by the first application to create a cropping area and its cropping handle according to the drawing area restriction information; and a cropping handle return unit, which is used to return the cropping handle to the second application, wherein the cropping handle includes the target cropping handle.

[0015] In some exemplary embodiments of the present disclosure, the rendering data also includes a target shader handle. The device further includes: a shading information acquisition unit, which is used for the first application to acquire the shading information of the object to be rendered from the second application; a shader generation unit, which is used to call the shader allocation function provided by the first application to generate a shader and its shader handle according to the shading information; and a shader handle return unit, which is used to return the shader handle to the second application, wherein the shader handle includes the target shader handle.

[0016] In some exemplary embodiments of the present disclosure, the rendering data also includes a target vertex layout handle. The device further includes: a vertex layout information acquisition unit, which is used for the first application to acquire the vertex layout information of the object to be rendered from the second application; a vertex layout form creation unit, which is used to call the vertex layout allocation function provided by the first application, and create a vertex layout form and its vertex layout handle according to the vertex layout information; a vertex layout handle return unit, which is used to return the vertex layout handle to the second application, wherein the vertex layout handle includes the target vertex layout handle.

[0017] In some exemplary embodiments of the present disclosure, the rendering data also includes target rendering pipeline state information and target rendering resource data, and the rendering data includes first rendering data and second rendering data, and the first rendering data is executed before the second rendering data. Wherein, the object rendering execution unit includes: a rendering data execution unit, used to execute the second rendering data; a target frame buffer determination unit, used to determine the target frame buffer of the second rendering data and perform operations on the target frame buffer according to the target view handle of the second rendering data if the target view handles of the first rendering data and the second rendering data are different; a cropping area setting unit, used to set the second rendering data according to the target cropping handle of the second rendering data if the target view handles of the first rendering data and the second rendering data are the same or the operations on the target frame buffer of the second rendering data have been performed, and the target cropping handles of the first rendering data and the second rendering data are different. a pipeline state setting unit, for setting the rendering pipeline state of the second rendering data according to the target rendering pipeline state information of the second rendering data if the target clipping handles of the first rendering data and the second rendering data are the same or the clipping area of ​​the second rendering data is set, and the target rendering pipeline state information of the first rendering data and the second rendering data are different; a resource data binding unit, for binding the target rendering resource data of the second rendering data to a graphics interface if the target rendering pipeline state information of the first rendering data and the second rendering data are the same or the rendering pipeline state of the second rendering data is set, so that the graphics interface can render the second rendering data.

[0018] In some exemplary embodiments of the present disclosure, if the object to be rendered is a dynamic rendering object, the rendering data further includes a target native value. The device further includes: a native value generation unit, configured to call a native value allocation function provided by the first application to generate a native value; and a native value return unit, configured to return the native value to the second application, wherein the native value includes the target native value.

[0019] In some exemplary embodiments of the present disclosure, the target rendering resource data includes target texture information. After the resource data binding unit binds the target texture information of the second rendering data to the graphics interface, the device further includes: a native value setting unit, configured to set the target native value to a uniform variable of the graphics interface.

[0020] In some exemplary embodiments of the present disclosure, the rendering data further includes a target rendering batch index, a position change index of the object to be rendered, and world coordinate information of the object to be rendered.

[0021] In some exemplary embodiments of the present disclosure, the object rendering execution unit also includes: a first batch generation unit, which is used to generate a first batch including the first rendering data if the target rendering batch index of the first rendering data is a set value; a rendering data addition unit, which is used to add the second rendering data to the first batch if the target rendering batch index of the second rendering data is the set value, and the target view handle, target cropping handle, target rendering pipeline state information, target map information and target native value of the first rendering data and the second rendering data are the same; a first batch execution unit, which is used to execute the first batch if at least one of the target view handle, target cropping handle, target rendering pipeline state information, target map information and target native value of the first rendering data and the second rendering data is different; and a second batch generation unit, which is used to generate a second batch including the second rendering data.

[0022] An embodiment of the present disclosure provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the rendering method described in the above embodiment is implemented.

[0023] An embodiment of the present disclosure provides an electronic device, including: one or more processors; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the rendering method as described in the above embodiments.

[0024] In the technical solutions provided by some embodiments of the present disclosure, a second application program based on a scripting language such as JS, such as a mini-game, sends the rendering data of the object to be rendered to a first application program based on a compiled language such as C / C++, such as a client, and the first application program based on the compiled language parses and executes the rendering of the rendering data to complete the rendering of the object to be rendered. On the one hand, the game rendering is abstracted from the process of calling the WebGL interface to rendering data, and the rendering data is used to replace the original second application program based on the scripting language to dispatch a large number of WebGL interfaces to perform rendering operations, which can improve the rendering efficiency; on the other hand, since the operating efficiency of the first application program based on the compiled language is higher than that of the second language based on the scripting language, through this solution, the heavy rendering process originally executed by JS is handed over to the first application program with better performance to execute, thereby greatly reducing the performance requirements for the JS system and improving the overall rendering capability of the first application program. When the solution provided by the embodiments of the present disclosure is applied to the mini-game platform, the rendering performance of the mini-game can be improved, and the rendering performance requirements of high-quality 3D games can be met.

[0025] 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

[0026] 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:

[0027] Figure 1 A schematic diagram showing an exemplary system architecture to which the rendering method or rendering device according to the embodiments of the present disclosure can be applied;

[0028] Figure 2 A schematic diagram showing the structure of a computer system suitable for implementing an electronic device of an embodiment of the present disclosure is shown;

[0029] Figure 3 A flowchart of a rendering method according to an embodiment of the present disclosure is schematically shown;

[0030] Figure 4 A flowchart of a rendering method according to an embodiment of the present disclosure is schematically shown;

[0031] Figure 5 A flowchart of a rendering method according to an embodiment of the present disclosure is schematically shown;

[0032] Figure 6 A flowchart of a rendering method according to an embodiment of the present disclosure is schematically shown;

[0033] Figure 7 A flowchart of a rendering method according to an embodiment of the present disclosure is schematically shown;

[0034] Figure 8 Shows Figure 3 Schematic diagram of the processing process of step S330 in one embodiment;

[0035] Fig. 9 A flowchart of a rendering method according to an embodiment of the present disclosure is schematically shown;

[0036] Fig.10 Shows Figure 3 Schematic diagram of the processing process of step S330 in one embodiment;

[0037] Fig.11 A flowchart of a rendering method according to an embodiment of the present disclosure is schematically shown;

[0038] Fig.12 A schematic diagram of a rendering pipeline according to an embodiment of the present disclosure is schematically shown;

[0039] Fig.13 A block diagram of a rendering device according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0040] 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 this disclosure will be more comprehensive and complete and will fully convey the concept of the example embodiments to those skilled in the art.

[0041] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.

[0042] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0043] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0044] Figure 1 A schematic diagram of an exemplary system architecture 100 is shown to which a rendering method or a rendering device according to an embodiment of the present disclosure can be applied.

[0045] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, a network 103 and a server 104. The network 103 is used to provide a medium for a communication link between the terminal devices 101, 102 and the server 104. The network 103 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0046] The user can use the terminal devices 101 and 102 to interact with the server 104 through the network 103 to receive or send messages, etc. The terminal devices 101 and 102 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, wearable devices, virtual reality devices, smart homes, etc.

[0047] The terminal device 101 is installed and runs an application with an instant messaging function. The application can enable the terminal to realize the instant messaging function. The terminal device 101 is a terminal used by game developers. Game developers use the terminal device 101 to communicate with the server 104 through the network 103, and can upload the small game they develop to the server 104 through the application.

[0048] The server 104 may include at least one of a single server, multiple servers, a cloud computing platform, a virtualization center, etc. The server 104 may be a server that provides various services, for example, it may be used to provide background services for supporting applications with instant messaging functions.

[0049] The terminal device 102 installs and runs an application with an instant messaging function. The application enables the terminal to implement the instant messaging function. The terminal device 102 is a terminal used by game players. Game players use the terminal device 102 to communicate with the server 104 through the network 103, and can request the server 104 for the mini-game they are interested in, and run the mini-game on their terminal device 102.

[0050] Optionally, the applications installed on the terminal device 101 and the terminal device 102 are the same, or the applications installed on the two terminals are the same type of applications on different control system platforms. The terminal device 101 may refer to one of a plurality of terminals, and the terminal device 102 may refer to one of a plurality of terminals. This embodiment is only illustrated by the terminal device 101 and the terminal device 102. The device types of the terminal device 101 and the terminal device 102 are the same or different. The following embodiments are illustrated by the example that the terminal includes a smart phone.

[0051] It should be noted that in the computer system with instant messaging function provided by the embodiment of the present disclosure, the server 104 can be used to establish a session during instant messaging, forward session messages during the session, and can also be used for storing and distributing mini-games. The terminal device 101 connected to the server 104 can be used to generate rendering data of the object to be rendered, and submit it to the application with instant messaging function installed thereon, and the terminal device 102 can be used to obtain the rendering data of the object to be rendered through the application with instant messaging function installed thereon, parse and execute the rendering data to complete the rendering of the object to be rendered.

[0052] Those skilled in the art will appreciate that the number of the above terminals may be more or less. For example, the above terminal may be only one, or the above terminals may be dozens or hundreds, or more. The embodiment of the present application does not limit the number of terminals and device types.

[0053] Figure 2 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present disclosure is shown.

[0054] It should be noted that Figure 2 The computer system 200 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0055] like Figure 2 As shown, the computer system 200 includes a central processing unit (CPU) 201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 202 or the program loaded from the storage part 208 to the random access memory (RAM) 203. Various programs and data required for system operation are also stored in the RAM 203. The CPU 201, the ROM 202 and the RAM 203 are connected to each other through a bus 204. An input / output (I / O) interface 205 is also connected to the bus 204.

[0056] The following components are connected to the I / O interface 205: an input section 206 including a keyboard, a mouse, etc.; an output section 207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 208 including a hard disk, etc.; and a communication section 209 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 209 performs communication processing via a network such as the Internet. A drive 210 is also connected to the I / O interface 205 as needed. A removable medium 211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 210 as needed so that a computer program read therefrom is installed into the storage section 208 as needed.

[0057] In particular, according to an embodiment of the present disclosure, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 209, and / or installed from a removable medium 211. When the computer program is executed by the central processing unit (CPU) 201, various functions defined in the method and / or device of the present application are executed.

[0058] It should be noted that the computer-readable storage 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 (Erasable Programmable Read Only Memory, Erasable Programmable Read Only Memory) 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. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device 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. Computer-readable signal media may also be any computer-readable storage medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF (Radio Frequency), etc., or any suitable combination of the above.

[0059] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the methods, devices and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0060] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0061] As another aspect, the present application also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the following embodiment. For example, the electronic device may implement the following Figure 3 or Figure 4 or Figure 5 or Figure 6 or Figure 7 or Figure 8 or Fig. 9 or Fig.10 or Fig.11 The steps shown.

[0062] Figure 3 The flowchart of the rendering method according to an embodiment of the present disclosure is schematically shown. The method provided by the embodiment of the present disclosure can be executed by any electronic device with computing processing capabilities, such as Figure 1 The terminal devices 101, 102 and / or the server 104 in the embodiment. In the following example description, the terminal device 102 is used as the execution subject for example. Figure 3 As shown, the rendering method provided by the embodiment of the present disclosure may include the following steps.

[0063] In step S310, a first application based on a compiled language obtains rendering data of an object to be rendered from a second application based on a scripting language, wherein the first application is installed on a terminal device.

[0064] In the disclosed embodiment, the first application program may be any client (APP) that can be downloaded and installed on a terminal device (hereinafter, a smart phone is taken as an example). The following examples are given by taking a certain instant messaging APP as an example, but the disclosure is not limited thereto. The instant messaging APP can be developed in any compiled language, such as C / C++, etc. The instant messaging APP can provide a small game platform for game developers to develop small games and game players to experience small games. The second application program may be a small game developed based on a scripting language (hereinafter, JS is taken as an example), and the game code of the small game may be JS code. Among them, the small game is a game application developed based on the small game platform and can be used without downloading and installing, which embodies the concept of "use it and go", fully saves the user's mobile phone space, and is based on the JS engine. From the perspective of game players, the small game can be easily obtained and spread in the instant messaging client, click to play, and at the same time, the social attributes of the instant messaging APP allow the small game to have a strong social communication power.

[0065] In the disclosed embodiment, the mini-game platform may include a system layer, a bridge layer, and a JS layer. The system layer may be understood as the bottom layer, which is responsible for providing system capabilities related to the bottom layer of the terminal device, such as the ability to access the memory, the ability to make calls, etc. The JS layer may be understood as the upper layer, which is responsible for running the mini-games, and the game code of the mini-games runs in the JS layer. The bridge layer may be understood as the middle layer, which is used to connect the system layer and the JS layer. The bridge layer may encapsulate the capabilities of the system layer into a unified API for direct calls by the JS layer. For example, the system layer may be a section of program code written in assembly language; the bridge layer may be a section of program code written in C / C++ language, and the bridge layer may also be called the C++ layer; the JS layer may be a section of program code written in JS language.

[0066] The terminal device can provide a game engine adaptation layer on the mini-game platform. The game engine adaptation layer can be located in the JS layer. The game engine adaptation layer can include a game engine. The game engine refers to some pre-written editable computer game systems or core components of some interactive real-time image applications. These systems provide game developers with various tools required for writing games, and their purpose is to allow game developers to easily and quickly make game programs instead of starting from scratch. However, in the disclosed embodiment, the game engine is not required, and the game developer can also fill it according to the properties of the object to be rendered according to the pre-set data structure of the rendering data.

[0067] In the disclosed embodiment, a game developer develops a small game by using the JS language. During the development process, the developer can send input parameter information to the game engine according to the properties of the objects to be rendered in the game scene, such as model structure, color, material, etc. The game engine can automatically generate rendering data for the objects to be rendered based on the input parameter information.

[0068] In the disclosed embodiment, more than 100 WebGL interface calls of the JS layer in the related art are converted into a set of rendering data. This set of rendering data can fully and comprehensively describe the entire rendering process. The data structure of the rendering data can be defined in advance between the JS layer and the client (also called the Native layer). When the object to be rendered needs to be drawn, the JS layer can pass the rendering data to the client in the form of an array according to the predefined data structure.

[0069] For example, an abstract design for rendering data for a small game is shown below:

[0070]

[0071] In the following embodiments, the meanings of the various identifiers of the rendering data are described. In the data structure of the rendering data defined above, unit32_t is a C / C++ language type that represents an unsigned 32-bit integer (int).

[0072] Here, the game engine can be considered as part of the JS layer. The game engine encapsulates some common logic. If there is no game engine, the game developer can manually fill in RenderDraw. The common logic can also be abstracted and then form a game engine. In this way, the game developer only needs to develop some parameters such as the material and color of the object to be rendered to the game engine, and then the game engine will automatically generate RenderDraw based on these parameters.

[0073] In step S320, the rendering data is parsed by the first application.

[0074] For example, after the Native layer receives the rendering data, the instant messaging client can parse the received rendering data of the object to be rendered according to the predefined data structure of the rendering data. For example, the first value in the rendering data represents the view_id, and the view corresponding to the id can be found according to the view_id.

[0075] In step S330, the first application performs rendering of the object to be rendered according to the parsed rendering data.

[0076] In the disclosed embodiment, the instant messaging client provides a JS layer, and the game developer develops a small game in the JS layer, and then uploads it to the instant messaging client, and the client parses and renders it. For example, the client parses the data of the RenderDraw and performs rendering.

[0077] Specifically, the client (assuming it is running through the CPU) can pass the parsed rendering data to the GPU (Graphics Processing Unit) of the terminal device, and the GPU calls the graphics interface (such as OpenGL (OpenGraphics Library, open graphics library or open graphics library) API or Direct3D API) to complete the rendering. In the embodiments provided in the present disclosure, the graphics interface is taken as OpenGL as an example.

[0078] OpenGL is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. It is a powerful, easy-to-call low-level 3D graphics library. This interface consists of nearly 350 different function calls, which are used to draw simple graphics to complex three-dimensional scenes. The OpenGL specification describes an abstract API for drawing 2D and 3D graphics. The OpenGL API defines several functions that can be called by client programs.

[0079] Rendering here refers to the process of creating the final image from the model by the computer. OpenGL is a system based on rasterization. Here, rendering can be roughly divided into three major stages: application stage, geometry stage, and rasterization stage. In the application stage, the developer sets the data, the CPU collects the data, and then calls Draw Call (the CPU calls the graphics interface such as OpenGL to command the GPU to perform rendering operations) to pass the data to the GPU. In the geometry stage, the GPU processes the data. In the rasterization stage, the processed data is projected onto the screen of the terminal device.

[0080] In the rendering method provided by the embodiment of the present disclosure, a second application program such as a mini-game based on a scripting language such as JS sends the rendering data of the object to be rendered to a first application program such as a client based on a compiled language such as C / C++, and the first application program based on the compiled language parses and executes the rendering of the rendering data to complete the rendering of the object to be rendered. On the one hand, the game rendering is abstracted from the process of calling the WebGL interface to rendering data, and the rendering data is used to replace the original second application program based on the scripting language to dispatch a large number of WebGL interfaces to perform rendering operations, which can improve the rendering efficiency; on the other hand, since the operating efficiency of the first application program based on the compiled language is higher than that of the second language based on the scripting language, through this solution, the heavy rendering process originally executed by JS is handed over to the first application program with better performance to execute, thereby greatly reducing the performance requirements for the JS system and improving the overall rendering capability of the first application program. When the solution provided by the embodiment of the present disclosure is applied to the mini-game platform, the rendering performance of the mini-game can be improved, and the rendering performance requirements of high-quality 3D games can be met.

[0081] Figure 4 The flowchart of the rendering method according to an embodiment of the present disclosure is schematically shown. In the embodiment of the present disclosure, the rendering data may include a target view handle (view_id).

[0082] like Figure 4 As shown, the difference from the above embodiment is that the method provided in the embodiment of the present disclosure may further include the following steps.

[0083] In step S410, the first application obtains view description information of the object to be rendered from the second application, where the view description information includes a target frame buffer and operations on the target frame buffer.

[0084] In the related art, when using WebGL rendering, it is necessary to specify the target frame buffer for this rendering, and perform some operations on the target frame buffer before rendering, such as clearing the color buffer or the depth buffer, etc. In the embodiments of the present disclosure, all operations on the rendering target, such as the above information: which frame buffer is the target frame buffer, what operation is performed on the target frame buffer, for one rendering, are abstracted into an id (identification, handle) for description.

[0085] The pixels in the system are stored in the frame buffer, which is a memory space managed by the graphics hardware and used to supply the display device of the terminal device.

[0086] In step S420, a view allocation function provided by the first application is called to create a view (view) and its view handle (view_id) according to the view description information.

[0087] In the disclosed embodiment, the view description information is abstracted into a view view, and the client provides a view allocation function such as an interface of "AllocView (const ViewDesc & desc);", wherein ViewDesc is the input parameter, i.e., the above view description information, which describes the settings and various operation behaviors of the target frame buffer. In C++, const is used to modify built-in type variables, desc is a reference name, and the function input parameter is declared as const to indicate that this parameter is for efficiency reasons, rather than allowing the calling function to modify the value of the object.

[0088] In step S430 , the view handle is returned to the second application, wherein the view handle includes the target view handle.

[0089] In the disclosed embodiment, the target frame buffer can be used to determine which canvas the object to be rendered will be drawn on at the current moment. The JS layer transmits information related to the canvas (Canvas) of the object to be rendered to the client. The client calls the above-mentioned function AllocView to generate a view based on this information, and assigns an id to the generated view, and then returns these view_ids to the JS layer. When JS needs to draw the object to be rendered, it can determine one from the received view_id as the target view_id at the current moment, and enter the target view_id in RenderDraw. For example, assuming that the target view_id is 1, it means that the current RenderDraw uses the canvas with id 1 for drawing. Among them, a frame can include 4-5 canvases. When the target view_ids of the previous and next RenderDraws are inconsistent, it means that the next RenderDraw is drawn on another canvas. At this time, some operations need to be performed, such as clearing the color of the original canvas.

[0090] Compared with the related art, in the rendering process of each frame, it is necessary to call the WebGL interface multiple times to specify the target frame buffer and perform various operations on the target frame buffer before rendering. In the rendering method provided by the embodiment of the present disclosure, various views and their corresponding view handles have been created by the client during the preprocessing process. In this way, during the rendering process, the JS layer only needs to simply determine the target view handle and pass the target view handle to the client. The client determines the target view based on the target view handle, thereby knowing the target frame buffer and the operations on it before rendering, resulting in a reduction in the execution steps of the JS layer. Since the client execution efficiency is higher, the overall rendering efficiency is improved.

[0091] Figure 5 The flowchart of the rendering method according to an embodiment of the present disclosure is schematically shown. In the embodiment of the present disclosure, the rendering data may also include a target clipping handle (scissor_id). Here, clipping refers to removing objects that are not in the field of view. Figure 5 As shown, the difference from the above embodiment is that the method provided in the embodiment of the present disclosure may further include the following steps.

[0092] In step S510, the first application obtains drawing area restriction information of the object to be rendered from the second application.

[0093] After determining on which canvas the current RenderDraw is drawn according to the above embodiment, the drawing area may be further limited. That is, the drawing area limitation information here means that the current RenderDraw cannot exceed the specified drawing area when drawing.

[0094] In step S520, the area allocation function provided by the first application is called to create a clipping area and a clipping handle thereof according to the drawing area restriction information.

[0095] In the embodiment of the present disclosure, the client provides a region allocation function such as "unit32_t AllocRect(constRect&rect);", calls the interface of the function, takes the drawing region restriction information as the input parameter Rect (rect is its reference name) of the function, creates a clipping region, and allocates a corresponding clipping handle. In the following embodiments, the clipping region is taken as a rectangle as an example, but the present disclosure is not limited to this.

[0096] In step S530, the cropping handle is returned to the second application, wherein the cropping handle includes the target cropping handle.

[0097] The client returns the scissor_id to the JS layer, and the JS layer can select a target scissor_id for the current RenderDraw and fill it into the corresponding position of the current RenderDraw. When the object to be rendered corresponding to the current RenderDraw exceeds the clipping area of ​​the target scissor_id, the content drawn in the excess part will be clipped.

[0098] Compared with the related art, in which the WebGL interface needs to be called multiple times to specify the cropping area and perform the cropping operation during the rendering process of each frame, the rendering method provided by the embodiment of the present disclosure has created various cropping areas and their corresponding cropping handles through the client during the preprocessing process. In this way, during the rendering process, the JS layer only needs to simply determine the target cropping handle and pass the target cropping handle to the client. The client determines the cropping area according to the target cropping handle and calls the graphics interface to perform the cropping operation. As a result, the execution steps of the JS layer are reduced. Since the client execution efficiency is higher, the overall rendering efficiency is improved.

[0099] Figure 6 The flowchart of the rendering method according to an embodiment of the present disclosure is schematically shown. In the embodiment of the present disclosure, the rendering data may also include a target shader handle (shader_id). In general, shaders refer to some highly programmable stages on the GPU pipeline. They are codes running on the GPU. Shaders can be used to control the rendering details in the rendering pipeline, such as using vertex shaders to perform vertex transformations and transfer data, and using fragment shaders to perform pixel-by-pixel rendering, etc. Figure 6 As shown, the difference from the above embodiment is that the method provided in the embodiment of the present disclosure may further include the following steps.

[0100] In step S610, the first application obtains shading information of the object to be rendered from the second application.

[0101] In step S620, a shader allocation function provided by the first application is called to generate a shader and a shader handle thereof according to the shading information.

[0102] In the disclosed embodiment, shader_id is used to express the shader information used in this rendering, which is equivalent to a shader program in WebGL. Similar to view_id, the JS layer will send some shading-related information to the client in advance, and the client will generate different shaders and allocate corresponding shader handles. The shader is actually implemented by the GPU.

[0103] In step S630, the shader handle is returned to the second application, wherein the shader handle includes the target shader handle.

[0104] The client returns the shader handle to the JS layer. The JS layer inputs a shader_id as the target shader_id in the current RenderDraw, so that the client can use which shader program in the current RenderDraw according to the target shader_id. For example, if the shader_id is 1, the shader program with handle 1 is used.

[0105] Compared with the related art, in which the WebGL interface needs to be called multiple times to specify the shader and perform shading operations during the rendering process of each frame, the rendering method provided by the embodiment of the present disclosure has created various shaders and their corresponding shader handles through the client during the preprocessing process. In this way, during the rendering process, the JS layer only needs to simply determine the target shader handle and pass the target shader handle to the client. The client determines the shader according to the target shader handle and calls the graphics interface to perform shading operations. As a result, the execution steps of the JS layer are reduced. Since the client execution efficiency is higher, the overall rendering efficiency is improved.

[0106] Figure 7 The flowchart of the rendering method according to an embodiment of the present disclosure is schematically shown. In the embodiment of the present disclosure, the rendering data may further include a target vertex layout handle (vertex_layout_id).

[0107] like Figure 7 As shown, the difference from the above embodiment is that the method provided in the embodiment of the present disclosure may further include the following steps.

[0108] In step S710, the first application obtains vertex layout information of the object to be rendered from the second application.

[0109] The graphics of the object to be rendered are composed of many vertices, and the vertex layout information may include various specification parameters such as the position (e.g., 3D coordinates) of the vertices. In the disclosed embodiment, in order to accurately describe the vertices used in the current rendering, the concept of vertex layout is abstracted to describe the layout of the vertices used in this rendering.

[0110] In step S720, a vertex layout allocation function provided by the first application is called to create a vertex layout form and a vertex layout handle thereof according to the vertex layout information.

[0111] The client provides a vertex layout allocation function such as "unit32_t AllocVertexLayout(const sg_layout_desc&desc);", and calls the interface of this function, where sg_layout_desc represents the vertex layout information passed into the function, and desc is its reference name. The client can create a vertex layout form through this vertex layout information and allocate the corresponding vertex layout handle vertex_layout_id.

[0112] In step S730 , the vertex layout handle is returned to the second application, wherein the vertex layout handle includes the target vertex layout handle.

[0113] The client returns the vertex_layout_id to the JS layer, and the JS layer can fill a vertex_layout_id as the target vertex_layout_id in the current RenderDraw and send it to the client. After the client parses the current RenderDraw, it can obtain the vertex layout form according to the target vertex_layout_id and correctly bind the vertices to the graphics API such as OpenGL. In order to render an object, a shader program is required, and this shader program defines a series of vertex attributes, such as the position in the vertex shader. These attributes determine which vertex data needs to be passed.

[0114] Compared with the related art, in the rendering process of each frame, for example, taking drawing a triangle as an example, it is necessary to call the WebGL interface multiple times to tell the GPU various vertex data. In the rendering method provided by the embodiment of the present disclosure, various vertex layout forms and their corresponding vertex layout handles have been created by the client during the preprocessing process. In this way, in the rendering process, the JS layer only needs to simply determine the target vertex layout handle and pass the target vertex layout handle to the client. The client determines the vertex layout form according to the target vertex layout handle, and calls the graphics interface to perform vertex data processing operations. As a result, the execution steps of the JS layer are reduced. Since the client execution efficiency is higher, the overall rendering efficiency is improved.

[0115] Figure 8 Shows Figure 3Schematic diagram of the processing process of step S330 in one embodiment shown in FIG. In the embodiment of the present disclosure, the rendering data may also include target rendering pipeline state information and target rendering resource data, and the rendering data may include first rendering data and second rendering data, and the first rendering data (denoted as RenderDraw 1) is executed before the second rendering data (denoted as RenderDraw 2).

[0116] Among them, the rendering pipeline can be understood as a rendering pipeline, which refers to the operation steps performed by the graphics interface such as OpenGL on the original graphics data during the image drawing process, such as vertex processing, surface processing, rasterization, pixel processing, etc., and finally appear on the screen of the terminal device after various changes. Here, OpenGL is taken as an example. Its rendering graphics performs the following operations: setting data from OpenGL's geometric primitives to build shapes; using different shaders to perform calculation operations on the input primitive data to determine their position, color, and other rendering attributes; converting the mathematical description of the input primitive into pixel fragments corresponding to the screen position, this step is also called rasterization; finally, for each fragment generated by the rasterization process, the fragment shader is executed to determine the final color and position of the fragment. If necessary, some additional operations can be performed on each fragment, such as determining whether the object corresponding to the fragment is visible, or blending the color of the fragment with the color of the current screen position.

[0117] In the related technology, when using WebGL rendering, a large number of WebGL APIs are called to set the pipeline state of the current rendering, mainly including color mixing method, stencil buffer setting, depth buffer setting, primitive drawing form, cull mode, etc.

[0118] In the disclosed embodiment, the target rendering pipeline state information may include the values ​​of blend, rgbα, stencil_op_test, stencil_depth and raster in the current RenderDraw (here assumed to be RenderDraw 2), that is, 5 unit32_ts with a total of 160 bits can be used to describe the state of the entire rendering pipeline, and each bit expresses a specific meaning, so that the above target pipeline state information is completely encoded.

[0119] The following is an explanation of each of them. Blend refers to the weighted calculation of the color value of the final fragment by adding the fragments (source fragments) that enter the frame buffer through various tests (such as depth test and template test) and the original fragments (target fragments) in the frame buffer according to the set ratio. OpenGL specifies the weighted ratio of the two fragments by setting the blending factor, where the source factor is used to determine the ratio of the fragments that will enter the frame buffer in the final fragment, and the target factor is used to determine the ratio of the fragments in the original frame buffer in the final fragment. Each color value in OpenGL includes 4 color channels (r (red), g (green), b (blue), α (alpha, transparency)). Therefore, both blending factors have 4 component values, corresponding to one color channel respectively. Here, it is assumed that blend is 32 bits in total, some of which can be used to control whether to enable blending or not, some bits are used to represent the source factor, and some bits are used for the target factor.

[0120] Here, RGBα is assumed to be represented by 32 bits, and each 8 bits represents the value of a color channel, but the present disclosure is not limited to this.

[0121] Among them, stencil_op_test refers to the template test. When the fragment shader processes the fragment, the stencil test begins to execute. Like the depth test, it can discard some fragments. The fragments that are still retained enter the depth test stage, and the depth test may discard more. The stencil test is based on another buffer, which is called the stencil buffer. The stencil buffer is the same size as the depth buffer. By setting the value of each pixel in the stencil buffer, you can specify that only certain pixels are rendered during rendering, so as to achieve some special effects. Like the color and depth buffers, the stencil buffer also needs to be cleared in each loop.

[0122] Stencil_depth refers to the depth test. The color buffer is the frame buffer. Each pixel of the scene to be rendered must be written into the buffer, which is then rendered to the screen. The depth buffer corresponds to the frame buffer and is used to record the depth value of each pixel. Through the depth buffer, a depth test can be performed to determine the occlusion relationship of the pixel and ensure correct rendering. The depth test in OpenGL uses a depth buffer algorithm to eliminate invisible faces in the scene. The depth buffer needs to be cleared at the beginning of each frame.

[0123] Raster refers to rasterization, gridding or pixelation, which is the process of converting vector graphics into pixels. The images displayed on the screen are composed of pixels, and three-dimensional objects are composed of points, lines and surfaces. To turn points, lines and surfaces into pixels that can be displayed on the screen, the raster process is required, which is to convert the description of vector points, lines and surfaces into the description of pixels.

[0124] In the disclosed embodiment, the target rendering resource data may include index_buffer, vertex_buffer and images in the current RenderDraw. The rendering resource data is used to describe the data information related to the resources actually used in the current rendering. Here, index_buffer represents the index information of the current rendering, vertex_buffers represents the vertex data used in the current rendering, and images represents the texture information used in the current rendering.

[0125] Among them, index_buffer is not necessary. For example, if you want to render 3 vertices to draw a triangle, you can define the following vertex data in vertex_buffer: {{1,1,1},{0,0,0},{0,0,1}}, and OpenGL will render the mesh according to the order of these vertices. You can directly use the above vertex_buffer data to render directly, or you can use the index to specify the order, so that the same vertex can be reused.

[0126] For example, if four vertices {0,1,2} are defined in index_buffer in advance, and the following vertex_buffers: {2,1,0,2,1,2} are used, then OpenGL will render 6 vertices: {{0,0,1},{0,0,0},{1,1,1},{0,0,1},{0,0,0},{0,0,1}}, that is, two triangles are drawn in the above way, and these two triangles are put together to form a rectangle. If vertex_buffer is used directly, six vertices are required for the two triangles. However, although six vertices are required to draw a rectangle, two vertices are defined twice, which wastes resources. In fact, only four vertices need to be defined for a rectangle.

[0127] When a large number of triangles need to be rendered, base_element and num_elements can be further included, and base_element and num_elements can be used to represent the data range in the index_buffer used for the current rendering. Among them, base_element indicates which index in the index_buffer to start rendering from, and num_elements indicates how many vertices in the index_buffer are used for rendering.

[0128] The surfaces of real-world objects generally present rich and special colors, and present colorful changes on very small graphics. It is very arduous to use a computer to calculate the colors of each tiny pixel and then piece them together into a specific "pattern". Texture mapping is to find a picture as a map, and then sample the texture from it to form the desired pattern.

[0129] The method provided in the embodiments of the present disclosure converts the definition of rendering pipeline state information, index information, vertex data, and texture information, etc., which is defined by calling a large number of WebGL interfaces through the JS layer in the related technology, into a binary encoding form. On the one hand, the rendering pipeline state information, index information, vertex data, and texture information, etc. required for rendering can be accurately defined. On the other hand, the JS layer only needs to determine the value of this information and then submit it to the client. The client can automatically complete the corresponding rendering work, thereby reducing the interaction between the JS layer and the graphics interface and improving rendering efficiency and performance.

[0130] like Figure 8 As shown, in the embodiment of the present disclosure, the above step S330 may further include the following steps.

[0131] In step S331, the second rendering data is executed.

[0132] Here it is assumed that RenderDraw 1 is an adjacent RenderDraw that is executed and completed before RenderDraw 2.

[0133] In step S332, if the target view handles of the first rendering data and the second rendering data are different, the target frame buffer of the second rendering data is determined according to the target view handle of the second rendering data, and an operation on the target frame buffer is performed.

[0134] First, parse the view_id in RenderDraw 2 and compare it with the view_id of RenderDraw 1. If the two are different, it means that RenderDraw 2 and RenderDraw 1 draw different canvases. At this time, determine the frame buffer corresponding to RenderDraw 2 according to the view_id of RenderDraw 2 and perform corresponding operations on it.

[0135] In step S333, if the target view handles of the first rendering data and the second rendering data are the same or the operation on the target frame buffer of the second rendering data is completed, and the target cropping handles of the first rendering data and the second rendering data are different, the cropping area of ​​the second rendering data is set according to the target cropping handle of the second rendering data.

[0136] If the view_id of RenderDraw 2 is the same as the view_id of RenderDraw 1, it means that the canvas drawn by RenderDraw 2 and RenderDraw 1 is the same. In this case, there is no need to reset the view of RenderDraw 2.

[0137] If the view_id of RenderDraw 2 is the same as the view_id of RenderDraw 1, or after executing the above step S332, it can be determined whether the scissor_id of RenderDraw 2 is the same as the scissor_id of RenderDraw 1. If they are not the same, it means that the clipping area of ​​RenderDraw 2 has changed compared to the clipping area of ​​RenderDraw 1. At this time, the clipping area of ​​RenderDraw 2 is set according to the scissor_id of RenderDraw 2.

[0138] In step S334, if the target cropping handles of the first rendering data and the second rendering data are the same or the cropping area of ​​the second rendering data is set, and the target rendering pipeline state information of the first rendering data and the second rendering data are different, the rendering pipeline state of the second rendering data is set according to the target rendering pipeline state information of the second rendering data.

[0139] If the scissor_id of RenderDraw 2 is the same as the scissor_id of RenderDraw 1, it means that the clipping area of ​​RenderDraw 2 has not changed compared to the clipping area of ​​RenderDraw 1, and there is no need to reset the clipping area of ​​RenderDraw 2.

[0140] If the scissor_id of RenderDraw 2 is the same as the scissor_id of RenderDraw 1, or after executing the above step S333, it is possible to continue to determine whether the rendering pipeline state information of RenderDraw 2 is consistent with that of RenderDraw 1. If any one of blend, rgbα, stencil_op_test, stencil_depth, and raster of RenderDraw 2 is inconsistent with blend, rgbα, stencil_op_test, stencil_depth, and raster of RenderDraw 1, it is determined that the target rendering pipeline state information of the first rendering data and the second rendering data is different, and the rendering pipeline state of RenderDraw 2 is set according to blend, rgbα, stencil_op_test, and stencil_depth of the second rendering data.

[0141] In step S335, if the target rendering pipeline state information of the first rendering data and the second rendering data is the same or the rendering pipeline state of the second rendering data is set, the target rendering resource data of the second rendering data is bound to the graphics interface so that the graphics interface can render the second rendering data.

[0142] If blend, rgbα, stencil_op_test, stencil_depth and raster of RenderDraw 2 are completely consistent with blend, rgbα, stencil_op_test, stencil_depth and raster of RenderDraw 1, it is determined that the target rendering pipeline state information of the first rendering data and the second rendering data is the same, and there is no need to reset the rendering pipeline state of RenderDraw 2.

[0143] When the target rendering pipeline state information of RenderDraw 1 and RenderDraw 2 is the same, or the above step S335 is executed, the target rendering resource data index_buffer, vertex_buffer, etc. of RenderDraw 2 are bound to the graphics interface to facilitate the graphics interface to perform rendering of RenderDraw 2.

[0144] Fig. 9The flowchart of the rendering method according to an embodiment of the present disclosure is schematically shown. In the embodiment of the present disclosure, if the object to be rendered is a dynamic rendering object, the rendering data may further include a target native value (native_values) for indicating the change of the position, rotation angle, etc. of the dynamic rendering object over time. For example, the data structure of the rendering data including the native value may be defined as:

[0145]

[0146] like Fig. 9 As shown, the difference from the above embodiment is that the method provided in the embodiment of the present disclosure may further include the following steps.

[0147] In step S910, a native value allocation function provided by the first application is called to generate a native value.

[0148] In the disclosed embodiment, the client provides a native value allocation function such as "ResourceInfoAllocNativeValue(unit32_t size);" to generate a native value, where size represents the size of the native value.

[0149] In step S920, the native value is returned to the second application, wherein the native value includes the target native value.

[0150] In an exemplary embodiment, the target rendering resource data may include target texture information; wherein, after binding the target texture information of the second rendering data to the graphics interface, the method further includes: setting the target native value to a uniform variable (uniform) of the graphics interface.

[0151] During the rendering process, for a specified object, i.e., the object to be rendered, some data may change every frame. For example, the position of the object, the rotation angle, etc. In the related art, when using WebGL rendering, the settings are performed sequentially each time the rendering is performed by calling the glUniform interface. For example, to draw a moving cup, only the cup moves, and other data remain unchanged. When the above-mentioned related art solution is adopted, the glUniform interface needs to be called again each time the cup moves, which will consume more GPU resources. However, when the solution provided by the embodiment of the present disclosure is adopted, only native_values ​​needs to be changed during the movement of the cup. That is, the rendering of an object is abstracted into one or more RenderDraws, but the data of the RenderDraw itself will not be frequently modified because of these variables. Because the concept of native_values ​​is abstracted here, it is used to represent a variable data area. Different data can be filled as needed during the game, and the RenderDraw itself only holds a reference to native_values. The client provides an interface of the native value allocation function for the JS side to obtain native_values.

[0152] In RenderDraw, the native_values ​​array is used to represent the target native values ​​used in this rendering. The client will eventually set this data to the uniform variables of the graphics API when rendering.

[0153] Uniforms are a way to send data from an application in the CPU, such as a client, to a shader in the GPU, but uniforms are a little different from vertex attributes. First, uniforms are global. Global means that the uniform variable is unique in each shader program object, and it can be accessed by any shader in the shader program at any stage. Second, no matter what the uniform value is set to, uniforms will always save their data until they are reset or updated. For example, if you want the color of an object to change slowly, you can update this uniform in every iteration of the game rendering (at this time, the color can change from frame to frame).

[0154] In the rendering process, there are often a large number of rendering elements, and the textures and rendering lines they use may be exactly the same, except for the index buffer and vertex buffer. For example, in a game, there are 10 identical bricks. Using related technologies, they need to be drawn one by one, and WebGL needs to be called ten times for rendering, which will increase the GPU overhead. At the same time, in the small game environment, even if the game engine provides a rendering batching function, that is, submitting the same or similar rendering elements for rendering at one time, because the game engine is based on the JS language, the operating efficiency is low, and batching is very heavy.

[0155] Therefore, in the embodiment of the present disclosure, a rendering batching function is provided, and the rendering batching function is mainly executed by the client. For rendering elements with exactly the same rendering pipeline status, texture information, etc. in the mini-game, their vertices can be combined for rendering, thereby reducing the number of Draw Call calls and reducing GPU overhead.

[0156] Fig.10 Shows Figure 3 Schematic diagram of the processing process of step S330 in one embodiment. In the disclosed embodiment, the rendering data may also include a target rendering batching index (batchable), a position change index of the object to be rendered (render_data_dirty), and world coordinate information of the object to be rendered (world_transform). At this time, the data structure of the defined rendering data may be as follows:

[0157]

[0158]

[0159] like Fig.10 As shown, in the embodiment of the present disclosure, the above step S330 may further include the following steps.

[0160] In step S336 , if the target rendering batch index of the first rendering data is a set value, a first batch including the first rendering data is generated.

[0161] As shown above, batchable is of bool type. If its value is the set value "true", it indicates that the corresponding RenderDraw can be batched. If its value is "false", it indicates that the corresponding RenderDraw cannot be batched.

[0162] Here, assuming that the batchable value of RenderDraw 1 is "true", it is determined that it can be batched. In this case, RenderDraw 1 can be skipped and added to the first batch in the batch queue. A batch can be considered a collection, which writes the index buffer and vertex buffer of multiple RenderDraws that can be batched together into the collection. If it is "false", RenderDraw 1 can be executed directly, and after RenderDraw 1 is executed, a similar judgment is made for the next RenderDraw.

[0163] In step S337, if the target rendering batch indicator of the second rendering data is the set value, and the target view handle, target clipping handle, target rendering pipeline state information, target map information and target native value of the first rendering data and the second rendering data are the same, then the second rendering data is added to the first batch.

[0164] If the batchable value of RenderDraw 1 is "true", then determine whether the batchable value of the next RenderDraw, that is, the second rendering data RenderDraw 2, is "true". If it is also "true", it means that RenderDraw 2 can also be batched. At this time, it is necessary to further determine whether RenderDraw 2 can be batched with RenderDraw 1, that is, at this time, it is necessary to further determine whether the view_id, scissor_id, blend, rgbα, stencil_op_test, stencil_depth, raster, images and native_values ​​of RenderDraw 2 and RenderDraw 1 are the same. If they are completely consistent, it means that the two can be batched. At this time, RenderDraw 2 can also be added to the first batch.

[0165] In step S338, if at least one of the target view handle, the target clipping handle, the target rendering pipeline state information, the target texture information and the target native value of the first rendering data and the second rendering data is different, the first batching is performed.

[0166] If the batchable values ​​of RenderDraw 1 and RenderDraw 2 are both "true", but at least one of view_id, scissor_id, blend, rgbα, stencil_op_test, stencil_depth, raster, images, and native_values ​​of RenderDraw 2 and RenderDraw 1 is the same, it means that the two cannot be batched. At this time, you can execute the RenderDraw in the first batch first, and after execution, clear the batch queue.

[0167] In step S339 , a second batch including the second rendering data is generated.

[0168] When RenderDraw 2 can be batched, but cannot be batched with the previous RenderDraw 1, a second batch can be created in the batch queue for RenderDraw 2 after the first batch is executed. Subsequent execution steps are similar until rendering is completed.

[0169] The RenderDraw designed in the disclosed embodiment provides a rendering batching function, which can be enabled by simply setting batchable to true. In addition, when the position of an object changes, it is necessary to set render_data_dirty to true to tell the client that the rendering data needs to be updated. In addition, world_transform is a native_value introduced above, which is used to represent the coordinate information of the rendered object in the world space. When batchable is set to true, during the batching process, it will check whether render_data_dirty is true. If it is true, the content of world_transform will be used to calculate the world coordinates of vertex, and then batched; if render_data_dirty is false, it means that the object has not moved, and the previously cached calculated world coordinates of vertex will be used.

[0170] In the disclosed embodiment, it is only necessary to set the above information in RenderDraw, and the mini-game will automatically obtain the rendering batching function provided by the client. Compared with the game engine using JS to implement rendering batching by itself, the rendering performance can be greatly improved.

[0171] The following uses the example of drawing a cup to compare the differences between the solution using the related art and the solution provided by the embodiment of the present disclosure.

[0172] The process of drawing a cup using WebGL is as follows: First, initialize the global environment, execute once, including the following steps: initialize the GL environment; configure the global canvas frame buffer; create a shader program; create a vertex buffer; create an index buffer; create a texture. Then, JS repeats each frame, assuming 60 times per second, including the following steps: clean the canvas; activate the texture unit; bind the texture; set the texture properties; bind the shader program; set the color blend parameters; set the stencil buffer parameters; set the depth buffer parameters; set other pipeline states such as cull face (back culling); set the clipping area; bind the index buffer; bind the vertex buffer; set the vertex layout information; set the shader variable uniform information; call the webGL drawing interface drawElements for drawing.

[0173] The solution provided by the embodiment of the present disclosure is adopted. First, the global environment is initialized and executed once, including the following steps: create a view to obtain view_id; create a shader to obtain shader_id; create cropping area information to obtain scissor_id; create top layout information to obtain vertex_layout_id; create a vertex buffer to obtain vertex_buffer; create an index buffer to obtain index_buffer; create a texture image to obtain images; if the object to be rendered changes in each frame, such as moving, create native_values; create a RenderDraw data structure corresponding to the drawing of the cup, fill in the above information, and set the pipeline state and the values ​​of other RenderDraw fields. Then, during the drawing process, JS is executed repeatedly for each frame, assuming 60 times per second. If the rendered object moves, the value of the corresponding native value is modified to indicate that the object has moved; submit RenderDraw, and the client completes the rendering.

[0174] From the above process, it can be seen that in the related art, during the rendering process, JS has to do a lot of things in each frame. Since JS itself runs slowly, the overall rendering speed is very slow. With the solution provided by the embodiment of the present disclosure, if the object does not change in each frame, nothing needs to be done, just submit the rendering. If the object moves, just set the value of the native value, which is very efficient. Then the client performs the rendering. Since the client runs efficiently, the overall rendering performance can be improved.

[0175] Fig.11The flowchart of the rendering method according to an embodiment of the present disclosure is schematically shown. In the embodiment of the present disclosure, the rendering process is illustrated by taking the rendering data with batching function and native value as an example. Fig.11 As shown, the method provided by the embodiment of the present disclosure may include the following steps.

[0176] In step S1101, the current RenderDraw is executed.

[0177] In step S1102, it is determined whether the current RenderDraw needs to be batched according to the batchable of the current RenderDraw; if the batchable of the current RenderDraw is "true", it is determined that the current RenderDraw needs to be batched, and the process proceeds to step S1103; if the batchable of the current RenderDraw is "false", it is determined that the current RenderDraw does not need to be batched, and the process jumps to step S1107.

[0178] In step S1103, the view_id, scissor_id, blend, rgbα, stencil_op_test, stencil_depth, raster, and images of the current RenderDraw are compared with the view_id, scissor_id, blend, rgbα, stencil_op_test, stencil_depth, raster, and images of the previous RenderDraw that can be batched together to determine whether it can be batched together with the previous RenderDraw. If the current RenderDraw is the first RenderDraw, raw, this step can be skipped and the first RenderDraw can be directly added to the first batch; if the view_id, scissor_id, blend, rgbα, stencil_op_test, stencil_depth, raster, and images of the two are the same, it is determined that the two can be batched, and the process goes to step S1104; if at least one of the view_id, scissor_id, blend, rgbα, stencil_op_test, stencil_depth, raster, and images of the two is different, it is determined that the two cannot be batched, and the process goes to step S1105.

[0179] In step S1104 , if both the current RenderDraw and the previous RenderDraw need to be batched together, and both can be batched together, then the current RenderDraw and the previous RenderDraw are batched together, and then the process jumps to step S1118 .

[0180] In step S1105, if the current RenderDraw needs to be batched but cannot be batched with the previous RenderDraw, the currently batched content in the batch queue is executed first, and after the execution is completed, the batch queue is cleared.

[0181] In step S1106, when the batch queue is cleared, a new batch can be generated in the batch queue for the current RenderDraw, and then jump to step S1118.

[0182] In step S1107, it is determined whether the view of the current RenderDraw has changed based on whether the view_id of the current RenderDraw is consistent with the view_id of the previous RenderDraw; if the view_ids of the two are inconsistent, it is determined that the view of the current RenderDraw has changed, and the process proceeds to step S1108; if the view_ids of the two are consistent, it is determined that the view of the current RenderDraw has not changed, and the process jumps to step S1109.

[0183] In step S1108, if the view of the current RenderDraw changes, the operation of the new view is performed for the current RenderDraw according to the view_id of the current RenderDraw, and then the process goes to step S1109.

[0184] In step S1109, if the view of the current RenderDraw has not changed or a new view has been set for the current RenderDraw, it is determined whether the clipping area of ​​the current RenderDraw has changed based on the scissor_id of the current RenderDraw and the scissor_id of the previous RenderDraw; if the scissor_id of the current RenderDraw is inconsistent with the scissor_id of the previous RenderDraw, it is determined that the clipping area of ​​the current RenderDraw has changed, and the process proceeds to step S1110; if the scissor_id of the current RenderDraw is consistent with the scissor_id of the previous RenderDraw, it is determined that the clipping area of ​​the current RenderDraw has not changed, and the process jumps to step S1111.

[0185] In step S1110, if the clipping region of the current RenderDraw changes, a new clipping region is set for the current RenderDraw according to the scissor_id of the current RenderDraw, and then the process goes to step S1111.

[0186] In step S1111, if the clipping area of ​​the current RenderDraw has not changed or a new clipping area has been set for the current RenderDraw, it is determined whether the rendering pipeline state of the current RenderDraw has changed based on the blend, rgbα, stencil_op_test, stencil_depth, raster of the current RenderDraw and the blend, rgbα, stencil_op_test, stencil_depth, raster of the previous RenderDraw; if at least one of the target pipeline rendering state information of the two is different, it can be determined that the rendering pipeline state of the current RenderDraw has changed, and the process proceeds to step S1112; if the target pipeline rendering state information of the two is exactly the same, it can be determined that the rendering pipeline state of the current RenderDraw has not changed, and the process jumps to step S1113.

[0187] In step S1112, if the rendering pipeline state of the current RenderDraw changes, a new rendering pipeline is set for the current RenderDraw according to the target pipeline rendering state information of the current RenderDraw, and then the process proceeds to step S1113.

[0188] In step S1113, the vertex data of the current RenderDraw is bound to the graphics interface according to the vertex_buffer of the current RenderDraw.

[0189] In step S1114, the texture data of the current RenderDraw is bound to the graphics interface, where the texture data is obtained based on the image sampling of the current RenderDraw.

[0190] In step S1115 , the target native value native_values ​​of the current RenderDraw is set to the uniform variable of the graphics interface.

[0191] In step S1116, the index of the current RenderDraw is bound to the graphics interface according to the index_buffer of the current RenderDraw.

[0192] In step S1117, the current RenderDraw is submitted for rendering, and then the process jumps to step S1118.

[0193] In step S1118, the next RenderDraw is executed.

[0194] In step S1119, determine whether there is any unexecuted RenderDraw; if yes, jump back to the above step S1101 and execute in a loop; if no, go to step S1120.

[0195] In step S1120 , rendering is completed.

[0196] Fig.12 A schematic diagram of a rendering pipeline according to an embodiment of the present disclosure is schematically shown.

[0197] like Fig.12 As shown, the rendering pipeline of OpenGL is described here. Vertex shader is used to process vertex data, subdivision control shader and subdivision compute shader are used to describe the shape of the object to make the model smoother, geometry shader is used to further process geometric primitives, primitive settings are used to organize vertices and geometric primitives, clipping is to clip the drawing outside the viewport, rasterization is used to generate corresponding fragments from primitives, and fragment shader controls the color displayed on the screen through programming, and finally completes the rendering of the object. Among them, vertex shader and fragment shader are required, subdivision and geometry shader are optional.

[0198] In the related art, the WebGL interface has more than 100 interfaces, and these interfaces are very complex and have no relationship with each other. When drawing, it is necessary to organize the relationship between these interfaces. The rendering method provided by the embodiment of the present disclosure pre-defines a set of data structures based on the client of the compiled language and the JS layer based on the scripting language, which is used to accurately define the very complex rendering process and abstract a complete state required for the underlying rendering. When rendering, the JS layer generates a RenderDraw object according to this specified data structure, or uses the game engine to fill in the rendering data, and then passes it to the client, that is, the JS layer and the client can directly share data through 180 bytes of pure binary data, and the client calls the graphics interface of OpenGL and the like through RenderDraw to realize the rendering of the entire game scene. That is, the same task is handed over to the client with high execution efficiency, and before handing over the task, the communication language between the two parties is accurately defined. Through this solution, the heavy rendering tasks for JS are transferred to the client with better performance to execute, which improves the overall rendering performance and creates a solid technical foundation for the small game platform to realize medium and large 3D games.

[0199] Fig.13 A block diagram of a rendering device according to an embodiment of the present disclosure is schematically shown.

[0200] like Fig.13As shown, the rendering device 1300 provided in the embodiment of the present disclosure may include: a rendering data acquiring unit 1310 , a rendering data parsing unit 1320 , and an object rendering executing unit 1330 .

[0201] The rendering data acquisition unit 1310 may be used for a first application based on a compiled language to acquire rendering data of an object to be rendered from a second application based on a scripting language, wherein the first application is installed on a terminal device. The rendering data parsing unit 1320 may be used for parsing the rendering data through the first application. The object rendering execution unit 1330 may be used for the first application to execute rendering of the object to be rendered according to the parsed rendering data.

[0202] In an exemplary embodiment, the rendering data includes a target view handle. The device further includes: a view description information acquisition unit, used for the first application to acquire view description information of the object to be rendered from the second application, the view description information including a target frame buffer and operations on the target frame buffer; a view creation unit, used to call a view allocation function provided by the first application, and create a view and its view handle according to the view description information; and a view handle return unit, used to return the view handle to the second application, wherein the view handle includes the target view handle.

[0203] In an exemplary embodiment, the rendering data also includes a target cropping handle. The device further includes: a drawing area information acquisition unit, which is used for the first application to acquire the drawing area restriction information of the object to be rendered from the second application; a cropping area creation unit, which is used to call the area allocation function provided by the first application to create a cropping area and its cropping handle according to the drawing area restriction information; and a cropping handle return unit, which is used to return the cropping handle to the second application, wherein the cropping handle includes the target cropping handle.

[0204] In an exemplary embodiment, the rendering data also includes a target shader handle. The device further includes: a shading information acquisition unit, used for the first application to acquire shading information of the object to be rendered from the second application; a shader generation unit, used to call a shader allocation function provided by the first application to generate a shader and its shader handle according to the shading information; and a shader handle return unit, used to return the shader handle to the second application, wherein the shader handle includes the target shader handle.

[0205] In an exemplary embodiment, the rendering data also includes a target vertex layout handle. The device further includes: a vertex layout information acquisition unit, which is used for the first application to acquire the vertex layout information of the object to be rendered from the second application; a vertex layout form creation unit, which is used to call the vertex layout allocation function provided by the first application, and create a vertex layout form and its vertex layout handle according to the vertex layout information; a vertex layout handle return unit, which is used to return the vertex layout handle to the second application, wherein the vertex layout handle includes the target vertex layout handle.

[0206] In an exemplary embodiment, the rendering data also includes target rendering pipeline state information and target rendering resource data, and the rendering data includes first rendering data and second rendering data, and the first rendering data is executed before the second rendering data. Wherein, the object rendering execution unit includes: a rendering data execution unit, used to execute the second rendering data; a target frame buffer determination unit, used to determine the target frame buffer of the second rendering data and perform operations on the target frame buffer according to the target view handle of the second rendering data if the target view handles of the first rendering data and the second rendering data are different; a cropping area setting unit, used to set the second rendering data according to the target cropping handle of the second rendering data if the target view handles of the first rendering data and the second rendering data are the same or the operations on the target frame buffer of the second rendering data have been performed, and the target cropping handles of the first rendering data and the second rendering data are different. a pipeline state setting unit, for setting the rendering pipeline state of the second rendering data according to the target rendering pipeline state information of the second rendering data if the target clipping handles of the first rendering data and the second rendering data are the same or the clipping area of ​​the second rendering data is set, and the target rendering pipeline state information of the first rendering data and the second rendering data are different; a resource data binding unit, for binding the target rendering resource data of the second rendering data to a graphics interface if the target rendering pipeline state information of the first rendering data and the second rendering data are the same or the rendering pipeline state of the second rendering data is set, so that the graphics interface can render the second rendering data.

[0207] In an exemplary embodiment, if the object to be rendered is a dynamic rendering object, the rendering data further includes a target native value. The device further includes: a native value generation unit, configured to call a native value allocation function provided by the first application to generate a native value; and a native value return unit, configured to return the native value to the second application, wherein the native value includes the target native value.

[0208] In an exemplary embodiment, the target rendering resource data includes target texture information. After the resource data binding unit binds the target texture information of the second rendering data to the graphics interface, the device further includes: a native value setting unit, configured to set the target native value to a uniform variable of the graphics interface.

[0209] In an exemplary embodiment, the rendering data further includes a target rendering batch index, a position change index of the object to be rendered, and world coordinate information of the object to be rendered.

[0210] In an exemplary embodiment, the object rendering execution unit also includes: a first batch generation unit, which is used to generate a first batch including the first rendering data if the target rendering batch index of the first rendering data is a set value; a rendering data addition unit, which is used to add the second rendering data to the first batch if the target rendering batch index of the second rendering data is the set value, and the target view handle, target cropping handle, target rendering pipeline state information, target map information and target native value of the first rendering data and the second rendering data are the same; a first batch execution unit, which is used to execute the first batch if at least one of the target view handle, target cropping handle, target rendering pipeline state information, target map information and target native value of the first rendering data and the second rendering data is different; and a second batch generation unit, which is used to generate a second batch including the second rendering data.

[0211] The specific implementation of each unit in the rendering device provided by the embodiment of the present disclosure can refer to the content of the above-mentioned rendering method, which will not be repeated here.

[0212] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0213] 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 techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0214] It should be understood that the present disclosure is not limited to the exact construction that has been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof.

Claims

1. A rendering method, characterized in that: include: A first application based on a compiled language obtains rendering data of an object to be rendered from a second application based on a scripting language, wherein the first application is installed on a terminal device, and the rendering data includes a target view handle; parsing the rendering data by the first application; The first application performs rendering of the object to be rendered according to the parsed rendering data; The first application program obtains view description information of the object to be rendered from the second application program, where the view description information includes a target frame buffer and operations on the target frame buffer; Calling a view allocation function provided by the first application to create a view and a view handle thereof according to the view description information; The view handle is returned to the second application, wherein the view handle includes the target view handle.

2. The rendering method according to claim 1, characterized in that: The rendering data also includes a target clipping handle; wherein the method further includes: The first application program obtains drawing area restriction information of the object to be rendered from the second application program; Calling the area allocation function provided by the first application to create a clipping area and a clipping handle thereof according to the drawing area restriction information; The crop handle is returned to the second application, wherein the crop handle includes the target crop handle.

3. The rendering method according to claim 2, characterized in that: The rendering data also includes a target shader handle; wherein the method further includes: The first application program obtains the shading information of the object to be rendered from the second application program; Calling a shader allocation function provided by the first application to generate a shader and a shader handle thereof according to the shading information; The shader handle is returned to the second application, wherein the shader handle includes the target shader handle.

4. The rendering method according to claim 3, characterized in that: The rendering data also includes a target vertex layout handle; wherein the method further includes: The first application program obtains vertex layout information of the object to be rendered from the second application program; Calling a vertex layout allocation function provided by the first application program, and creating a vertex layout form and a vertex layout handle thereof according to the vertex layout information; The vertex layout handle is returned to the second application, wherein the vertex layout handle includes the target vertex layout handle.

5. The rendering method according to claim 4, characterized in that: The rendering data further includes target rendering pipeline state information and target rendering resource data, and the rendering data includes first rendering data and second rendering data, and the first rendering data is executed before the second rendering data; wherein the first application performs rendering of the object to be rendered according to the parsed rendering data, including: Executing the second rendering data; If the target view handles of the first rendering data and the second rendering data are different, determining a target frame buffer of the second rendering data according to the target view handle of the second rendering data and performing an operation on the target frame buffer; If the target view handles of the first rendering data and the second rendering data are the same or the operation on the target frame buffer of the second rendering data is completed, and the target clipping handles of the first rendering data and the second rendering data are different, setting the clipping region of the second rendering data according to the target clipping handle of the second rendering data; If the target clipping handles of the first rendering data and the second rendering data are the same or the clipping region of the second rendering data is set, and the target rendering pipeline state information of the first rendering data and the second rendering data are different, setting the rendering pipeline state of the second rendering data according to the target rendering pipeline state information of the second rendering data; If the target rendering pipeline state information of the first rendering data and the second rendering data is the same or the rendering pipeline state of the second rendering data is set, the target rendering resource data of the second rendering data is bound to the graphics interface so that the graphics interface renders the second rendering data.

6. The rendering method according to claim 5, characterized in that: If the object to be rendered is a dynamic rendering object, the rendering data further includes a target native value; wherein the method further includes: Calling a native value allocation function provided by the first application to generate a native value; The native value is returned to the second application, wherein the native value includes the target native value.

7. The rendering method according to claim 6, characterized in that: The target rendering resource data includes target texture information; wherein, after binding the target texture information of the second rendering data to the graphics interface, the method further includes: The target native value is set to a uniform variable of the graphics interface.

8. The rendering method according to claim 7, characterized in that: The rendering data also includes a target rendering batch index, a position change index of the object to be rendered, and world coordinate information of the object to be rendered.

9. The rendering method according to claim 8, characterized in that: The first application program performs rendering of the object to be rendered according to the parsed rendering data, further comprising: If the target rendering batch index of the first rendering data is a set value, generating a first batch including the first rendering data; If the target rendering batch index of the second rendering data is the set value, and the target view handle, target clipping handle, target rendering pipeline state information, target texture information and target native value of the first rendering data and the second rendering data are the same, then adding the second rendering data to the first batch; If at least one of the target view handle, the target clipping handle, the target rendering pipeline state information, the target texture information, and the target native value of the first rendering data and the second rendering data is different, performing the first batching; A second batch including the second rendering data is generated.

10. A rendering device, characterized in that: include: A rendering data acquisition unit, configured to acquire rendering data of an object to be rendered from a second application program based on a scripting language by a first application program based on a compiled language, wherein the first application program is installed on a terminal device, and the rendering data includes a target view handle; a rendering data parsing unit, configured to parse the rendering data through the first application; An object rendering execution unit, used by the first application to execute rendering of the object to be rendered according to the parsed rendering data; a view description information acquisition unit, configured to acquire view description information of the object to be rendered from the second application program through the first application program, wherein the view description information includes a target frame buffer and operations on the target frame buffer; A view creation unit, configured to call a view allocation function provided by the first application program, and create a view and a view handle thereof according to the view description information; A view handle returning unit is used to return the view handle to the second application, wherein the view handle includes the target view handle.

11. The rendering device according to claim 10, characterized in that: The rendering data also includes a target clipping handle; wherein the device also includes: A drawing area information acquisition unit, configured to acquire drawing area restriction information of the object to be rendered from the second application program through the first application program; A clipping region creating unit, configured to call a region allocation function provided by the first application program, and to create a clipping region and a clipping handle thereof according to the drawing region restriction information; The cropping handle returning unit is used to return the cropping handle to the second application, wherein the cropping handle includes the target cropping handle.

12. The rendering device according to claim 11, characterized in that: The rendering data also includes a target shader handle; wherein the apparatus further includes: a shading information acquiring unit, configured to acquire shading information of the object to be rendered from the second application program via the first application program; A shader generation unit, configured to call a shader allocation function provided by the first application program, and generate a shader and a shader handle thereof according to the shading information; A shader handle returning unit is used to return the shader handle to the second application, wherein the shader handle includes the target shader handle.

13. The rendering device according to claim 12, characterized in that: The rendering data also includes a target vertex layout handle; wherein the device also includes: A vertex layout information acquisition unit, configured to acquire the vertex layout information of the object to be rendered from the second application program via the first application program; A vertex layout form creation unit, used to call a vertex layout allocation function provided by the first application program, and create a vertex layout form and a vertex layout handle thereof according to the vertex layout information; A vertex layout handle returning unit is used to return the vertex layout handle to the second application, wherein the vertex layout handle includes the target vertex layout handle.

14. The rendering device according to claim 13, characterized in that: The rendering data further includes target rendering pipeline state information and target rendering resource data, and the rendering data includes first rendering data and second rendering data, and the first rendering data is executed before the second rendering data; wherein the object rendering execution unit includes: A rendering data execution unit, configured to execute the second rendering data; a target frame buffer determining unit, configured to determine a target frame buffer of the second rendering data according to the target view handle of the second rendering data and perform an operation on the target frame buffer if the target view handles of the first rendering data and the second rendering data are different; a clipping region setting unit, configured to set a clipping region of the second rendering data according to a target clipping handle of the second rendering data if the target view handles of the first rendering data and the second rendering data are the same or an operation on a target frame buffer of the second rendering data is completed and the target clipping handles of the first rendering data and the second rendering data are different; a pipeline state setting unit, configured to set a rendering pipeline state of the second rendering data according to the target rendering pipeline state information of the second rendering data if the target clipping handles of the first rendering data and the second rendering data are the same or the clipping region of the second rendering data is set, and the target rendering pipeline state information of the first rendering data and the second rendering data are different; A resource data binding unit is used to bind the target rendering resource data of the second rendering data to a graphics interface if the target rendering pipeline state information of the first rendering data and the second rendering data is the same or the rendering pipeline state of the second rendering data is set, so that the graphics interface can render the second rendering data.

15. The rendering device according to claim 14, characterized in that: If the object to be rendered is a dynamic rendering object, the rendering data further includes a target native value; wherein the device further includes: A native value generation unit, configured to call a native value allocation function provided by the first application program to generate a native value; A native value returning unit is used to return the native value to the second application, wherein the native value includes the target native value.

16. The rendering device according to claim 15, characterized in that: The target rendering resource data includes target texture information; wherein, after binding the target texture information of the second rendering data to the graphics interface, the device further includes: The native value setting unit is used to set the target native value to the uniform variable of the graphical interface.

17. The rendering device according to claim 16, characterized in that: The rendering data also includes a target rendering batch index, a position change index of the object to be rendered, and world coordinate information of the object to be rendered.

18. The rendering device according to claim 17, characterized in that: The object rendering execution unit also includes: A first batch generation unit, configured to generate a first batch including the first rendering data if a target rendering batch indicator of the first rendering data is a set value; a rendering data adding unit, configured to add the second rendering data to the first batch if the target rendering batch index of the second rendering data is the set value, and the target view handle, target clipping handle, target rendering pipeline state information, target texture information and target native value of the first rendering data and the second rendering data are the same; a first batch execution unit, configured to execute the first batch if at least one of a target view handle, a target clipping handle, a target rendering pipeline state information, a target texture information, and a target native value of the first rendering data and the second rendering data is different; The second batch generating unit is configured to generate a second batch including the second rendering data.

19. An electronic device, characterized in that: include: one or more processors; A storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the rendering method according to any one of claims 1 to 9.

20. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the rendering method according to any one of claims 1 to 9 is implemented.

21. A computer program product, characterized in that The computer program comprises a computer program, which implements the rendering method according to any one of claims 1 to 9 when being executed.