Texture coordinate calculation circuit

By designing the texture coordinate calculation circuits of the Config module, LOD module, and Coord module, and by specifically handling the texture coordinates at the edges of the cube texture, the problem of discontinuous rendering at the edges of the cube texture was solved, resulting in a smoother texture image effect.

CN121639894APending Publication Date: 2026-03-10WUHAN LINGJIU MICROELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-11
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

In existing technologies, cube textures suffer from discontinuous rendering at the edges, especially when bilinear or trilinear filtering is applied. The texture coordinate calculation unit only calculates texel coordinates from one face, resulting in uneven rendering at the edges.

Method used

A texture coordinate calculation circuit was designed, including a Config module, an LOD module, and four Coord modules. Each Coord module contains a seamless calculation unit. The calculation tasks are distributed through configuration information and LOD values. The texture coordinates at the edges of the cube texture are specially processed to achieve seamless filtering.

Benefits of technology

Supporting multiple texture types and filtering methods, it ensures a smooth transition of texture images at the edges of cube textures, improving GPU rendering performance and avoiding discontinuities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121639894A_ABST
    Figure CN121639894A_ABST
Patent Text Reader

Abstract

The invention provides a texture coordinate calculation circuit, which comprises a Config module, an LOD module and four Coord modules, and is characterized in that each Coord module comprises a seamless calculation unit; the Config module is used for storing configuration information; the LOD module calculates the LOD value of each texture coordinate; each Coord module is used for processing each texture coordinate according to the configuration information and the LOD value of each texture coordinate, and each seamless calculation unit is used for calculating the cubic texture coordinate at the edge of the cubic texture. According to the method, a texture coordinate calculation circuit is designed, and texture coordinates at the edges of two surfaces of cubic texture are additionally processed under the calculation requirements of supporting various texture types, filtering modes and surrounding modes, so that a texture image finally rendered by a GPU is smooth.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of texture sampling technology, and more specifically, to a texture coordinate calculation circuit. Background Technology

[0002] Currently, texture units in GPUs typically support various texture sampling types, including 2D, 3D, and cubic textures. The texture coordinate calculation unit, a key circuit within this unit, processes these different texture coordinate types to obtain the texel coordinates to be sampled within the texture pattern. While traditional texture coordinate generation units can support coordinate calculations for various texture types, when dealing with a cubic texture composed of six independent faces, bilinear or trilinear filtering can cause sampled texels to be located on two adjacent faces. Without special handling, the texel coordinates calculated by the texture coordinate generation unit will only come from one face, resulting in uneven rendering at the edges. Therefore, an optimized method for cubic texture coordinate calculation is needed to render the entire cubic texture more continuously and smoothly. Summary of the Invention

[0003] This invention addresses the technical problems existing in the prior art by providing a texture coordinate calculation circuit that can solve the problem of discontinuity in texture images at the seams between two faces caused by existing cube texture processing methods.

[0004] According to a first aspect of the present invention, a texture coordinate calculation circuit is provided, comprising a Config module, an LOD module and four Coord modules, each Coord module including a seamless calculation unit;

[0005] The Config module is used to receive quad fragment texture requests sent by the shader and store texture information and configuration information, so as to calculate and configure the LOD module and each of the Coord modules according to the configuration information;

[0006] The LOD module is used to calculate the LOD value of each texture coordinate in the texture request; and to distribute the calculation task of each texture coordinate to the corresponding Coord module according to the LOD value of each texture coordinate.

[0007] Each of the Coord modules is used to calculate each texture coordinate based on the configuration information and the LOD value of each texture coordinate, wherein each seamless calculation unit calculates the cube texture coordinates located at the edge of the cube texture.

[0008] The present invention provides a texture coordinate calculation circuit that, under the calculation requirements of various texture types, filtering methods and wrapping modes, performs additional processing on the texture coordinates at the edges of the two faces of a cube texture, thereby making the texture image rendered by the GPU smooth and solving the problem of discontinuity in the texture image at the seam between the two faces of the cube texture. Attached Figure Description

[0009] Figure 1 This is a schematic diagram of a texture coordinate calculation circuit provided in one embodiment of the present invention;

[0010] Figure 2 This is a flowchart illustrating the process of a texture coordinate calculation circuit according to an embodiment of the present invention.

[0011] Figure 3 A schematic diagram of the texture coordinates in the four fragments of the quad sent to the shader;

[0012] Figure 4 A schematic diagram of the cube texture unfolding;

[0013] Figure 5 This is a schematic diagram of sampling at the edge of a cube texture;

[0014] Figure 6 This is a schematic diagram of the internal structure of a seamless computing unit;

[0015] Figure 7 A flowchart of the workflow for a seamless computing unit;

[0016] Figure 8 This is a schematic diagram of ID generation for face switching. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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, 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. In addition, the technical features of the various embodiments or individual embodiments provided by the present invention can be arbitrarily combined with each other to form feasible technical solutions. Such combinations are not constrained by the order of steps and / or structural composition patterns, but must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.

[0018] Before introducing the texture coordinate calculation circuit provided by the present invention, the technical terms involved in the present invention will be explained.

[0019] LOD (Level of Detail): The level of detail of a texture. By calculating LOD, we can determine which level of texture image in the mipmap pyramid is best suited for the current rendering situation, that is, the texture image region that is best suited for the current screen pixel area.

[0020] Texture coordinate normalization: Texture images have a fixed resolution. If pixel coordinates are used to represent the points of the texture directly, these coordinates will no longer be applicable when the texture size changes. Therefore, normalized texture coordinates are commonly used in computer graphics to map all positions of the texture to the range of [0, 1].

[0021] Wrapping modes: When texture coordinates are outside the normal range, they are converted to the valid range. Common wrapping modes include Repeat, Mirror_Repeat, and Clamp to edge.

[0022] Nearest neighbor filtering: uses the texel closest to the sampling point as the sampling result.

[0023] Bilinear filtering: Sample four texels near the target point and perform a weighted average based on their weights.

[0024] Trilinear filtering: Bilinear filtering is applied to two adjacent mipmap levels of texture, and the two sampling results are linearly interpolated to obtain the final color.

[0025] Anisotropic filtering: Due to the tilt of the viewpoint, the sampling range of the texture is stretched. At this time, using ordinary texture filtering will result in texture blurring. Anisotropic filtering will sample multiple times in the stretched direction to retain more details.

[0026] Bypass path: A path that passes data directly from input to output without processing.

[0027] In texture mapping, the texture unit typically obtains color values ​​from the corresponding texture through two steps: texture addressing and texture filtering. During texture addressing, the texture unit receives texture coordinates (u, v) from the shader. These coordinates are usually floating-point numbers and may exceed the range [0, 1], meaning they are unnormalized. Based on the set texture type, texture filtering mode, and texture wrapping mode, the texture unit ultimately obtains the texture coordinates for the corresponding mipmap layer. During texture filtering, the memory address of these coordinates is calculated, and the texels at that address are retrieved and interpolated to obtain the final color value.

[0028] GPU texture units typically need to support various texture types, such as 2D, 3D, and cube textures, when performing texture filtering operations. In cube texture mapping, 3D texture coordinates are mapped onto a face of the cube, and then 2D texture sampling is performed on that face. During the texture addressing phase, due to the special nature of cube textures, when calculating texture coordinates at the edge of a cube face, the wrapping mode processing may calculate coordinates outside the cube face as coordinates within the cube face. This can lead to incorrect texel interpolation during subsequent texture filtering, resulting in unevenness in the final image at the cube face edges.

[0029] When performing bilinear or trilinear filtering on the edges of a cube-type texture, the texture coordinate calculation unit only generates the texel coordinates of one face of the cube texture, resulting in discontinuities in the texture image at the seam between the two faces. This invention designs a texture coordinate calculation circuit that, while supporting various texture types, filtering methods, and wrapping modes, controls whether to perform additional processing on the coordinates at the edges of the two faces of the cube texture through configuration registers, thereby smoothing the final GPU-rendered graphics image.

[0030] To address the issue of discontinuous texture images during cube texture mapping, Figure 1 This illustration shows a texture coordinate calculation circuit according to an embodiment of the present invention, incorporating a circuit implementation design with seamless cube texture filtering. Figure 1 This is a structural diagram of the texture coordinate calculation circuit. The structure employs a pipelined design with four paths, enabling parallel calculation of the texture coordinates of four segments within the quad.

[0031] like Figure 1 As shown, the texture coordinate calculation circuit includes a Config module, an LOD module, and four Coord modules, each of which contains a Seamless unit.

[0032] The Config module is used to receive quad fragment texture requests sent by the shader and store texture information and configuration information, so as to calculate and configure the LOD module and each of the Coord modules according to the configuration information;

[0033] The LOD module is used to calculate the LOD value of each texture coordinate in the texture request; and to distribute the calculation task of each texture coordinate to the corresponding Coord module according to the LOD value of each texture coordinate.

[0034] Each of the Coord modules is used to calculate each texture coordinate based on the configuration information and the LOD value of each texture coordinate, wherein each seamless calculation unit calculates the cube texture coordinates located at the edge of the cube texture.

[0035] Understandably, see Figure 1 The texture coordinate calculation circuit mainly consists of three parts: the Config module, the LOD module, and the Coord module. The Config module stores texture information such as width and height of the quad fragment texture sent by the shader, as well as configuration information such as texture type, filtering mode, and wrapping mode, configuring the calculations of the LOD and Coord modules. The LOD module calculates the LOD value for each texture coordinate of the current quad. The Coord module processes each texture coordinate of the quad according to the configuration information, with its seamless calculation unit calculating the coordinates for the cube texture mode.

[0036] This circuit can be configured to support coordinate processing for texture modes such as 1D, 2D, 3D, cube, 1D ARRAY, and 2D ARRAY. It supports coordinate processing for nearest-neighbor sampling, bilinear filtering, trilinear filtering, and anisotropic filtering, and also supports configuring the source of LOD, further increasing the flexibility of LOD calculation.

[0037] To enhance the effect of the cube texture and make the edge color transition between the two faces of the cube smooth, this invention has specially designed a seamless module in the texture coordinate calculation circuit to support seamless cube texture filtering and process the coordinates at the edge of the cube texture.

[0038] See Figure 2 This is a flowchart of the coordinate processing of the texture coordinate calculation circuit designed in this invention. The design receives texture coordinates from four segments in a quad sent by the shader, processes them, and then outputs the results.

[0039] The Config module is used to receive quad fragment texture requests sent by the shader and store configuration information, including:

[0040] Receive a quad fragment texture request sent by the shader, the texture request including 4 texture coordinates and texture type;

[0041] The system stores texture information and configuration information, whereby the texture information includes the height and width of the texture, and the configuration information includes the texture type, filtering mode, and wrapping mode.

[0042] The LOD module is used to calculate the LOD value of each texture coordinate in the texture request, including:

[0043] Based on the texture type, determine whether the four texture coordinates are cube texture coordinates. If so, convert each three-dimensional texture coordinate into a two-dimensional texture coordinate and normalize it. Then, calculate the LOD value of each texture coordinate based on the normalized texture coordinates.

[0044] The step of distributing the calculation task for each texture coordinate to the corresponding Coord module based on the LOD value of each texture coordinate includes:

[0045] Based on the LOD value of each texture coordinate, the calculation task for each texture coordinate is sent to the corresponding Coord module.

[0046] For details, see Figure 3 This is a schematic diagram of the four texture coordinates of a quad fragment. After receiving the four texture coordinates of the quad fragment, the texture coordinate calculation circuit processes the four texture coordinates.

[0047] First, the Config module receives a quad fragment texture request from the shader. This request includes four texture coordinates and a texture type, such as 2D, 3D, or cube. Upon receiving the texture request, the Config module stores texture information and configuration information. The texture information includes the texture's height and width, while the configuration information includes the texture type, filtering mode, and wrapping mode. The filtering mode and wrapping mode are configuration settings used by the subsequent LOD and Coord modules for computation.

[0048] The LOD module is used to calculate the LOD value of each texture coordinate in the texture request. The specific calculation process is as follows:

[0049] Based on the texture type carried in the texture request, determine whether the four texture coordinates are cube texture coordinates. If so, process each three-dimensional texture coordinate. A cube texture consists of six textures forming the six planes of a cube. In this case, the three-dimensional coordinates can be regarded as a vector drawn from the origin. The place where this vector intersects with the cube texture is the texture surface that needs to be sampled, that is, the principal axis surface.

[0050] Since it is necessary to sample one face of the cube texture, the coordinates of the 3D cube texture need to be processed to transform them into coordinates (s,t) in the 2D texture and then normalized.

[0051] First, the principal axis plane is determined. The principal axis is the component with the largest absolute value among the three components of the 3D texture coordinates. The sign of this component represents the direction of the principal axis. For example, in (0.8, 0.5, -0.6), |0.8| is the largest and is positive; therefore, the principal axis plane for this coordinate system is +X. According to Table 1, the corresponding intermediate parameter s can be obtained from the principal axis plane. c t c m a , where m a s is the component with the largest absolute value in the three-dimensional coordinate system. c To calculate the intermediate parameters of texture coordinates s, t c Intermediate parameters are used to calculate the texture coordinate t. Table 1 provides the parameters s. c t c m a The calculation method.

[0052] Table 1 Parameters s c t c m a Calculation method

[0053]

[0054] The parameter s was calculated. c t c m a , to 3D texture coordinates (r x r y and r z Converting s to 2D texture coordinates (s, t) using the following formula:

[0055] ;

[0056] in,( , () represents the transformed two-dimensional texture coordinates.

[0057] The transformed 2D texture coordinates are normalized to fit within the range [0, 1]. Non-cubic textures do not require this normalization and are allowed to exceed the range [0, 1].

[0058] In one embodiment of the present invention, after normalizing the three-dimensional texture coordinates, normalized texture coordinates are obtained. Based on the normalized texture coordinates, the Level of Displacement (LOD) value of isotropic filtering for each texture coordinate is calculated. The filtering mode in the configuration information is then used to determine whether it is an anisotropic filtering mode. If so, the LOD value of anisotropic filtering is calculated based on the LOD value of isotropic filtering, and the LOD value of anisotropic filtering is corrected. The corrected LOD value of anisotropic filtering is then used as the LOD value of each texture coordinate. If not, the LOD value of isotropic filtering is corrected, and the corrected LOD value of isotropic filtering is used as the LOD value of each texture coordinate. The LOD value correction includes: determining whether an offset value needs to be added to the LOD value based on an enable signal. If so, an offset value is added to the LOD value according to the configuration information, which includes pre-configured offset values, to obtain the LOD value after adding the offset value; if not, no offset value is added.

[0059] After processing the LOD value to see if an offset value is added, it is determined whether the LOD value is within the allowed range. If it is, no correction is made; otherwise, the LOD value is clamped within the allowed range.

[0060] Clamping LOD values ​​within the allowed range, including:

[0061] Set the allowed range of LOD values ​​[LOD] min LOD max If LOD value < LOD min Then LOD = LOD min If LOD value > LOD max Then LOD = LOD max .

[0062] Understandably, see Figure 2 After obtaining the normalized texture coordinates, the LOD value of the isotropic filter is obtained based on the actual scaling from screen space to texture space. If anisotropic filtering is enabled at this point, the LOD value, sampling rate, and sampling step size of the anisotropic filter need to be calculated. Finally, the LOD value of the anisotropic filter is corrected to determine whether it is within the allowable range and whether an offset value needs to be added to the LOD. The corrected LOD value of the anisotropic filter is used as the final LOD value for each texture coordinate. If anisotropic filtering is disabled at this point, the LOD value of the isotropic filter is used directly for correction, and the corrected LOD value of the isotropic filter is used as the final LOD value for each texture coordinate.

[0063] It should be noted that during initialization, LOD values ​​can be configured using registers. If an LOD value has already been configured in the register, that configured LOD value will be used as the final LOD value for each texture coordinate. The LOD values ​​for all four texture coordinates in the quad will be the configured LOD values. If no LOD value is configured in the register, the LOD value for each texture coordinate will be calculated using the method described above.

[0064] Once the LOD value for each texture coordinate is determined, the calculation task for each texture coordinate is sent to the corresponding Coord module. The Coord module calculates the texture sampling coordinates for each texture coordinate under the corresponding filtering mode. Specifically, if the texture filtering mode is anisotropic, the texture sampling coordinates for each texture coordinate under anisotropic filtering mode are calculated based on its LOD value, and then the absolute coordinates of each texture are calculated based on these texture sampling coordinates. If the texture filtering mode is non-anisotropic, the absolute coordinates of each texture are calculated based on the normalized texture coordinates.

[0065] Determine whether each texture absolute coordinate exceeds the texture image range. If it does, perform wrap mode processing on the texture absolute coordinates so that the wrapped texture absolute coordinates are within the texture pattern range.

[0066] Understandably, once the LOD value of each texture coordinate is determined, subsequent coordinate processing is calculated based on the mipmap pattern of that layer. If the texture filtering mode is anisotropic filtering, the coordinates of each sampling point (texture sampling coordinates) of the anisotropic filtering are calculated according to the number of sampling steps of the anisotropic filtering. The texture sampling coordinates are then multiplied by the height, width, and depth of the texture pattern of the corresponding mipmap layer to obtain the absolute texture coordinates. If the texture filtering mode is non-anisotropic filtering, the normalized texture coordinates are directly multiplied by the height, width, and depth of the texture pattern of the corresponding mipmap layer to obtain the absolute texture coordinates. For absolute texture coordinates that exceed the texture pattern, a wrap mode is applied to adjust their coordinates to be within the texture pattern.

[0067] The texture coordinates processed in surround mode undergo seamless cube filtering. This processing is performed by the Seamless computation unit in the Coord module. Each Seamless unit calculates the cube texture coordinates, including determining whether the quad is located at the intersection of cube texture faces. Specifically, it checks whether the four texels generated by each texture coordinate are located on two faces of the cube texture. If they are, it indicates an intersection. If at the intersection, the Seamless unit recalculates the texel coordinates generated by each texture coordinate of the quad and the corresponding cube face; otherwise, no recalculation is needed.

[0068] For details, see Figure 4 If it's a cube texture mode, it checks if the quad is at the intersection of cube texture faces. If it is, the texel coordinates and cube faces need to be recalculated so that the four texels come from different cube faces. This invention designs a seamless module to implement this function, and the specific design is as follows.

[0069] One cube texture consists of six 2D textures, such as... Figure 4 As shown, the cube is unfolded according to the coordinate system at the lower left corner. The UV directions of each cube face are as follows: Figure 4 As shown.

[0070] like Figure 5 As shown in ①, when the left side of the texture mapping is at the edge of the 0th face, the current coordinates will calculate the coordinates i0, j0, i1, j1 of the four sampled texels when performing bilinear filtering. After calculation, the range of texel coordinates may exceed the range of the 0th face. Figure 5 As shown in ②, the wrap-around mode operation in the texture coordinate calculation unit transforms coordinates outside the texture coordinate range to the texture coordinate range. The result of reading texels and performing bilinear filtering based on these new coordinates does not conform to the prefetch. The sampler only samples from face 4 or face 0, which will produce discontinuous color transitions at the edges. In this case, the coordinates of the texels and the cube surface they occupy need to be recalculated. Figure 5 As shown in ③, for coordinates that are outside the range of texture coordinates on face 0, calculate their coordinates in texture coordinates on face 4.

[0071] like Figure 6 The image shows the seamless computing unit designed in this invention, which includes four face-switching lookup table modules, four index-switching lookup table modules, one state control module, and one index calculation module. The state control module controls the order in which the four texel coordinates need to be read when calculating bilinear filtering, and the index calculation module calculates the final texel coordinates.

[0072] The specific calculation process is as follows:

[0073] Controlled by the seamless enable signal, for coordinates located in the non-edge region of the cube, the seamless computing unit outputs a set of i0, i1, j0, j1 (which can form four coordinates (i0, j0), (i1, j0), (i0, j1), (i1, j1)) per cycle as the coordinates of four texels for bilinear filtering sampling. For coordinates located in the edge region of the cube, the seamless computing unit outputs four coordinates (i, j) over four cycles as the coordinates of four texels for bilinear filtering sampling, and the output order is shown in Table 2.

[0074] Table 2 Output Order

[0075]

[0076] The flowchart of the computation process of this seamless computing unit can be found here. Figure 7 The working process of the seamless computing unit includes the following steps:

[0077] a. When performing bilinear or trilinear filtering, calculate the coordinates of the four sampled texels based on the texture coordinates after processing in the wraparound mode.

[0078] If the current texture coordinates after processing in surround mode are (u, v), when performing bilinear or trilinear filtering, calculate i0=u-1 / 2, i1=u+1 / 2, j0=v-1 / 2, j1=v+1 / 2, and calculate the coordinates of the four sampled texels (i0, j0), (i1, j0), (i0, j1), and (i1, j1).

[0079] b. Calculate the face switching ID of each texel based on the coordinates of each texel.

[0080] Understandably, after calculating the four texel coordinates, the face switching ID for each texel is calculated based on each texel coordinate. Specifically, the face switching ID for each texel coordinate can be generated according to the face switching generation table in Table 2.

[0081] Table 3. Surface Switching Signal Generation Table

[0082]

[0083] The diagram illustrating the generation of the face switching ID can be found here. Figure 8 ,in:

[0084] For a texel (i0, j0), a face switching ID of 0 indicates it is within the texture coordinate range; a face switching ID of 1 indicates it is within the texture coordinate range where i is less than 0 and j is within the texture coordinate range; a face switching ID of 2 indicates it is within the texture coordinate range where i is within the texture coordinate range and j is less than 0. For example... Figure 8 As shown in Figure ①.

[0085] For a texel (i1, j0), a face switching ID of 0 indicates it is within the texture coordinate range; a face switching ID of 1 indicates it is located where i is greater than the texture width and j is within the texture coordinate range; a face switching ID of 2 indicates it is located where i is within the texture coordinate range and j is less than 0. For example... Figure 8 As shown in Figure ②.

[0086] For a texel (i0, j1), a face switching ID of 0 indicates it is within the texture coordinate range; a face switching ID of 1 indicates it is in a position where i is less than 0 and j is within the texture coordinate range; a face switching ID of 2 indicates it is in a position where i is within the texture coordinate range and j is greater than the texture height. For example... Figure 8 As shown in Figure ③.

[0087] For a texel (i1, j1), a face switching ID of 0 indicates it is within the texture coordinate range; a face switching ID of 1 indicates it is located where i is greater than the texture width and j is within the texture coordinate range; a face switching ID of 2 indicates it is located where i is within the texture coordinate range and j is greater than the texture height. For example... Figure 8 As shown in Figure ④.

[0088] c. Based on each texel ID and face switching ID, retrieve the new cube face ID and index switching ID for each texel from the corresponding face switching lookup table module and index switching lookup table module, respectively.

[0089] Understandably, the new cube face ID for each texel is calculated in the face switching lookup table module using the current cube face ID, texel ID, and face switching ID. Based on the adjacency relationship of cube faces, different texels with the same current cube face ID and the same face switching ID will have different new cube face IDs. Therefore, the lookup table can be divided into four parts, corresponding to texels 0, 1, 2, and 3 for searching. Based on the above analysis, the steps for finding a new cube face are as follows:

[0090] The corresponding face switching lookup table module is determined from the four face switching lookup table modules based on the texel ID.

[0091] The new cube face ID is determined by combining the current cube face ID and the face switching ID from the corresponding face switching lookup table module.

[0092] for Figure 5For example, if the current cube face ID is 0, and the face switching ID for texels 0 and 2 is 1, then it can be determined according to... Figure 4 Based on the ID numbers of the cube faces, the new cube face ID for texels 0 and 2 is 4. The face switching ID for texels 1 and 3 is 0, therefore their new cube face ID remains 0.

[0093] Similarly, based on each texel ID, the corresponding index switching lookup table module is determined from the four index switching lookup table modules. Based on the current cube face ID and face switching ID of each texel, the index switching ID of each texel is retrieved from the corresponding index switching lookup table module.

[0094] d. The state control module outputs the face switching ID of the four texels, the new cube face ID, and the index switching ID in sequence.

[0095] Understandably, based on the above b c, the face switching ID, new cube face ID, and index switching ID of each texel are determined, and the state control module outputs the face switching ID, new cube face ID, and index switching ID of the four texels in sequence.

[0096] e. The index calculation module calculates the new coordinates of each texel based on each texel coordinate and the index switching ID, and outputs the new coordinates of each texel along with the new cube face ID.

[0097] Understandably, the ID is switched based on each texel coordinate and index, where the default calculation method is as follows:

[0098] When the texel index switching ID is 0 or 1 ;

[0099] When the texel index switching ID is 2 ;

[0100] When the index switching ID of the texel is 3 ;

[0101] When the texel index switching ID is 4 ;

[0102] in, The width of the texture pattern.

[0103] The preset calculation method can be found in Table 3.

[0104] Table 3 Coordinate Calculation Selection Table

[0105]

[0106] according to Figure 5In the example, the new cube face IDs of texels 1 and 3 are still 0, so the index switching ID is also 0. At this point, the coordinates of texels 1 and 3 remain unchanged. The new cube face IDs of texels 2 and 3 are 4, and the index switching ID is also 1. At this point, according to the calculation formula in Table 2, the coordinates processed by the wrapping mode are recalculated to obtain the new coordinates in cube face 4. Finally, the new coordinates of each texel and its corresponding new cube face ID are output.

[0107] This invention provides a texture coordinate calculation circuit that dynamically configures parameter values ​​during texture mapping through a configurable pipeline design, offering greater flexibility. A bypass path design is employed for different calculation modes, reducing clock cycles required for computation and enabling efficient texture mapping calculations. Furthermore, this invention incorporates a seamless cube texture filtering circuit design, recalculating the coordinates of elements at the cube's edges and reading texels from both cube faces. This results in superior pattern effects for the cube texture mapping, offering more comprehensive functionality and covering a wider range of scenario requirements.

[0108] The advantages of this invention are that it allows for configuration of the texture coordinate calculation unit, making calculations more flexible; it effectively avoids wasting clock cycles, improves the calculation efficiency of texture coordinates, and optimizes coordinate calculations in cube texture mode, thereby resulting in better texture mapping effects.

[0109] It should be noted that the descriptions of each embodiment in the above embodiments have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0110] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0111] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0112] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0113] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0114] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.

[0115] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A texture coordinate calculation circuit, characterized by comprising: The Config module, the LOD module and four Coord modules are included, and each Coord module includes a seamless calculation unit; The Config module is configured to receive a quad fragment texture request sent by a shader, and store texture information and configuration information, so as to configure the LOD module and each Coord module according to the configuration information; The LOD module is configured to calculate an LOD value of each texture coordinate in the texture request; And distribute the calculation task of each texture coordinate to a corresponding Coord module according to the LOD value of each texture coordinate; Each Coord module is configured to calculate each texture coordinate according to the configuration information and the LOD value of each texture coordinate, wherein each seamless calculation unit calculates a cube texture coordinate at the edge of a cube texture.

2. The texture coordinate calculation circuit according to claim 1, characterized by, The Config module is configured to receive a quad fragment texture request sent by a shader, and store texture information and configuration information, including: The Config module is configured to receive a quad fragment texture request sent by a shader, and store texture information and configuration information, including: The texture information includes height and width of the texture, and the configuration information includes texture type, filtering mode and wrap mode; The LOD module is configured to calculate an LOD value of each texture coordinate in the texture request, including: According to the texture type, it is judged whether the four texture coordinates are cube texture coordinates, if so, each three-dimensional texture coordinate is converted into a two-dimensional texture coordinate, and normalization is performed, and the LOD value of each texture coordinate is calculated according to the normalized texture coordinate; The distribution of the calculation task of each texture coordinate to a corresponding Coord module according to the LOD value of each texture coordinate includes: According to the LOD value of each texture coordinate, the calculation task of each texture coordinate is sent to the corresponding Coord module.

3. The texture coordinate calculation circuit according to claim 2, characterized by, According to the texture type, it is judged whether the four texture coordinates are cube texture coordinates, if so, each three-dimensional texture coordinate is converted into a two-dimensional texture coordinate, including: According to the texture type carried in the texture request, it is judged whether the four texture coordinates are cube texture coordinates; If so, according to each three-dimensional texture coordinate, the judgment of the principal plane is performed, and the component with the largest absolute value of the three components in the three-dimensional texture coordinate is taken as the principal plane, and the positive and negative values of the component represent the pointing direction of the principal axis; According to the three-dimensional texture coordinates and the principal plane, the corresponding intermediate parameters s, t and m are calculated c c a wherein m a is the component with the largest absolute value in the three-dimensional texture coordinates, s c is the intermediate parameter for calculating the texture coordinate s, and t c is the intermediate parameter for calculating the texture coordinate t​​ According to the intermediate parameter s c , t c , m a , the two-dimensional texture coordinates are calculated: ; Wherein, (s, t) is the converted two-dimensional texture coordinate.

4. The texture coordinate calculation circuit according to claim 2, characterized by, The calculation of the LOD value of each texture coordinate according to the normalized texture coordinate includes: Based on the normalized texture coordinate, the isotropic filtering LOD value of each texture coordinate is calculated, and it is judged whether it is an anisotropic filtering mode according to the filtering mode in the configuration information; If yes, the anisotropic filtering LOD value is calculated according to the isotropic filtering LOD value, and the anisotropic filtering LOD value is corrected, and the corrected anisotropic filtering LOD value is used as the LOD value of each texture coordinate; If no, the isotropic filtering LOD value is corrected, and the corrected isotropic filtering LOD value is used as the LOD value of each texture coordinate; The correction of the LOD value comprises: Based on the enable signal, it is judged whether the LOD value needs to add an offset value, if yes, the offset value is added to the LOD value according to the configuration information, the configuration information including a pre-configured offset value, and the LOD value after adding the offset value is obtained; if no, the offset value is not added; It is judged whether the LOD value is within the allowed range, if yes, it is not corrected; if no, the LOD value is clamped within the allowed range; The clamping of the LOD value within the allowed range comprises: Setting the allowable range of the LOD value [LOD min , LOD max ], if the LOD value < LOD min , then LOD = LOD min ; if the LOD value > LOD max , then LOD = LOD max .

5. The texture coordinate calculation circuit of claim 1, wherein, Each Coord module is configured to calculate each texture coordinate according to the configuration information and the LOD value of each texture coordinate, comprising: If the texture filtering mode is the anisotropic filtering mode, the corresponding texture sampling coordinates of each texture coordinate in the anisotropic filtering mode are calculated based on the LOD value of each texture coordinate, and each texture absolute coordinate is calculated according to the corresponding texture sampling coordinates; If the texture filtering mode is the non-anisotropic filtering mode, each texture absolute coordinate is calculated according to the normalized each texture coordinate; It is judged whether each texture absolute coordinate exceeds the texture image range, if yes, the wrap-around mode processing is performed on the texture absolute coordinate, so that the texture absolute coordinate after the wrap-around processing is within the texture pattern range; The seamless cube filtering processing is performed on each texture coordinate based on the Seamless calculation unit.

6. The texture coordinate calculation circuit of claim 1, wherein, The seamless cube filtering processing performed on each texture coordinate based on the Seamless calculation unit comprises: It is judged whether the quad is at the intersection of the cube texture surface and the surface, if yes, the Seamless calculation unit re-calculates the texel coordinates generated by each texture coordinate of the quad and the cube surface; If no, the re-calculation is not needed.

7. The texture coordinate calculation circuit of claim 6, wherein, Each seamless calculation unit comprises four face switching lookup table modules, four index switching lookup table modules, one state control module and one index calculation module; When the bilinear filtering or trilinear filtering is performed, the sampled four texel coordinates are calculated according to the current texture coordinate after the wrap-around processing; The face switching ID of each texel is found according to each texel coordinate; The new cube surface ID and the index switching ID of each texel are found from the corresponding face switching lookup table module and index switching lookup table module according to each texel ID and face switching ID; The state control module outputs the face switching ID, new cube surface ID and index switching ID of the four texels in sequence; and The index calculation module calculates the index of each texel according to the texel coordinate and the index switching ID of the corresponding texel. The index calculation module calculates new coordinates of each texel according to each texel coordinate and index switching ID, and outputs the new coordinates of each texel and new cubic face ID.

8. The texture coordinate calculation circuit according to claim 7, characterized by, The new cubic face ID and index switching ID of each texel are respectively found from the corresponding face switching lookup table module and index switching lookup table module according to the face switching ID of each texel, and the method comprises the following steps of: According to each texel ID, the corresponding face switching lookup table module is determined from the four face switching lookup table modules, and the corresponding index switching lookup table module is determined from the four index switching lookup table modules; According to the current cubic face ID and face switching ID of each texel, the new cubic face ID of each texel is found from the corresponding face switching lookup table module, and the index switching ID of each texel is found from the corresponding index switching lookup table module.

9. The texture coordinate calculation circuit according to claim 7 or 8, characterized by, The index calculation module calculates new coordinates of each texel according to each texel coordinate and index switching ID, and outputs the new coordinates of each texel and new cubic face ID, and the method comprises the following steps of: According to each texel coordinate and index switching ID, the new coordinates of each texel are calculated according to a pre-designed calculation mode, wherein the pre-designed calculation mode is: When the index of the texel switches ID to 0 or to 1, ; When the index of the texel switches ID to 2, ; When the index of the texel switches ID to 3, ; When the index of the texture element switches to ID = 4, ; wherein, is the width of the texture pattern.

10. The texture coordinate calculation circuit of claim 9, wherein, Through seamless enabling signal control, for the texture coordinates in the non-edge area of the cubic, the seamless calculation unit outputs four texel coordinates as four texel coordinates for bilinear filtering sampling in one period; For the texture coordinates in the edge area of the cubic, the seamless calculation unit outputs four texel coordinates as four texel coordinates for bilinear filtering sampling in four periods.