A texture sampling system

By acquiring non-normalized texture coordinates and preset reference thresholds, and correcting sizes, the problem of insufficient efficiency and flexibility in texture mapping is solved, and the flexibility of texture sampling is improved without sacrificing efficiency.

CN121724826BActive Publication Date: 2026-06-16METAX INTEGRATED CIRCUITS (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, when the texture image range is large, users may want to use a portion of the image as the actual texture image, which increases the workload, reduces the efficiency of texture address mapping, and results in poor flexibility, failing to meet user needs.

Method used

By acquiring non-normalized texture coordinate values ​​and preset reference thresholds and correction dimensions, the texture sampling boundary and position can be flexibly adjusted. The first and second addressing modes are used to determine the sampling coordinate values ​​using the reference threshold and correction dimensions respectively, thereby improving the flexibility of texture sampling.

Benefits of technology

Without sacrificing efficiency, it improves the flexibility of texture sampling to meet user needs, and the reference threshold and correction size can be configured by the user, further enhancing flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121724826B_ABST
    Figure CN121724826B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of graphics rendering, in particular to a texture sampling system, which flexibly adjusts the boundary during texture sampling through a first reference threshold and a second reference threshold in a first addressing mode, thereby improving the flexibility of texture sampling, and the first reference threshold and the second reference threshold can be configured by a user, further improving the flexibility of texture sampling; in a second addressing mode, the position of a texture sampling result is flexibly adjusted through a correction size, thereby improving the flexibility of texture sampling, and the correction size can also be configured by the user, further improving the flexibility of texture sampling; and without special processing of a texture image, the flexibility of texture sampling is effectively improved without loss of the efficiency of texture sampling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of graphics rendering technology, and in particular to a texture sampling system. Background Technology

[0002] When a chip performs graphics rendering tasks, it usually needs to perform texture mapping operations. Texture mapping refers to mapping the texture value at a specific location in a texture image to the corresponding pixel in the screen display area. Texture coordinates have different representations in different coordinate systems. Generally, normalized texture coordinates can be used to represent the sampling position. After obtaining the normalized texture coordinates, they need to be converted into non-normalized texture coordinates. However, non-normalized texture coordinates are not integer coordinates and are difficult to apply directly to the texture image. Therefore, it is necessary to determine the integer coordinates corresponding to the sampling point in the texture image based on the non-normalized texture coordinates.

[0003] In practical applications, non-normalized texture coordinates can be obtained directly before subsequent coordinate transformations. However, since texture coordinates can be specified by the user, non-normalized texture coordinates that exceed the range of the texture image may be obtained. For such texture coordinates, existing technologies provide a variety of addressing modes, including cyclic mode, boundary mode, and mirror mode, so that the texture mapping task can still be executed normally when the non-normalized texture coordinate values ​​exceed the range of the texture image. At the same time, different addressing modes can provide different mapping effects.

[0004] In existing technologies, when obtaining non-normalized texture coordinates that exceed the range of a texture image in boundary mode, the range of the texture image is usually used for judgment. However, when the range of the texture image is large, users may want to use a portion of the texture image as the actual texture image. To meet such requirements, the texture image needs to be truncated, which increases the workload and leads to a decrease in the efficiency of texture address mapping. If the efficiency of texture address mapping is not sacrificed, the flexibility of texture sampling is poor and cannot meet the needs of users.

[0005] Therefore, improving the flexibility of texture sampling has become an urgent problem to be solved. Summary of the Invention

[0006] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows:

[0007] A texture sampling system includes a processor and a memory storing a computer program, which, when executed by the processor, performs the following steps:

[0008] S101, obtain the non-normalized texture coordinate value a, the preset first reference threshold b1, the preset second reference threshold b2, and the initial size c of the target texture image.

[0009] S102, determine the first target value d1 and the second target value d2 based on the texture coordinate value a and the preset adjustment value.

[0010] S103, when the obtained texture addressing mode is the first addressing mode, determine the first sampling coordinate value f1 according to d1 and c, and determine the second sampling coordinate value f2 according to d2 and c.

[0011] S104, based on f1, b1, b2, the target texture image and the preset reference texture, determine the texture sampling result g1 corresponding to the first sampling coordinate value f1, and based on f2, b1, b2, the target texture image and the reference texture, determine the texture sampling result g2 corresponding to the second sampling coordinate value f2.

[0012] S105, when the texture addressing mode is the second addressing mode, the first sampling coordinate value f1 is determined according to d1, c and the preset correction size e, and the second sampling coordinate value f2 is determined according to d2, c and e.

[0013] S106, based on f1 and the target texture image, determine the texture sampling result g1 corresponding to the first sampling coordinate value f1, and based on f2 and the target texture image, determine the texture sampling result g2 corresponding to the second sampling coordinate value f2.

[0014] Compared with the prior art, the present invention has significant advantages. Through the above technical solution, the texture sampling system provided by the present invention achieves considerable technological advancement and practicality, and has broad industrial application value. It has at least the following advantages:

[0015] This invention provides a texture sampling system, comprising: a processor and a memory storing a computer program. When the computer program is executed by the processor, it performs the following steps: S101, acquiring a non-normalized texture coordinate value a, a preset first reference threshold b1, a preset second reference threshold b2, and an initial size c of a target texture image; S102, determining a first target value d1 and a second target value d2 based on the texture coordinate value a and a preset adjustment value; S103, when the acquired texture addressing mode is the first addressing mode, determining a first sampling coordinate value f based on d1 and c. 1. Determine the second sampling coordinate value f2 based on d2 and c. 2. Determine the texture sampling result g1 corresponding to the first sampling coordinate value f1 based on f1, b1, b2, the target texture image, and the preset reference texture. 3. Determine the texture sampling result g2 corresponding to the second sampling coordinate value f2 based on f2, b1, b2, the target texture image, and the reference texture. 4. When the texture addressing mode is the second addressing mode, determine the first sampling coordinate value f1 based on d1, c, and the preset correction size e. Determine the second sampling coordinate value f2 based on d2, c, and e.

[0016] It can be seen that in the first addressing mode, the boundary during texture sampling is flexibly adjusted by the first reference threshold and the second reference threshold, thereby improving the flexibility of texture sampling. Moreover, the first reference threshold and the second reference threshold can be configured by the user, further improving the flexibility of texture sampling. In the second addressing mode, the position of the texture sampling result is flexibly adjusted by correcting the size, thereby improving the flexibility of texture sampling. Moreover, the correcting size can also be configured by the user, further improving the flexibility of texture sampling. Furthermore, no special processing of the texture image is required, effectively improving the flexibility of texture sampling without sacrificing the efficiency of texture sampling. Attached Figure Description

[0017] 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.

[0018] Figure 1 This is a flowchart illustrating the execution of a computer program by a processor in a texture sampling system according to an embodiment of the present invention. Detailed Implementation

[0019] 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.

[0020] This embodiment provides a texture sampling system, see [link / reference] Figure 1 This is a flowchart illustrating the execution of a computer program by a processor in a texture sampling system according to an embodiment 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:

[0021] S101, obtain the non-normalized texture coordinate value a, the preset first reference threshold b1, the preset second reference threshold b2 and the initial size c of the target texture image;

[0022] S102, determine the first target value d1 and the second target value d2 based on the texture coordinate value a and the preset adjustment value;

[0023] S103, when the obtained texture addressing mode is the first addressing mode, determine the first sampling coordinate value f1 according to d1 and c, and determine the second sampling coordinate value f2 according to d2 and c;

[0024] S104, based on f1, b1, b2, the target texture image and the preset reference texture, determine the texture sampling result g1 corresponding to the first sampling coordinate value f1, and based on f2, b1, b2, the target texture image and the reference texture, determine the texture sampling result g2 corresponding to the second sampling coordinate value f2;

[0025] S105, when the texture addressing mode is the second addressing mode, the first sampling coordinate value f1 is determined according to d1, c and the preset correction size e, and the second sampling coordinate value f2 is determined according to d2, c and e.

[0026] S106, based on f1 and the target texture image, determine the texture sampling result g1 corresponding to the first sampling coordinate value f1, and based on f2 and the target texture image, determine the texture sampling result g2 corresponding to the second sampling coordinate value f2.

[0027] The texture sampling system provided in this embodiment can be used in a chip. When the chip performs a texture mapping task, the coordinate transformation is performed by the texture sampling system to determine the texture sampling result, thereby improving the flexibility of the chip in performing texture sampling.

[0028] The non-normalized texture coordinate value 'a' can refer to a non-normalized texture coordinate value that exceeds the range of the texture image. This non-normalized texture coordinate value can be any value of any dimension of the N-dimensional texture coordinate. Typically, N can be an integer in the range of [1,2]. For example, for two-dimensional texture coordinates, it can be a coordinate value in the x-axis dimension or a coordinate value in the y-axis dimension. The non-normalized texture coordinate value 'a' is a non-integer coordinate value.

[0029] The adjustment value can be used to determine the mapping range of the texture coordinate value a. In this embodiment, the adjustment value can be set to 0.5.

[0030] Texture addressing mode can refer to the strategy for determining the texture sampling result when the texture coordinate value exceeds the range of the target texture image.

[0031] The target texture image can be used to provide texture for graphics rendering. The texture size can refer to the maximum value of the target texture image in the dimension to which the texture coordinate values ​​belong.

[0032] The reference texture can be used in the first addressing mode to provide a preset texture for the texture sampling result when the texture sampling result exceeds the target texture image.

[0033] The first reference threshold b1 and the second reference threshold b2 can be used in the first addressing mode to adjust the range of mapping using the reference texture. The first reference threshold b1 and the second reference threshold b2 can be set by the implementer.

[0034] The correction size e can be used in the second addressing mode to adjust the mapping position of coordinates that exceed the target texture image in the target texture image. The correction size e can also be set by the implementer.

[0035] In this embodiment, the texture filtering mode can be a bilinear filtering mode, which requires sampling the texture at four positions in the target texture image for filtering. Among the four positions in the sampled target texture image, for any dimension, there are two positions with the same coordinate value in that dimension, and the other two positions with the same coordinate value in that dimension. Therefore, only the first sampled coordinate value and the second sampled coordinate value are needed to execute the bilinear filtering mode.

[0036] Optionally, step S102 includes the following steps:

[0037] S1021, Subtract the texture coordinate value a from the adjustment value, and use the result of the subtraction as the first target value d1;

[0038] S1022, add the texture coordinate value a and the adjustment value together, and use the sum as the second target value d2.

[0039] The adjustment value can be 0.5, then the difference between the second target value and the first target value is 1, and the range from the first target value to the second target value can represent the mapping range of texture coordinate values.

[0040] Optionally, the first addressing mode is a clamping boundary mode.

[0041] Among them, the clamping boundary mode can refer to forcibly setting the texture sampling result corresponding to the texture coordinate value that is outside the range of the target texture image as the reference texture.

[0042] Optionally, step S103 includes the following steps:

[0043] S1031, when 0≤d1<c, determine the first sampled coordinate value f1=w(d1), where w() is the floor function;

[0044] S1032, when d1 < 0 or d1 ≥ c, determine the first sampling coordinate value f1 = w(frac(d1)), where the frac() function is used to extract the decimal part of the input data;

[0045] S1033, when 0≤d2<c, determine the second sampling coordinate value f2=w(d2);

[0046] S1034, when d2 < 0 or d2 ≥ c, determine the second sampling coordinate value f2 = w(frac(d2)).

[0047] Since the first and second sampled coordinate values ​​should be integers, a rounding function is needed for calculation. In this embodiment, the rounding function can be used.

[0048] Optionally, step S104 includes the following steps:

[0049] S1041, when b1≤f1≤b2, determine the texture sampling result g1 corresponding to the first sampling coordinate value f1 from the target texture image according to f1;

[0050] S1042, when f1 < b1 or f1 > b2, the reference texture is used as the texture sampling result g1 corresponding to the first sampling coordinate value f1;

[0051] S1043, when b1≤f2≤b2, determine the texture sampling result g2 corresponding to the second sampling coordinate value f2 from the target texture image according to f2;

[0052] S1044, when f2 < b1 or f2 > b2, the reference texture is used as the texture sampling result g2 corresponding to the second sampling coordinate value f2.

[0053] In this embodiment, f1 and f2 are compared with b1 and b2 respectively to determine the texture sampling result in the clamping boundary mode. b1 and b2 determine the range of the custom clamping boundary mode, which allows the implementer to flexibly select the actual texture image to be used based on the target texture image, thereby improving the flexibility of texture sampling.

[0054] Optionally, the second addressing mode is a clamp-specific texture mode.

[0055] Among them, clamping specific texture mode can refer to mapping texture coordinate values ​​that are outside the range of the target texture image to specific coordinates, and using the texture sampling result corresponding to the specific coordinates as the texture sampling result corresponding to the texture coordinate values ​​outside the range of the target texture image.

[0056] Optionally, step S105 includes the following steps:

[0057] S1051, when d1 < 0, determine the first sampling coordinate value f1 = 0;

[0058] S1052, when 0≤d1<c, determine the first sampled coordinate value f1=w(d1), where w() is the floor function;

[0059] S1053, when d1 > c, determine the first sampled coordinate value f1 = w(e);

[0060] S1054, when d2 < 0, determine the second sampling coordinate value f2 = 0;

[0061] S1055, when 0≤d2<c, determine the second sampling coordinate value f2=w(d2);

[0062] S1056, when d2>c, determine the second sampling coordinate value f2=w(e).

[0063] In this case, w() can still use the round function to round down the integers. Usually, e can be set by the implementer, but it should satisfy the condition e≤c.

[0064] Optionally, the first reference threshold b1 and the second reference threshold b2 are in the range of [0, c], and b1 < b2.

[0065] Since the first reference threshold b1 and the second reference threshold b2 are used to select the actual application texture image based on the target texture image, and the actual application texture image should be within the range of the target texture image, the range of the first reference threshold b1 and the second reference threshold b2 is [0, c], and the condition b1 < b2 is satisfied.

[0066] As can be seen, in the first addressing mode, the boundary during texture sampling is flexibly adjusted by using a first reference threshold and a second reference threshold, thereby improving the flexibility of texture sampling. Furthermore, the first and second reference thresholds can be configured by the user, further enhancing the flexibility of texture sampling. In the second addressing mode, the position of the texture sampling result is flexibly adjusted by correcting the size, thereby improving the flexibility of texture sampling. Moreover, the corrected size can also be configured by the user, further enhancing the flexibility of texture sampling. In addition, no special processing of the texture image is required, effectively improving the flexibility of texture sampling without sacrificing the efficiency of texture sampling.

[0067] 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 texture sampling system, 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, obtain the non-normalized texture coordinate value a, the preset first reference threshold b1, the preset second reference threshold b2 and the initial size c of the target texture image; S102, determine the first target value d1 and the second target value d2 based on the texture coordinate value a and the preset adjustment value; S103, when the obtained texture addressing mode is the first addressing mode, determine the first sampling coordinate value f1 according to d1 and c, and determine the second sampling coordinate value f2 according to d2 and c; S104, based on f1, b1, b2, the target texture image, and the preset reference texture, determine the texture sampling result g1 corresponding to the first sampling coordinate value f1; based on f2, b1, b2, the target texture image, and the reference texture, determine the texture sampling result g2 corresponding to the second sampling coordinate value f2. Step S104 includes the following steps: S1041, when b1≤f1≤b2, determine the texture sampling result g1 corresponding to the first sampling coordinate value f1 from the target texture image according to f1; S1042, when f1 < b1 or f1 > b2, the reference texture is used as the texture sampling result g1 corresponding to the first sampling coordinate value f1; S1043, when b1≤f2≤b2, determine the texture sampling result g2 corresponding to the second sampling coordinate value f2 from the target texture image according to f2; S1044, when f2 < b1 or f2 > b2, the reference texture is used as the texture sampling result g2 corresponding to the second sampling coordinate value f2; S105, when the texture addressing mode is the second addressing mode, the first sampling coordinate value f1 is determined according to d1, c and the preset correction size e, and the second sampling coordinate value f2 is determined according to d2, c and e. S106, based on f1 and the target texture image, determine the texture sampling result g1 corresponding to the first sampling coordinate value f1, and based on f2 and the target texture image, determine the texture sampling result g2 corresponding to the second sampling coordinate value f2.

2. The texture sampling system according to claim 1, characterized in that, Step S102 includes the following steps: S1021, Subtract the texture coordinate value a from the adjustment value, and use the result of the subtraction as the first target value d1; S1022, add the texture coordinate value a and the adjustment value together, and use the sum as the second target value d2.

3. The texture sampling system according to claim 1, characterized in that, The first addressing mode is clamp boundary mode.

4. The texture sampling system according to claim 3, characterized in that, Step S103 includes the following steps: S1031, when 0≤d1<c, determine the first sampled coordinate value f1=w(d1), where w() is the floor function; S1032, when d1 < 0 or d1 ≥ c, determine the first sampling coordinate value f1 = w(frac(d1)), where the frac() function is used to extract the decimal part of the input data; S1033, when 0≤d2<c, determine the second sampling coordinate value f2=w(d2); S1034, when d2 < 0 or d2 ≥ c, determine the second sampling coordinate value f2 = w(frac(d2)).

5. The texture sampling system according to claim 1, characterized in that, The second addressing mode is a clamp-specific texture mode.

6. The texture sampling system according to claim 5, characterized in that, Step S105 includes the following steps: S1051, when d1 < 0, determine the first sampling coordinate value f1 = 0; S1052, when 0≤d1<c, determine the first sampled coordinate value f1=w(d1), where w() is the floor function; S1053, when d1 > c, determine the first sampled coordinate value f1 = w(e); S1054, when d2 < 0, determine the second sampling coordinate value f2 = 0; S1055, when 0≤d2<c, determine the second sampling coordinate value f2=w(d2); S1056, when d2>c, determine the second sampling coordinate value f2=w(e).

7. The texture sampling system according to claim 1, characterized in that, The first reference threshold b1 and the second reference threshold b2 are in the range of [0, c], and b1 < b2.

Citation Information

Patent Citations

  • Texture sampling point number control system

    CN117593438A

  • Texture sampling method, electronic equipment and storage medium

    CN118397163A