Specific embodiment
Exemplary embodiments of the present disclosure are described in more detail below with reference to accompanying drawings.Although showing the disclosure in attached drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
It is fully disclosed to those skilled in the art.
To solve to run in the equipment based on programmable rendering pipeline in the prior art after fixed rendering pipeline rendering
Application program when, the lower problem of figure rendering efficiency, the embodiment of the invention provides a kind of method of graphics process, the party
Method is mainly used in OpenGL ES server side, as shown in Figure 1, this method specifically includes that
101, after receiving rendering order, the status data carried in rendering order is obtained.
Wherein, status data is for describing initiate mode corresponding to the different renderer properties of figure to be rendered.In user
After starting the application program (i.e. OpenGL ES client) based on fixed rendering pipeline rendering, when needing to OpenGL ES client
When certain figure in end carries out rendering display, OpenGL ES client can be obtained from the data rendered based on fixed rendering pipeline
Status data corresponding with the figure is taken, the rendering order for carrying the status data is then sent to OpenGL ES server,
So as to OpenGL ES server vertex program compiled according to needed for the programmable rendering pipeline of the state data acquisition and
The fragment program of compiling.Wherein, rendering order mainly include glDraw* order, renderer property include light, deformation, texture with
And mist etc..
102, preset decision tree is traversed according to status data.
Wherein, preset decision tree is made of the different initiate modes of at least one renderer property, and decision tree have with
Lower feature: from the second node layer of decision tree, every node layer represents a kind of two states whether renderer property enables.Example
Such as, Fig. 2 be a decision tree, wherein the renderer property of second layer node on behalf be light, and include enable light processing and
Not enabled light handles both initiate modes, and the renderer property of third layer node on behalf is texture, and includes to enable at texture
It manages and does not have and enable both initiate modes of texture processing.
It should be noted that may be only comprising renderer property involved in status data in decision tree, it is also possible to both include
Renderer property involved in status data, and include other renderer properties.During traversing decision tree, encounter and status number
When the renderer property that each renderer property is all different in, the node that initiate mode is not enabled is directly selected.
In addition, can be begun stepping through from the root node of decision tree, successively when OpenGL ES server traverses decision tree
It searches and corresponds to the matched child node of renderer property in status data, until obtaining leaf node.
103, when traversing leaf node, corresponding program object is obtained from leaf node.
Wherein, program object is the program for meeting combinations of states condition defined by traverse path, and program object includes
Compiled vertex program and compiled fragment program.Wherein, since root node, traversal with wash with watercolours each in status data
The dye attribute path that successively matched node is constituted is traverse path.Due to being stored in each leaf node of decision tree
Corresponding program object, so can directly be obtained from the leaf node when traversing certain leaf node according to status data
Take the program object of storage.
104, program object is sent to video card, so that video card is based on programmable rendering pipeline processing routine object, realized
Figure rendering.
Meet combinations of states defined by traverse path when OpenGL ES server is obtained from the leaf node traversed
After the program object of condition, which can be sent to video card, be somebody's turn to do so that video card is based on programmable rendering pipeline execution
Compiled vertex program and compiled fragment program in program object, thus realize graphical rendering operations, Jin Er
Corresponding rendering effect is shown on the interface of OpenGL ES client.
It should be noted that the application scenarios of the embodiment of the present invention can be for " in Windows operating system
The application program based on fixed rendering pipeline rendering is run in Android simulator ", or " in Windows operating system
In iphone simulator on application program of the operation based on fixed rendering pipeline rendering ", or other application scenarios,
This is without limitation.
The method of graphics process provided in an embodiment of the present invention, can receive client transmission rendering order after,
Server first obtains the status data carried in rendering order, then according to the preset decision tree of status data traversal, and
By obtaining leaf node, corresponding program finally being obtained from the leaf node with after the matched traverse path of status data
Object (i.e. compiled vertex program and compiled fragment program), and the program object is sent to video card, so as to video card
The program object is handled based on programmable rendering pipeline, realizes figure rendering.It follows that the present invention in each rendering, takes
Business device only needs to traverse preset decision tree by the status data in rendering order, and from the leaf node traversed
Program object needed for directly acquiring programmable rendering pipeline generates AST tree without taking a significant amount of time every time, with
And simultaneously compiler is generated based on AST tree, to improve the efficiency of figure rendering.
Further, according to above method embodiment, another embodiment of the invention additionally provides a kind of graphics process
Method, as shown in figure 3, this method specifically includes that
201, after receiving rendering order, the status data carried in rendering order is obtained.
The specific implementation of this step is identical as above-mentioned steps 101, and details are not described herein.
202, preset decision tree is traversed according to status data.
Specifically, the specific implementation of traversal decision tree can be with are as follows: determine the corresponding renderer property of present node layer;From
The initiate mode of renderer property is searched in status data;When traversing the corresponding node of initiate mode, repeat the above steps, after
It is continuous that next stage node layer is traversed, until traversing leaf node.
Illustratively, if in status data include two kinds of renderer properties initiate mode, i.e., enabling light processing and not
Texture processing is enabled, and decision tree is as shown in Fig. 2, then OpenGL ES server is according to the specific of status data traversal decision tree
Implementation can be with are as follows: it is begun stepping through from root node, firstly, determine that node layer corresponding renderer property in the second level is light, from
The initiate mode that light is searched in status data is to enable light processing, thus selects initiate mode from the node layer of the second level
For the node for enabling light processing;Secondly, determining that the corresponding renderer property of third level node layer is texture, looked into from status data
The initiate mode for looking for texture is not enabled texture processing, is then selected from the child node for the node selected in the node layer of the second level
Select the node that initiate mode is not enabled texture processing;Finally, due to which the node selected from third level node layer is leaf
Node, so traversal terminates.In addition, it is the node → shape for enabling light processing that the exemplary traverse path, which is root node → state,
State is the node of not enabled texture processing.
203, when traversing leaf node, corresponding program object is obtained from leaf node.
The specific implementation of this step is identical as above-mentioned steps 103, and details are not described herein.
204, when the leaf node traversed is empty, the corresponding program source code of leaf node is obtained.
Wherein, program source code includes uncompiled vertex program and uncompiled fragment program.
In practical applications, obtain the corresponding program source code of leaf node specific implementation can there are many, below
It is introduced in following two mode as an example:
Mode one: the combinations of states condition generator source code according to defined by traverse path.
Wherein, after OpenGL ES server has traversed decision tree, it can get and match traverse path with status data and limited
Fixed combinations of states condition, and program source code is generated based on technologies such as mesa.In practical applications, it is limited according to traverse path
Combinations of states condition generator source code specific implementation can according to combinations of states item defined by traverse path
Part first generates AST tree, then generates program source code by AST tree, or other modes, it is not limited here.
Mode two: the corresponding pre- program source code write of leaf node is obtained.
Since program source code is the program about the initiate mode of various renderer properties, thus programmer can be directed to it is various
Combinations of states condition is write corresponding program source code in advance, and is saved to default memory space.When OpenGL ES server traverses
When to certain leaf node, program source code corresponding with the leaf node can be searched directly from default memory space, and to lookup
To program source code be compiled, obtain program object.
In addition, OpenGL ES server can also obtain program source code by the mode that above two mode combines.Specifically
, OpenGL ES server can first search the corresponding pre- program source code write of leaf node;If finding leaf node pair
The pre- program source code write answered, then directly acquire the program source code found;If not finding, leaf node is corresponding to prelist
The program source code write, then the combinations of states condition generator source code according to defined by traverse path.
205, acquisition program object is compiled to program source code.
Further, due to compiling source code needs take a significant amount of time, so for convenient for it is subsequent render the figure again when,
Rendering efficiency is improved, OpenGL ES server can be after being compiled acquisition program object to program source code, by program pair
As being stored in the corresponding leaf node of traverse path.
206, program object is sent to video card, so that video card is based on programmable rendering pipeline processing routine object, realized
Figure rendering.
The specific implementation of this step is identical as the step 104 in above-described embodiment, and details are not described herein.
By being discussed in detail it is found that after the starting of OpenGL ES server to the present embodiment, leaf section can be first constructed
Point is empty initial decision tree;When OpenGL ES server for the first time renders certain figure, can traverse for the first time corresponding
Leaf node can first obtain the corresponding program source code of the leaf node at this time, then be compiled acquisition to the program source code
Program object, and save program object is obtained into the leaf node;When OpenGL ES server again carries out the figure
When rendering, the leaf node can be traversed again, can obtain programmable rendering pipeline institute directly from the leaf node at this time
The program object needed, without being compiled to program source code, to improve the efficiency of figure rendering.
Further, according to above method embodiment, another embodiment of the invention additionally provides a kind of graphics process
Device, as shown in figure 4, the device mainly includes acquiring unit 31, Traversal Unit 32 and transmission units 33.Wherein,
Acquiring unit 31, for obtaining the status data carried in rendering order, status number after receiving rendering order
According to for describing initiate mode corresponding to the different renderer properties of figure to be rendered;
Wherein, rendering order includes mainly glDraw* order, and renderer property includes light, deformation, texture and mist etc..
Traversal Unit 32, the status data for being obtained according to acquiring unit 31 traverse preset decision tree, wherein from certainly
The second node layer of plan tree rises, and every node layer represents a kind of two states whether renderer property enables;
It should be noted that may be only comprising renderer property involved in status data in decision tree, it is also possible to both include
Renderer property involved in status data, and include other renderer properties.
Acquiring unit 31 is also used to obtain from leaf node corresponding when Traversal Unit 32 traverses leaf node
Program object, program object is the program for meeting combinations of states condition defined by traverse path, and program object includes having compiled
The vertex program translated and compiled fragment program;
Transmission unit 33, the program object for will acquire the acquisition of unit 31 are sent to video card, so that video card is based on to compile
Journey rendering pipeline processing routine object realizes figure rendering.
The device of graphics process provided in an embodiment of the present invention, can receive client transmission rendering order after,
Server first obtains the status data carried in rendering order, then according to the preset decision tree of status data traversal, and
By obtaining leaf node, corresponding program finally being obtained from the leaf node with after the matched traverse path of status data
Object (i.e. compiled vertex program and compiled fragment program), and the program object is sent to video card, so as to video card
The program object is handled based on programmable rendering pipeline, realizes figure rendering.It follows that the present invention in each rendering, takes
Business device only needs to traverse preset decision tree by the status data in rendering order, and from the leaf node traversed
Program object needed for directly acquiring programmable rendering pipeline generates AST tree without taking a significant amount of time every time, with
And simultaneously compiler is generated based on AST tree, to improve the efficiency of figure rendering.
Further, acquiring unit 31 when being also sky with the leaf node traversed when Traversal Unit 32, obtain leaf section
The corresponding program source code of point, program source code includes uncompiled vertex program and uncompiled fragment program;
As shown in figure 5, the device further comprises:
Compilation unit 34, the program source code for obtaining to acquiring unit 31 are compiled acquisition program object.
Further, as shown in figure 5, the device further comprises:
Storage unit 35, for compilation unit 34 program source code is compiled obtain program object after, by program
Object is stored in the corresponding leaf node of traverse path.
Further, as shown in figure 5, acquiring unit 31 includes:
Generation module 311 is used for the combinations of states condition generator source code according to defined by traverse path;
Module 312 is obtained, for obtaining the corresponding pre- program source code write of leaf node.
Further, as shown in figure 5, the device further comprises:
Construction unit 36, for after server starting, building leaf node to be empty initial decision tree.
Further, as shown in figure 5, Traversal Unit 32 includes:
Determining module 321, for determining the corresponding renderer property of present node layer;
Searching module 322, for searching the initiate mode of renderer property from status data;
Spider module 323, for repeating the above steps, continuing to next when traversing the corresponding node of initiate mode
Grade node layer is traversed, until traversing leaf node.
Further, as an implementation of the above method, another embodiment of the invention additionally provides at a kind of figure
The device of reason, as shown in fig. 6, the device includes: transceiver 61, processor 62, video card 63, memory 64 and bus 65;Its
In,
Transceiver 61 is configured as receiving render instruction;
Processor 62, is configured as:
The status data carried in rendering order is obtained, status data is used to describe the different renderer properties of figure to be rendered
Corresponding initiate mode;
Preset decision tree is traversed according to status data, wherein from the second node layer of decision tree, every node layer is represented
A kind of two states whether renderer property enables;
When Traversal Unit traverses leaf node, corresponding program object is obtained from leaf node, program object is
Meet the program of combinations of states condition defined by traverse path, and program object includes compiled vertex program and compiled
Fragment program;
Transceiver 61 is additionally configured to for program object to be sent to video card 63;
Video card 63 is configured as realizing figure rendering based on programmable rendering pipeline processing routine object;
Memory 64 is configured as the executable instruction of storage processor 62;
Bus 65 is configured as coupling transceiver 61, processor 62, video card 63 and memory 64.
Further, processor 62 is also configured to
When the leaf node that Traversal Unit traverses is empty, the corresponding program source code of leaf node, program source code are obtained
Including uncompiled vertex program and uncompiled fragment program;
Acquisition program object is compiled to program source code.
Further, memory 64 is also configured to
After being compiled acquisition program object to program source code, program object is stored in the corresponding leaf of traverse path
In child node.
Further, processor 62 is also configured to
The combinations of states condition generator source code according to defined by traverse path;
Obtain the corresponding pre- program source code write of leaf node.
Further, processor 62 is also configured to
After server starting, building leaf node is empty initial decision tree.
Further, processor 62 is also configured to
Determine the corresponding renderer property of present node layer;
The initiate mode of renderer property is searched from status data;
When traversing the corresponding node of initiate mode, repeats the above steps, continues to traverse next stage node layer,
Until traversing leaf node.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment
Point, reference can be made to the related descriptions of other embodiments.
It is understood that the correlated characteristic in the above method and device can be referred to mutually.In addition, in above-described embodiment
" first ", " second " etc. be and not represent the superiority and inferiority of each embodiment for distinguishing each embodiment.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
Algorithm and display are not inherently related to any particular computer, virtual system, or other device provided herein.
Various general-purpose systems can also be used together with teachings based herein.As described above, it constructs required by this kind of system
Structure be obvious.In addition, the present invention is also not directed to any particular programming language.It should be understood that can use various
Programming language realizes summary of the invention described herein, and the description done above to language-specific is to disclose this hair
Bright preferred forms.
In the instructions provided here, numerous specific details are set forth.It is to be appreciated, however, that implementation of the invention
Example can be practiced without these specific details.In some instances, well known method, structure is not been shown in detail
And technology, so as not to obscure the understanding of this specification.
Similarly, it should be understood that in order to simplify the disclosure and help to understand one or more of the various inventive aspects,
Above in the description of exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes
In example, figure or descriptions thereof.However, the disclosed method should not be interpreted as reflecting the following intention: i.e. required to protect
Shield the present invention claims features more more than feature expressly recited in each claim.More precisely, as following
Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore,
Thus the claims for following specific embodiment are expressly incorporated in the specific embodiment, wherein each claim itself
All as a separate embodiment of the present invention.
Those skilled in the art will understand that can be carried out adaptively to the module in the equipment in embodiment
Change and they are arranged in one or more devices different from this embodiment.It can be the module or list in embodiment
Member or component are combined into a module or unit or component, and furthermore they can be divided into multiple submodule or subelement or
Sub-component.Other than such feature and/or at least some of process or unit exclude each other, it can use any
Combination is to all features disclosed in this specification (including adjoint claim, abstract and attached drawing) and so disclosed
All process or units of what method or apparatus are combined.Unless expressly stated otherwise, this specification is (including adjoint power
Benefit require, abstract and attached drawing) disclosed in each feature can carry out generation with an alternative feature that provides the same, equivalent, or similar purpose
It replaces.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments
In included certain features rather than other feature, but the combination of the feature of different embodiments mean it is of the invention
Within the scope of and form different embodiments.For example, in the following claims, embodiment claimed is appointed
Meaning one of can in any combination mode come using.
Various component embodiments of the invention can be implemented in hardware, or to run on one or more processors
Software module realize, or be implemented in a combination thereof.It will be understood by those of skill in the art that can be used in practice
Microprocessor or digital signal processor (DSP) realize the denomination of invention according to an embodiment of the present invention (as determined in website
The device of Hyperlink rank) in some or all components some or all functions.The present invention is also implemented as being used for
Some or all device or device programs of method as described herein are executed (for example, computer program and calculating
Machine program product).It is such to realize that program of the invention can store on a computer-readable medium, or can have one
Or the form of multiple signals.Such signal can be downloaded from an internet website to obtain, or be provided on the carrier signal,
Or it is provided in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and ability
Field technique personnel can be designed alternative embodiment without departing from the scope of the appended claims.In the claims,
Any reference symbol between parentheses should not be configured to limitations on claims.Word "comprising" does not exclude the presence of not
Element or step listed in the claims.Word "a" or "an" located in front of the element does not exclude the presence of multiple such
Element.The present invention can be by means of including the hardware of several different elements and being come by means of properly programmed computer real
It is existing.In the unit claims listing several devices, several in these devices can be through the same hardware branch
To embody.The use of word first, second, and third does not indicate any sequence.These words can be explained and be run after fame
Claim.