Texture management method, device, equipment and storage medium
By introducing preset texture pools in computer graphics to manage the creation and reuse of texture objects, the problems of increased system load and reduced rendering efficiency caused by frequent texture generation and destruction are solved, and more efficient texture management and rendering performance is achieved.
Patent Information
- Application Number
- CN202210185280.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-28
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2042-02-28
AI Technical Summary
In the prior art, texture generation and destruction are frequent, resulting in increased system load and reduced rendering efficiency.
The preset texture pool is used to manage the created texture objects. When you need to generate a texture, you query the corresponding texture object pointer from the preset texture pool according to the texture attributes, and obtain the texture object according to the pointer for texture generation.
By reducing the need to temporarily apply to create texture objects in the system memory, the texture generation efficiency is improved, and thus the picture rendering efficiency is improved.
Smart Images

Figure CN114549727B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to texture management methods, devices, equipment and storage media. Background Art
[0002] In the field of computer graphics, texture can be understood as one or several two-dimensional graphics that represent the details of an object's surface, also known as texture maps. When the texture is mapped onto the surface of an object in a specific way, the object can look more realistic. Texture mapping is the process of mapping texture pixels in texture space to pixels in screen space, so that the rendered image can show the scene more delicately and realistically.
[0003] Textures usually contain multiple attributes, such as size and dimension, etc. Since texture attributes are numerous and usually vary greatly, it is difficult to reuse textures effectively. In existing rendering engines, textures are frequently created and destroyed, which increases the system load and brings additional time consumption, thus affecting rendering efficiency. Summary of the invention
[0004] The embodiments of the present application provide a texture management method, apparatus, device and storage medium, which can optimize the existing texture management solution.
[0005] In a first aspect, an embodiment of the present application provides a texture management method, the method comprising:
[0006] Determine first attribute information of a first texture to be generated in a to-be-rendered picture, and determine a corresponding first texture identifier according to the first attribute information;
[0007] Querying whether there is a first texture unit corresponding to the first texture identifier in a preset texture pool, wherein the preset texture pool includes a correspondence between texture identifiers and texture units, and the texture unit includes a pointer to a memory occupied by a texture object;
[0008] If it exists, the first texture object is obtained according to the first pointer in the first texture unit, and the first texture is generated according to the first texture object.
[0009] In a second aspect, an embodiment of the present application provides a texture management device, the device comprising:
[0010] A texture identification determination module, used to determine first attribute information of a first texture to be generated in a to-be-rendered picture, and determine a corresponding first texture identification according to the first attribute information;
[0011] A texture unit query module, used for querying whether there is a first texture unit corresponding to the first texture identifier in a preset texture pool, wherein the preset texture pool includes a correspondence between texture identifiers and texture units, and the texture unit includes a pointer to a memory occupied by a texture object;
[0012] The texture generation module is used to obtain a first texture object according to a first pointer in the first texture unit if a first texture unit corresponding to the first texture identifier exists in the preset texture pool, and generate the first texture according to the first texture object.
[0013] In a third aspect, an embodiment of the present application provides a texture management device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the texture management method provided in the embodiment of the present application is implemented.
[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a texture management method as provided in an embodiment of the present application.
[0015] The texture management solution provided in the embodiment of the present application determines the first attribute information of the first texture to be generated in the to-be-rendered screen, and determines the corresponding first texture identifier based on the first attribute information, and queries whether there is a first texture unit corresponding to the first texture identifier in the preset texture pool, wherein the preset texture pool includes the correspondence between the texture identifier and the texture unit, and the texture unit includes a pointer to the memory occupied by the texture object, and if it exists, the first texture object is obtained according to the first pointer in the first texture unit, and the first texture is generated according to the first texture object. By adopting the above technical solution, the preset texture pool is used to manage the created texture objects, and when it is necessary to generate a texture, the pointer of the corresponding texture object is queried from the preset texture pool according to the texture attribute, and the texture object is obtained according to the pointer to generate the texture, thereby avoiding temporarily applying to the system memory to create a texture object when it is necessary to generate a texture, improving the texture generation efficiency, and thus improving the screen rendering efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A schematic diagram of a texture management method provided in an embodiment of the present application;
[0017] Figure 2 A flowchart of another texture management method provided in an embodiment of the present application;
[0018] Figure 3 A structural block diagram of a texture management device provided in an embodiment of the present application;
[0019] Figure 4A structural block diagram of a texture management device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It will be appreciated that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only the parts related to the present application, rather than all structures, are shown in the accompanying drawings. In addition, the embodiments in the present application and the features in the embodiments may be combined with each other without conflict.
[0021] It should be noted that the concepts of "first", "second", etc. mentioned in the present disclosure are only used to distinguish different devices, modules, units or objects, such as the first texture and the second texture, etc., and are not used to limit the order or interdependence of the functions performed by these devices, modules, units or objects.
[0022] In the related art, after the texture is generated and used for screen rendering, the texture is not cached, so the texture is frequently created and destroyed, which increases the load on the system and brings additional time consumption, thereby affecting the rendering efficiency.
[0023] In an embodiment of the present application, the concept of a texture pool is proposed, and the created texture objects can be stored in the memory. For example, the system ordinary memory is divided into a texture memory area and a system memory heap, and the texture objects are stored in the texture memory area. The saved texture objects are managed by a preset texture pool. When it is necessary to generate a texture, the preset texture pool is used to find a suitable texture object for generating the texture, thereby avoiding temporarily applying to the system memory for creating a texture object when it is necessary to generate a texture, thereby improving the texture generation efficiency, and further improving the picture rendering efficiency.
[0024] Figure 1 A flow chart of a texture management method provided in an embodiment of the present application, the method can be executed by a texture management device, wherein the device can be implemented by software and / or hardware, and can generally be integrated in a texture management device. The electronic device can be a mobile device such as a mobile phone, a tablet computer, and a laptop computer; it can also be other devices such as a desktop computer.
[0025] like Figure 1 As shown, the method includes:
[0026] Step 101: Determine first attribute information of a first texture to be generated in a to-be-rendered picture, and determine a corresponding first texture identifier according to the first attribute information.
[0027] Exemplarily, the picture to be rendered may be a picture in a target page, and the target page may be included in a preset application (Application, APP). The specific type of the preset application is not limited, for example, it may be a short video application, a live broadcast application, or a game application, etc., or other types of applications. The target page may be, for example, a video playback page, a live broadcast page, or a game page, etc. The picture to be rendered may also be understood as a picture to be displayed, and the picture to be rendered may include one or more objects or objects to which textures need to be added. The first texture may be any texture or a specified texture in the picture to be rendered, and is not specifically limited.
[0028] A texture generally has multiple attributes. In an embodiment of the present application, the attribute information of the texture may include, for example, one or more of size, dimension, pixel format, sampling method, number of channels, and access rights. The first attribute information is the attribute information of the first texture. Textures with different attribute information are different textures, and the textures can be divided according to the attribute information, and different attribute information corresponds to different texture identifiers. Optionally, a hash value can be calculated based on the attribute information, and the hash value is used as the texture identifier. The first texture identifier is the texture identifier corresponding to the first attribute information, and the hash value can be calculated based on the first attribute information, and the calculated hash value is determined as the first texture identifier.
[0029] Step 102: query whether there is a first texture unit corresponding to the first texture identifier in a preset texture pool, wherein the preset texture pool includes a correspondence between texture identifiers and texture units, and the texture unit includes a pointer to a memory occupied by a texture object.
[0030] Exemplarily, the texture memory area can store all or part of the texture objects created in the process of rendering the screen corresponding to the target page. The texture object can be understood as a texture template with certain attribute information, and it can be understood that different texture attribute information can correspond to different texture objects. When generating a texture, it is generally necessary to first create a texture object with corresponding attribute information, and then perform operations such as filling or modifying the content of the texture object to generate the required texture. The correspondence between the texture identifier and the texture unit is stored in the preset texture pool. The texture unit includes a pointer to the memory occupied by the texture object. The pointer can point to the storage location of the corresponding texture object in the texture memory area, so that the corresponding texture object can be found through the pointer for subsequent texture generation.
[0031] In the embodiment of the present application, after obtaining the first texture identifier, a search is performed in the preset texture pool to determine whether the first texture identifier exists. If the first texture identifier exists, it is determined that a first texture unit corresponding to the first texture identifier exists in the preset texture pool, and the first texture unit is found based on the above correspondence.
[0032] Step 103: If it exists, obtain the first texture object according to the first pointer in the first texture unit, and generate the first texture according to the first texture object.
[0033] Exemplarily, after finding the first texture unit, the pointer contained therein, namely the first pointer, can be read, the first texture object can be obtained from the memory address pointed to by the first pointer, and the first texture object can be filled or modified to generate the first texture.
[0034] Optionally, after querying whether there is a first texture unit corresponding to the first texture identifier in the preset texture pool, the method further includes: if not, applying to the system memory to create a second texture object matching the first attribute information, and generating the first texture based on the second texture object. The advantage of such a setting is that when the created texture object corresponding to the first texture identifier cannot be found, applying to the system memory to create a second texture object matching the first attribute information ensures that the texture can be successfully generated, thereby enabling the rendering of the image to be rendered to be completed successfully.
[0035] Optionally, one texture identifier corresponds to one texture unit, that is, one texture identifier corresponds to one pointer, which can reduce the occupation of system memory by texture objects. In this case, when the texture object corresponding to the pointer has been taken out, the stored texture object cannot be obtained again according to the pointer. At this time, an application can be made to the system memory to create a new texture object matching the first attribute information.
[0036] Optionally, the preset texture pool exists in the form of a hash multi-table, and the texture identifier includes a hash value calculated based on the attribute information of the texture, and each of the texture identifiers corresponds to multiple texture units. The advantage of this arrangement is that one texture identifier corresponds to multiple texture units, that is, one texture identifier corresponds to multiple pointers, each pointer corresponds to a texture object that matches the texture attribute represented by the texture identifier, and when a texture object corresponding to a texture identifier is taken out, there are still other texture objects available for acquisition, further ensuring the efficiency of texture generation. Exemplarily, in the hash multi-table, the texture identifier is used as the key (Key) and multiple texture units are used as the value (Value).
[0037] The texture management method provided in the embodiment of the present application determines the first attribute information of the first texture to be generated in the to-be-rendered picture, and determines the corresponding first texture identifier based on the first attribute information, and queries whether there is a first texture unit corresponding to the first texture identifier in the preset texture pool, wherein the preset texture pool includes the correspondence between the texture identifier and the texture unit, and the texture unit includes a pointer to the memory occupied by the texture object, and if it exists, the first texture object is obtained according to the first pointer in the first texture unit, and the first texture is generated according to the first texture object. By adopting the above technical solution, the preset texture pool is used to manage the created texture objects, and when it is necessary to generate a texture, the pointer of the corresponding texture object is queried from the preset texture pool according to the texture attribute, and the texture object is obtained according to the pointer to generate the texture, thereby avoiding temporarily applying to the system memory to create a texture object when it is necessary to generate a texture, improving the texture generation efficiency, and then improving the picture rendering efficiency.
[0038] In some embodiments, determining the corresponding first texture identifier according to the first attribute information includes: determining whether the first texture to be generated in the rendered image needs to occupy the system shared memory; if not, determining the corresponding first texture identifier according to the first attribute information; if so, applying to the system shared memory to create a third texture object matching the first attribute information, and generating the first texture according to the third texture object. The advantage of such a setting is that the advantages of shared memory are reasonably used to create textures.
[0039] In the embodiment of the present application, the system shared memory may specifically refer to the shared memory of the central processing unit (CPU) and the graphics processing unit (GPU), and the system common memory may specifically refer to the memory in the system except the system shared memory. The performance can be improved by using the system shared memory to generate textures, and a preset condition that the system shared memory needs to be used for texture generation can be set. When the preset condition is met, it is determined that the system shared memory needs to be occupied, and the preset condition can be set according to actual needs. For the system shared memory, after the texture is used, the memory occupied by the texture needs to be released in time, and the texture objects managed by the preset texture pool are stored in the system common memory. Therefore, when it is determined that the first texture does not need to occupy the system shared memory, the first texture identifier is calculated according to the first attribute information, and if the system shared memory needs to be occupied, the memory is applied to the system shared memory for creating a texture object matching the first attribute information.
[0040] In some embodiments, the method further includes: upon detecting a release request of the second texture, determining the type of system memory currently occupied by the fourth texture object corresponding to the second texture; if the fourth texture object occupies system shared memory, releasing the memory occupied by the fourth texture object; if the fourth texture object occupies system ordinary memory, retaining the fourth texture object. The advantage of such a setting is that the texture that has been used can be processed in a targeted manner according to different creation methods.
[0041] Exemplarily, when it is determined that the second texture (which may be the generated first texture or any other generated texture) is no longer needed in the next page to be rendered, it can be considered that a release request for the second texture is detected. For the fourth texture object that the second texture depends on when generating it, it can be determined whether it is stored in the system shared memory or the system ordinary memory. If it is stored in the system shared memory, the memory allocated to the fourth texture object needs to be returned, that is, the fourth texture object is deleted, and the memory occupied by the fourth texture object is no longer reserved for it; if it is stored in the system ordinary memory, in order to avoid repeated creation operations when the fourth texture object is needed again in the future, the fourth texture object can be reserved.
[0042] In some embodiments, retaining the fourth texture object includes: determining whether the preset texture pool contains a second texture identifier corresponding to the fourth texture object, and if not, retaining the fourth texture object, and adding a correspondence between the second texture identifier and a second texture unit in the preset texture pool, wherein the second texture unit contains a pointer to the memory occupied by the fourth texture object. The advantage of such a setting is that an appropriate method is selected to retain the fourth texture object.
[0043] Exemplarily, for the fourth texture object created for the first time, its corresponding texture identifier does not exist in the preset texture pool. At this time, the fourth texture object can be included in the management scope of the preset texture pool. For example, the pointer to the memory occupied by the fourth texture object can be determined, and the second texture unit can be generated. The correspondence between the second texture identifier and the second texture unit is added to the preset texture pool, so that the fourth texture object can be reused in the subsequent picture rendering process.
[0044] Exemplarily, if the fourth texture object is already within the management scope of the preset texture pool, there is a second texture identifier corresponding to the fourth texture object in the preset texture pool, and a pointer corresponding to the fourth texture object is found from the texture unit corresponding to the second texture identifier. According to the pointer, the fourth texture object is placed in the storage location that was once occupied in the texture memory area, avoiding reallocating memory for the fourth texture object.
[0045] In some embodiments, the texture unit also includes a pooled frame count value, and the pooled frame count value is used to indicate the number of frames of the picture that the corresponding texture object has completed rendering during the period when it is not used. Exemplarily, for the texture object existing in the texture memory area, because it has not been taken out, because it has not been used, that is, it has not been used for texture generation, it is in an idle state. During this period, the picture rendering operation has not stopped. Therefore, the number of frames of the picture that has been rendered during this period can be used to measure the length of time that the texture object has not been used. If it has not been used for a long time, it can be considered that continuing to store the texture object will cause a waste of memory and reduce the utilization rate of memory, and the memory occupied by it can be released. Exemplarily, the method also includes: when it is determined that the pooled frame count value in the third texture unit is greater than the first preset value, the memory pointed to by the pointer in the third texture unit is released, and the third texture unit and the corresponding third texture identifier are cleared from the preset texture pool. The advantage of such a setting is to avoid the long-term occupation of memory space by texture objects with low utilization, release memory in time, and improve memory utilization. The first preset value can be set according to actual needs, for example, it can be set with reference to the complexity of the screen content in the target page or the drastic degree of content change. For example, for the game page and the live page, the change frequency and change amplitude of the screen content of the game page are higher than those of the live page, and the first preset value corresponding to the game page can be greater than the first preset value of the live page, such as 8 for the game page and 3 for the live page.
[0046] In some embodiments, the obtaining of the first texture object according to the first pointer in the first texture unit includes: obtaining the first texture object according to the first pointer in the first texture unit when the pool entry frame count value in the first texture unit is less than a second preset value. The advantage of such a setting is that, for a texture object that has just entered the preset texture pool or just returned to the preset texture pool, the previous frame may not have been completely used. In order to avoid errors, it can be set to temporarily not allow allocation.
[0047] In some embodiments, the method further includes: upon receiving a target screen rendering task of a target page, creating a preset texture pool corresponding to the target page; after detecting that the target screen rendering task is completed, releasing the memory pointed to by the pointer in the preset texture pool, and clearing the preset texture pool. The advantage of such a setting is that after the target screen rendering task is completed, the memory of the texture object is released in time and returned to the system's general memory heap, and the preset texture pool is cleared, thereby improving memory utilization.
[0048] Exemplarily, it may be checked whether the rendering thread corresponding to the target screen rendering task has exited, and if so, it is determined that the target screen rendering task is terminated.
[0049] Figure 2 A flowchart of another texture management method provided in an embodiment of the present application is provided. The embodiment of the present application is optimized based on the above optional embodiments and may include:
[0050] Step 201: When a target screen rendering task of a target page is received, a preset texture pool corresponding to the target page is created.
[0051] The preset texture pool exists in the form of a hash multi-table, and the texture identifier includes a hash value calculated according to the attribute information of the texture. Each texture identifier corresponds to multiple texture units. Each texture unit contains a pointer to the memory occupied by the texture object and a pool entry frame count value, and the pool entry frame count value is used to indicate the number of frames of the picture that the corresponding texture object has completed rendering during the period when it is not in use.
[0052] Optionally, the preset texture pool created for the first time can be empty. After the creation is completed, the corresponding texture object can be automatically created according to the preset attribute information, and the texture identifier and texture unit can be generated, and the corresponding relationship between the two can be saved; or as the picture rendering continues, texture objects that meet the current needs can be gradually created and included in the preset texture pool.
[0053] Step 202: Determine first attribute information of a first texture to be generated in a picture to be rendered.
[0054] The attribute information of the texture may include, for example, size, dimension, pixel format, sampling method, number of channels and access rights, which can comprehensively characterize the texture attributes so that texture objects can be divided more accurately.
[0055] Step 203 , determine whether the first texture is created by the system shared memory, if so, execute step 208 ; otherwise, execute step 204 .
[0056] Step 204: Calculate a hash value according to the first attribute information to obtain a first texture identifier.
[0057] Step 205 , query whether there is a first texture unit corresponding to the first texture identifier in the preset texture pool, if yes, execute step 206 ; otherwise, execute step 209 .
[0058] Exemplarily, the out-of-pool texture linked list in the preset texture pool is determined according to the first texture identifier, and it is determined whether the out-of-pool texture linked list is empty, that is, whether there is an available texture object.
[0059] Step 206 , determining whether the pooled frame count value in the first texture unit is less than a second preset value, if so, executing step 209 ; otherwise, executing step 207 .
[0060] Exemplarily, the second preset value may be 2.
[0061] Step 207: Obtain a first texture object according to the first pointer in the first texture unit, and generate a first texture according to the first texture object.
[0062] Step 208: Apply to the system shared memory to create a third texture object that matches the first attribute information, and generate the first texture according to the third texture object.
[0063] Step 209: Apply to the system general memory to create a second texture object that matches the first attribute information, and generate the first texture according to the second texture object.
[0064] Step 210: When a release request of the second texture is detected, determine the type of system memory currently occupied by a fourth texture object corresponding to the second texture.
[0065] Step 211, determine whether the type is system shared memory, if so, execute step 212; otherwise, execute step 213.
[0066] Step 212: Release the memory occupied by the fourth texture object.
[0067] Step 213: Reserve the fourth texture object.
[0068] Exemplarily, if the fourth texture object is constructed by using the system common memory, the fourth texture object is inserted into a free list in a preset texture pool.
[0069] Step 214, determine whether the target screen rendering task is completed, if so, execute step 215; otherwise, return to execute step 202.
[0070] It should be noted that when step 202 is executed again, the first texture is a new texture to be generated.
[0071] During the target screen rendering task, the pooled frame count values in the texture units corresponding to each unused texture object can be updated in real time, and a check is made at a preset frequency whether there is a texture unit whose pooled frame count value is greater than a first preset value. If so, the memory pointed to by the pointer in the third texture unit is released, and the third texture unit and the corresponding third texture identifier are cleared from the preset texture pool.
[0072] Step 215: Release the memory pointed to by the pointer in the preset texture pool, and clear the preset texture pool.
[0073] The texture management method provided in the embodiment of the present application divides the texture creation method into texture pool allocation and system memory heap creation. When creating a texture, it is determined whether the texture object is allocated by the texture pool or created from the system memory according to the texture's attributes. When releasing the memory, it is determined whether the texture object is destroyed or enters the texture pool according to the texture creation method. In addition, the texture units in the texture pool are updated according to the specified rules for each frame. In the rendering task of complex scenes, texture creation is divided into two methods: allocating textures from the texture pool and applying to the system for texture creation. By managing texture creation and deletion through the texture pool, the efficiency of texture use is improved, and frequent application for system memory and creation of textures are avoided, which can effectively reduce the system load and reduce the time consumption of rendering.
[0074] Figure 3 This is a structural block diagram of a texture management device provided in an embodiment of the present application. The device can be implemented by software and / or hardware, and can generally be integrated in a texture management device, and can perform texture management by executing a texture management method. Figure 3 As shown, the device comprises:
[0075] The texture identification determination module 301 is used to determine first attribute information of a first texture to be generated in a to-be-rendered picture, and determine a corresponding first texture identification according to the first attribute information;
[0076] A texture unit query module 302 is used to query whether there is a first texture unit corresponding to the first texture identifier in a preset texture pool, wherein the preset texture pool includes a correspondence between texture identifiers and texture units, and the texture unit includes a pointer to a memory occupied by a texture object;
[0077] The texture generation module 303 is configured to obtain a first texture object according to a first pointer in the first texture unit if a first texture unit corresponding to the first texture identifier exists in the preset texture pool, and generate the first texture according to the first texture object.
[0078] The texture management device provided in the embodiment of the present application determines the first attribute information of the first texture to be generated in the to-be-rendered picture, and determines the corresponding first texture identifier based on the first attribute information, and queries whether there is a first texture unit corresponding to the first texture identifier in the preset texture pool, wherein the preset texture pool includes the correspondence between the texture identifier and the texture unit, and the texture unit includes a pointer to the memory occupied by the texture object, and if it exists, the first texture object is obtained according to the first pointer in the first texture unit, and the first texture is generated according to the first texture object. By adopting the above technical solution, the preset texture pool is used to manage the created texture objects, and when it is necessary to generate a texture, the pointer of the corresponding texture object is queried from the preset texture pool according to the texture attribute, and the texture object is obtained according to the pointer to generate the texture, thereby avoiding temporarily applying to the system memory to create a texture object when it is necessary to generate a texture, improving the texture generation efficiency, and then improving the picture rendering efficiency.
[0079] An embodiment of the present application provides a texture management device, in which the texture management apparatus provided by the embodiment of the present application can be integrated. Figure 4 The structure block diagram of a texture management device provided in an embodiment of the present application. The texture management device 400 includes a memory 401, a processor 402, and a computer program stored in the memory 401 and executable on the processor 402. When the processor 402 executes the computer program, the texture management method provided in an embodiment of the present application is implemented.
[0080] The embodiment of the present application also provides a storage medium containing computer executable instructions, and the computer executable instructions are used to execute the texture management method provided by the embodiment of the present application when executed by a computer processor.
[0081] The texture management apparatus, device and storage medium provided in the above embodiments can execute the texture management method provided in any embodiment of the present application, and have the corresponding functional modules and beneficial effects of executing the method. For technical details not described in detail in the above embodiments, please refer to the texture management method provided in any embodiment of the present application.
Claims
1. A texture management method, characterized in that: include: Determine first attribute information of a first texture to be generated in a to-be-rendered picture, and determine a corresponding first texture identifier according to the first attribute information; Querying whether there is a first texture unit corresponding to the first texture identifier in a preset texture pool, wherein the preset texture pool includes a correspondence between texture identifiers and texture units, and the texture unit includes a pointer to a memory occupied by a texture object; If it exists, obtaining a first texture object according to a first pointer in the first texture unit, and generating the first texture according to the first texture object; Wherein, the texture objects managed by the preset texture pool are stored in the system common memory; The determining the corresponding first texture identifier according to the first attribute information includes: Determine whether the first texture needs to occupy system shared memory; If not, determining a corresponding first texture identifier according to the first attribute information; If so, apply to the system shared memory to create a third texture object matching the first attribute information, and generate the first texture according to the third texture object.
2. The method according to claim 1, characterized in that After querying whether there is a first texture unit corresponding to the first texture identifier in the preset texture pool, the method further includes: If not, apply to the system memory to create a second texture object matching the first attribute information, and generate the first texture according to the second texture object.
3. The method according to claim 1, characterized in that The preset texture pool exists in the form of a hash multi-table, the texture identifier includes a hash value calculated according to the attribute information of the texture, and each of the texture identifiers corresponds to multiple texture units.
4. The method according to claim 1, characterized in that Also includes: When a release request of the second texture is detected, determining a type of system memory currently occupied by a fourth texture object corresponding to the second texture; If the fourth texture object occupies system shared memory, releasing the memory occupied by the fourth texture object; If the fourth texture object occupies the system normal memory, the fourth texture object is retained.
5. The method according to claim 4, characterized in that The retaining the fourth texture object comprises: Determine whether the preset texture pool contains the second texture identifier corresponding to the fourth texture object. If not, retain the fourth texture object and add the correspondence between the second texture identifier and the second texture unit in the preset texture pool, wherein the second texture unit contains a pointer to the memory occupied by the fourth texture object.
6. The method according to claim 1, characterized in that The texture unit also includes a pooled frame count value, and the pooled frame count value is used to indicate the number of frames of the picture that the corresponding texture object has completed rendering during the period when it is not in use; the method also includes: When it is determined that the pool entry frame count value in the third texture unit is greater than a first preset value, the memory pointed to by the pointer in the third texture unit is released, and the third texture unit and the corresponding third texture identifier are cleared from the preset texture pool.
7. The method according to claim 1, characterized in that The texture unit also includes a pooled frame count value, where the pooled frame count value is used to indicate the number of frames of the picture that the corresponding texture object has completed rendering during the period when the texture object is not in use; The acquiring the first texture object according to the first pointer in the first texture unit comprises: When the pooled frame count value in the first texture unit is less than a second preset value, a first texture object is obtained according to a first pointer in the first texture unit.
8. The method according to claim 1, characterized in that Also includes: When receiving a target screen rendering task of a target page, creating a preset texture pool corresponding to the target page; After detecting that the target screen rendering task is finished, the memory pointed to by the pointer in the preset texture pool is released, and the preset texture pool is cleared.
9. A texture management device, characterized in that: include: A texture identification determination module, used to determine first attribute information of a first texture to be generated in a to-be-rendered picture, and determine a corresponding first texture identification according to the first attribute information; A texture unit query module, used for querying whether there is a first texture unit corresponding to the first texture identifier in a preset texture pool, wherein the preset texture pool includes a correspondence between texture identifiers and texture units, and the texture unit includes a pointer to a memory occupied by a texture object; a texture generation module, configured to obtain a first texture object according to a first pointer in the first texture unit, and generate the first texture according to the first texture object, if a first texture unit corresponding to the first texture identifier exists in the preset texture pool; Wherein, the texture objects managed by the preset texture pool are stored in the system common memory; The determining the corresponding first texture identifier according to the first attribute information includes: Determine whether the first texture needs to occupy system shared memory; If not, determining a corresponding first texture identifier according to the first attribute information; If so, apply to the system shared memory to create a third texture object matching the first attribute information, and generate the first texture according to the third texture object.
10. A texture management device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Method for sharing GPU resources in cloud game
CN104991827A
Image rendering method, device and equipment and storage medium
CN108765534A
Game picture transmission method and device, storage medium and equipment
CN111346378A