Shader compiling method and device, equipment, medium and program product

By obtaining and processing reference information in the shader compilation task, merging external code files, forming independent compilation tasks, and scheduling the execution of the compilation cluster, the problems of long shader compilation time and waste of resources in the existing technology are solved, and a more efficient compilation process is achieved.

CN119645419APending Publication Date: 2025-03-18ZHUHAI KINGSOFT ONLINE GAME TECH CO LTD

Patent Information

Application Number
CN202411790971.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

In the prior art, there are problems of extended compilation time and repeated labor during the shader compilation process. Especially when the same project is deployed on multiple compilers, each machine needs to load the entire project, resulting in wasted computing resources and the total compilation time is extended.

Method used

Retrieve compilation task information for any shader, including reference information to reference external code files, in response to precompilation instructions sent by the rendering engine. The external code files are obtained based on the reference information and compiled task information is formed to form update task information. Then, based on the update task information of each shader, the compilation cluster is scheduled to execute the corresponding compilation tasks to ensure that the compilation task information does not depend on the original project file structure or path and can be executed on any machine.

Benefits of technology

Improves the flexibility and efficiency of shader compilation, solves the problems of inefficient concurrent compilation and repeated startup of the same content, and reduces the waste of computing resources and compile time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645419A_ABST
    Figure CN119645419A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a shader compiling method and device, equipment, a medium and a program product, and the shader compiling method comprises the steps that in response to a pre-compiling instruction sent by a rendering engine, compiling task information aiming at any shader is obtained, the compiling task information comprises reference information, and the reference information comprises a pre-compiling instruction sent by the rendering engine; the reference information is used for referencing an external code file in the compiling task, and the external code file is a code file defined outside any shader; obtaining an external code file based on the reference information, and merging the external code file into the compiling task information to obtain updating task information; and based on the update task information of each shader, scheduling a compiling cluster line to execute a corresponding compiling task. Before compiling, all quoted code files are merged into compiling task information by processing quoted information to form a complete and independent compiling task, and the compiling task does not depend on an original project file structure or path any more and can be executed on any machine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of image rendering technology, and in particular to a shader compilation method, device, equipment, medium and program product. Background Art

[0002] With the development of games and graphics applications, shaders have become an indispensable part of the rendering pipeline. A shader is a special program used to perform complex image processing tasks on a GPU (graphics processing unit), such as lighting calculations, texture mapping, etc. With the improvement of hardware performance and the advancement of rendering technology, shaders in modern games and applications have become more and more complex and powerful. However, this also brings about the problem of extended compilation time.

[0003] In the related art, in order to improve the compilation efficiency, multiple compilers are used for concurrent compilation. However, when deploying the same project on multiple compilers, each machine needs to open the entire project and compile the shader. This not only increases the cost of each compilation, but also leads to duplication of work. Each build machine has to load the entire project, which not only wastes precious computing resources, but also prolongs the total compilation time.

[0004] Therefore, an efficient shader compilation method is urgently needed. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a shader compilation method. One or more embodiments of the present invention also relate to a shader compilation device, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.

[0006] According to a first aspect of an embodiment of the present invention, a shader compiling method is provided, comprising: In response to the pre-compilation instruction sent by the rendering engine, obtaining compilation task information for any shader, wherein the compilation task information includes reference information, and the reference information is used to reference an external code file in the compilation task, and the external code file is a code file defined outside any shader; Acquire an external code file based on the reference information, and merge the external code file into the compilation task information to obtain update task information; Based on the updated task information of each shader, the compiling cluster is scheduled to execute the corresponding compiling task, wherein each shader is a shader corresponding to the rendering engine, and each shader includes any one of the shaders.

[0007] According to a second aspect of an embodiment of the present invention, a shader compiling device is provided, comprising: An acquisition module is configured to acquire, in response to a pre-compilation instruction sent by a rendering engine, compilation task information for any shader, wherein the compilation task information includes reference information, and the reference information is used to reference an external code file in the compilation task, and the external code file is a code file defined outside any shader; A reference module is configured to obtain an external code file based on the reference information, and merge the external code file into the compilation task information to obtain update task information; The compiling module is configured to schedule the compiling cluster to execute the corresponding compiling task based on the updated task information of each shader, wherein each shader is a shader corresponding to the rendering engine, and each shader includes any of the shaders.

[0008] According to a third aspect of an embodiment of the present invention, there is provided a computing device, including: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned shader compilation method are implemented.

[0009] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program / instruction, and the computer program / instruction implements the steps of the above-mentioned shader compilation method when executed by a processor.

[0010] According to a fifth aspect of an embodiment of the present invention, there is provided a computer program product, comprising a computer program / instruction, which implements the steps of the above-mentioned shader compilation method when executed by a processor.

[0011] An embodiment of the present invention implements the acquisition of compilation task information for any shader in response to a pre-compilation instruction sent by a rendering engine, wherein the compilation task information includes reference information, and the reference information is used to reference an external code file in the compilation task, and the external code file is a code file defined outside any shader; the external code file is obtained based on the reference information, and the external code file is incorporated into the compilation task information to obtain update task information; based on the update task information of each shader, the compilation cluster is scheduled to execute the corresponding compilation task, wherein each shader is a shader corresponding to the rendering engine, and each shader includes any shader. By processing the reference information before compilation, all referenced code files are merged into the compilation task information to form a complete and independent compilation task. In this way, the compilation task information no longer depends on the original project file structure or path, and can be executed on any machine. The pre-processed task information is sent to any machine in the compilation cluster for compilation, thereby improving the flexibility and efficiency of compilation, and solving the problems of low efficiency of concurrent compilation and repeated startup of the same content. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 It is a structural interaction diagram of a shader compilation system provided by an embodiment of the present invention; Figure 2 is a flowchart of a shader compilation method provided by one embodiment of the present invention; Figure 3 is a compiling cluster diagram of a shader compiling method provided by an embodiment of the present invention; Figure 4 is a structural schematic diagram of a shader compiling device provided by an embodiment of the present invention; Figure 5 It is a structural block diagram of a computing device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0013] Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present invention, so the present invention is not limited to the specific implementation disclosed below.

[0014] The terms used in one or more embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present invention. The singular forms of "a", "said" and "the" used in one or more embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present invention refers to and includes any or all possible combinations of one or more associated listed items.

[0015] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present invention, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present invention, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0016] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0017] First, the terms involved in one or more embodiments of the present invention are explained.

[0018] Shader: A special program that is executed on a graphics processor to calculate the visual effects of an image. It is mainly used to handle various tasks in graphics rendering, such as vertex transformation, lighting calculation, texture mapping, and pixel shading.

[0019] IPC: Inter-Process Communication. It refers to the method of exchanging data and information between multiple processes in an operating system. Inter-process communication is an important concept in multitasking operating systems, allowing multiple independent processes to work together and share resources and data.

[0020] MD5: Message-Digest Algorithm 5, a widely used hash function that can receive input (such as text or files) and produce a fixed-length 128-bit (16-byte) hash value, usually expressed as a 32-bit hexadecimal number.

[0021] As the complexity of game and application development continues to increase, the scale and resource requirements of projects are also growing. Especially when using game engines such as Unity, development teams are facing more and more challenges. Unity introduced the ShaderGraph graphical tool, making the creation and management of shaders more intuitive and efficient. However, this also brought new problems: the number of shader variants has increased dramatically, resulting in significantly longer compilation times. To meet this challenge, Unity provides a Cache Server feature that aims to speed up subsequent compilation processes by caching compilation results. The Cache Server can upload the shader compilation results to the server after the first compilation is completed, so that it is obtained from the server first when used elsewhere to avoid repeated compilation. This mechanism improves compilation efficiency to a certain extent, but there are still many problems in large projects.

[0022] Although Unity's Cache Server mechanism has alleviated the problem of long compilation time to a certain extent, it still faces many challenges in practical applications, including single point failure and bandwidth limitations. A single Cache Server is often difficult to support the high concurrency requirements of large projects, especially when multiple machines request cached data at the same time. Bandwidth bottlenecks and cache errors become common problems, which not only affects the compilation speed, but may also cause compilation failures, increasing development costs and time. Local compilation overhead is also a problem. When developers edit and modify shaders locally for the first time, it still takes a lot of time to compile because the local compilation environment cannot fully utilize the Cache The cache advantage of the server, each modification requires recompiling the entire shader variant, which seriously affects the development efficiency; in addition, the complexity of distributed compilation cannot be ignored. Since Unity itself does not support distributed compilation, the development team usually needs to design and implement a distributed compilation solution by themselves, which involves deploying the same project on multiple machines and specifying the shader content that each machine is responsible for compiling through configuration or startup parameters. Although this method is suitable for build machines, there are many problems in actual operation. For example, the cost of opening the Unity project on each build machine is very high, which is repetitive work and cannot be effectively solved by increasing the number of machines. Project updates are also a complex and time-consuming process, which is prone to synchronization errors, and task division is not easy. If two different materials use the same shader and are divided into two different build machines, it will lead to repeated compilation and waste of resources; finally, code confidentiality and cloud service restrictions are also an important issue. In most cases, the source code of games and applications needs to be kept confidential and can only be transmitted and stored on the intranet, which limits the ability of development teams to use increasingly developed cloud services for distributed compilation. Although cloud services provide powerful computing resources and flexible scalability, there are strict restrictions on code confidentiality, making distributed compilation solutions difficult to implement.

[0023] In view of the above problems, a shader compilation method is provided in the present invention. The present invention also relates to a shader compilation system, a shader compilation device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.

[0024] See also Figure 1 , Figure 1It is a structural interaction diagram of a shader compilation system provided by an embodiment of the present invention, wherein the shader compilation system includes a rendering engine and a compilation end, wherein the rendering engine is used to send a pre-compilation instruction to the compilation end in response to a user operation; the compilation end is used to perform pre-compilation in response to the pre-compilation instruction sent by the rendering engine, and obtain compilation task information for any shader, wherein the compilation task information includes reference information, and the reference information is used to reference an external code file in the compilation task, and the external code file is a code file defined outside any shader, and the external code file is obtained based on the reference information, and the external code file is incorporated into the compilation task information to obtain update task information, and based on the update task information of each shader, the compilation cluster is scheduled to execute the corresponding compilation task, wherein each shader is a shader corresponding to the rendering engine, and each shader includes any shader.

[0025] Applied to the shader compilation system, the rendering engine responds to user operations and sends pre-compilation instructions to the compilation end. After receiving the pre-compilation instructions, the compilation end performs pre-compilation and obtains compilation task information for any shader. The compilation task information contains reference information. The reference information is used to reference external code files in the compilation task. The external code file refers to a code file defined outside any shader. The compilation end obtains the external code file based on the reference information and incorporates the external code file into the compilation task information to obtain updated task information. The updated task information contains all necessary code files, forming a complete and independent compilation task. In this way, the compilation task information no longer depends on the original project file structure or path, and can be executed on any machine. The pre-processed task information is sent to any machine in the compilation cluster for compilation. The machines in the compilation cluster execute the corresponding compilation tasks according to the scheduling strategy, thereby improving the flexibility and efficiency of compilation and solving the problems of low efficiency of concurrent compilation and repeated startup of the same content.

[0026] See also Figure 2 , Figure 2 It is a flowchart of a shader compilation method provided by an embodiment of the present invention, which specifically includes the following steps.

[0027] Step 202: In response to the pre-compilation instruction sent by the rendering engine, obtain the compilation task information for any shader, wherein the compilation task information includes reference information, and the reference information is used to reference an external code file in the compilation task, and the external code file is a code file defined outside any shader.

[0028] The pre-compilation instruction is a command sent by the rendering engine to trigger the shader compilation task. The compilation task information contains various parameters and configurations required for compilation, including reference information, which is used to reference external code files in the compilation task. These external code files are code files defined outside any shader.

[0029] Definition, in the context of programming, refers to the process of creating a variable, function, class, or other code structure, which includes their declaration (i.e. type and name) and implementation (specific functionality or behavior). When external code files are fully defined and described outside of the shader, it means that those specific features (such as variables, functions, etc.) are first created and written in detail in a separate file. The contents of these files can be thought of as a complete set of tools.

[0030] For any shader, referencing these external files through the #include directive in its compilation task actually includes these pre-defined code snippets, so that the existing functions can be used directly without redefining them again. This method promotes code reuse, reduces the workload of repeated coding, and helps to maintain code consistency and maintainability. In short, "definition" here refers to the completion of the entire process from conception to implementation in a separate file, and other shaders reuse this part of the work through a simple reference mechanism.

[0031] In actual applications, when the rendering engine needs to compile a new shader or recompile an existing shader, a pre-compilation instruction will be sent. After receiving this pre-compilation instruction, the system will start the preparation for the compilation task. First, the system will parse the pre-compilation instruction and extract the compilation task information for any shader. The compilation task information contains a lot of key information, especially reference information, which specifies the external code files that need to be referenced during the compilation process. These external code files usually contain some common shader functions, macro definitions or other auxiliary codes, which are not defined in any shader source file, but stored in other files. The system will find and read the contents of these external code files based on the reference information.

[0032] In a specific embodiment of the present invention, a game engine needs to compile a new shader file shader1.hlsl. The shader file references two external code files common_functions.hlsl and macros.hlsl, which respectively contain some commonly used shader functions and macro definitions. When the game engine sends a pre-compilation instruction, the system will receive the instruction and parse the compilation task information for shader1.hlsl. The compilation task information contains reference information, indicating the external code files common_functions.hlsl and macros.hlsl that need to be referenced. The system will find and read the contents of the two external code files based on the reference information.

[0033] Step 204: Obtain an external code file based on the reference information, and merge the external code file into the compilation task information to obtain update task information.

[0034] In actual applications, the system will preprocess the queried external code files and insert their contents into the compilation task to form a complete compilation task information containing all necessary codes. In this way, the compiler can directly use these preprocessed codes in the subsequent compilation process without having to process each external file separately. In this way, the system can ensure the integrity and consistency of the compilation task and avoid compilation errors caused by missing or inconsistent external code files.

[0035] In a specific embodiment of the present invention, following the above example, the system will pre-process the external code files and insert their contents into shader1.hlsl to form a complete compilation task information. For example, the system may insert the contents of common_functions.hlsl and macros.hlsl into the top of shader1.hlsl to ensure that the compiler can directly access these external codes when compiling shader1.hlsl. In this way, the compiler does not need to process each external file separately during the compilation process, thereby simplifying the compilation process and improving the compilation efficiency.

[0036] Step 206: Based on the updated task information of each shader, schedule the compiling cluster to execute the corresponding compiling task, wherein each shader is a shader corresponding to the rendering engine, and each shader includes any shader.

[0037] The compilation cluster is a group of computing resources used to execute compilation tasks in parallel, which may be multiple physical servers or compilers. Each shader includes at least two shaders, and each shader includes any of the aforementioned shaders.

[0038] Any shader is one of multiple shaders managed by the rendering engine. The compilation task information of any shader contains reference information for referencing external code files. The system obtains external code files based on the reference information, and incorporates them into the compilation task information to generate updated task information. Subsequently, the rendering engine schedules the compilation cluster to execute the compilation tasks of all shaders including any shader based on the updated compilation task information.

[0039] In actual applications, after the system has completed the preprocessing of the compilation task information of each shader and generated the update task information containing all necessary code files, the next step is to schedule the compilation cluster to execute these compilation tasks. The system will assign each compilation task to one or more nodes in the compilation cluster according to the content in the update task information. Each node in the compilation cluster has independent computing power and can process multiple compilation tasks in parallel, thereby greatly improving the compilation efficiency. The system will dynamically assign compilation tasks according to the current cluster's task pull request and the priority of the task. For example, if a node is in an idle state and initiates a request to the system, the system can assign more compilation tasks to the node; if a node is in a task execution state and does not initiate a task request, it means that the node is busy and is executing other compilation tasks. The system will give priority to assigning tasks to other idle nodes to balance the load of the entire cluster. After the task allocation is completed, the nodes in the compilation cluster will execute the corresponding compilation tasks according to the received update task information. During the compilation process, the node will read the code file contained in the update task information, perform syntax checking, optimization, and generate the final compilation result. After the compilation is completed, the node will return the compilation results to the system, and the system will summarize these results to ensure that all compilation tasks are completed successfully.

[0040] In a specific embodiment of the present invention, it is assumed that the system needs to compile three shaders, shader1.hlsl, shader2.hlsl and shader3.hlsl. After preprocessing, the system generates update task information for the three shaders, each of which contains all necessary code files. The system sends these update task information to the compilation cluster for scheduling. It is assumed that the compilation cluster consists of three servers, namely server1, server2 and server3. If server1, server2 and server3 are idle, they will request tasks from the system. If the request is successful, the compilation task of shader1.hlsl will be assigned to server1, the compilation task of shader2.hlsl will be assigned to server2, and the compilation task of shader3.hlsl will be assigned to server3. After each server receives the task, it will read the code file in the update task information and compile it. During the compilation process, the server will perform syntax checking, optimization and generate the final compilation result. After the compilation is completed, each server returns the compilation result to the system. After receiving all the compilation results, the system summarizes them to ensure that all shaders are successfully compiled. In this way, the system can efficiently utilize the computing resources of the compilation cluster, significantly shorten the compilation time, and improve the compilation efficiency.

[0041] It is understandable that if the server cannot request a compilation task, it will enter a period of sleep and continue to make requests to the system after the sleep ends.

[0042] Furthermore, based on the update task information of each shader, the compilation cluster is scheduled to execute the corresponding compilation task, wherein each shader is a shader corresponding to the rendering engine, and each shader includes any shader, including: verifying the update task information to obtain verification information; querying the cache task information in the remote compilation server in the compilation cluster based on the verification information; if the cache task information is not queried, scheduling the target compiler corresponding to the compilation strategy in the compilation cluster to execute the corresponding compilation task.

[0043] The verification information is used to verify the integrity and correctness of the updated task information, and the cached task information refers to the previously compiled task results, which are stored in the remote compilation server of the compilation cluster.

[0044] In actual applications, after receiving the update task information of each shader, the system first verifies it to ensure the integrity and correctness of the task information. The verification process includes checking whether all code files in the update task information exist, whether there are syntax errors, whether the references are correct, etc. The system will perform detailed verification on the update task information of each shader and generate verification information. The verification information will be used for subsequent cache query and compilation task scheduling.

[0045] After the verification is completed, the system will query the cached task information in the remote compile server in the compilation cluster based on the verification information. The remote compile server usually stores the results of previously successfully compiled tasks to avoid repeatedly compiling the same task. The system uses the unique identifier (such as MD5 hash value) in the verification information to query the cached task information. If the query is successful, that is, the cached task information that matches the current updated task information is found, the system will directly return the cached result without the need to compile again. This step can significantly reduce compilation time and resource consumption.

[0046] If no cached task information is found in the remote compilation server, the system will schedule the target compiler corresponding to the compilation strategy in the compilation cluster to execute the corresponding compilation task. The compilation strategy can be based on a comprehensive consideration of factors such as task priority, compiler pull request sending, and compilation time. The system will select a suitable compiler node and send the compilation task to the node. The compiler node will read the code file in the update task information, perform syntax checking, optimization, and generate the final compilation result. After the compilation is completed, the compilation result will be returned to the system and stored in the remote compilation server so that subsequent tasks can use the cached result.

[0047] In a specific embodiment of the present invention, it is assumed that the system needs to compile three shaders, shader1.hlsl, shader2.hlsl and shader3.hlsl. After preprocessing, the system generates update task information for the three shaders, and each update task information contains all necessary code files. The system first verifies each update task information and generates verification information. It is assumed that the verification result shows that all task information is correct. The system then queries the cache task information in the remote compilation server based on the MD5 hash value in the verification information. It is assumed that the query of the cache task information of shader1.hlsl is successful, and the system directly returns the cache result without re-compilation. For shader2.hlsl and shader3.hlsl, it is assumed that the cache task information is not queried, and the system will schedule the target compiler in the compilation cluster to perform the compilation task. It is assumed that the compilation cluster consists of three servers, namely server1, server2 and server3. The system assigns the compilation task of shader2.hlsl to server1 and the compilation task of shader3.hlsl to server2 according to the initiation of the pull request of each compiler in the current cluster. After receiving the task, each server will read the code file in the updated task information and compile it. After the compilation is completed, each server returns the compilation results to the system and stores the results in the remote compilation server. After the system receives all the compilation results, it summarizes them to ensure that all shaders are successfully compiled.

[0048] Based on this, by scheduling the compilation cluster to execute the corresponding compilation tasks based on the updated task information of each shader, the system can make full use of the parallel computing capabilities of the cluster and efficiently complete the compilation tasks. Verification processing ensures the correctness of task information, and cache query reduces repeated compilation and improves compilation efficiency. Reasonable scheduling of compilation strategies enables compilation tasks to be evenly distributed, avoids single-point overload, and ensures the efficiency and reliability of the compilation process. The system can manage and schedule compilation tasks more flexibly to adapt to compilation requirements of different scales and complexities.

[0049] Furthermore, the compilation strategy is serial compilation; the target compiler corresponding to the compilation strategy in the scheduling compilation cluster executes the corresponding compilation task, including: compressing the task information of the update task to obtain compressed task information, and uploading the compressed task information to the remote compilation server so that the remote compilation server caches the update task information; scheduling the first compiler in the compilation cluster to execute the corresponding compilation task.

[0050] The remote compile server is used to store and manage cache information of the compile task. The first compiler refers to a specific compiler in the compile cluster that is responsible for executing the local compile task.

[0051] In actual applications, after receiving the update task information of each shader, the system first compresses it to reduce transmission bandwidth and storage space. Compression usually uses a standard compression algorithm (such as gzip or zlib) to compress the update task information to generate compressed task information. The compressed task information will contain all necessary code files and compilation parameters, but the space occupied is significantly reduced. The system uploads the compressed task information to the remote compilation server so that the remote compilation server can cache the update task information. The caching mechanism ensures that in future compilation tasks, if the same task information is encountered, the result can be directly obtained from the cache to avoid repeated compilation.

[0052] After the compression and upload are completed, the system will schedule the first compiler in the compilation cluster to perform the corresponding compilation task. The first compiler is the designated compiler in the compilation cluster and is responsible for processing the current compilation task. The system will decompress the compressed task information and pass it to the first compiler. The first compiler will read the code file in the decompressed update task information, perform syntax checking, optimization, and generate the final compilation result. After the compilation is completed, the first compiler will return the compilation result to the system and store the result in the remote compilation server so that subsequent tasks can use the cached result.

[0053] In a specific embodiment of the present invention, it is assumed that the system needs to compile three shaders, shader1.hlsl, shader2.hlsl and shader3.hlsl. After preprocessing, the system generates update task information for the three shaders, each of which contains all necessary code files. The system first compresses each update task information to generate compressed task information. It is assumed that the compression process uses the gzip algorithm, and the generated compressed task information significantly reduces the file size. The system uploads the compressed task information to the remote compilation server, and the remote compilation server decompresses and caches the compressed task information after receiving it. Next, the system schedules the first compiler in the compilation cluster to perform the compilation task. It is assumed that there is only one compiler node compiler1 in the compilation cluster, and the system decompresses the compressed task information of the first compilation task shader1.hlsl and passes it to compiler1. Compiler1 reads the code file in the decompressed update task information and compiles it. After the compilation is completed, compiler1 returns the compilation result to the system and stores the result in the remote compilation server. The system then decompresses the compressed task information of the second compilation task shader2.hlsl and passes it to compiler1, repeating the above compilation process. Finally, the system decompresses the compressed task information of the third compilation task shader3.hlsl and passes it to compiler1, completing all compilation tasks.

[0054] Based on this, by using the compilation strategy of serial compilation, the system can ensure that compilation tasks are executed in sequence, avoiding resource competition and conflicts that may be caused by parallel compilation. Compression processing and caching mechanisms reduce transmission bandwidth and storage space, and improve compilation efficiency. The first compiler in the compilation cluster is scheduled to execute compilation tasks, ensuring the efficiency and reliability of the compilation process. The system can manage and schedule compilation tasks more flexibly to adapt to compilation requirements of different scales and complexities.

[0055] Furthermore, the compilation strategy is parallel compilation; the target compiler corresponding to the compilation strategy in the scheduling compilation cluster executes the corresponding compilation task, including: compressing the task information of the update task to obtain compressed task information, and uploading the compressed task information to the remote compilation server so that the remote compilation server caches the update task information; generating concurrent task information based on the update task information, and sending the concurrent task information to the remote compilation server so that the remote compilation server calls multiple second compilers in the compilation cluster to concurrently execute the corresponding compilation tasks.

[0056] The second compiler refers to a plurality of compilers in the compilation cluster that are responsible for remotely executing concurrent compilation tasks.

[0057] In actual applications, after receiving the update task information of each shader, the system first compresses it to reduce transmission bandwidth and storage space. Compression usually uses a standard compression algorithm (such as gzip or zlib) to compress the update task information to generate compressed task information. The compressed task information will contain all necessary code files and compilation parameters, but the space occupied is significantly reduced. The system uploads the compressed task information to the remote compilation server so that the remote compilation server can cache the update task information. The caching mechanism ensures that in future compilation tasks, if the same task information is encountered, the result can be directly obtained from the cache to avoid repeated compilation.

[0058] After compression and uploading, the system will generate concurrent task information based on the update task information. Concurrent task information is to split a large compilation task into multiple subtasks for parallel execution. The system will split the update task information into multiple subtasks based on the complexity of the compilation task and the available resources of the compilation cluster, and generate the corresponding concurrent task information. These concurrent task information will contain the specific compilation parameters and code files of each subtask.

[0059] The system sends the concurrent task information to the remote compilation server. After receiving the concurrent task information, the remote compilation server will call multiple second compilers in the compilation cluster to concurrently execute the corresponding compilation tasks. Each second compiler will read the code file in the concurrent task information, perform syntax checking, optimization, and generate the final compilation results. After the compilation is completed, each second compiler returns the compilation results to the remote compilation server, which summarizes these results and returns them to the system. After receiving all the compilation results, the system summarizes them to ensure that all compilation tasks are successfully completed.

[0060] In a specific embodiment of the present invention, it is assumed that the system needs to compile three shaders, shader1.hlsl, shader2.hlsl and shader3.hlsl. After preprocessing, the system generates update task information for the three shaders, and each update task information contains all necessary code files. The system first compresses each update task information to generate compressed task information. It is assumed that the compression process uses the gzip algorithm, and the generated compressed task information significantly reduces the file size. The system uploads the compressed task information to a remote compilation server, and after receiving the compressed task information, the remote compilation server decompresses and caches it.

[0061] Next, the system generates concurrent task information based on the updated task information. Assume that the system splits the compilation task of each shader into two subtasks and generates six concurrent task information. The system sends these six concurrent task information to the remote compilation server. After receiving the concurrent task information, the remote compilation server calls multiple second compilers in the compilation cluster to concurrently execute the corresponding compilation tasks. Assume that there are four compiler nodes compiler1, compiler2, compiler3 and compiler4 in the compilation cluster, and the system assigns the concurrent task information to these compiler nodes. Each compiler node reads the code file in the concurrent task information and compiles it. After the compilation is completed, each compiler node returns the compilation results to the remote compilation server, which summarizes these results and returns them to the system. After receiving all the compilation results, the system summarizes them to ensure that all shaders are successfully compiled.

[0062] Based on this, by using the compilation strategy of parallel compilation, the system can make full use of the parallel computing capabilities of the compilation cluster and complete the compilation task efficiently.

[0063] Furthermore, the concurrent task information is sent to the remote compilation server so that the remote compilation server calls multiple second compilers in the compilation cluster to concurrently execute corresponding compilation tasks, including: sending the concurrent task information to the remote compilation server so that the remote compilation server determines multiple second compilers based on the concurrent task information; receiving the compilation task result returned by the remote compilation server, wherein the compilation task result is obtained by parallel compilation of the multiple second compilers.

[0064] In actual applications, after the system generates concurrent task information, it sends this information to the remote compilation server. After receiving the concurrent task information, the remote compilation server will determine multiple second compilers based on this information. The remote compilation server will select the appropriate second compiler to execute these concurrent tasks based on the initiation of each compiler pull request in the current cluster, the availability of the compiler, and the priority of the task. For example, if a compiler node is idle and initiates a task pull request, the system will give priority to this node to execute the task. After each second compiler receives the concurrent task information, it will read the code file in the task, perform syntax checking, optimization, and generate the final compilation result.

[0065] After the compilation is completed, each second compiler returns the compilation results to the remote compilation server. The remote compilation server summarizes these results and returns the final compilation task results to the system. After receiving the compilation task results returned by the remote compilation server, the system summarizes and verifies them to ensure that all compilation tasks are successfully completed. In this way, the system can efficiently manage and schedule compilation tasks, fully utilize the parallel computing capabilities of the compilation cluster, and improve compilation efficiency.

[0066] In a specific embodiment of the present invention, it is assumed that the system needs to compile three shaders, shader1.hlsl, shader2.hlsl, and shader3.hlsl. After preprocessing, the system generates update task information for the three shaders and splits it into multiple concurrent task information. It is assumed that the compilation task of each shader is split into two subtasks, and a total of six concurrent task information is generated. The system sends these six concurrent task information to the remote compilation server.

[0067] After receiving the concurrent task information, the remote compile server determines multiple second compilers based on the information. Assume that there are four compiler nodes compiler1, compiler2, compiler3, and compiler4 in the compile cluster. The remote compile server assigns the concurrent task information to these compiler nodes based on the initiation of the pull request of each compiler in the current cluster. For example, compiler1 may be assigned two subtasks, compiler2 may be assigned two subtasks, and compiler3 and compiler4 may each be assigned one subtask.

[0068] After receiving the concurrent task information, each compiler node reads the code file in the task and compiles it. After the compilation is completed, each compiler node returns the compilation results to the remote compilation server. The remote compilation server summarizes these results and returns the final compilation task results to the system. After the system receives the compilation task results returned by the remote compilation server, it summarizes and verifies them to ensure that all compilation tasks are successfully completed. In this way, the system can efficiently utilize the parallel computing capabilities of the compilation cluster, significantly shorten the compilation time, and improve the compilation efficiency.

[0069] Based on this, the compilation efficiency is improved, the reliability and consistency of the compilation tasks are ensured, and the compilation requirements of different scales and complexities are adapted.

[0070] Furthermore, the concurrent task information is sent to the remote compilation server so that the remote compilation server determines multiple second compilers based on the concurrent task information, including: sending the concurrent task information to the remote compilation server so that the remote compilation server adds the concurrent task information to a queue to be compiled, and when the remote compilation server receives a pull request sent by the proxy server, the remote compilation server forwards the concurrent task information in the queue to be compiled to the multiple second compilers through the proxy server, wherein the multiple second compilers are used to execute corresponding compilation tasks based on the concurrent task information.

[0071] The proxy server is used to forward and manage tasks between the remote compilation server and the second compiler.

[0072] In actual applications, after the system generates concurrent task information, it sends this information to the remote compile server. After receiving the concurrent task information, the remote compile server adds it to the queue to be compiled. The queue to be compiled is a queue used to store and manage compilation tasks to ensure that tasks are processed in order. The remote compile server periodically checks the tasks in the queue to be compiled and waits for pull requests sent by the proxy server.

[0073] When the proxy server sends a pull request, the remote compilation server will take out the concurrent task information from the queue to be compiled and forward it to multiple second compilers through the proxy server. After receiving the concurrent task information, the proxy server will select the appropriate second compiler to execute these tasks based on the initiation of the pull request of each compiler in the current compilation cluster and the availability of the compiler. After receiving the concurrent task information, each second compiler will read the code file in the task, perform syntax checking, optimization, and generate the final compilation result.

[0074] After the compilation is completed, each second compiler returns the compilation results to the proxy server, and the proxy server returns the results to the remote compilation server. The remote compilation server summarizes these results and returns the final compilation task results to the system. After receiving the compilation task results returned by the remote compilation server, the system summarizes and verifies them to ensure that all compilation tasks are successfully completed.

[0075] In a specific embodiment of the present invention, it is assumed that the system needs to compile three shaders, shader1.hlsl, shader2.hlsl, and shader3.hlsl. After preprocessing, the system generates update task information for the three shaders and splits it into multiple concurrent task information. It is assumed that the compilation task of each shader is split into two subtasks, and a total of six concurrent task information is generated. The system sends these six concurrent task information to the remote compilation server.

[0076] After receiving the concurrent task information, the remote compilation server adds it to the queue to be compiled. Assume that the proxy server sends a pull request to the remote compilation server every certain period of time (such as 10 seconds). When the proxy server sends a pull request, the remote compilation server takes out the concurrent task information from the queue to be compiled and forwards the task information to multiple second compilers through the proxy server. Assume that there are four compiler nodes compiler1, compiler2, compiler3 and compiler4 in the compilation cluster. The proxy server assigns the concurrent task information to these compiler nodes according to the initiation of the pull request of each compiler in the current cluster. For example, compiler1 may be assigned two subtasks, compiler2 may be assigned two subtasks, and compiler3 and compiler4 may each be assigned one subtask.

[0077] After receiving the concurrent task information, each compiler node reads the code file in the task and compiles it. After the compilation is completed, each compiler node returns the compilation result to the proxy server, and the proxy server returns the result to the remote compilation server. The remote compilation server summarizes these results and returns the final compilation task result to the system. After the system receives the compilation task results returned by the remote compilation server, it summarizes and verifies them to ensure that all compilation tasks are successfully completed. In this way, the system can efficiently utilize the parallel computing capabilities of the compilation cluster, significantly shorten the compilation time, and improve the compilation efficiency.

[0078] Based on this, the compilation efficiency is improved, and through centralized management and distributed execution, resource utilization is optimized, the waiting time of compilation tasks is reduced, and the overall performance and response speed of the system are further improved. The system can respond to large-scale compilation tasks more flexibly, ensuring that the compilation capability is still efficient and stable under high load conditions.

[0079] An embodiment of the present invention implements a method of obtaining compilation task information for any shader in response to a pre-compilation instruction sent by a rendering engine, wherein the compilation task information includes reference information, and the reference information is used to reference an external code file in the compilation task, and the external code file is a code file defined outside any shader; obtaining the external code file based on the reference information, and incorporating the external code file into the compilation task information to obtain update task information; scheduling the compilation cluster to execute the corresponding compilation task based on the update task information of each shader, wherein each shader is a shader corresponding to the rendering engine, and each shader includes any shader. By processing the reference information before compilation, all referenced code files are merged into the compilation task information to form a complete and independent compilation task. In this way, the compilation task information no longer depends on the original project file structure or path, and can be executed on any machine. The pre-processed task information is sent to any machine in the compilation cluster for compilation, thereby improving the flexibility and efficiency of compilation, and solving the problems of low efficiency of concurrent compilation and repeated startup of the same content.

[0080] The following combination Figure 3 , taking the application of the shader compilation method provided by the present invention in the Unity rendering engine as an example, the shader compilation method is further described. Figure 3 It is a compilation cluster diagram of a shader compilation method provided by an embodiment of the present invention.

[0081] All compilers in the compilation cluster include seven configuration options, including SkipCompile: whether to skip compilation; DebugOuput: whether to output debugging information; UseCompileServer: whether to use remote compilation service; AgentMode: agent mode; ShaderCompileServeIP: remote compilation server address (IP+port); UploadPreProcessShader: whether to upload pre-processed Shader; QueryCompileCached: whether to query cached compilation results.

[0082] When configuring whether to skip compilation: false, whether to use remote compilation service: true, proxy mode: false, whether to upload preprocessed Shader: true, whether to query cached compilation results: true, the compilation cluster is in daily working mode, that is, serial compilation mode. In this mode, Unity starts the corresponding number of first compilers according to the number of machine cores, and then the first compiler starts and reads the above daily working mode configuration. After reading, the first compiler and the Unity process establish an IPC connection, and communicate for verification. Unity sends the Shader compilation task to the first compiler through IPC. The first compiler preprocesses the compilation task data, expands all the include content in the Shader file (that is, the aforementioned reference information), and obtains the Shader file and compilation parameters for the final compilation. At this time, the True branch of "Whether to query cached compilation results" takes effect. The first compiler calculates the MD5 of the above final Shader file and uses this MD5 to query the remote compilation server. If the query is successful, the query result is directly returned (IPC transmission to Unity), and the compilation ends. Otherwise, the True branch of "Whether to upload preprocessed Shader" takes effect, compresses the final Shader file, and uploads it to the remote compilation server (an upload thread is started here, which does not affect the next Shader compilation). Finally, the False branch of "Whether to skip compilation" takes effect, compiles the Shader locally, and returns the compilation result.

[0083] When the configuration is "Skip compilation": true, and other configurations are the same as the daily working mode, edit the cluster to parallel compilation mode. Compared with the daily working mode, in parallel compilation mode, only the True branch of "Skip compilation" takes effect, and the shader file is sent to the remote compilation server.

[0084] The remote compilation server, in the daily working mode, uses MD5 to query cache data from Redis for the received query MD5 and returns the query results. In the parallel compilation mode, it receives the Shader compilation task (including compilation parameters and preprocessed Shader completion files) and MD5 code sent by the first compiler; then the Shader compilation task calculates the MD5 code. If the MD5 does not match, an error is reported and it returns directly. Otherwise, MD5 is used to query from Redis. If the query is successful, the task is ignored and returned directly. Otherwise, MD5 is used to query from the global dictionary. If the query is successful, the task is ignored and returned directly. Otherwise, the task is added to the global dictionary and the queue to be compiled and returned.

[0085] In parallel mode, the remote compilation server receives the proxy server pull request, the incoming number parameter N carried in the pull request, obtains N tasks from the queue to be compiled, and returns them. If the number of tasks is insufficient, the remaining tasks are returned. After the second compiler in the proxy server completes the compilation, it receives the compilation result returned by the proxy server, writes the result to Redis, and removes it from the global dictionary.

[0086] The proxy server is used to start the server and read the configuration of "AgentMode" as True, send a pull request to the remote compilation server, pull task time interval N, the number of Shader compilers M, start M Shader compilation threads, enter the next main loop, if there is no compilation task at present, and N seconds have passed without pulling, query and pull the compilation task from the remote Shader compilation server, and add the compilation task to the queue to be compiled, otherwise sleep for 1 second. In the specific parallel compilation process, the proxy server obtains a task from the queue to be mutated. If there is no task, it sleeps for 100 milliseconds. If there is a task, it starts the second compiler (proxy mode), waits for the compilation to end, reads the compilation result, and uploads it to the remote Shader compilation server.

[0087] The second compiler is used for parallel compilation. The configuration is: whether to skip compilation: false, proxy mode: true, and all other false. The proxy server starts the second compiler and passes in the input path and output path of the shader file to be compiled in the startup parameters; the second compiler starts and reads the configuration. The second compiler reads the shader file according to the startup parameters and compiles it, and writes the compilation result to the output path in the startup parameters and returns it to the proxy server.

[0088] Applied to the shading compilation method, the compilation task is decoupled by implementing Shader compilation preprocessing, so that Shader compilation can be performed on any machine. At the same time, by introducing Shader compilation cache, repeated Shader compilation is avoided, greatly improving the response speed of Shader compilation. By introducing compression, the transmission bandwidth is reduced, further improving the compilation efficiency. By means of proxy pull, a compilation cluster is realized, which can simply and efficiently expand the compilation server, thereby utilizing more computing resources. Through the above benefits, Shader compilation can be conveniently uploaded to the cloud, and the idle machines of the cloud host can be used for Shader compilation, which saves machine costs and improves compilation efficiency. In addition, by introducing the task dispatching mode, tasks are quickly generated, which improves the upper limit of the efficiency of daily build tasks.

[0089] Corresponding to the above method embodiment, the present invention also provides a shader compilation device embodiment, Figure 4 FIG. 1 is a schematic diagram of the structure of a shader compilation device provided by an embodiment of the present invention. Figure 4 As shown, the device comprises: The acquisition module 402 is configured to acquire the compilation task information for any shader in response to the pre-compilation instruction sent by the rendering engine, wherein the compilation task information includes reference information, and the reference information is used to reference an external code file in the compilation task, and the external code file is a code file defined outside any shader; The reference module 404 is configured to obtain an external code file based on the reference information, and incorporate the external code file into the compilation task information to obtain the update task information; The compiling module 406 is configured to schedule the compiling cluster to execute the corresponding compiling task based on the updated task information of each shader, wherein each shader is a shader corresponding to the rendering engine, and each shader includes any shader.

[0090] Optionally, the compilation module 406 is further configured to verify the updated task information to obtain verification information; query cached task information in a remote compilation server in the compilation cluster based on the verification information; and if no cached task information is found, schedule the target compiler corresponding to the compilation strategy in the compilation cluster to execute the corresponding compilation task.

[0091] Optionally, the compilation module 406 is further configured to compress the task information of the update task to obtain compressed task information, and upload the compressed task information to the remote compilation server so that the remote compilation server caches the update task information; and schedule the first compiler in the compilation cluster to execute the corresponding compilation task.

[0092] Optionally, the compilation module 406 is further configured to compress the update task information to obtain compressed task information, and upload the compressed task information to the remote compilation server so that the remote compilation server caches the update task information; generate concurrent task information based on the update task information, and send the concurrent task information to the remote compilation server so that the remote compilation server calls multiple second compilers in the compilation cluster to concurrently execute corresponding compilation tasks.

[0093] Optionally, the compilation module 406 is further configured to send the concurrent task information to the remote compilation server, so that the remote compilation server determines multiple second compilers based on the concurrent task information; and receive the compilation task result returned by the remote compilation server, wherein the compilation task result is obtained by parallel compilation of the multiple second compilers.

[0094] Optionally, the compilation module 406 is further configured to send the concurrent task information to the remote compilation server, so that the remote compilation server adds the concurrent task information to the queue to be compiled. When the remote compilation server receives a pull request sent by the proxy server, the remote compilation server forwards the concurrent task information in the queue to be compiled to multiple second compilers through the proxy server, wherein the multiple second compilers are used to execute corresponding compilation tasks based on the concurrent task information.

[0095] Applied to the shader compilation device, the acquisition module 402 is configured to respond to the pre-compilation instruction sent by the rendering engine, and obtain the compilation task information for any shader, wherein the compilation task information includes reference information, and the reference information is used to reference an external code file in the compilation task, and the external code file is a code file defined outside any shader; the reference module 404 is configured to obtain the external code file based on the reference information, and merge the external code file into the compilation task information to obtain the updated task information, so that the compilation task information contains all the necessary code files, forming a complete and independent compilation task, and the compilation task information no longer depends on the original project file structure or path, and can be executed on any machine; the compilation module 406 is configured to schedule the compilation cluster to execute the corresponding compilation task based on the updated task information of each shader, and the pre-processed task information is sent to any machine in the compilation cluster for compilation, thereby improving the flexibility and efficiency of the compilation, and solving the problems of low efficiency of concurrent compilation and repeated startup of the same content.

[0096] The above is a schematic scheme of a shader compilation device of this embodiment. It should be noted that the technical scheme of the shader compilation device and the technical scheme of the shader compilation method described above belong to the same concept, and the details of the technical scheme of the shader compilation device that are not described in detail can all be referred to the description of the technical scheme of the shader compilation method described above.

[0097] Figure 5 The block diagram of a computing device 500 provided according to an embodiment of the present invention is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.

[0098] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).

[0099] In one embodiment of the present invention, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present invention. Those skilled in the art may add or replace other components as needed.

[0100] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 500 may also be a mobile or stationary server.

[0101] The processor 520 is used to execute the following computer program / instruction, which implements the steps of the above-mentioned shader compilation method when executed by the processor.

[0102] Each embodiment of the present invention is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computing device embodiment, since it is basically similar to the shader compilation method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the shader compilation method embodiment.

[0103] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned shader compilation method when executed by a processor.

[0104] Each embodiment of the present invention is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computer-readable storage medium embodiment, since it is basically similar to the shader compilation method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the shader compilation method embodiment.

[0105] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned shader compilation method when executed by a processor.

[0106] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned shader compilation method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned shader compilation method.

[0107] The above describes specific embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0108] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0109] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the described action sequence, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of the present invention.

[0110] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0111] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of the present invention. The present invention selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.

Claims

1. A shader compilation method, characterized in that: include: In response to the pre-compilation instruction sent by the rendering engine, obtaining compilation task information for any shader, wherein the compilation task information includes reference information, and the reference information is used to reference an external code file in the compilation task, and the external code file is a code file defined outside of the any shader; Acquire the external code file based on the reference information, and merge the external code file into the compile task information to obtain update task information; Based on the updated task information of each shader, the compiling cluster is scheduled to execute the corresponding compiling task, wherein each shader is a shader corresponding to the rendering engine, and each shader includes any one of the shaders.

2. The method according to claim 1, characterized in that The updating task information of each shader is used to schedule the compilation cluster to execute the corresponding compilation task, including: Performing verification processing on the update task information to obtain verification information; Based on the verification information, query cache task information in a remote compile server in the compile cluster; When no cached task information is found, the target compiler corresponding to the compilation strategy in the compilation cluster is scheduled to execute the corresponding compilation task.

3. The method according to claim 2, characterized in that The compilation strategy is serial compilation; the target compiler corresponding to the compilation strategy in the scheduling compilation cluster executes the corresponding compilation task, including: Compressing the task information of the update task to obtain compressed task information, and uploading the compressed task information to the remote compiling server so that the remote compiling server caches the update task information; The first compiler in the compilation cluster is scheduled to execute the corresponding compilation task.

4. The method according to claim 2, characterized in that: The compilation strategy is parallel compilation; the target compiler corresponding to the compilation strategy in the scheduling compilation cluster executes the corresponding compilation task, including: Compressing the task information of the update task to obtain compressed task information, and uploading the compressed task information to the remote compiling server so that the remote compiling server caches the update task information; Concurrent task information is generated based on the updated task information, and the concurrent task information is sent to the remote compile server, so that the remote compile server calls multiple second compilers in the compile cluster to concurrently execute corresponding compile tasks.

5. The method according to claim 4, characterized in that The sending the concurrent task information to the remote compile server so that the remote compile server calls multiple second compilers in the compile cluster to concurrently execute corresponding compile tasks includes: Sending the concurrent task information to the remote compile server, so that the remote compile server determines a plurality of second compilers based on the concurrent task information; Receive the compilation task result returned by the remote compilation server, wherein the compilation task result is obtained by parallel compilation by the multiple second compilers.

6. The method according to claim 5, characterized in that The sending the concurrent task information to the remote compile server so that the remote compile server determines a plurality of second compilers based on the concurrent task information includes: The concurrent task information is sent to the remote compilation server so that the remote compilation server adds the concurrent task information to a queue to be compiled. When the remote compilation server receives a pull request sent by a proxy server, the remote compilation server forwards the concurrent task information in the queue to be compiled to multiple second compilers through the proxy server, wherein the multiple second compilers are used to execute corresponding compilation tasks based on the concurrent task information.

7. A shader compilation device, characterized in that: include: an acquisition module, configured to acquire, in response to a pre-compilation instruction sent by a rendering engine, compilation task information for any shader, wherein the compilation task information includes reference information, and the reference information is used to reference an external code file in the compilation task, and the external code file is a code file defined outside of the any shader; a reference module configured to obtain the external code file based on the reference information, and merge the external code file into the compilation task information to obtain update task information; The compiling module is configured to schedule the compiling cluster to execute the corresponding compiling task based on the updated task information of each shader, wherein each shader is a shader corresponding to the rendering engine, and each shader includes any of the shaders.

8. A computing device, characterized in that include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the shader compilation method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which, when executed by a processor, implements the steps of the shader compilation method described in any one of claims 1 to 6.

10. A computer program product, characterized in that The invention comprises a computer program / instruction, which, when executed by a processor, implements the steps of the shader compilation method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Distributed compiling method and system, master server and storage medium

    CN113885875A

  • Code injection method and system for compiling description file and electronic equipment

    CN115617343A

  • Compiling method, device and equipment and computer readable storage medium

    CN117076111A

  • Method and device for processing shading language, storage medium and electronic equipment

    CN117270962A

  • Data processing method and device

    CN117971233A

Cited By

  • Shader adjusting method and device, computer equipment and storage medium

    CN120953463A