Image resource loading method and device, equipment, storage medium and program product

By using the GPU for image resource loading, converting resource reading instructions, and combining them with a data decompression module, the problem of CPU resource contention is solved, improving loading efficiency and user experience.

CN121209786APending Publication Date: 2025-12-26MOORE THREADS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511314350.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-12
Publication Date
2025-12-26

AI Technical Summary

Technical Problem

In existing game engines, relying on the CPU for resource decompression leads to severe CPU resource contention, affecting main thread performance, creating loading bottlenecks, reducing available computing power, causing frame rate fluctuations and stuttering, and impacting user experience.

Method used

The graphics processing unit (GPU) is used as the main execution body for loading image resources. It receives resource loading instructions, converts them into resource reading instructions, reads from memory and writes to the target video memory area, and performs parallel processing in conjunction with the data decompression module, avoiding CPU involvement.

Benefits of technology

Reduce CPU load, improve image resource loading efficiency, reduce frame rate fluctuations and stuttering, and enhance user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121209786A_ABST
    Figure CN121209786A_ABST
Patent Text Reader

Abstract

The invention provides an image resource loading method and device, equipment, a storage medium and a program product, the method is applied to a graphics processor of electronic equipment, and the method comprises the steps of converting a resource loading instruction into a resource reading instruction under the condition that the resource loading instruction for a to-be-rendered image is received; and reading a target image resource corresponding to the to-be-rendered image from a memory of the electronic equipment based on the resource reading instruction, and writing the target image resource into a target video memory area of the graphics processor, so that the graphics processor renders the to-be-rendered image according to the target image resource. According to the embodiment of the invention, the load and resource occupation of the central processing unit can be reduced, and the image resource loading efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of image processing, and particularly relates to an image resource loading method and device, electronic equipment, computer readable storage medium and computer program product. BACKGROUND

[0002] With the continuous development of computer graphics technology and game engines, the content of modern electronic games is increasingly rich, and the volume and complexity of game resources (such as textures, models, audio, animations, scene data, etc.) have significantly increased. In order to reduce storage space occupation and improve distribution efficiency, game resources are usually stored in a compressed format. During game running, when a specific resource needs to be loaded, the system needs to first read it from the storage medium (such as a hard disk, an SSD or a network) to the memory and perform decompression processing, and then it can be used by the rendering engine or other modules.

[0003] At present, most game engines use a central processing unit (CPU) as the main computing unit for resource decompression. Specifically, when the game is running, the main thread or a special resource loading thread calls the CPU to execute the decompression algorithm to restore the compressed game resources to the original format that can be directly accessed by the graphics processing unit (GPU) or application.

[0004] However, relying on the CPU and the file system for resource decompression and loading will occupy a large amount of CPU resources, increase the CPU load, and the game resource loading efficiency is low. Especially when dynamically loading game resources, the CPU needs to invest a large number of computing cycles for decompression, which leads to a decrease in available computing power, which may cause frame rate fluctuations, response delays or even freezing phenomena, and seriously affects the user experience. SUMMARY

[0005] The present disclosure provides an image resource loading method and device, electronic equipment, computer readable storage medium and computer program product.

[0006] In a first aspect, the present disclosure provides an image resource loading method applied to a graphics processing unit of an electronic device, comprising:

[0007] In the case of receiving a resource loading instruction for a to-be-rendered image, the resource loading instruction is converted into a resource reading instruction;

[0008] Based on the resource reading instruction, the target image resource corresponding to the to-be-rendered image is read from the memory of the electronic device, and the target image resource is written into the target video memory area of the graphics processing unit, so that the graphics processing unit renders the to-be-rendered image according to the target image resource.

[0009] In a second aspect, the present disclosure provides an image resource loading apparatus applied to a graphics processor of an electronic device, comprising:

[0010] a conversion module configured to convert the resource loading instruction into a resource reading instruction in a case where the resource loading instruction for a to-be-rendered image is received;

[0011] a reading module configured to read a target image resource corresponding to the to-be-rendered image from a memory of the electronic device based on the resource reading instruction, and write the target image resource into a target video memory area of the graphics processor, so that the graphics processor renders the to-be-rendered image according to the target image resource.

[0012] In a third aspect, the present disclosure provides an electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the image resource loading method described above.

[0013] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the image resource loading method described above.

[0014] In a fifth aspect, the present disclosure provides a computer program product comprising computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device performs the image resource loading method described above.

[0015] The embodiments provided by the present disclosure take the graphic processor in the electronic device as the execution subject of the image resource loading method, and the central processing unit does not need to participate in the execution process of the image resource loading method, which can greatly reduce the load of the central processing unit and reduce the occupation of the central processing unit resources. The graphic processor can convert the resource loading instruction into a resource reading instruction by receiving the resource loading instruction for the to-be-rendered image, so as to read the target image resource corresponding to the to-be-rendered image from the memory of the electronic device. After the target image resource is written into the target video memory area of the graphic processor, the target image resource is used for subsequent rendering of the to-be-rendered image. The resource loading instruction for the to-be-rendered image is converted into a resource reading instruction in real time, and the target image resource is directly read from the memory in real time based on the resource reading instruction in the case that the electronic device has an image resource loading demand, and is written into the target video memory area of the graphic processor. In this process, the target image resource does not need to be copied multiple times, and the image resource loading efficiency is improved.

[0016] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become apparent to those skilled in the art through the following description. BRIEF DESCRIPTION OF DRAWINGS

[0017] The accompanying drawings are included to provide a further understanding of the present disclosure and constitute a part of the specification, which together with the embodiments of the present disclosure are used to explain the present disclosure and do not constitute a limitation of the present disclosure. The above and other features and advantages will become more apparent to those skilled in the art through the description of the detailed example embodiments by referring to the accompanying drawings, in which:

[0018] Figure 1 A flowchart of an image resource loading method provided for an embodiment of the present disclosure is provided;

[0019] Figure 2 A processing flowchart of an image resource loading method provided for an embodiment of the present disclosure is provided;

[0020] Figure 3 A block diagram of an image resource loading device provided for an embodiment of the present disclosure is provided;

[0021] Figure 4 A block diagram of an electronic device provided for an embodiment of the present disclosure is provided. DETAILED DESCRIPTION

[0022] For those skilled in the art to better understand the technical solutions of the present disclosure, the exemplary embodiments of the present disclosure are described below in conjunction with the drawings, which include various details of the embodiments of the present disclosure to help understanding, and should be considered only as exemplary. Therefore, those skilled in the art should realize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, for the sake of clarity and conciseness, the description below omits the description of well-known functions and structures.

[0023] In the case of no conflict, each embodiment of the present disclosure and each feature in the embodiments can be combined with each other.

[0024] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0025] The terms used herein are only used to describe specific embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the terms "comprise" and / or "consist of, when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. The terms "connected" or "coupled" and / or similar terms are not limited to a physical or mechanical connection, but can include an electrical connection, whether direct or indirect.

[0026] Unless otherwise defined, all terms used herein, including technical and scientific terms, have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in a commonly used dictionary should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and the present disclosure, and should not be interpreted in an idealized or overly formal sense unless expressly so defined herein.

[0027] At present, most game engines use CPU as the main computing unit for resource decompression. When the game is running, the main thread or a dedicated resource loading thread calls the CPU to execute the decompression algorithm to restore the compressed game resource data to the original format that can be directly accessed by the GPU or application.

[0028] However, this technical solution of relying on CPU for resource decompression has several inherent defects:

[0029] First, CPU resource contention is severe, affecting the performance of the main thread. The core tasks of game logic update, physics simulation, AI operation, etc. are executed on the CPU, especially relying on the main thread or a few worker threads. When resource loading occurs (especially large scene switching or dynamic loading), the CPU needs to invest a lot of computing cycles for decompression, resulting in a decrease in available computing power, which may cause frame rate fluctuations, response delays, and even freezing, seriously affecting user experience.

[0030] Second, the decompression process becomes a loading bottleneck, prolonging the resource readiness time. Although modern storage devices (such as NVMe SSD) have high read bandwidth capabilities, the speed of CPU decompression often cannot match the data read speed, forming a performance bottleneck in the "IO-processing" pipeline. This results in a delay in the overall delay from resource request to availability, even though the data has been read.

[0031] In addition, the number of CPU cores is limited, and it is good at serial or light parallel tasks, while resource decompression has a certain parallel potential, but it is difficult to achieve efficient large-scale parallel processing on the CPU. In contrast, GPUs or dedicated hardware acceleration modules have stronger parallel processing capabilities, but in the current related technology, it is difficult to fully utilize the parallel computing capabilities of modern hardware. Therefore, there is an urgent need for a method to overcome the above deficiencies and improve overall system efficiency.

[0032] According to the image resource loading method of the embodiments of the present disclosure, the GPU in the electronic device is used as the execution subject of the image resource loading method, and the CPU does not need to participate in the execution process of the image resource loading method, which can greatly reduce the load of the CPU, reduce the occupation of CPU resources, and avoid affecting the performance of the main thread. The GPU can receive the resource loading instruction for the to-be-rendered image, convert the resource loading instruction into a resource reading instruction, read the target image resource corresponding to the to-be-rendered image from the storage (such as a solid state drive, Solid State Drive, SSD, etc.) of the electronic device, and write the target image resource into the target video memory area of the GPU after the target image resource is written into the target video memory area of the GPU. The target image resource is used for subsequent rendering of the to-be-rendered image, realizing real-time reception of the resource loading instruction for the to-be-rendered image and conversion into the resource reading instruction, real-time reading of the target image resource from the storage based on the resource reading instruction in the case where the electronic device has an image resource loading demand, and writing the target image resource into the target video memory area of the GPU. In this process, the target image resource does not need to be copied multiple times, improving the image resource loading efficiency. In the image resource loading method provided in the embodiments of the present disclosure, a dedicated hardware decompression module is arranged in the GPU, and the GPU and the dedicated hardware decompression module are used in combination to improve the efficiency of reading and decompressing the target image resource from the storage to the target video memory area.

[0033] The execution subject of the image resource loading method provided by the embodiments of the present disclosure can be a graphics processor in an electronic device, and the electronic device can be a terminal device or other processing device, where the terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, and the like. In some possible implementation manners, the image resource loading method can be implemented by a processor calling computer readable program instructions stored in a memory.

[0034] Figure 1 A flowchart of an image resource loading method provided by the embodiments of the present disclosure is provided. Referring to FIG. 1, Figure 1 The method specifically includes the following steps:

[0035] Step 102: In a case where a resource loading instruction for a to-be-rendered image is received, the resource loading instruction is converted into a resource reading instruction.

[0036] The to-be-rendered image refers to an image to be rendered, which can be a game picture to be presented to a user in a game scene, a live picture in a live scene, or a video frame in an animation video, and is specifically determined according to an actual application scenario. The resource loading instruction refers to an instruction constructed by a central processing unit (CPU) for loading a target image resource for rendering the to-be-rendered image to a graphics processing unit (GPU) memory. The resource reading instruction refers to an instruction for reading the target image resource from a memory of an electronic device. The memory of the electronic device can be a solid state disk (SSD) or other memory or disk with a data storage function. The target image resource refers to a resource stored in the memory for loading the to-be-rendered image, for example, a texture resource, a model resource, and the like.

[0037] The image resource loading method provided by the embodiments of the present disclosure can be applied to various scenes of loading image resources, such as a game scene, a live scene, an animation video scene, and the like.

[0038] In actual applications, when it is necessary to load a to-be-rendered image, an application program or an engine corresponding to the to-be-rendered image usually generates a resource loading request, where the resource loading request is a request for loading a target image resource of the to-be-rendered image. The resource loading request usually carries resource parameters for loading the target image resource, and the resource parameters include a resource path, a target video memory address, a target compression format, and data block size and offset. The resource path is used to indicate a storage location of the target image resource in a storage; the target video memory address is used to indicate a target video memory region of the target image resource in a GPU video memory space; the target compression format is a compression format corresponding to the target image resource; and the data block size and offset are a size and an offset of a data block read from the storage based on a resource reading instruction, and are used to jointly determine a data range that needs to be read. The CPU can create a corresponding resource loading instruction according to the resource parameters carried in the resource loading request. In the embodiment of the present disclosure, the CPU sends the created resource loading instruction to the GPU, and the GPU performs subsequent operations, that is, after receiving the resource loading instruction for the to-be-rendered image sent by the CPU, the GPU can convert the resource loading instruction into a resource reading instruction to read the target image resource corresponding to the to-be-rendered image from the storage based on the resource reading instruction. In the process of converting the resource loading instruction into the resource reading instruction, the resource parameters carried in the resource loading instruction are also converted into the resource reading instruction.

[0039] For example, in a game scene, when it is necessary to load a game picture, a corresponding game application program or game engine (such as Unity, Unreal Engine, etc.) usually generates a resource loading request. The CPU creates a corresponding resource loading instruction according to the resource parameters in the resource loading request, and sends the resource loading instruction to the GPU. After receiving the resource loading instruction, the GPU converts the resource loading instruction into a resource reading instruction to read a game resource corresponding to the game picture in a subsequent process.

[0040] Further, in a specific embodiment provided in the present disclosure, converting the resource loading instruction into the resource reading instruction includes:

[0041] invoking a direct storage interface to convert the resource loading instruction into a resource reading instruction supported by the direct storage technology.

[0042] Specifically, by invoking the direct storage interface, the received resource loading instruction is converted into a resource reading instruction supported by the direct storage technology, so as to read the target image resource based on the direct storage technology in a subsequent process.

[0043] The image resource loading method provided by the embodiments of the present disclosure is executed by a GPU. After receiving a resource loading instruction for a to-be-rendered image sent by a CPU, the GPU can convert the resource loading instruction into a resource reading instruction supported by a direct-attached storage interface, so as to realize the transfer of the loading process of the image resource to the GPU and the execution of the GPU, thereby reducing the CPU resource occupation.

[0044] In step 104, the target image resource corresponding to the to-be-rendered image is read from the memory of the electronic device based on the resource reading instruction, and the target image resource is written into the target memory region of the graphics processor.

[0045] After the resource loading instruction is converted into the resource reading instruction, the target image resource corresponding to the to-be-rendered image can be read from the memory of the electronic device based on the resource reading instruction, and the read target image resource can be written into the target memory region of the GPU. The target memory region refers to a memory region in the memory space of the GPU for caching the target image resource, for example, a texture buffer region. After the target image resource of the to-be-rendered image is written into the corresponding target memory region, the GPU can render the to-be-rendered image based on the target image resource in the subsequent rendering process.

[0046] In actual applications, although the GPU can read the target image resource from the memory to decouple the image resource loading process of the CPU, the process still depends on the I / O stack and the file system of Windows, and the processing efficiency is relatively low.

[0047] In the embodiments of the present disclosure, a data decompression module is arranged in the GPU. The data decompression module is a hardware module, for example, an NVIDIA GPU-accelerated Deflate module (NVIDIA GPU-Accelerated Deflate, NVIDIA GDeflate), an AMD SmartAccess storage module, and the like. In the case that the target image resource is in a compressed format, the reading and writing of the target image resource can be performed by the data decompression module in the GPU, so that the parallel execution of the resource reading and writing can be realized, and the processing efficiency can be greatly improved. The specific implementation manner of reading and writing the target image resource based on the data decompression module is as follows:

[0048] In a specific implementation provided by the present disclosure, reading the target image resource corresponding to the to-be-rendered image from the memory of the electronic device based on the resource reading instruction and writing the target image resource into the target memory region of the graphics processor includes:

[0049] reading the target image resource from the memory in response to the resource reading instruction;

[0050] In a case where the format of the target image resource is a compressed format, the target image resource is decompressed in parallel during reading of the target image resource, to obtain a decompressed target image resource;

[0051] The decompressed target image resource is written into the target GPU memory region.

[0052] Specifically, the GPU can read, in response to a resource reading instruction, a target image resource corresponding to an image to be rendered from a memory (for example, an SSD) based on a direct memory access technology (DMA) through a PCIe / NVMe controller, and determine whether the format of the target image resource is a compressed format. If the format of the target image resource is a compressed format, the data decompression module is called to decompress the target image resource in parallel during reading of the target image resource, to obtain a decompressed target image resource, so that the decompression of the target image resource is completed when the reading of the target image resource is completed, and the efficiency of resource reading and decompression is improved. The decompressed target image resource is written into a target GPU memory region of the GPU for subsequent use. If the format of the target image resource is a non-compressed format, the GPU can directly write the read target image resource into the target GPU memory region through a PCIe bus.

[0053] It should be noted that in actual application, the GPU can also directly call the data decompression module to read the target image resource from the memory. At this time, after receiving the resource loading instruction sent by the CPU and converting the resource loading instruction into a resource reading instruction, the GPU sends the resource reading instruction to the data decompression module, so that the data decompression module performs subsequent operations based on the resource reading instruction.

[0054] As described above, the resource loading request generated by the application program or the engine carries resource parameters, including a resource path, a target GPU memory address, a target compression format, and data block size and offset, and correspondingly, the converted resource reading instruction also carries the above resource parameters, so that the GPU can read, decompress, and write the target image resource according to the resource parameters.

[0055] Based on this, in a specific embodiment provided in the present disclosure, the target image resource is read from the memory in response to the resource reading instruction, including:

[0056] The resource path carried in the resource reading instruction is obtained;

[0057] The target image resource corresponding to the image to be rendered is read from the memory based on the resource path.

[0058] Specifically, the GPU or the data decompression module obtains the resource path carried in the resource reading instruction after receiving the resource reading instruction, and determines the storage location of the target image resource in the memory based on the resource path, so as to read the target image resource corresponding to the image to be rendered from the memory.

[0059] The embodiment of the present disclosure realizes that the target image resource corresponding to the image to be rendered can be quickly located in the memory through the resource path carried in the resource reading instruction, and the efficiency of reading the target image resource is improved.

[0060] In a specific implementation provided by the present disclosure, writing the decompressed target image resource into the target GPU memory region includes:

[0061] Obtaining the target GPU memory address carried in the resource reading instruction;

[0062] According to the target GPU memory address, the decompressed target image resource is written into the target GPU memory region corresponding to the target GPU memory address.

[0063] Specifically, the GPU or the data decompression module obtains the target GPU memory address from the resource reading instruction, so as to know the target GPU memory region in the GPU memory space to which the decompressed target image resource needs to be cached. After the decompression of the target image resource is completed, the decompressed target image resource is written into the target GPU memory region corresponding to the target GPU memory address according to the target GPU memory address. Correspondingly, if the target image resource is in a non-compressed format, that is, the target image resource does not need to be decompressed, the target image resource can be directly written into the target GPU memory region corresponding to the target GPU memory address according to the target GPU memory address.

[0064] The embodiment of the present disclosure realizes that the target GPU memory region for caching the decompressed target image resource in the GPU memory space is determined through the target GPU memory address carried in the resource reading instruction, and the decompressed target image resource is written into the target GPU memory region, so as to realize the accuracy of writing the decompressed target image resource.

[0065] In actual application, different target image resources can be compressed into multiple compression formats. In order to further improve the decompression efficiency of the data decompression module on the target image resources in different compression formats, the embodiment of the present disclosure sets multiple data decompression modules of different types in the GPU. Each type of data decompression module can be used to decompress the target image resource in the same compression format. Therefore, in the case that multiple data decompression modules are set in the GPU, the GPU needs to determine the data decompression module to be used this time in the multiple data decompression modules after receiving the resource reading instruction, and then perform subsequent processing. The specific implementation manner is as follows:

[0066] In a specific embodiment provided in the present disclosure, the number of the data decompression modules is multiple, the types of the multiple data decompression modules are different, and the target compression format corresponding to the target image resource is carried in the resource reading instruction;

[0067] Before reading the target image resource corresponding to the image to be rendered from the memory of the electronic device based on the resource reading instruction, the method further includes:

[0068] According to the target compression format, a target data decompression module for processing the target image resource is selected from the multiple data decompression modules, and the resource reading instruction is sent to the target data decompression module, so that the target data decompression module performs the step of reading the target image resource corresponding to the image to be rendered from the memory of the electronic device based on the resource reading instruction and writing the target image resource into the target video memory area of the graphics processor.

[0069] Specifically, after the GPU converts the resource loading instruction into the resource reading instruction, the target compression format carried in the resource reading instruction is obtained, and the type of the data decompression module corresponding to the target compression format is determined. According to the determined type of the data decompression module, a target data decompression module of the type is selected from the multiple data decompression modules, and the resource reading instruction is sent to the target data decompression module, so that the target data decompression module performs the reading, decompression and writing operation of the target image resource based on the resource reading instruction. In actual application, the compression format of the target image resource can be Zstd, LZ4, BC7, etc., and the type of the data decompression module can include NVIDIA GDeflate, AMD SmartAccess, etc., which can be set according to actual application.

[0070] It should be noted that setting multiple data decompression modules in the GPU will increase the design complexity and design cost. In the case where there is no high demand for the processing efficiency and speed of the reading and decompression process of the target image resource, or in the case of pursuing to reduce the design complexity and cost, the present embodiment preferably sets one data decompression module in the GPU.

[0071] The present embodiment can be implemented to set one or more data decompression modules in the GPU, combine the GPU with the data decompression module for use, improve the parallel processing capability of the GPU, and improve the processing efficiency of the reading and decompression of the target image resource.

[0072] Accordingly, in the game scene, the image to be rendered includes the game map to be rendered, and the target image resources include terrain maps and model compressed packages. After writing the terrain maps and model compressed packages into the memory based on the above image resource loading method, the GPU can render the game map to be rendered according to the terrain maps and model compressed packages.

[0073] This embodiment of the disclosure can read and decompress the target image resources corresponding to the game map to be rendered, namely terrain maps and model compressed packages, from the memory in a game scene that is loaded and rendered in real time. Based on the GPU and the data decompression module, the target image resources corresponding to the game map to be rendered are read and decompressed from the memory. The decompressed terrain maps and model compressed packages are written into the target video memory area corresponding to the GPU. Then, the game map to be rendered is rendered based on the terrain maps and model compressed packages in the target video memory area, thereby realizing real-time rendering of the game map and improving the user experience.

[0074] The following is in conjunction with the appendix Figure 2 The image resource loading method provided in the embodiments of this disclosure will be explained in detail below. See also: Figure 2 , Figure 2 This is a flowchart illustrating an image resource loading method provided in an embodiment of this disclosure. Figure 2 As shown, after the game application or game engine generates a resource loading request for the image to be rendered ( Figure 2 (Not shown in the image) The CPU creates a corresponding resource loading instruction based on the resource loading request and sends the instruction to the GPU. The GPU converts the resource loading instruction into a resource read instruction that supports direct-attached memory (DAP) technology by calling the DAP interface. If the GPU only has one data decompression module, it can directly send the resource read instruction to the internal decompression module. The decompression module responds to the resource read instruction by reading the target image resource corresponding to the image to be rendered from the SSD. If the target image resource is in compressed format, it decompresses it in parallel. Simultaneously with reading the target image resource from the SSD, the decompression module also decompresses the target image resource and writes it to the GPU's target memory area. This allows the GPU to render the image based on the target image resource in the target memory area during subsequent rendering. If the GPU has multiple data decompression modules, the GPU needs to select the target data decompression module that corresponds to the target compression format of the image to be rendered from among the multiple data decompression modules according to the target compression format of the image to be rendered carried in the resource read instruction. Then, the resource read instruction is sent to the target data decompression module, and the target data decompression module performs the above-mentioned read, decompress, and write operations on the target image resource to write the decompressed target image resource into the target video memory area of ​​the GPU.

[0075] In practical applications, the target image resource can also be decompressed using only the data decompression module. Figure 2 (Not shown in the image). In this case, the GPU can read the target image resource from the SSD through the PCIe / NVMe controller. If the target image resource is in a compressed format, the GPU calls the data decompression module to decompress the target image resource and write the decompressed target image resource to the target video memory area. If the target image resource is in an uncompressed format, the GPU can write the target image resource to the target video memory area through the PCIe bus.

[0076] The image resource loading method provided in this disclosure is applied to a graphics processor of an electronic device, and includes: upon receiving a resource loading instruction for an image to be rendered, converting the resource loading instruction into a resource reading instruction; reading a target image resource corresponding to the image to be rendered from the memory of the electronic device based on the resource reading instruction, and writing the target image resource into a target video memory area of ​​the graphics processor, so that the graphics processor renders the image to be rendered according to the target image resource.

[0077] This embodiment implements an image resource loading method using the GPU in an electronic device as the execution entity. During the execution of this method, the CPU is not required, significantly reducing CPU load and resource consumption, and avoiding impact on the main thread's performance. The GPU receives resource loading instructions for the image to be rendered, converts these instructions into resource read instructions, and reads the target image resource corresponding to the image to be rendered from the electronic device's memory. The target image resource is then written to the GPU's target video memory area for subsequent rendering. This process eliminates the need for multiple copies of the target image resource, improving image resource loading efficiency and real-time loading efficiency. Simultaneously, during this process, the data decompression module can directly read the target image resource from memory and write it to the GPU's target video memory area in real time based on the resource read instructions. By integrating the data decompression module into the GPU, the efficiency of reading, decompressing, and writing target image resources from memory to the target video memory area is improved.

[0078] It is understood that the various method embodiments mentioned above in this disclosure can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this disclosure will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.

[0079] In addition, the disclosure also provides an image resource loading device, an electronic device, and a computer readable storage medium, which can be used to implement any one of the image resource loading methods provided by the disclosure. The corresponding technical solutions and descriptions are described in the method part and are not repeated here.

[0080] Figure 3 A block diagram of an image resource loading device provided by an embodiment of the disclosure.

[0081] Referring to Figure 3 An image resource loading device provided by an embodiment of the disclosure is applied to a graphics processor of an electronic device, and the device comprises:

[0082] A conversion module 302 is configured to convert a resource loading instruction into a resource reading instruction when the resource loading instruction for a to-be-rendered image is received;

[0083] A reading module 304 is configured to read a target image resource corresponding to the to-be-rendered image from a memory of the electronic device based on the resource reading instruction, and write the target image resource into a target video memory area of the graphics processor, so that the graphics processor renders the to-be-rendered image according to the target image resource.

[0084] Optionally, the reading module 304 is further configured to:

[0085] read the target image resource from the memory in response to the resource reading instruction;

[0086] In a case where a format of the target image resource is a compressed format, decompress the target image resource during reading of the target image resource in parallel to obtain a decompressed target image resource;

[0087] write the decompressed target image resource into the target video memory area.

[0088] Optionally, the resource reading instruction carries a resource path corresponding to the to-be-rendered image, and the resource path is used to indicate a storage location of the target image resource in the memory. The resource path carried in the resource reading instruction is determined according to the resource loading instruction;

[0089] The reading module 304 is further configured to:

[0090] obtain the resource path carried in the resource reading instruction;

[0091] read the target image resource corresponding to the to-be-rendered image from the memory based on the resource path.

[0092] Optionally, the resource reading instruction carries a target video memory address, the target video memory address is used to indicate a target video memory region of the target image resource in a video memory space, and the target video memory address carried in the resource reading instruction is determined according to the resource loading instruction.

[0093] The reading module 304 is further configured to:

[0094] acquire the target video memory address carried in the resource reading instruction;

[0095] write the decompressed target image resource into a target video memory region corresponding to the target video memory address according to the target video memory address.

[0096] Optionally, the graphics processor includes a plurality of data decompression modules, the types of the plurality of data decompression modules are different, the resource reading instruction carries a target compression format corresponding to the target image resource, and the target compression format carried in the resource reading instruction is determined according to the resource loading instruction.

[0097] The device further includes a selection module configured to:

[0098] select a target data decompression module for processing the target image resource from the plurality of data decompression modules according to the target compression format, and send the resource reading instruction to the target data decompression module, so that the target data decompression module performs the steps of reading the target image resource corresponding to the to-be-rendered image from a memory of the electronic device based on the resource reading instruction, and writing the target image resource into a target video memory region of the graphics processor.

[0099] Optionally, the conversion module 302 is further configured to:

[0100] invoke a direct-connection storage interface to convert the resource loading instruction into a resource reading instruction supported by a direct-connection storage technology.

[0101] Optionally, the to-be-rendered image includes a to-be-rendered game map, the target image resource includes a terrain map and a model compression package, and the device further includes a rendering module configured to:

[0102] render the to-be-rendered game map according to the terrain map and the model compression package.

[0103] The image resource loading apparatus provided by the embodiment of the present disclosure is applied to a graphics processor of an electronic device, and includes: a conversion module configured to convert a resource loading instruction into a resource reading instruction in a case where the resource loading instruction for a to-be-rendered image is received; and a reading module configured to read a target image resource corresponding to the to-be-rendered image from a memory of the electronic device based on the resource reading instruction, and write the target image resource into a target video memory area of the graphics processor, so that the graphics processor renders the to-be-rendered image according to the target image resource.

[0104] The embodiment of the present disclosure implements that the GPU in the electronic device is taken as an execution subject of the image resource loading method, and the CPU does not need to participate in the execution process of the image resource loading method, so that the load of the CPU can be greatly reduced, the occupation of the CPU resource is reduced, and the performance of the main thread is avoided from being affected; the GPU can convert the resource loading instruction into the resource reading instruction by receiving the resource loading instruction for the to-be-rendered image, so that the target image resource corresponding to the to-be-rendered image can be read from the memory of the electronic device, and the target image resource is written into the target video memory area of the GPU, so as to be used for subsequent rendering of the to-be-rendered image. In this process, the target image resource does not need to be copied for multiple times, the image resource loading efficiency is improved, and the efficiency of real-time loading of the target image resource is improved. Meanwhile, in this processing process, the data decompression module can directly read the target image resource from the memory based on the resource reading instruction and write the target image resource into the target video memory area of the GPU. The data decompression module is set in the GPU, the GPU and the data decompression module are combined for use, and the efficiency of reading, decompressing and writing the target image resource from the memory into the target video memory area is improved.

[0105] Figure 4 A block diagram of an electronic device is provided for the embodiment of the present disclosure.

[0106] Referring to Figure 4 The electronic device 400 provided by the embodiment of the present disclosure includes: at least one processor 401; at least one memory 402, and one or more I / O interfaces 403 connected between the processor 401 and the memory 402; wherein the memory 402 stores one or more computer programs executable by the at least one processor 401, and the one or more computer programs are executed by the at least one processor 401 to enable the at least one processor 401 to execute the image resource loading method described above.

[0107] In some embodiments, the electronic device can be a brain-like chip. Since the brain-like chip can employ vectorized computing, it needs to load parameters such as weight information of a neural network model through an external memory, for example, a double data rate (DDR) synchronous dynamic random access memory. Therefore, the disclosed embodiments have higher operation efficiency in batch processing.

[0108] The disclosed embodiments also provide a computer-readable storage medium having a computer program stored thereon, where the computer program, when executed by a processor, implements the image resource loading method described above. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.

[0109] The disclosed embodiments also provide a computer program product including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, where when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device executes the image resource loading method described above.

[0110] Those of ordinary skill in the art can understand that all or some of the steps in the methods disclosed above and the functional modules / units in the systems and devices can be implemented as software, firmware, hardware, or appropriate combinations thereof. In hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component can have multiple functions, or one function or step can be performed by several physical components in cooperation. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on computer-readable storage media, which can include computer storage media (or non-transitory media) and communication media (or transitory media).

[0111] As those skilled in the art will appreciate, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable program instructions, data structures, program modules or other data. Computer storage media include, but are not limited to, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM), static random access memory (SRAM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer. Further, as those skilled in the art will appreciate, communication media typically embodies computer readable program instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term "modulated data signal" means a signal that has one or more of its characteristics changed or set in a manner so as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as wireless networks, cellular telephone networks, code division multiple access (CDMA) networks, and other terrestrial and satellite radio frequency communication networks. Thus, the computer readable program instructions and / or other program modules can be embodied in a computer readable storage medium, which can be any device or article that is enab!ed to store and / or carry computer readable program instructions and / or data structures. The computer readable storage medium can also be distributed over networked computer systems so that the computer readable program instructions and / or other program modules are stored and executed in a distributed fashion.

[0112] Computer readable program instructions described herein can be downloaded to respective computing / processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and / or a wireless network. The network can comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing / processing device.

[0113] Computer readable program instructions for carrying out operations of the present disclosure can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state setting data, or any combination of one or more of the above in any combination, written in any combination of one or more programming languages, including object oriented programming languages such as Smalltalk, C++ or the like, and conventional procedural programming languages such as "C" or the like. The computer readable program instructions can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present disclosure.

[0114] The computer program product described herein can be embodied in a specific manner by hardware, software, or a combination thereof. In an optional embodiment, the computer program product is embodied as a computer storage medium. In another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK), and the like.

[0115] The various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer readable program instructions.

[0116] These computer readable program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer readable program instructions can also be stored in a computer readable storage medium that can include a non-transitory computer readable storage medium that can be a computer- readable storage medium having no data storage viruses or other code or instructions implementing a functionally equivalent process, such that the instructions, defining functions described by the flowchart and / or block diagram block or blocks are stored in the computer readable storage medium.

[0117] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable data processing apparatus, or other device implement the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0118] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable data processing apparatus, or other device implement the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0119] Example embodiments have been disclosed herein and, although specific terms are employed, they are used in a generic and descriptive sense only and not for purposes of limitation. In some instances, it will be apparent to those skilled in the art that features, characteristics or elements described with reference to one embodiment can be used, combined or modified in accordance with other embodiments to be used with a different embodiment without departing from the scope of the present disclosure as set forth by the appended claims. Therefore, it will be understood that various changes can be made in form and details of the disclosure without departing from the spirit thereof.

Claims

1. A method for loading image resources, characterized in that, Graphics processors used in electronic devices include: Upon receiving a resource loading instruction for the image to be rendered, the resource loading instruction is converted into a resource reading instruction; Based on the resource read instruction, the target image resource corresponding to the image to be rendered is read from the memory of the electronic device, and the target image resource is written into the target video memory area of ​​the graphics processor, so that the graphics processor renders the image to be rendered according to the target image resource.

2. The method as described in claim 1, characterized in that, Based on the resource read instruction, the target image resource corresponding to the image to be rendered is read from the memory of the electronic device, and the target image resource is written into the target video memory area of ​​the graphics processor, including: In response to the resource read instruction, the target image resource is read from the memory; If the target image resource is in a compressed format, the target image resource is decompressed in parallel during the reading of the target image resource to obtain the decompressed target image resource. The decompressed target image resource is written into the target video memory area.

3. The method as described in claim 2, characterized in that, The resource read instruction carries the resource path corresponding to the image to be rendered. The resource path is used to indicate the storage location of the target image resource in the memory. The resource path carried in the resource read instruction is determined according to the resource load instruction. Responding to the resource read instruction, reading the target image resource from the memory includes: Obtain the resource path carried in the resource read instruction; The target image resource corresponding to the image to be rendered is read from the memory based on the resource path.

4. The method as described in claim 2, characterized in that, The resource read instruction carries a target video memory address, which is used to indicate the target video memory region of the target image resource in the video memory space. The target video memory address carried in the resource read instruction is determined according to the resource load instruction. Writing the decompressed target image resource into the target video memory area includes: Obtain the target video memory address carried in the resource read instruction; According to the target video memory address, the decompressed target image resource is written into the target video memory area corresponding to the target video memory address.

5. The method as described in claim 1, characterized in that, The graphics processor includes a data decompression module, and there are multiple data decompression modules of different types. The resource reading instruction carries the target compression format corresponding to the target image resource, and the target compression format carried in the resource reading instruction is determined according to the resource loading instruction. Before reading the target image resource corresponding to the image to be rendered from the memory of the electronic device based on the resource reading instruction, the method further includes: According to the target compression format, a target data decompression module for processing the target image resource is selected from among the multiple data decompression modules, and the resource reading instruction is sent to the target data decompression module so that the target data decompression module performs the steps of reading the target image resource corresponding to the image to be rendered from the memory of the electronic device based on the resource reading instruction, and writing the target image resource into the target video memory area of ​​the graphics processor.

6. The method as described in claim 1, characterized in that, Converting the resource loading instruction into a resource reading instruction includes: The direct-attached storage interface is invoked to convert the resource loading instruction into a resource reading instruction supported by the direct-attached storage technology.

7. The method as described in claim 1, characterized in that, The image to be rendered includes a game map to be rendered, and the target image resources include terrain textures and model compressed packages. The method further includes: The graphics processor renders the game map to be rendered based on the terrain map and the model archive.

8. An image resource loading device, characterized in that, Graphics processors used in electronic devices include: The conversion module is configured to convert a resource loading instruction into a resource reading instruction upon receiving a resource loading instruction for an image to be rendered. The reading module is configured to read the target image resource corresponding to the image to be rendered from the memory of the electronic device based on the resource reading instruction, and write the target image resource into the target video memory area of ​​the graphics processor, so that the graphics processor renders the image to be rendered according to the target image resource.

9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the method as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-7.

11. A computer program product, characterized in that, Includes computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is executed in a processor of an electronic device, the processor in the electronic device performs the method as described in any one of claims 1-7.