A lookup table generation system for bezel texture sampling

By merging data formats and building a cache lookup table, the problem of the inability to customize preset values ​​in the border texture sampling mode was solved, enabling user-defined color selection and efficient texture mapping.

CN122289501APending Publication Date: 2026-06-26METAX INTEGRATED CIRCUITS (SHANGHAI) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
METAX INTEGRATED CIRCUITS (SHANGHAI) CO LTD
Filing Date
2026-05-26
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

In existing technologies, the preset value of the border texture sampling mode cannot be customized by the user, which makes it difficult to meet the user's expectations for texture mapping effect. In addition, data format conversion consumes GPU chip computing resources and reduces texture mapping efficiency.

Method used

By merging M initial data formats into N reference data formats, an initial texture lookup table is constructed. The initial texture data corresponding to the preset color is converted into the reference data format, and a target texture lookup table is generated and stored in the cache. This supports user-defined color selection and reduces data format conversion on the GPU chip hardware side.

Benefits of technology

It effectively reduces the storage capacity of the target texture lookup table, supports user-defined color selection, reduces GPU chip computation latency, and improves texture mapping efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122289501A_ABST
    Figure CN122289501A_ABST
Patent Text Reader

Abstract

This application relates to the field of integrated circuit design technology, and in particular to a lookup table generation system for border texture sampling. This system merges M initial data formats into N reference data formats, avoiding the storage of texture data corresponding to redundant data formats in the lookup table, effectively reducing the storage capacity of the target texture lookup table, enabling the target texture lookup table to cover a sufficient number of preset colors to support user-defined selection of preset colors. Furthermore, it can achieve texture mapping by caching the target texture lookup table, without requiring real-time data format conversion on the GPU chip hardware side, reducing texture sampling latency and ensuring texture mapping efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of integrated circuit design technology, and in particular to a lookup table generation system for border texture sampling. Background Technology

[0002] Currently, in texture mapping scenarios, GPU chips typically map the texture pixel values ​​of texture pixels in a texture image to the corresponding target pixels in a screen image to achieve texture mapping. However, there are cases where the texture coordinates that need to be sampled for the target pixel in the texture image coordinate system are not within the range of the texture image, or where the texture coordinates that the user specifies for the target pixel are not within the range of the texture image. In such cases, existing technologies typically use texture addressing modes to determine the texture pixel values ​​corresponding to these texture coordinates. Texture addressing modes include repeat mode, mirror mode, edge texture sampling mode, border texture sampling mode, etc.

[0003] In the border texture sampling mode, the texture pixel value corresponding to the sampling point that is outside the range of the texture image is determined by a preset value. In the existing technology, this preset value can usually only be selected from a limited range of color values ​​and cannot be customized by the user, which makes it difficult to meet the user's expectations for the texture mapping effect of the sampling results.

[0004] The reason why the preset values ​​of the border texture sampling mode cannot be customized by the user is mainly because there are many color types, and each color type contains a large number of texture pixel values ​​corresponding to different data formats. This means that if the preset values ​​of the border texture sampling mode are allowed to be customized by the user, a huge amount of storage space would be required to store the texture pixel values.

[0005] To circumvent the above problems, existing technologies often only provide texture pixel values ​​in a single data format when implementing user-defined color sampling. Only after the data format is converted by the GPU chip's hardware can the texture pixel values ​​in a specific data format for a specific color required by the GPU chip be obtained. However, data format conversion also consumes the GPU chip's computing resources and generates additional time consumption, reducing the efficiency of texture mapping.

[0006] Therefore, how to enable users to customize the texture sampling values ​​in the border texture sampling mode without reducing texture mapping efficiency has become an urgent problem to be solved. Summary of the Invention

[0007] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows: A lookup table generation system for border texture sampling, the system comprising: a processor and a memory storing a computer program, wherein when the computer program is executed by the processor, the following steps are performed: S101, based on the attribute information sets corresponding to the M initial data formats respectively, merge the M initial data formats into N reference data formats, where M and N are both positive integers, and N is less than M; S102, construct an initial texture lookup table based on K preset colors and N reference data formats, where K is a positive integer; S103, for any preset color, convert the initial texture data corresponding to the preset color into reference texture data that conforms to N reference data formats respectively; S104, update all reference texture data to the initial texture lookup table to obtain the target texture lookup table.

[0008] Compared with the prior art, the present invention has significant advantages. Through the above technical solution, the lookup table generation system for border texture sampling provided by the present invention achieves considerable technical progress and practicality, and has broad industrial application value. It has at least the following advantages: This invention merges M initial data formats into N reference data formats, avoiding the storage of texture data corresponding to redundant data formats in the lookup table. This effectively reduces the storage capacity of the target texture lookup table, enabling it to cover a sufficient number of preset colors to support user-defined selection of preset colors. Furthermore, it enables texture mapping by caching the target texture lookup table, eliminating the need for real-time data format conversion on the GPU chip hardware side, reducing texture sampling latency, and ensuring texture mapping efficiency. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 This is a flowchart illustrating the execution of a computer program by a processor in a lookup table generation system for border texture sampling, as provided in Embodiment 1 of the present invention. Figure 2 This is a schematic diagram of a hardware and software combined border texture sampling system provided in Embodiment 2 of the present invention; Figure 3 This is a flowchart illustrating a border texture sampling method with good compression format accuracy provided in Embodiment 3 of the present invention. Detailed Implementation

[0011] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0012] This embodiment provides a lookup table generation system for border texture sampling. See [link to relevant documentation]. Figure 1 This is a flowchart illustrating the execution of a computer program by a processor in a lookup table generation system for border texture sampling, as provided in Embodiment 1 of the present invention. The system includes a processor and a memory storing the computer program. When the computer program is executed by the processor, the following steps are implemented: S101, based on the attribute information sets corresponding to the M initial data formats respectively, merge the M initial data formats into N reference data formats, where M and N are both positive integers, and N is less than M; S102, construct an initial texture lookup table based on K preset colors and N reference data formats, where K is a positive integer; S103, for any preset color, convert the initial texture data corresponding to the preset color into reference texture data that conforms to N reference data formats respectively; S104, update all reference texture data to the initial texture lookup table to obtain the target texture lookup table.

[0013] The initial data format can refer to the original data format that may be used in the border texture sampling scenario, such as RGB888, RGBA8888, RGB565, etc. The attribute information set can contain color attribute information corresponding to the initial data format. Border texture sampling is a texture addressing mode used when the texture coordinates of the pixel to be rendered on the GPU chip are not within the range of the texture image. In this mode, texture data of a specific color and a specific format is used as the texture data corresponding to the pixel to be rendered.

[0014] Reference data formats can refer to the formats obtained after merging and filtering the initial data formats. Each reference data format can cover the sampling requirements of all initial data formats.

[0015] Preset colors can refer to colors that support user-defined selection. K preset colors can be combined into a color palette or other form for users to choose from.

[0016] The initial texture lookup table can refer to an empty lookup table built according to preset colors and reference data formats, used to fill in the reserved storage structure for texture data.

[0017] The target texture lookup table can refer to the final lookup table after all reference texture data has been filled. The target texture lookup table can be used by the GPU chip hardware side to quickly query texture data.

[0018] Specifically, taking RGB888, RGBA8888, and BGR888 formats as initial data formats as examples, the three formats can be merged into a single reference data format, RGBA8888.

[0019] In one specific implementation, for any initial data format, the set of attribute information corresponding to the initial data format includes several attribute information and bit width information corresponding to each attribute information.

[0020] Among them, attribute information can refer to the dimensions that can characterize the color of texture data. For example, attribute information can be red (R), green (G), blue (B), transparency (A), brightness (Y), chromaticity (U / V), etc.

[0021] Bit width information refers to the number of binary bits occupied by the corresponding attribute information, which can be used to determine the value range of the corresponding attribute information.

[0022] For example, in the RGB888 format, the three attribute information are R, G and B, and the bit width information corresponding to each attribute information is 8 bits.

[0023] In one specific implementation, step S101 includes the following steps: S1011, use all M initial data formats as temporary data formats; S1012, for any temporary data format, if the attribute information set of the temporary data format and the attribute information set of another temporary data format meet the preset conditions, then delete the temporary data format and retain the other temporary data format; S1013, return to step S1012 until the temporary data format cannot be deleted, and use each temporary data format as a reference data format.

[0024] Temporary data format can refer to the intermediate state data format during the format merging process, initially consisting of full copies of M initial data formats.

[0025] Preset conditions can be used to determine whether the temporary data format is redundant. When the preset conditions are met, the corresponding temporary data format is deleted.

[0026] In one implementation, the implementer can set a reservation flag for some commonly used temporary data formats based on the commonality of the format. Accordingly, when the attribute information set of any temporary data format and the attribute information set of another temporary data format meet the preset conditions, if the temporary data format has a reservation flag, the temporary data format is also reserved.

[0027] In one specific implementation, the preset condition is that each attribute information included in the attribute information set of the temporary data format exists in the attribute information set of another temporary data format, and the bit width information corresponding to any attribute information included in the attribute information set of the temporary data format is equal to the bit width information corresponding to that attribute information in the attribute information set of another temporary data format.

[0028] The retained reference data format is compatible with the texture sampling requirements of the deleted format, eliminating the need to store texture data separately for the deleted format, thus simplifying storage without affecting functionality.

[0029] Specifically, taking RGB888 and RGBA8888 formats as temporary data formats as examples, the individual attribute information R, G, and B contained in the RGB888 format are all contained in the attribute information set contained in the RGBA8888 format. Moreover, the bit width information corresponding to the three attribute information R, G, and B in the RGB888 format is 8 bits, which is equal to the bit width information corresponding to the three attribute information R, G, and B in the RGBA8888 format. Therefore, the RGB888 format meets the preset conditions and can be deleted.

[0030] In one embodiment, the preset conditions can be that each attribute information included in the attribute information set of the temporary data format exists in the attribute information set of another temporary data format, and the bit width information corresponding to any attribute information included in the attribute information set of the temporary data format is equal to the bit width information corresponding to the attribute information in the attribute information set of another temporary data format, and the precision corresponding to the temporary data format is equal to the precision corresponding to the other temporary data format, so as to ensure that no precision loss occurs when merging formats.

[0031] In one specific implementation, step S102 includes the following steps: S1021, For any preset color, assign a unique corresponding index value to that preset color; S1022, For any reference data format, assign a unique corresponding offset value to that reference data format; S1023, construct an initial texture lookup table of size K×N based on K index values ​​and N offset values.

[0032] The index value can be used to distinguish texture data of different color dimensions, and the offset value can be used to distinguish texture data of different format dimensions.

[0033] The number of storage units in the initial texture lookup table = the number of preset colors × the number of reference data formats. Each storage unit stores the reference texture data corresponding to a color-format combination.

[0034] In one specific implementation, step S103 includes the following steps: S1031, For any preset color, obtain the initial texture data corresponding to the preset color, wherein the initial texture data conforms to the input data format; S1032, for any reference data format, convert the initial texture data that conforms to the input data format into reference texture data that conforms to the reference data format; S1033, traverse N reference data formats to obtain the reference texture data corresponding to the preset color under each of the N reference data formats.

[0035] The input data format can refer to the original format of the initial texture data, and the input data format may be different from the initial data format.

[0036] Converting initial texture data conforming to the input data format into reference texture data conforming to the reference data format can be implemented on the software side, thus eliminating the need to add additional format conversion logic to the GPU chip hardware side, saving GPU chip area and reducing GPU chip hardware resource consumption.

[0037] Specifically, format conversion methods can include bit-width expansion and bit-width truncation, which will not be elaborated here.

[0038] In one specific implementation, step S104 includes the following steps: S1041, For any reference texture data, update the reference texture data to the corresponding position in the initial texture lookup table according to the index value and offset value corresponding to the reference texture data; S1042, Traverse all reference texture data to obtain the target texture lookup table.

[0039] Specifically, based on the index and offset values ​​corresponding to the reference texture data, the position of the corresponding storage unit in the initial texture lookup table can be determined.

[0040] In one specific implementation, the target texture lookup table is stored in a cache to support the GPU chip's hardware side in obtaining reference texture data of a specific color and specific data format.

[0041] The GPU chip's hardware side can directly read the required reference texture data from the cache without going through the CPU or memory, which can effectively accelerate the texture mapping process and improve texture mapping efficiency.

[0042] In this first embodiment, M initial data formats are merged into N reference data formats to avoid storing texture data corresponding to redundant data formats in the lookup table. This effectively reduces the storage capacity of the target texture lookup table, allowing it to cover a sufficient number of preset colors to support user-defined selection of preset colors. Furthermore, texture mapping can be achieved by caching the target texture lookup table, eliminating the need for real-time data format conversion on the GPU chip hardware side. This reduces texture sampling latency and ensures the efficiency of texture mapping.

[0043] This second embodiment provides a hardware and software combined border texture sampling system, see [link to documentation]. Figure 2 This is a schematic diagram of a hardware and software combined border texture sampling system provided in Embodiment 2 of the present invention. The system includes: a software side, a hardware side, and a cache. The software side is used to generate a target texture lookup table and store the target texture lookup table in the cache; The software side is also used to determine the target index value corresponding to the specified color based on the specified color input by the user, and send the target index value to the hardware side; The hardware side is used to map the target data format to a target offset value according to the required target data format; The hardware side is also used to determine the target address based on the target index value and the target offset value; The hardware side is also used to access the target texture lookup table in the cache according to the target address, so as to obtain the target texture data corresponding to the target address.

[0044] The target texture lookup table can be used on the GPU chip hardware side to quickly query texture data, so as to enable user-customizable border texture sampling.

[0045] Storage space is configured in the cache to store the target texture lookup table.

[0046] The user-input color can be set directly by the user, or selected by the user through a color palette or other means, thus supporting user-customizable border texture sampling.

[0047] A color pointer can be determined based on the color specified by the user input. This color pointer is then used as the target index value, which is sent to the hardware side.

[0048] The target data format required can refer to the data format needed when the hardware performs border texture sampling processing.

[0049] The target address can be used to determine the location of the target texture data in the cache.

[0050] Target texture data can refer to texture data that conforms to the target data format under a specified color.

[0051] In one specific implementation, the target texture lookup table includes several reference texture data, each of which corresponds to an index value and an offset value.

[0052] The reference texture data can refer to the texture data in the reference texture format corresponding to the preset color, which is pre-converted by the software. The preset color can be represented by an index value, and the reference texture format can be represented by an offset value.

[0053] In one specific implementation, mapping the target data format to a target offset value according to the required target data format includes: Based on the target data format required, a reference data format that is compatible with the target data format is determined, and the offset value corresponding to the reference data format that is compatible with the target data format is used as the target offset value.

[0054] The target data format corresponds to the attribute information set, which includes several attribute information and the bit width information corresponding to each attribute information. The reference data format that is compatible with the target data format can be one in which all the attribute information contained in the target data format exists in the attribute information set of the reference data format, and the bit width information corresponding to any attribute information included in the attribute information set of the target data format is equal to the bit width information corresponding to that attribute information in the attribute information set of the temporary data format.

[0055] In one embodiment, a reference data format that is compatible with the target data format may also refer to a reference data format in which all attribute information contained in the target data format exists in the attribute information set of the reference data format, and the bit width information corresponding to any attribute information included in the attribute information set of the target data format is equal to the bit width information corresponding to the attribute information in the attribute information set of the temporary data format, and the precision corresponding to the target data format is equal to the precision corresponding to the temporary data format.

[0056] In one specific implementation, determining the target address based on the target index value and the target offset value includes: The target address is determined based on the pre-configured base address, the target index value, and the target offset value.

[0057] The base address can be used to identify the starting position in the cache used to store the target texture lookup table.

[0058] Specifically, the target address can be calculated as P = Q + I × W + J, where P is the target address, Q is the base address, I is the target index value, and the value of I is an integer greater than or equal to 0. In this embodiment, I is an integer in the range of [0, 4095], indicating that there are 4096 preset colors available for user customization. W is the sum of the storage bit widths of all reference data formats corresponding to a single preset color, and J is the target offset value.

[0059] In one specific implementation, the step of accessing the target texture lookup table in the cache according to the target address to obtain the target texture data corresponding to the target address includes: Based on the target address, the reference texture data corresponding to the target address in the target texture lookup table is determined as the target texture data corresponding to the target address.

[0060] Specifically, the reference texture data can be retrieved from the target texture lookup table in the cache based on the target address.

[0061] In one specific implementation, the process of generating the target texture lookup table includes: Based on the attribute information sets corresponding to the M initial data formats, the M initial data formats are merged into N reference data formats, where M and N are both positive integers, and N is less than M; Based on K preset colors and N reference data formats, construct an initial texture lookup table, where K is a positive integer; For any preset color, convert the initial texture data corresponding to the preset color into reference texture data that conforms to N reference data formats respectively; Update all reference texture data to the initial texture lookup table to obtain the target texture lookup table.

[0062] The initial data format can refer to the original data format that may be used in the border texture sampling scenario, such as RGB888 format, RGBA8888 format, RGB565 format, etc. Border texture sampling is a type of texture addressing mode used when the texture coordinates of the pixel to be rendered on the GPU chip are not within the range of the texture image. In this mode, texture data of a specific color and a specific format is used as the texture data corresponding to the pixel to be rendered.

[0063] Reference data formats can refer to the formats obtained after merging and filtering the initial data formats. Each reference data format can cover the sampling requirements of all initial data formats.

[0064] Preset colors can refer to colors that support user-defined selection. K preset colors can be combined into a color palette or other form for users to choose from.

[0065] The initial texture lookup table can refer to an empty lookup table built according to preset colors and reference data formats, used to fill in the reserved storage structure for texture data.

[0066] The target texture lookup table can refer to the final lookup table after all reference texture data has been filled.

[0067] Specifically, taking RGB888, RGBA8888, and BGR888 formats as initial data formats as examples, the three formats can be merged into a single reference data format, RGBA8888.

[0068] In one specific implementation, for any initial data format, the set of attribute information corresponding to the initial data format includes several attribute information and bit width information corresponding to each attribute information.

[0069] Among them, attribute information can refer to the dimensions that can characterize the color of texture data. For example, attribute information can be red (R), green (G), blue (B), transparency (A), brightness (Y), chromaticity (U / V), etc.

[0070] Bit width information refers to the number of binary bits occupied by the corresponding attribute information, which can be used to determine the value range of the corresponding attribute information.

[0071] For example, in the RGB888 format, the three attribute information are R, G and B, and the bit width information corresponding to each attribute information is 8 bits.

[0072] In one specific implementation, the step of merging the M initial data formats into N reference data formats based on the attribute information sets corresponding to the M initial data formats includes: All M initial data formats are used as temporary data formats; For any temporary data format, if the attribute information set of the temporary data format and the attribute information set of another temporary data format meet a preset condition, then the temporary data format is deleted and the other temporary data format is retained. Return to the step of deleting the temporary data format and retaining the other temporary data format if the attribute information set of the temporary data format and the attribute information set of another temporary data format meet the preset conditions, until no temporary data format can be deleted, and each temporary data format is used as a reference data format.

[0073] Temporary data format can refer to the intermediate state data format during the format merging process, initially consisting of full copies of M initial data formats.

[0074] Preset conditions can be used to determine whether the temporary data format is redundant. When the preset conditions are met, the corresponding temporary data format is deleted.

[0075] In one implementation, the implementer can set a reservation flag for some commonly used temporary data formats based on the commonality of the format. Accordingly, when the attribute information set of any temporary data format and the attribute information set of another temporary data format meet the preset conditions, if the temporary data format has a reservation flag, the temporary data format is also reserved.

[0076] Specifically, the preset conditions can be: each attribute information included in the attribute information set of the temporary data format exists in the attribute information set of another temporary data format, and the bit width information corresponding to any attribute information included in the attribute information set of the temporary data format is equal to the bit width information corresponding to that attribute information in the attribute information set of another temporary data format.

[0077] The retained reference data format is compatible with the texture sampling requirements of the deleted format, eliminating the need to store texture data separately for the deleted format, thus simplifying storage without affecting functionality.

[0078] Specifically, taking RGB888 and RGBA8888 formats as temporary data formats as examples, the individual attribute information R, G, and B contained in the RGB888 format are all contained in the attribute information set contained in the RGBA8888 format. Moreover, the bit width information corresponding to the three attribute information R, G, and B in the RGB888 format is 8 bits, which is equal to the bit width information corresponding to the three attribute information R, G, and B in the RGBA8888 format. Therefore, the RGB888 format meets the preset conditions and can be deleted.

[0079] In one embodiment, the preset conditions can be that each attribute information included in the attribute information set of the temporary data format exists in the attribute information set of another temporary data format, and the bit width information corresponding to any attribute information included in the attribute information set of the temporary data format is equal to the bit width information corresponding to the attribute information in the attribute information set of another temporary data format, and the precision corresponding to the temporary data format is equal to the precision corresponding to the other temporary data format, so as to ensure that no precision loss occurs when merging formats.

[0080] In this second embodiment, border texture sampling is achieved through a combination of software and hardware. It supports user-defined sampling colors. The software side pre-stores a target texture lookup table and provides the target index value for the custom color to the hardware side. The hardware side only needs to perform target offset mapping and target address calculation to directly read the target texture data from the cache according to the target address. There is no need for the hardware side to perform format conversion after obtaining the texture data, which saves the hardware side's computing resources. Moreover, the target texture lookup table contains texture data in multiple data formats. When obtaining texture data, the hardware side does not need to always obtain large bit-width texture data and then convert it, but can directly obtain the texture data with the required bit width, thereby reducing the memory access bandwidth of the hardware side and improving the border texture sampling efficiency.

[0081] This third embodiment provides a border texture sampling method with compressed format and good accuracy. See [link to documentation]. Figure 3 This is a flowchart illustrating a compression format-accuracy-friendly border texture sampling method provided in Embodiment 3 of the present invention. The method is applied to the hardware side of a GPU chip and includes: S301, based on the target data format required, when the target data format is an uncompressed format, a reference data format that is compatible with the target data format is determined, and the offset value corresponding to the reference data format that is compatible with the target data format is used as the target offset value. S302, when the target data format is a compressed format, a reference data format that meets the preset format change conditions is determined, and the offset value corresponding to the reference data format that meets the preset format change conditions is used as the target offset value; S303, determine the target address based on the target offset value and the received target index value; S304, according to the target address, access the target texture lookup table in the cache to obtain the target texture data corresponding to the target address.

[0082] The target data format can refer to the data format required by the GPU chip's hardware side when performing border texture sampling. The uncompressed format can refer to the storage of texture data according to the original pixel information. In the uncompressed format, the texture data is encoded according to a fixed bit width and order. After reading the uncompressed texture data, no decompression operation is required, and it can be directly applied to texture mapping. The compressed format can refer to the use of compression algorithms to compress the original pixel information into compressed texture data in order to reduce the bit width of texture data storage and reduce redundant information in the texture data. The compressed texture data needs to be decompressed before use to restore the original pixel information before subsequent processing.

[0083] The target data format corresponds to an attribute information set, which includes several attribute information and the bit width information corresponding to each attribute information. A reference data format that is compatible with the target data format can be one in which all attribute information contained in the target data format exists in the attribute information set of the reference data format, and the bit width information corresponding to any attribute information included in the attribute information set of the target data format is equal to the bit width information corresponding to that attribute information in the attribute information set of the temporary data format.

[0084] Offset values ​​can be used to determine the reference data format, while target offset values ​​can be used to determine the reference data format to which the texture data is actually mapped when acquiring the target data format.

[0085] Preset format change conditions can be used to determine whether a reference data format can be used as a replacement for the target data format.

[0086] The target index value can be used to determine the preset color corresponding to the target texture data. In this embodiment, the target index value is determined by the software side according to the specified color input by the user and sent to the hardware side. The specified color input by the user can be set directly by the user or selected by the user through a color palette or other means, thereby supporting border texture sampling with customizable border colors.

[0087] The target address can be used to determine the location of the target texture data in the cache. The target texture data can be texture data that conforms to the target data format under a specified color.

[0088] The target texture lookup table can be used on the GPU chip hardware side to quickly query texture data, enabling user-customizable border texture sampling with customizable border colors.

[0089] Specifically, in texture mapping scenarios, BC compression format is typically used. However, BC compression is obtained through lossy compression. After decompression, the recovered pixel information will have a certain degree of precision loss compared to the original pixel information, which may result in the inability to meet the precision requirements of texture mapping. Therefore, in this embodiment, when the target data format is compressed, the offset value corresponding to the reference data format that meets the preset format change conditions is used as the target offset value. Only the address mapping relationship needs to be modified on the hardware side. This eliminates the need to obtain the compressed texture data and perform decompression. Instead, the target texture data under the reference data format that meets the precision requirements is directly obtained, thereby improving texture mapping efficiency.

[0090] In one specific implementation, the target texture lookup table includes several reference texture data, each of which corresponds to an index value and an offset value.

[0091] The reference texture data can refer to the texture data in the reference texture format corresponding to the preset color, which is pre-converted by the software. The preset color can be represented by an index value, and the reference texture format can be represented by an offset value.

[0092] In one specific implementation, the preset format change condition is: The current reference data format has the same bit width as the target data format, and the precision of the current reference data format meets the preset precision requirements.

[0093] The current reference data format has the same bit width as the target data format to ensure that the bandwidth of the reference texture data corresponding to the reference data format is the same as that of the target data format when it is read, so that there will be no bandwidth change and no additional design and processing required on the hardware side.

[0094] The preset accuracy requirement can be determined based on the accuracy requirements of the texture data during the border texture sampling process.

[0095] As can be seen, when it is necessary to obtain compressed texture data, the hardware directly maps the compressed format to a reference data format that meets the preset format change conditions, thereby obtaining the reference texture data under the reference data format that meets the preset format change conditions without decompression. Moreover, the reference texture data under the reference data format that meets the preset format change conditions meets the preset precision requirements. For the software side, there is no need to add a large number of compressed formats to the target texture lookup table. It is still only necessary to store the reference texture data of each reference texture format under each preset color. This avoids the target texture lookup table becoming too large due to the introduction of compressed formats, thereby increasing the storage pressure of the cache.

[0096] In one specific implementation, determining the target address based on the target offset value and the received target index value includes: The target address is determined based on the pre-configured base address, the target index value, and the target offset value.

[0097] The base address can be used to identify the starting position in the cache used to store the target texture lookup table.

[0098] Specifically, the target address can be calculated as P = Q + I × W + J, where P is the target address, Q is the base address, I is the target index value, and the value of I is an integer greater than or equal to 0. In this embodiment, I is an integer in the range of [0, 4095], indicating that there are 4096 preset colors available for user customization. W is the sum of the storage bit widths of all reference data formats corresponding to a single preset color, and J is the target offset value.

[0099] In one specific implementation, the step of accessing the target texture lookup table in the cache according to the target address to obtain the target texture data corresponding to the target address includes: Based on the target address, the reference texture data corresponding to the target address in the target texture lookup table is determined as the target texture data corresponding to the target address.

[0100] Specifically, the reference texture data corresponding to the target address can be found from the target texture lookup table in the cache based on the target address, and the found reference texture data is used as the target texture data.

[0101] In one specific implementation, the process of generating the target texture lookup table includes: Based on the attribute information sets corresponding to the M initial data formats, the M initial data formats are merged into N reference data formats, where M and N are both positive integers, and N is less than M; Based on K preset colors and N reference data formats, construct an initial texture lookup table, where K is a positive integer; For any preset color, convert the initial texture data corresponding to the preset color into reference texture data that conforms to N reference data formats respectively; Update all reference texture data to the initial texture lookup table to obtain the target texture lookup table.

[0102] The initial data format can refer to the original data format that may be used in the border texture sampling scenario.

[0103] Reference data formats can refer to the formats obtained after merging and filtering the initial data formats. Each reference data format can cover the sampling requirements of all initial data formats.

[0104] Preset colors can refer to colors that support user-defined selection. K preset colors can be combined into a color palette or other form for users to choose from.

[0105] The initial texture lookup table can refer to an empty lookup table built according to preset colors and reference data formats, used to fill in the reserved storage structure for texture data.

[0106] The target texture lookup table can refer to the final lookup table after all reference texture data has been filled.

[0107] In one specific implementation, for any initial data format, the set of attribute information corresponding to the initial data format includes several attribute information and bit width information corresponding to each attribute information.

[0108] Among them, attribute information can refer to the dimensions that can characterize the color of texture data. For example, attribute information can be red (R), green (G), blue (B), transparency (A), brightness (Y), chromaticity (U / V), etc.

[0109] Bit width information refers to the number of binary bits occupied by the corresponding attribute information, which can be used to determine the value range of the corresponding attribute information.

[0110] In one specific implementation, the step of merging the M initial data formats into N reference data formats based on the attribute information sets corresponding to the M initial data formats includes: All M initial data formats are used as temporary data formats; For any temporary data format, if the attribute information set of the temporary data format and the attribute information set of another temporary data format meet a preset condition, then the temporary data format is deleted and the other temporary data format is retained. Return to the step of deleting the temporary data format and retaining the other temporary data format if the attribute information set of the temporary data format and the attribute information set of another temporary data format meet the preset conditions, until no temporary data format can be deleted, and each temporary data format is used as a reference data format.

[0111] Temporary data format can refer to the intermediate state data format during the format merging process, initially consisting of full copies of M initial data formats.

[0112] Preset conditions can be used to determine whether the temporary data format is redundant. When the preset conditions are met, the corresponding temporary data format is deleted.

[0113] The preset conditions can be: each attribute information included in the attribute information set of the temporary data format exists in the attribute information set of another temporary data format, and the bit width information corresponding to any attribute information included in the attribute information set of the temporary data format is equal to the bit width information corresponding to that attribute information in the attribute information set of another temporary data format.

[0114] In this third embodiment, when the target data format is a compressed format, the reference data format that meets the format change conditions is determined on the hardware side to provide the target offset value for determining the target texture data. Only the offset value mapping relationship needs to be added on the hardware side, so there is no need to obtain the compressed texture data. This avoids the need for decompression, which would cause a loss of texture data accuracy and affect the normal processing of border texture sampling. The target texture data under the reference data format that meets the accuracy requirements corresponding to the compressed format can be directly obtained, improving the efficiency of texture sampling. Moreover, there is no need to add a large number of compressed formats to the target texture lookup table, thus ensuring that the space occupied by the target texture lookup table can be supported by the cache.

[0115] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of this invention is defined by the appended claims.

Claims

1. A lookup table generation system for border texture sampling, characterized in that, The system includes a processor and a memory storing a computer program, which, when executed by the processor, performs the following steps: S101, based on the attribute information sets corresponding to the M initial data formats respectively, merge the M initial data formats into N reference data formats, where M and N are both positive integers, and N is less than M; S102, construct an initial texture lookup table based on K preset colors and N reference data formats, where K is a positive integer; S103, for any preset color, convert the initial texture data corresponding to the preset color into reference texture data that conforms to N reference data formats respectively; S104, update all reference texture data to the initial texture lookup table to obtain the target texture lookup table.

2. The lookup table generation system for border texture sampling according to claim 1, characterized in that, For any initial data format, the set of attribute information corresponding to the initial data format includes several attribute information and the bit width information corresponding to each attribute information.

3. The lookup table generation system for border texture sampling according to claim 2, characterized in that, Step S101 includes the following steps: S1011, use all M initial data formats as temporary data formats; S1012, for any temporary data format, if the attribute information set of the temporary data format and the attribute information set of another temporary data format meet the preset conditions, then delete the temporary data format and retain the other temporary data format; S1013, return to step S1012 until the temporary data format cannot be deleted, and use each temporary data format as a reference data format.

4. The lookup table generation system for border texture sampling according to claim 3, characterized in that, The preset condition is that each attribute information included in the attribute information set of the temporary data format exists in the attribute information set of another temporary data format, and the bit width information corresponding to any attribute information included in the attribute information set of the temporary data format is less than or equal to the bit width information corresponding to the attribute information in the attribute information set of another temporary data format.

5. The lookup table generation system for border texture sampling according to claim 1, characterized in that, Step S102 includes the following steps: S1021, For any preset color, assign a unique corresponding index value to that preset color; S1022, For any reference data format, assign a unique corresponding offset value to that reference data format; S1023, construct an initial texture lookup table of size K×N based on K index values ​​and N offset values.

6. The lookup table generation system for border texture sampling according to claim 1, characterized in that, Step S103 includes the following steps: S1031, For any preset color, obtain the initial texture data corresponding to the preset color, wherein the initial texture data conforms to the input data format; S1032, for any reference data format, convert the initial texture data that conforms to the input data format into reference texture data that conforms to the reference data format; S1033, traverse N reference data formats to obtain the reference texture data corresponding to the preset color under each of the N reference data formats.

7. The lookup table generation system for border texture sampling according to claim 5, characterized in that, Step S104 includes the following steps: S1041, For any reference texture data, update the reference texture data to the corresponding position in the initial texture lookup table according to the index value and offset value corresponding to the reference texture data; S1042, Traverse all reference texture data to obtain the target texture lookup table.

8. The lookup table generation system for border texture sampling according to claim 1, characterized in that, The target texture lookup table is stored in a cache to enable the GPU chip's hardware side to obtain reference texture data in a specific data format for a specific color.