A task processing method, device, and electronic device

By creating a task sequence for rendering nodes based on dependency tags, the method addresses the inefficiency of serial computation in calculating absolute transformation matrices, improving processing efficiency and utilizing multi-core processors.

CN114470767BActive Publication Date: 2025-07-15竞技世界(北京)网络技术有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210138462.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-15
Publication Date
2025-07-15
Estimated Expiration
2042-02-15

AI Technical Summary

Technical Problem

In game programs, calculating the absolute transformation matrix of the rendered object is low efficiency, unable to meet the computing needs, and cannot take advantage of the advantages of multi-core processors.

Method used

By obtaining the tree structure diagram of the node, configuring the task attribute information, extracting the rendering node, creating a task sequence, and based on the task dependency identification and node dependency relationship, the task processing system processes the task information in parallel to obtain an absolute transformation matrix.

Benefits of technology

It improves task processing efficiency, meets the requirement of calculating the absolute transformation matrix of the rendered object, and makes full use of the performance of multi-core processors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114470767B_ABST
    Figure CN114470767B_ABST
Patent Text Reader

Abstract

The present invention provides a task processing method, apparatus and electronic device, which acquire a tree structure diagram of nodes; each node in the tree structure diagram is configured with corresponding node attribute information, the node attribute information includes task attribute information, the task attribute information includes a task dependency identifier, extract each rendering node from the tree structure diagram, create a task sequence for the rendering node in sequence, and determine the task information in the task sequence based on the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node. During the process of determining the task information in the task sequence, output the task information in the task sequence of each rendering node to the task processing system in sequence, so that the task processing system processes the task information in the task sequence of each rendering node in parallel, obtains the absolute transformation matrix of each rendering node, improves the task processing efficiency, and further improves the efficiency of calculating the absolute transformation matrix of the object to be rendered, meeting the calculation requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and more particularly, to a task processing method, apparatus, and electronic device. Background Art

[0002] In a game program, generally, the rendered objects in a scene are organized in a tree structure, and the movement of a child node object is affected by the movement of a parent node object. Therefore, when calculating the absolute transformation matrix of the rendered objects in the scene, the relative transformation matrices of the parent node and other ancestor nodes are required. At this time, only a serial calculation method can be used to calculate the absolute transformation matrix of the rendered objects, and this calculation method has low efficiency and cannot meet the calculation requirements. Summary of the Invention

[0003] In view of this, the present invention provides a task processing method, apparatus, and electronic device to solve the problem of low efficiency in calculating the absolute transformation matrix of the rendered objects.

[0004] To solve the above technical problems, the present invention adopts the following technical solutions:

[0005] A task processing method includes:

[0006] Obtain a tree structure diagram of nodes; each node in the tree structure diagram is configured with corresponding node attribute information, and the node attribute information includes task attribute information, and the task attribute information includes a task dependency identifier;

[0007] Extract each rendering node from the tree structure diagram;

[0008] Create a task sequence of the rendering nodes in sequence, and determine the task information in the task sequence based on the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node. In the process of determining the task information in the task sequence, output the task information in the task sequences of the rendering nodes to a task processing system in sequence, so that the task processing system processes the task information in the task sequences of the rendering nodes in parallel to obtain the absolute transformation matrix of each rendering node.

[0009] Optionally, obtaining a tree structure diagram of nodes includes:

[0010] During the generation of the tree structure tree, set the node attribute information of each node in the structure tree based on the node task dependency relationship of the nodes in the tree structure tree;

[0011] The node attribute information includes task attribute information, and the task attribute information includes node task dependencies and task dependency identifiers corresponding to the computing tasks of the node; the task dependency identifiers include a first identifier and a second identifier, the first identifier represents that the computing task has been successfully executed; the second identifier represents that the computing task has not been successfully executed, and the task dependency identifier is updated in real time according to the computing progress data of the node's computing task.

[0012] Optionally, extracting each rendering node from the tree structure diagram includes:

[0013] Extracting each rendering node from the tree structure diagram whose node type is the rendering node type and whose node visibility is visible.

[0014] Optionally, determining the task information in the task sequence based on the content of the task dependency identifier of the rendering node and the node task dependencies of the rendering node includes:

[0015] Obtaining the computing task of the rendering node and obtaining the content of the task dependency identifier of the computing task;

[0016] When the task dependency identifier of the computing task is the first identifier, placing the task calculation result of the computing task at the end of the task sequence;

[0017] When the task dependency identifier of the computing task is the second identifier, placing the computing task at the end of the task sequence;

[0018] Based on the node task dependencies of the rendering node, determining whether there are dependent tasks for the computing task;

[0019] If there are, taking the dependent task as a new computing task and returning to execute the step of obtaining the content of the task dependency identifier of the computing task until there are no dependent tasks for the new computing task;

[0020] When there are no dependent tasks for the new computing task, or the computing task has been output to the task processing system, or the task calculation result of the computing task has been placed at the end of the task sequence, setting dependency relationships for the elements in the task sequence.

[0021] Optionally, setting dependency relationships for the elements in the task sequence includes:

[0022] Traversing the elements in the task sequence from back to front to obtain the elements;

[0023] When the element is a computing task, determine whether the computing task has been sent to the task processing system. If not, send the computing task to the task processing system and use the computing task as a dependent task of the previous computing task in the task sequence where the computing task is located.

[0024] If so, use the computing task as a dependent task of the previous computing task in the task sequence where the computing task is located.

[0025] When the element is the task calculation result of a computing task, use the task calculation result of the computing task as dependent data of the previous computing task in the task sequence where the task calculation result of the computing task is located.

[0026] A task processing device, comprising:

[0027] A structure diagram acquisition module, configured to acquire a tree structure diagram of nodes; each node in the tree structure diagram is configured with corresponding node attribute information, the node attribute information includes task attribute information, and the task attribute information includes a task dependency identifier.

[0028] A node extraction module, configured to extract each rendering node from the tree structure diagram.

[0029] A task processing module, configured to sequentially create a task sequence of the rendering nodes, and determine task information in the task sequence based on the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node. Wherein, in the process of determining the task information in the task sequence, output the task information in the task sequence of each of the rendering nodes to the task processing system in sequence, so that the task processing system processes the task information in the task sequence of each of the rendering nodes in parallel to obtain an absolute transformation matrix of each of the rendering nodes.

[0030] Optionally, the structure diagram acquisition module is specifically configured to:

[0031] During the generation process of the tree structure tree, set the node attribute information of each node in the structure tree based on the node task dependency relationship of the nodes in the tree structure tree.

[0032] The node attribute information includes task attribute information, the task attribute information includes a node task dependency relationship and a task dependency identifier corresponding to the computing task of the node; the task dependency identifier includes a first identifier and a second identifier, the first identifier indicates that the computing task has been successfully executed; the second identifier indicates that the computing task has not been successfully executed, and the task dependency identifier is updated in real time according to the calculation progress data of the computing task of the node.

[0033] Optionally, the node extraction module is specifically configured to:

[0034] Extract each rendering node from the tree structure diagram, where the node type is the rendering node type and the node visibility is visible.

[0035] Optionally, the task processing module includes:

[0036] A content acquisition sub-module, configured to acquire the calculation task of the rendering node and acquire the content of the task dependency identifier of the calculation task;

[0037] A queue setting sub-module, configured to place the task calculation result of the calculation task at the end of the task sequence when the task dependency identifier of the calculation task is the first identifier; and place the calculation task at the end of the task sequence when the task dependency identifier of the calculation task is the second identifier;

[0038] A dependency determination sub-module, configured to determine whether there is a dependent task for the calculation task based on the node task dependency relationship of the rendering node;

[0039] A node determination sub-module, configured to, if any, use the dependent task as a new calculation task;

[0040] The content acquisition sub-module is further configured to acquire the content of the task dependency identifier of the new calculation task;

[0041] A dependency relationship setting sub-module, configured to set the dependency relationship of the elements in the task sequence when there is no dependent task for the new calculation task, or the calculation task has been output to the task processing system, or the task calculation result of the calculation task is placed at the end of the task sequence.

[0042] An electronic device, including: a memory and a processor;

[0043] Wherein, the memory is used to store a program;

[0044] The processor calls the program and is configured to execute the above-mentioned task processing method.

[0045] Compared with the prior art, the present invention has the following beneficial effects:

[0046] The present invention provides a task processing method, apparatus and electronic device, which obtain a tree structure diagram of nodes; each node in the tree structure diagram is configured with corresponding node attribute information, the node attribute information includes task attribute information, and the task attribute information includes a task dependency identifier. Extract each rendering node from the tree structure diagram, create a task sequence of the rendering nodes in sequence, and determine the task information in the task sequence based on the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node. Wherein, in the process of determining the task information in the task sequence, the task information in the task sequences of each of the rendering nodes is sequentially output to a task processing system, so that the task processing system processes the task information in the task sequences of each of the rendering nodes in parallel, and obtains an absolute transformation matrix of each of the rendering nodes. In the present invention, by analyzing the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node, the task information in the task sequences of each of the rendering nodes is obtained, so that the task processing system processes the task information in each task sequence in parallel, improves the task processing efficiency, and further improves the efficiency of calculating the absolute transformation matrix of the object to be rendered, meeting the calculation requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the provided drawings.

[0048] Figure 1 It is a flowchart of a task processing method provided by an embodiment of the present invention;

[0049] Figure 2 It is a schematic diagram of a tree structure tree provided by an embodiment of the present invention;

[0050] Figure 3 It is a flowchart of a task processing method provided by an embodiment of the present invention;

[0051] Figure 4 It is a schematic diagram of a task sequence provided by an embodiment of the present invention;

[0052] Figure 5 It is a schematic structural diagram of a task processing apparatus provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0053] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0054] In a game program, the rendered objects in a general scene are organized in a tree structure, and the movement of the child node objects is affected by the movement of the parent node objects. Therefore, when calculating the absolute transformation matrix of the rendered objects in the scene, the relative transformation matrices of the parent node and other ancestor nodes are required. At this time, when calculating the transformation matrix of a certain visible rendering node, starting from this node in the main thread, recursively multiply the relative transformation matrix of itself by the relative transformation matrix of the parent node until reaching the root node. If this calculation method uses multiple threads, there may be a situation where multiple threads simultaneously write to the relative transformation matrix of the parent node, resulting in operation errors. Therefore, it can only be calculated in a single thread and cannot utilize the advantages of multi-core processors. That is, only a serial calculation method can be used to calculate the absolute transformation matrix of the rendered objects, and this calculation method has low efficiency and cannot meet the calculation requirements.

[0055] To this end, in order to improve the calculation efficiency and make full use of the advantages of multi-core processors, the present invention provides a task processing method, device, and electronic device, which obtain a tree structure diagram of nodes; each node in the tree structure diagram is configured with corresponding node attribute information, and the node attribute information includes task attribute information, and the task attribute information includes a task dependency identifier. Extract each rendering node from the tree structure diagram, create a task sequence of the rendering node in sequence, and determine the task information in the task sequence based on the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node. Among them, in the process of determining the task information in the task sequence, the task information in the task sequences of each rendering node is sequentially output to the task processing system, so that the task processing system processes the task information in the task sequences of each rendering node in parallel to obtain the absolute transformation matrix of each rendering node. In the present invention, by analyzing the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node, the task information in the task sequences of each rendering node is obtained, so that the task processing system processes the task information in each task sequence in parallel, improving the task processing efficiency, and further improving the efficiency of calculating the absolute transformation matrix of the rendered object to meet the calculation requirements.

[0056] In addition, by calculating the transformation matrix concurrently, the present invention can better handle the problem of mounting nodes. At the same time, no computing power is wasted on non-rendering nodes that do not require calculation.

[0057] Based on the above, an embodiment of the present invention provides a task processing method, which may include: Figure 1 , may include:

[0058] S11. Obtain the tree structure diagram of the nodes.

[0059] In practical applications, the tree structure diagram of the nodes may refer to Figure 2 as shown. Among them, B, D, E, F, G, and K are rendering nodes, H is an animation node, J is a mounting node, I is a node that does not require rendering, and A and R are ordinary nodes. Among them, node C is invisible, and its subtree is also invisible, so F and G do not need to calculate the transformation matrix.

[0060] Among them, the animation node refers to: a node containing animation elements, which has two tasks, absolute transformation matrix calculation and animation calculation. The animation calculation depends on the absolute transformation matrix calculation, and the absolute transformation matrix calculation depends on the absolute transformation matrix calculation of the parent node.

[0061] The mounting node refers to: a special node, whose absolute transformation matrix is only affected by a certain bone of the first animation node in the ancestor nodes. It has an absolute transformation matrix calculation task. The flag bit of the mounting node is always a dependent task.

[0062] The rendering node refers to: a node containing renderable elements, which has an absolute transformation matrix calculation task.

[0063] The ordinary node refers to: other nodes that are not the previous three types of nodes, which have an absolute transformation matrix calculation task.

[0064] The dependent node refers to: a node on which the absolute transformation matrix calculation of the current node depends, generally the parent node. The mounting node depends on the first animation node in the ancestor nodes.

[0065] Among them, each node in the tree structure diagram is configured with corresponding node attribute information, and the node attribute information includes task attribute information, and the task attribute information includes a task dependency identifier.

[0066] Specifically, obtaining the tree structure diagram of the nodes includes:

[0067] During the generation process of the tree structure tree, based on the node task dependency relationship of the nodes in the tree structure tree, set the node attribute information of each node in the structure tree.

[0068] The node attribute information includes task attribute information, and the task attribute information includes node task dependencies and task dependency identifiers corresponding to the computing tasks of the node; the task dependency identifiers include a first identifier and a second identifier, the first identifier indicates that the computing task has been successfully executed; the second identifier indicates that the computing task has not been successfully executed, and the task dependency identifier is updated in real time according to the computing progress data of the node's computing task.

[0069] Specifically, node attribute information is attached to each node, and the node attribute information includes the task attribute information of each computing task of the node and an absolute transformation matrix computing task.

[0070] The task attribute information includes:

[0071] A set of tasks [1 or 2], each task may depend on tasks within the node or tasks of other nodes, and each task attribute information contains the following elements:

[0072] 1) Whether the task has been delivered to the task processing system (default is not delivered);

[0073] 2) The node where the current task is located (default is the node where the task is contained);

[0074] 3) The node task dependencies of the current task (default is empty);

[0075] 4) The task dependency identifier, and the task dependency identifier has two states. One state is the first identifier, and the other state is the second identifier. The first identifier indicates that the computing task has been successfully executed; the second identifier indicates that the computing task has not been successfully executed, and the task dependency identifier is updated in real time according to the computing progress data of the node's computing task. The task dependency identifier is defaulted to the second identifier.

[0076] When creating a node in the tree structure tree, add an absolute matrix computing task, its dependency flag is the second identifier, and the node task dependency is the absolute matrix computing task of the parent node. For the root node without a parent node, its node task dependency is empty. The default state is that the task has not been delivered to the task system.

[0077] For animation nodes, two computing tasks are created, an animation computing task and an absolute transformation matrix computing task. The animation computing task depends on the absolute transformation matrix computing task of this node, and the absolute transformation matrix computing task is the same as above.

[0078] For the attachment node, we need to find the animation node in the first ancestor node and set the node task dependency of this node to the animation computing task of this animation node.

[0079] After the absolute transformation matrix calculation task is completed, the task dependency identifier of this task will be set to the first identifier. However, this does not apply to the mounted node. The task dependency identifier of the absolute transformation matrix calculation task of the mounted node is always the second identifier.

[0080] When a node changes its own transformation information, we need to set the task dependency identifier of the absolute transformation matrix calculation tasks of all nodes with this node as the subtree to the second identifier.

[0081] When constructing a tree structure tree, the first three contents of the above-mentioned task attribute information are set based on the node dependency relationship. Then, when continuously processing node calculation tasks, such as absolute transformation matrix calculation tasks or animation calculation tasks, the task dependency identifier is updated in real time according to the calculation progress data of the calculation task.

[0082] It should be noted that the node sets the node attribute information, and the node attribute information includes task attribute information. The task attribute information includes node task dependency relationships and the task dependency identifier, which solves the problem of multiple threads simultaneously calculating a node in the calculation of the absolute transformation matrix. In the task system, non-dependent tasks are naturally calculated concurrently in multiple threads, making the calculation of the transformation matrix more efficient in this way.

[0083] S12. Extract each rendering node from the tree structure diagram.

[0084] Specifically, extract each rendering node from the tree structure diagram whose node type is the rendering node type and whose node visibility is visible.

[0085] In this embodiment, a rendering node set can be set to store rendering nodes. During the process of generating the tree structure diagram or after generating the tree structure diagram, if it is found that the node type of the added node is the rendering node type and the visibility is visible, this node is added to the rendering node set.

[0086] If a certain rendering node in the tree structure diagram needs to be deleted, it is deleted from the above-mentioned rendering node set.

[0087] If a certain rendering node in the tree structure diagram needs to be hidden, it is necessary to recursively traverse the subtree with this node as the root node, and remove all the rendering nodes in the subtree from all the rendering node sets.

[0088] S13. Create the task sequence of the rendering nodes in sequence, and determine the task information in the task sequence based on the content of the task dependency identifier of the rendering nodes and the node task dependency relationship of the rendering nodes. Wherein, in the process of determining the task information in the task sequence, the task information in the task sequence of each rendering node is output to the task processing system in sequence, so that the task processing system processes the task information in the task sequence of each rendering node in parallel to obtain the absolute transformation matrix of each rendering node.

[0089] In practical applications, for each rendering node, create its corresponding task sequence. That is, if there are m rendering nodes, then m task sequences are created, where m is a positive integer. It should be noted that the task sequences can be created in the same common queue. For the rendering nodes, create the corresponding task information in the common queue. During the creation process, the task information in the common queue is output to the task processing system in sequence. After all the task information is output, for the next rendering node, create the corresponding task information in the common queue until the task information of all the rendering nodes is constructed and output to the task processing system.

[0090] Then, determine the task information in the task sequence based on the content of the task dependency identifier of the rendering nodes and the node task dependency relationship of the rendering nodes.

[0091] Specifically, referring to Figure 3 , determining the task information in the task sequence based on the content of the task dependency identifier of the rendering nodes and the node task dependency relationship of the rendering nodes may include:

[0092] S21. Obtain the computing tasks of the rendering nodes.

[0093] S22. Obtain the content of the task dependency identifier of the computing tasks.

[0094] In this embodiment, the rendering nodes in the rendering node set are arranged in sequence. The sequence identifiers can be set according to the arrangement order of the rendering nodes. For example, the first rendering node is 1, and the second rendering node is 2. When obtaining the task information in the task sequence of the rendering nodes, it can be processed in sequence according to the arrangement order. At this time, first process the i-th rendering node. After processing is completed to obtain the task information in the task sequence and send the task information in the task sequence to the task processing system, make i = i + 1 until the last rendering node is processed to obtain the task information in the task sequence of the last rendering node. At this time, forcefully refresh the task processing system and wait for all tasks to be completed.

[0095] For any rendering node, such as the i-th node, it can be denoted as N(i). The task of calculating the absolute transformation matrix for N(i) is denoted as TM(i), and the task of calculating the animation for N(i) is denoted as TA(i). At this time, the calculation task of the rendering node can be TM(i) or TA(i).

[0096] Obtain the content of the task dependency identifier of the calculation task. The content of the task dependency identifier of the calculation task is the first identifier or the second identifier. The first identifier indicates that the calculation task has been successfully executed; the second identifier indicates that the calculation task has not been successfully executed, and the task dependency identifier is updated in real time according to the calculation progress data of the node's calculation task.

[0097] S23. When the task dependency identifier of the calculation task is the first identifier, place the task calculation result of the calculation task at the end of the task sequence.

[0098] S24. When the task dependency identifier of the calculation task is the second identifier, place the calculation task at the end of the task sequence.

[0099] Specifically, taking the calculation task as TM(i) as an example, check the task dependency identifier of TM(i). If it is the first identifier, it means that the absolute transformation matrix M(i) has been calculated, and M(i) is sent to the tail of the task sequence TQ. If it is the second identifier, TM(i) is sent to the tail of the task sequence TQ.

[0100] S25. Determine whether the calculation task has dependent tasks; if so, execute step S25.

[0101] Specifically, based on the node task dependency relationship of the rendering node, determine whether the calculation task has dependent tasks.

[0102] During the generation process of the tree structure tree, the node task dependency relationship has been set in the node attribute information. The dependent task may be the animation calculation task of other nodes or the absolute transformation matrix calculation task of the parent node. For example Figure 2 if the rendering node D depends on the ordinary node A, then the dependent task of the absolute transformation matrix of the ordinary node A is the absolute transformation matrix of the rendering node D. If the rendering node E depends on the ordinary node A, then the dependent task of the absolute transformation matrix of the ordinary node A is the absolute transformation matrix of the rendering node E, etc.

[0103] S26. Take the dependent task as a new calculation task.

[0104] If there are dependent tasks, taking the computing task as the absolute transformation matrix and the dependent task as the absolute transformation matrix of a certain node as an example. Since the absolute transformation matrix of the rendering node needs to use the absolute transformation matrix of the dependent task during calculation, at this time, it is necessary to first calculate the absolute transformation matrix of the dependent task, and then calculate the absolute transformation matrix of the rendering node. At this time, the dependent task is used as the new computing task, and then the above steps S21 - S25 are executed. Similarly, if the dependent task also has a corresponding dependent task, after placing the absolute transformation matrix of the dependent task at the end of the task sequence, or placing the dependent task at the end of the task sequence, the corresponding dependent task of the dependent task is used as the new dependent task until there is no dependent task.

[0105] That is, after using the dependent task as the new computing task, return to execute step S22 until there is no dependent task for the new computing task.

[0106] S26. When there is no dependent task for the new computing task, or the computing task has been output to the task processing system, or the task calculation result of the computing task is placed at the end of the task sequence, set the dependency relationship for the elements in the task sequence.

[0107] Specifically, traverse the elements in the task sequence from the back to the front to obtain the elements;

[0108] When the element is a computing task, determine whether the computing task has been sent to the task processing system. If not, send the computing task to the task processing system, and use the computing task as the dependent task of the previous computing task in the task sequence where the computing task is located;

[0109] If so, use the computing task as the dependent task of the previous computing task in the task sequence where the computing task is located;

[0110] When the element is the task calculation result of a computing task, use the task calculation result of the computing task as the dependent data of the previous computing task in the task sequence where the task calculation result of the computing task is located.

[0111] In this embodiment, the task processing system is a dependency - based concurrent task execution system. Dependency is the guarantee of the correctness of the task sequence, so the dependency relationship of the task ensures the calculation correctness. The value input of the absolute matrix is the input parameter of a task.

[0112] Specifically, traverse the task sequence TQ from the back to the front. Each element is denoted as TQE. If TQE is the task calculation result for a calculation task, such as an absolute calculation matrix or an animation calculation result, then use it as the next calculation task in the task sequence, that is, the data input of the previous calculation task sorted before this calculation task. If TQE is a calculation task that has been sent to the task processing system, then use it as the dependent task of the next calculation task. If TQE is a task that has not been sent to the task processing system, then send it to the task processing system and at the same time make it the dependent task of the next calculation task.

[0113] Among them, the task processing system is a task system that supports task dependencies and multi-threaded concurrency, and can be used to concurrently execute subsystem programs for various related or unrelated tasks, mainly improving the execution efficiency of tasks through multi-threading.

[0114] Take Figure 4 as an example. Figure 4 The task sequence of the rendering node DEK is given. D, E, and K represent each rendering node, and the right box represents the possible content of the task sequence. For example, for E, there may be two cases. The virtual box TM(A) in the first queue represents that TM(A) has been sent to the task processing system, and TM(E) only needs to depend on this calculation task.

[0115] The virtual box M(A) in the second queue represents that the calculation task TM(A) has been calculated to obtain the absolute transformation matrix M(A) of A, and only this absolute transformation matrix needs to be used as the input of TM(E).

[0116] Similarly, the task sequence of the rendering node D is TM(D), TM(A), TM(R).

[0117] The task sequence of the rendering node K also has two cases, which are TM(K), TM(J), TA(H), TM(H), TM(R), or TM(K), TM(J), TA(H), M(H).

[0118] Refer to Figure 4 . Taking the rendering nodes DEK as an example, there are 3 task sequences, and the task information of these three task sequences can be processed in parallel in the task processing system.

[0119] If TM(A) in the rendering node D is calculated, then the virtual dependent task TM(A) (already sent to the task processing system) in the rendering node E does not need to be calculated, and the value of M(A) calculated by TM(A) in the rendering node D can be directly used.

[0120] When performing parallel processing, the multi-threaded approach can be adopted. Among them, a thread is the smallest unit that the operating system can schedule for operations. It is contained within a process and is the actual operating unit within the process. A thread refers to a single sequential control flow within a process. Multiple threads can be concurrent within a process, and each thread executes different tasks in parallel.

[0121] For example, when calculating the rendering node D, TM(A) has been sent to the task system for calculation. Therefore, when calculating E, the task TM(A) it depends on does not need to be recalculated. Only a dependency needs to be established for it (a dependency is established for it in the task processing system), and the workload of the dependency is very small. Since there is no need to repeatedly calculate the result, the repeated calculation of TM(A) can be avoided, improving the calculation efficiency. In addition, after calculating the absolute transformation matrix of node R, the calculation tasks of rendering nodes D and K are not related, so the calculation tasks of rendering nodes D and K can be executed in parallel.

[0122] In this embodiment, a tree structure diagram of the nodes is obtained; each node in the tree structure diagram is configured with corresponding node attribute information, and the node attribute information includes task attribute information, and the task attribute information includes a task dependency identifier. Each rendering node is extracted from the tree structure diagram, and a task sequence of the rendering node is created in sequence. Based on the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node, the task information in the task sequence is determined. Among them, during the process of determining the task information in the task sequence, the task information in the task sequences of each of the rendering nodes is sequentially output to the task processing system, so that the task processing system processes the task information in the task sequences of each of the rendering nodes in parallel to obtain the absolute transformation matrix of each of the rendering nodes. In the present invention, by analyzing the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node, the task information in the task sequences of each of the rendering nodes is obtained, enabling the task processing system to process the task information in each task sequence in parallel, improving the task processing efficiency, and further improving the efficiency of calculating the absolute transformation matrix of the object to be rendered, meeting the calculation requirements.

[0123] In addition, after the calculation of the matrix task of a parent node is completed in the present invention, the matrix calculation tasks of the child nodes can all be calculated in parallel, making full use of the performance of the multi-core processor and being able to concurrently calculate the absolute transformation matrix of the rendering nodes. At the same time, when the absolute transformation matrix does not change, it will not be recalculated multiple times. It can also handle the problem of mounted nodes.

[0124] Optionally, based on the embodiment of the above task processing method, another embodiment of the present invention provides a task processing device. Referring to Figure 5 , it may include:

[0125] A structure diagram acquisition module 11, configured to acquire a tree structure diagram of nodes; each node in the tree structure diagram is configured with corresponding node attribute information, the node attribute information includes task attribute information, and the task attribute information includes a task dependency identifier;

[0126] A node extraction module 12, configured to extract each rendering node from the tree structure diagram;

[0127] A task processing module 13, configured to sequentially create a task sequence of the rendering nodes, and determine task information in the task sequence based on the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node. Wherein, in the process of determining the task information in the task sequence, the task information in the task sequence of each rendering node is sequentially output to a task processing system, so that the task processing system processes the task information in the task sequence of each rendering node in parallel to obtain an absolute transformation matrix of each rendering node.

[0128] Further, the structure diagram acquisition module is specifically configured to:

[0129] During the generation process of the tree structure tree, based on the node task dependency relationship of the nodes in the tree structure tree, set the node attribute information of each node in the structure tree;

[0130] The node attribute information includes task attribute information, and the task attribute information includes a node task dependency relationship and a task dependency identifier corresponding to the calculation task of the node; the task dependency identifier includes a first identifier and a second identifier, the first identifier indicates that the calculation task has been successfully executed; the second identifier indicates that the calculation task has not been successfully executed, and the task dependency identifier is updated in real time according to the calculation progress data of the calculation task of the node.

[0131] Further, the node extraction module is specifically configured to:

[0132] Extract each rendering node from the tree structure diagram whose node type is a rendering node type and whose node visibility is visible.

[0133] Further, the task processing module includes:

[0134] A content acquisition sub-module, configured to acquire the calculation task of the rendering node, and acquire the content of the task dependency identifier of the calculation task;

[0135] A queue setting sub-module, configured to place the task calculation result of the computing task at the end of the task sequence when the task dependency identifier of the computing task is the first identifier; and place the computing task at the end of the task sequence when the task dependency identifier of the computing task is the second identifier.

[0136] A dependency determination sub-module, configured to determine whether there is a dependent task for the computing task based on the node task dependency relationship of the rendering node.

[0137] A node determination sub-module, configured to, if there is, use the dependent task as a new computing task.

[0138] The content acquisition sub-module is further configured to acquire the content of the task dependency identifier of the new computing task.

[0139] A dependency relationship setting sub-module, configured to set the dependency relationship for the elements in the task sequence when the new computing task has no dependent task, or the computing task has been output to the task processing system, or the task calculation result of the computing task is placed at the end of the task sequence.

[0140] Furthermore, the dependency relationship setting sub-module includes:

[0141] A traversal unit, configured to traverse and obtain elements from the end to the front of the elements in the task sequence.

[0142] A setting unit, configured to, when the element is a computing task, determine whether the computing task has been sent to the task processing system. If not, send the computing task to the task processing system and use the computing task as a dependent task of the previous computing task of the computing task in the task sequence; if so, use the computing task as a dependent task of the previous computing task of the computing task in the task sequence; when the element is the task calculation result of the computing task, use the task calculation result of the computing task as the dependent data of the previous computing task of the task calculation result of the computing task in the task sequence.

[0143] In this embodiment, a tree structure diagram of nodes is obtained; each node in the tree structure diagram is configured with corresponding node attribute information, the node attribute information includes task attribute information, the task attribute information includes a task dependency identifier, each rendering node is extracted from the tree structure diagram, a task sequence of the rendering node is created in sequence, and based on the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node, the task information in the task sequence is determined. Wherein, in the process of determining the task information in the task sequence, the task information in the task sequences of each of the rendering nodes is output to a task processing system in order, so that the task processing system processes the task information in the task sequences of each of the rendering nodes in parallel, and an absolute transformation matrix of each of the rendering nodes is obtained. In the present invention, by analyzing the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node, the task information in the task sequences of each of the rendering nodes is obtained, so that the task processing system processes the task information in each task sequence in parallel, improving the task processing efficiency, and further improving the efficiency of calculating the absolute transformation matrix of the object to be rendered, meeting the calculation requirements.

[0144] It should be noted that for the working processes of the modules, sub-modules and units in this embodiment, please refer to the corresponding descriptions in the above embodiments, which will not be elaborated here.

[0145] Optionally, on the basis of the above embodiments of the task processing method and apparatus, another embodiment of the present invention provides an electronic device, including: a memory and a processor;

[0146] Wherein, the memory is used for storing a program;

[0147] The processor calls the program and is used for executing the above task processing method.

[0148] In this embodiment, a tree structure diagram of nodes is obtained; each node in the tree structure diagram is configured with corresponding node attribute information, the node attribute information includes task attribute information, the task attribute information includes a task dependency identifier, each rendering node is extracted from the tree structure diagram, a task sequence of the rendering node is sequentially created, and based on the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node, the task information in the task sequence is determined. Among them, in the process of determining the task information in the task sequence, the task information in the task sequences of the respective rendering nodes is sequentially output to a task processing system, so that the task processing system processes the task information in the task sequences of the respective rendering nodes in parallel, and an absolute transformation matrix of each rendering node is obtained. In the present invention, by analyzing the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node, the task information in the task sequences of the respective rendering nodes is obtained, so that the task processing system processes the task information in each task sequence in parallel, improving the task processing efficiency, and further improving the efficiency of calculating the absolute transformation matrix of the object to be rendered, meeting the calculation requirements.

[0149] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A task processing method, characterized in that, including: obtaining a tree structure diagram of nodes; each node in the tree structure diagram is configured with corresponding node attribute information, the node attribute information includes task attribute information, and the task attribute information includes a task dependency identifier; extracting each rendering node from the tree structure diagram; successively creating a task sequence for the rendering nodes, and determining task information in the task sequence based on the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node. During the process of determining the task information in the task sequence, the task information in the task sequences of each rendering node is sequentially output to a task processing system, so that the task processing system processes the task information in the task sequences of each rendering node in parallel to obtain an absolute transformation matrix for each rendering node; wherein, obtaining a tree structure diagram of nodes includes: during the generation of the tree structure tree, setting the node attribute information of each node in the structure tree based on the node task dependency relationship of the nodes in the tree structure tree; the node attribute information includes task attribute information, and the task attribute information includes a node task dependency relationship and a task dependency identifier corresponding to the calculation task of the node; the task dependency identifier includes a first identifier and a second identifier, the first identifier indicates that the calculation task has been successfully executed; the second identifier indicates that the calculation task has not been successfully executed, and the task dependency identifier is updated in real time according to the calculation progress data of the node's calculation task.

2. The task processing method according to claim 1, wherein extracting each rendering node from the tree structure diagram includes: extracting each rendering node whose node type is a rendering node type and whose node visibility is visible from the tree structure diagram.

3. The task processing method according to claim 1, wherein determining task information in the task sequence based on the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node includes: obtaining the calculation task of the rendering node and obtaining the content of the task dependency identifier of the calculation task; when the task dependency identifier of the calculation task is the first identifier, placing the task calculation result of the calculation task at the end of the task sequence; when the task dependency identifier of the calculation task is the second identifier, placing the calculation task at the end of the task sequence; determining whether there is a dependent task for the calculation task based on the node task dependency relationship of the rendering node; if so, taking the dependent task as a new calculation task, and returning to execute the step of obtaining the content of the task dependency identifier of the calculation task until there is no dependent task for the new calculation task; when there is no dependent task for the new calculation task, or the calculation task has been output to the task processing system, or the task calculation result of the calculation task has been placed at the end of the task sequence, setting dependency relationships for elements in the task sequence.

4. The task processing method according to claim 3, characterized in that, setting dependency relationships for elements in the task sequence includes: traversing and obtaining elements from the end to the beginning of the elements in the task sequence; When the element is a computing task, determine whether the computing task has been sent to the task processing system. If not, send the computing task to the task processing system and use the computing task as a dependent task of the previous computing task in the task sequence; If so, use the computing task as a dependent task of the previous computing task in the task sequence; When the element is the task calculation result of a computing task, use the task calculation result of the computing task as the dependent data of the previous computing task in the task sequence of the task calculation result of the computing task.

5. A task processing device, characterized in that, It includes: A structure diagram acquisition module for acquiring a tree structure diagram of nodes; each node in the tree structure diagram is configured with corresponding node attribute information, and the node attribute information includes task attribute information, and the task attribute information includes a task dependency identifier; A node extraction module for extracting each rendering node from the tree structure diagram; A task processing module for sequentially creating a task sequence of the rendering nodes and determining the task information in the task sequence based on the content of the task dependency identifier of the rendering node and the node task dependency relationship of the rendering node. During the process of determining the task information in the task sequence, output the task information in the task sequence of each rendering node to the task processing system in order, so that the task processing system processes the task information in the task sequence of each rendering node in parallel to obtain the absolute transformation matrix of each rendering node; Among them, the structure diagram acquisition module is specifically used for: During the generation of the tree structure tree, set the node attribute information of each node in the structure tree based on the node task dependency relationship of the nodes in the tree structure tree; The node attribute information includes task attribute information, and the task attribute information includes the node task dependency relationship and the task dependency identifier corresponding to the computing task of the node; the task dependency identifier includes a first identifier and a second identifier, the first identifier indicates that the computing task has been successfully executed; the second identifier indicates that the computing task has not been successfully executed, and the task dependency identifier is updated in real time according to the calculation progress data of the computing task of the node.

6. The task processing device according to claim 5, characterized in that, The node extraction module is specifically used for: Extract each rendering node from the tree structure diagram whose node type is the rendering node type and whose node visibility is visible.

7. The task processing device according to claim 5, wherein The task processing module includes: A content acquisition sub-module for acquiring the computing task of the rendering node and acquiring the content of the task dependency identifier of the computing task; A queue setting sub-module for placing the task calculation result of the computing task at the end of the task sequence when the task dependency identifier of the computing task is the first identifier; and placing the computing task at the end of the task sequence when the task dependency identifier of the computing task is the second identifier; A dependency determination sub-module for determining whether there is a dependent task for the computing task based on the node task dependency relationship of the rendering node; A node determination sub-module, which is used to, if any, use the dependent task as a new computing task; The content acquisition sub-module is further used to acquire the content of the task dependency identifier of the new computing task; A dependency relationship setting sub-module, which is used to set the dependency relationship of the elements in the task sequence when there is no dependent task for the new computing task, or the computing task has been output to the task processing system, or the task calculation result of the computing task is placed at the end of the task sequence.

8. An electronic device, characterized in that, Comprising: A memory and a processor; Wherein, the memory is used to store programs; The processor calls the program and is used to execute the task processing method according to any one of claims 1-4.

Citation Information

Patent Citations

  • A method and device for updating a user interface in a game

    CN109558159A

  • Page rendering method and device based on tree structure

    CN112395483A