Texture coordinate processing method and device, electronic equipment and storage medium
By receiving multiple sets of accuracy parameters to convert and compare the floating-point texture coordinates, and selecting the fixed-point number with the largest accuracy gap as the result, it solves the problem of many iterations and high cost of texture coordinate accuracy control in the existing technology, and realizes efficient texture coordinate processing and simplified software model.
Patent Information
- Application Number
- CN202510983800.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-16
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-07-16
AI Technical Summary
In the graphics rendering process of graphics processors, the accuracy control of texture coordinates requires multiple iterations, resulting in high data processing costs and low efficiency, and the software model and hardware circuit architecture are complex, making it difficult to quickly locate accuracy problems.
By receiving multiple sets of accuracy parameters, converting the floating-point texture coordinates, generating multiple fixed-point texture coordinates, comparing the accuracy gap with the reference value, selecting the fixed-point number with the largest accuracy gap as the processing result, simplifying the software model architecture, and dynamically adjusting the accuracy parameters.
It reduces the number of iterations, reduces data processing costs, improves the processing efficiency of texture coordinates, simplifies the operation of software models, reduces manual intervention, and ensures the accuracy of rendering results.
Smart Images

Figure CN120510266A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a texture coordinate processing method, device, electronic device, and storage medium. Background Art
[0002] During graphics rendering on a graphics processing unit (GPU), a software model is needed to simulate the hardware to calculate texture coordinates. This simulation must be bit-accurate to provide a reference for GPU hardware design and architecture definition.
[0003] To improve computing performance, floating-point texture coordinates are typically processed first, expressing them as fixed-point numbers. This processing may involve operations such as floating-point to fixed-point conversion and rounding. The accuracy of the resulting texture coordinates directly affects the quality and accuracy of image rendering. Generally, higher accuracy results in greater hardware costs, while lower accuracy cannot meet testing requirements. Therefore, precise control of the accuracy of the processed texture coordinates is necessary to ensure that the GPU meets both testing requirements and chip area and power consumption requirements.
[0004] In existing technologies, determining the appropriate accuracy typically requires multiple iterations. Each iteration involves refactoring the software model code, testing with a graphics API test suite, and adjusting the accuracy based on the test results. This requires significant data processing overhead and reduces the efficiency of texture coordinate processing. Summary of the Invention
[0005] In view of this, the present disclosure proposes a texture coordinate processing method, device, electronic device, and storage medium. The method can reduce the number of iterations, lower data processing costs, and improve the processing efficiency of texture coordinates.
[0006] According to one aspect of the present disclosure, a method for processing texture coordinates is provided, the method comprising: receiving at least one first texture coordinate and multiple groups of precision parameters, the first texture coordinate being a floating-point number; for each first texture coordinate, using the multiple groups of precision parameters to convert the first texture coordinate respectively to obtain multiple second texture coordinates, the second texture coordinates being fixed-point numbers; for each multiple second texture coordinates converted from the first texture coordinate, determining the accuracy difference between each second texture coordinate and a reference value corresponding to the second texture coordinate, and determining the second texture coordinate having the largest accuracy difference with the reference value as the processed texture coordinate.
[0007] In a possible implementation, each set of precision parameters includes the number of integer digits and the number of decimal digits.
[0008] In one possible implementation, the first texture coordinate includes an exponent bit, a mantissa bit, and a sign bit, and the use of the multiple sets of precision parameters to convert the first texture coordinates respectively includes: when using any set of precision parameters to convert the first texture coordinates, determining the mantissa corresponding to the first texture coordinate according to the mantissa bit and the sign bit of the first texture coordinate; determining a reference value corresponding to the set of precision parameters and the first texture coordinate according to the number of bits of the mantissa bits, the exponent bits, and the number of decimal places included in the set of precision parameters; converting the mantissa using the set of precision parameters to obtain a first fixed-point number; determining a second fixed-point number according to the first fixed-point number and texture mapping parameters; and determining the second texture coordinate according to the reference value and the second fixed-point number.
[0009] In a possible implementation, all reference values corresponding to the same first texture coordinate have the same true value.
[0010] In a possible implementation, when the first texture coordinate is a width coordinate, the texture mapping parameter is a width mapping parameter; when the first texture coordinate is a height coordinate, the texture mapping parameter is a height mapping parameter; when the first texture coordinate is a depth coordinate, the texture mapping parameter is a depth mapping parameter.
[0011] In one possible implementation, the reference value corresponding to any set of precision parameters and any first texture coordinate is equal to the maximum value that can be expressed by a Y-bit binary number, where Y is equal to the result of subtracting the number of mantissa bits of the first texture coordinate from the exponent bits of the first texture coordinate and adding the result to the number of decimal places included in the set of precision parameters, and Y is a positive integer.
[0012] In one possible implementation, determining the precision difference between each second texture coordinate and a reference value corresponding to the second texture coordinate includes: rounding the reference value to retain an integer digit and X decimal digits of the reference value, where X is the number of decimal digits of the second texture coordinate and is a positive integer; and using the numerical difference between the second texture coordinate and the reference value as the precision difference between the second texture coordinate and the reference value corresponding to the second texture coordinate.
[0013] According to another aspect of the present disclosure, a texture coordinate processing device is provided, the device comprising: a receiving module for receiving at least one first texture coordinate and multiple groups of precision parameters, the first texture coordinate being a floating-point number; a conversion module for converting each first texture coordinate using the multiple groups of precision parameters to obtain a plurality of second texture coordinates, the second texture coordinates being fixed-point numbers; a determination module for determining, for each of the multiple second texture coordinates converted from the first texture coordinate, a precision difference between each second texture coordinate and a reference value corresponding to the second texture coordinate, and determining the second texture coordinate having the largest precision difference from the reference value as the processed texture coordinate.
[0014] In a possible implementation, each set of precision parameters includes the number of integer digits and the number of decimal digits.
[0015] In one possible implementation, the first texture coordinate includes an exponent bit, a mantissa bit, and a sign bit, and the use of the multiple sets of precision parameters to convert the first texture coordinates respectively includes: when using any set of precision parameters to convert the first texture coordinates, determining the mantissa corresponding to the first texture coordinate according to the mantissa bit and the sign bit of the first texture coordinate; determining a reference value corresponding to the set of precision parameters and the first texture coordinate according to the number of bits of the mantissa bits, the exponent bits, and the number of decimal places included in the set of precision parameters; converting the mantissa using the set of precision parameters to obtain a first fixed-point number; determining a second fixed-point number according to the first fixed-point number and texture mapping parameters; and determining the second texture coordinate according to the reference value and the second fixed-point number.
[0016] In a possible implementation, all reference values corresponding to the same first texture coordinate have the same true value.
[0017] In a possible implementation, when the first texture coordinate is a width coordinate, the texture mapping parameter is a width mapping parameter; when the first texture coordinate is a height coordinate, the texture mapping parameter is a height mapping parameter; when the first texture coordinate is a depth coordinate, the texture mapping parameter is a depth mapping parameter.
[0018] In one possible implementation, the reference value corresponding to any set of precision parameters and any first texture coordinate is equal to the maximum value that can be expressed by a Y-bit binary number, where Y is equal to the result of subtracting the number of mantissa bits of the first texture coordinate from the exponent bits of the first texture coordinate and adding the result to the number of decimal places included in the set of precision parameters, and Y is a positive integer.
[0019] In one possible implementation, determining the precision difference between each second texture coordinate and a reference value corresponding to the second texture coordinate includes: rounding the reference value to retain an integer digit and X decimal digits of the reference value, where X is the number of decimal digits of the second texture coordinate and is a positive integer; and using the numerical difference between the second texture coordinate and the reference value as the precision difference between the second texture coordinate and the reference value corresponding to the second texture coordinate.
[0020] According to another aspect of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above method.
[0021] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0022] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, or a non-volatile computer-readable storage medium carrying the computer program, wherein the computer program implements the steps of the above method when executed by a processor.
[0023] According to a texture coordinate processing method of an embodiment of the present disclosure, at least one first texture coordinate and multiple sets of precision parameters are received. For each first texture coordinate, the method converts the first texture coordinate using the multiple sets of precision parameters to obtain multiple second texture coordinates. The first texture coordinate is a floating-point number, and the second texture coordinate is a fixed-point number. Therefore, the method converts the texture coordinates from floating-point numbers to fixed-point numbers and achieves multi-precision conversion. For each of the multiple second texture coordinates converted from the first texture coordinate, the method determines the precision difference between each second texture coordinate and a reference value corresponding to the second texture coordinate. The second texture coordinate with the largest precision difference from the reference value is determined as the processed texture coordinate. The second texture coordinate with the largest precision difference from the reference value also suffers the largest precision loss during the conversion process. Therefore, whether the precision of the processed texture coordinate meets the precision requirement can be used to determine whether the multiple sets of precision parameters meet the requirement. If the precision of the processed texture coordinate meets the requirement, the multiple sets of precision parameters can be considered to meet the required precision. The user can select the appropriate precision parameter from the multiple sets of precision parameters without the need for iterative calculations, thereby reducing the number of iterative calculations, lowering data processing costs, and improving texture coordinate processing efficiency.
[0024] This method does not require reconstruction of the model code or running a large number of test sets, which can further reduce data processing costs and improve the processing efficiency of texture coordinates.
[0025] In the process of converting each first texture coordinate to obtain multiple second texture coordinates, different second texture coordinates can be converted in parallel, further improving the processing efficiency of the texture coordinates.
[0026] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0028] Figure 1 An exemplary application scenario of the texture coordinate processing method according to an embodiment of the present disclosure is shown.
[0029] Figure 2 A schematic diagram illustrating the flow of a method for processing texture coordinates according to an embodiment of the present disclosure.
[0030] Figure 3 A schematic diagram showing the structure of a software model according to an embodiment of the present disclosure.
[0031] Figure 4 A schematic diagram showing the structure of a conversion module according to an embodiment of the present disclosure.
[0032] Figure 5 A schematic diagram illustrating the structure of a texture coordinate processing device according to an embodiment of the present disclosure.
[0033] Figure 6 A block diagram of an electronic device 1900 implemented in accordance with the present disclosure is shown. DETAILED DESCRIPTION
[0034] Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise indicated.
[0035] As used herein, the terms "comprises," "comprising," "having," or variations thereof are open ended and include one or more stated features, integers, elements, steps, parts, or functions, but do not preclude the presence or addition of one or more other features, integers, elements, steps, parts, functions, or groups thereof.
[0036] When an element is referred to as being "connected," "coupled," "responsive" or variations thereof to another element, it can be directly connected, coupled or responsive to the other element or intervening elements may be present.
[0037] Although the terms first, second, third, etc. may be used herein to describe various elements / operations, these elements / operations should not be limited by these terms. These terms are only used to distinguish one element / operation from another element / operation. Therefore, without departing from the teachings of the present invention, the first element / operation in some embodiments may be referred to as the second element / operation in other embodiments.
[0038] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0039] In addition, numerous specific details are provided in the following detailed description to better illustrate the present disclosure. Those skilled in the art will appreciate that the present disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art are not described in detail in order to highlight the main points of the present disclosure.
[0040] As mentioned above, in the prior art, an initial precision parameter is usually preset and then adjusted through multiple iterations. Each iteration involves refactoring the software model code, testing using the graphics API test set, and adjusting the precision parameter based on the test results. The graphics API test set includes a large amount of sample data, and each test using the graphics API test set requires a large amount of data processing cost. Multiple iterations further increase the data processing cost. In this case, the texture coordinate processing efficiency is also low.
[0041] Furthermore, to achieve bit-level accuracy, existing simulation techniques require the architecture of the software model to be consistent with the hardware circuit architecture. This results in complex simulations, significantly increasing development and iteration costs. Furthermore, the complex model design also results in slower execution, further reducing the efficiency of texture coordinate processing.
[0042] Furthermore, the solutions of the existing technology cannot quickly locate the problem of accuracy, and manual analysis of the test results is required to determine whether the accuracy meets the requirements, which increases labor costs.
[0043] In view of this, the present disclosure proposes a texture coordinate processing method, device, electronic device, and storage medium. The method can reduce the number of iterations, lower data processing costs, and improve the processing efficiency of texture coordinates.
[0044] Furthermore, the architecture of the software model corresponding to this method does not need to be completely consistent with the hardware circuit, as long as the input and output are consistent with the hardware circuit. In this case, the architecture of the software model is simplified, which can improve the operating efficiency of the software model.
[0045] Furthermore, this method can dynamically adjust precision parameters at runtime to meet the needs of hardware design, architecture definition, and software development. It can also automatically compare fixed-point texture coordinates converted at different precision parameters with corresponding reference values at runtime, determining the accuracy gap between the fixed-point texture coordinates at different precision parameters and the reference value. The reference value is the fixed-point texture coordinate converted without loss of precision, allowing for rapid determination of whether the precision parameters meet requirements, reducing labor costs.
[0046] Figure 1 An exemplary application scenario of the texture coordinate processing method according to an embodiment of the present disclosure is shown.
[0047] like Figure 1 As shown, the texture coordinate processing method of the embodiment of the present disclosure can be executed by a processor. The processor uses multiple sets of precision parameters input by the user to execute the texture coordinate processing method of the embodiment of the present disclosure, converting the floating-point texture coordinates (such as the first texture coordinates described below) to obtain multiple fixed-point texture coordinates (such as the second texture coordinates described below), and then outputting the fixed-point texture coordinates with the greatest precision loss (such as the texture coordinates obtained by the processing described below) through numerical comparison.
[0048] The output texture coordinates can be displayed to the user, who can determine whether the accuracy of the texture coordinates meets the requirements. If the accuracy of the fixed-point texture coordinates meets the requirements, the precision parameter adjustment is stopped, and appropriate precision parameters are further selected from the multiple sets of precision parameters input this time. If the accuracy of the fixed-point texture coordinates does not meet the requirements, the user enters multiple sets of precision parameters, and the new multiple sets of precision parameters have at least one set of precision parameters different from the multiple sets of precision parameters input previously. The processor re-executes the texture coordinate processing method of the disclosed embodiment.
[0049] Figure 2 A schematic diagram illustrating the flow of a method for processing texture coordinates according to an embodiment of the present disclosure.
[0050] like Figure 2 As shown, in a possible implementation, the embodiment of the present disclosure proposes a method for processing texture coordinates, the method comprising:
[0051] Step S21, receiving at least one first texture coordinate and multiple sets of precision parameters, where the first texture coordinate is a floating point number;
[0052] Step S22: for each first texture coordinate, use multiple sets of precision parameters to convert the first texture coordinate respectively to obtain multiple second texture coordinates, where the second texture coordinates are fixed-point numbers;
[0053] Step S23, for each of the multiple second texture coordinates obtained by converting the first texture coordinate, determine the accuracy difference between each second texture coordinate and the reference value corresponding to the second texture coordinate, and determine the second texture coordinate with the largest accuracy difference from the reference value as the processed texture coordinate.
[0054] For example, the processor may execute step S21 to receive at least one first texture coordinate and multiple sets of precision parameters. The texture may include at least one sampling point, with each sampling point being sampled to obtain a corresponding first texture coordinate. The first texture coordinate may be a normalized floating-point number, and the present disclosure does not limit the specific number of bits in the first texture coordinate.
[0055] Multiple sets of precision parameters can be set and input by the user. In a possible implementation, each set of precision parameters includes the number of integer digits and the number of decimal digits.
[0056] For example, a set of precision parameters may include the number of integer digits M and the number of decimal digits N. (M, N) will be used to represent the precision parameters below. M and N are positive integers, and their values can be set by the user based on the application scenario. When the first texture coordinate is a 32-bit floating point number, N is typically less than 23. The disclosed embodiments do not limit the specific values of M and N.
[0057] Any two sets of precision parameters may have different integer and / or decimal digits. That is, if one set of precision parameters has M1 integer digits and N1 decimal digits, and another set of precision parameters has M2 integer digits and N2 decimal digits, then M1 = M2 and N1 = N2 will not result in M1 = M2 and N1 = N2.
[0058] The number of integer digits in a set of precision parameters represents the number of integer digits in the fixed-point number obtained after texture coordinate conversion using that set of precision parameters. The number of decimal digits in a set of precision parameters represents the number of decimal digits in the fixed-point number obtained after texture coordinate conversion using that set of precision parameters. Therefore, the values of M and N in each set of precision parameters can be set based on the value of the first texture coordinate and the relationship between the number of bits in the binary number and the numerical expression range.
[0059] For example, the numerical range of a 3-bit binary number is 0-7, and the numerical range of a 4-bit binary number is 0-15. When the value of the first texture coordinate is 7.5, at least 4 binary digits are required to represent the integer portion of the first texture coordinate. Therefore, the value of M can be greater than or equal to 4. It should be understood that an excessively large value of M does not help improve accuracy, so an integer value closer to 4 can be selected as M. The method for selecting the value of N is similar to that of M and will not be repeated here.
[0060] The processor may execute step S22 to convert each first texture coordinate using multiple sets of precision parameters to obtain multiple second texture coordinates, where the second texture coordinates are fixed-point numbers. The number of digits in the integer portion of the second texture coordinate may be equal to M. The number of digits in the fractional portion of the second texture coordinate may be equal to N. In this case, for each first texture coordinate, the precision of the multiple second texture coordinates obtained by conversion may be different.
[0061] The embodiments of the present disclosure do not limit the specific process of converting the first texture coordinates to the second texture coordinates. In one example, the process of converting the first texture coordinates to the second texture coordinates may include floating-point to fixed-point conversion, texture mapping, address and offset calculation, etc. An example of the process of converting the first texture coordinates to the second texture coordinates is provided below.
[0062] After each first texture coordinate is converted using multiple sets of precision parameters to obtain multiple second texture coordinates, step S23 may be performed to determine, for each of the multiple second texture coordinates converted from the first texture coordinate, a precision difference between each second texture coordinate and a reference value corresponding to the second texture coordinate. The reference value may be a fixed-point number obtained by converting the first texture coordinate without loss of precision. The precision difference between each second texture coordinate and the reference value may represent a precision loss during the conversion of the second texture coordinate.
[0063] The greater the precision difference between the second texture coordinate and the reference value, the greater the precision loss of the second texture coordinate during the conversion process. The second texture coordinate with the largest precision difference from the reference value can be determined as the processed texture coordinate. In this case, if the precision of the processed texture coordinate meets the required accuracy, the multiple sets of precision parameters can be considered to meet the required accuracy. The user can simply select the appropriate precision parameter from the multiple sets of precision parameters, eliminating the need for iterative calculations and thus reducing the number of iterative calculations. The specific selection method will not be elaborated here.
[0064] Furthermore, the processed texture coordinates can also be used in the rendering calculation process of the GPU to ensure that the boundaries of the actual rendering results are controllable.
[0065] According to a texture coordinate processing method of an embodiment of the present disclosure, at least one first texture coordinate and multiple sets of precision parameters are received. For each first texture coordinate, the method converts the first texture coordinate using the multiple sets of precision parameters to obtain multiple second texture coordinates. The first texture coordinate is a floating-point number, and the second texture coordinate is a fixed-point number. Therefore, the method converts the texture coordinates from floating-point numbers to fixed-point numbers and achieves multi-precision conversion. For each of the multiple second texture coordinates converted from the first texture coordinate, the method determines the precision difference between each second texture coordinate and a reference value corresponding to the second texture coordinate. The second texture coordinate with the largest precision difference from the reference value is determined as the processed texture coordinate. The second texture coordinate with the largest precision difference from the reference value also suffers the largest precision loss during the conversion process. Therefore, whether the precision of the processed texture coordinate meets the precision requirement can be used to determine whether the multiple sets of precision parameters meet the requirement. If the precision of the processed texture coordinate meets the requirement, the multiple sets of precision parameters can be considered to meet the required precision. The user can select the appropriate precision parameter from the multiple sets of precision parameters without the need for iterative calculations, thereby reducing the number of iterative calculations, lowering data processing costs, and improving texture coordinate processing efficiency.
[0066] This method does not require reconstruction of the model code or running a large number of test sets, which can further reduce data processing costs and improve the processing efficiency of texture coordinates.
[0067] In the process of converting each first texture coordinate to obtain multiple second texture coordinates, different second texture coordinates can be converted in parallel, further improving the processing efficiency of the texture coordinates.
[0068] The embodiment of the present disclosure constructs a software model for a processing method that applies texture coordinates. Figure 3 A schematic diagram showing the structure of a software model according to an embodiment of the present disclosure.
[0069] like Figure 3 As shown, the software model may include a conversion module and a comparison module. The conversion module receives multiple sets of precision parameters and the first texture coordinate ( Figure 3 Taking a first texture coordinate as an example), output multiple second texture coordinates; the comparison module receives the multiple second texture coordinates, and selects one of the second texture coordinates as the processed texture coordinate output by calculating the accuracy difference and comparing the accuracy difference.
[0070] The various modules in this software model work together to achieve efficient conversion of texture coordinates in scenarios with multiple precision requirements and determine whether further precision parameter adjustments are necessary. The overall architecture is designed to accommodate the varying precision requirements of texture coordinate processing, ensuring that all precision requirements are met and accelerating the texture coordinate processing process. The software model's architecture does not need to be completely identical to the hardware circuitry; as long as the inputs and outputs are consistent with the hardware circuitry, it suffices. This simplifies the software model's architecture and improves its operational efficiency.
[0071] Users can write multiple sets of precision parameters into a configuration file in the form of a queue. The software model then reads the configuration file to obtain the current precision parameter queue. This configuration file can be adjusted in real time, and the precision parameter queue can be modified dynamically at runtime. This allows the software model to adjust the processing precision of texture coordinates according to user needs. When there are multiple sampling points, the software model processes the first texture coordinate at each sampling point in sequence. When completing the processing of the first texture coordinate at any sampling point, the multiple sets of precision parameters are used in the order in which they were stored in the queue.
[0072] This software model optimizes the texture coordinate processing process, can dynamically adjust the texture coordinate processing accuracy, and greatly improves the operating efficiency and reduces the testing time through parallel processing.
[0073] The comparison module provides users with a means to quickly identify and optimize precision issues, further ensuring the accuracy of rendering results using the processed coordinates. Compared to existing processes that require extensive manual testing and analysis, this significantly shortens the adjustment cycle for precision parameters, reduces the need for manual intervention, and improves the accuracy of precision testing.
[0074] An example of a process of converting a first texture coordinate into a second texture coordinate is described below.
[0075] In one possible implementation, the first texture coordinate includes an exponent bit, a mantissa bit, and a sign bit.
[0076] The first texture coordinates are converted using multiple sets of precision parameters, including:
[0077] When the first texture coordinate is transformed using any set of precision parameters,
[0078] Determining a mantissa corresponding to the first texture coordinate according to the mantissa bit and the sign bit of the first texture coordinate;
[0079] Determining a reference value corresponding to the set of precision parameters and the first texture coordinate according to the number of mantissa bits, the exponent bits, and the number of decimal places included in the set of precision parameters;
[0080] The mantissa is converted using the set of precision parameters to obtain a first fixed-point number;
[0081] Determine a second fixed-point number according to the first fixed-point number and the texture mapping parameter;
[0082] The second texture coordinate is determined according to the reference value and the second fixed-point number.
[0083] Figure 4 A schematic diagram showing the structure of a conversion module according to an embodiment of the present disclosure.
[0084] like Figure 4 As shown, the conversion module may include a bit field separation unit, a reference value calculation unit, a precision adjustment unit, a texture mapping unit, and an address and offset calculation unit.
[0085] The first texture coordinate can include an exponent bit, a mantissa bit, and a sign bit. For example, if the first texture coordinate is a 32-bit floating-point number, bit 1 is the sign bit, whose value indicates the sign of the floating-point number, typically 0 for positive and 1 for negative. Bits 2-9 are the exponent bits, used to indicate the power of the floating-point number. Bits 10-32 are the mantissa bits, used to indicate the precision of the floating-point number.
[0086] The first texture coordinate can be first subjected to bit field separation to separate the exponent bit, mantissa bit, and sign bit. This step can be performed by a bit field separation unit. The bit field separation unit also receives the precision parameters (M, N).
[0087] The mantissa corresponding to the first texture coordinate can be determined based on the mantissa and sign bit of the first texture coordinate. When the sign bit is 0, the mantissa determined can be the original code of the mantissa. When the sign bit is 1, the mantissa determined can be the complement of the mantissa. This step can be performed by the precision adjustment unit.
[0088] After obtaining the mantissa of the first texture coordinate, the mantissa of the first texture coordinate can be converted using the precision parameters (M, N) to obtain a first fixed-point number. This step can be performed by the precision adjustment unit, and the precision parameters (M, N) can come from the bit field separation unit. The first fixed-point number has an integer part with M bits and a fractional part with N bits. This conversion can be implemented based on existing technologies, and the details of the conversion are not detailed here.
[0089] In this case, the mantissa of the first texture coordinate can be converted to a first fixed-point number of the specified precision (M, N). Since the exponent alignment is not performed, the first fixed-point number can be considered lossless.
[0090] A second fixed-point number can be determined based on the first fixed-point number and texture mapping parameters to ensure that the second fixed-point number can be correctly mapped to the texture data. The integer portion of the second fixed-point number can be used as an index value corresponding to the precision parameters (M, N) and the first texture coordinate. This step can be performed by the texture mapping unit.
[0091] In one example, the second fixed-point number may be equal to the product of the first fixed-point number and the texture mapping parameter.
[0092] In one possible implementation,
[0093] When the first texture coordinate is a width coordinate, the texture mapping parameter is a width mapping parameter;
[0094] When the first texture coordinate is a height coordinate, the texture mapping parameter is a height mapping parameter;
[0095] When the first texture coordinate is a depth coordinate, the texture mapping parameter is a depth mapping parameter.
[0096] For example, there are multiple types of texture mapping parameters, which correspond to the types of the first texture coordinates. When the first texture coordinate is a width coordinate, the texture mapping parameter can be a width mapping parameter; when the first texture coordinate is a height coordinate, the texture mapping parameter can be a height mapping parameter; when the first texture coordinate is a depth coordinate, the texture mapping parameter can be a depth mapping parameter.
[0097] The values of the texture mapping parameters are related to the properties of the sampling point corresponding to the first texture coordinate. Specifically, the value of the width mapping parameter may be equal to the width of the sampling point, the value of the height mapping parameter may be equal to the height of the sampling point, and the value of the depth mapping parameter may be equal to the depth of the sampling point.
[0098] In this way, the accuracy of the second fixed-point number can be guaranteed.
[0099] Based on the number of mantissa digits, exponent digits, and decimal digits of the first texture coordinate, a reference value corresponding to the number of integer digits, the number of decimal digits, and the first texture coordinate is determined. This step can be performed by a reference value calculation unit. In one example, the true value of the reference value can be 1. Those skilled in the art will appreciate that the true value of the reference value can also be other values, such as 0.5, and the embodiments of the present disclosure do not limit the specific value of the true value of the reference value.
[0100] The following describes an exemplary method for determining the reference value, taking the true value of the reference value being 1 as an example.
[0101] In one possible implementation, the reference value corresponding to any set of precision parameters and any first texture coordinate is equal to the maximum value that can be expressed by a Y-bit binary number, where Y is equal to the result of subtracting the number of mantissa bits of the first texture coordinate from the exponent bits of the first texture coordinate and adding the result to the number of decimal places included in the set of precision parameters, and Y is a positive integer.
[0102] For example, an exemplary method for determining the reference value is shown in formula (1).
[0103] S=1×2^(W-exp+N) (1)
[0104] Where S represents the reference value corresponding to the precision parameter (M, N) and the first texture coordinate F. W represents the number of mantissa bits of the first texture coordinate F. When the first texture coordinate F is a 32-bit floating point number, W can be equal to 23. exp represents the exponent bits of the first texture coordinate F. N represents the number of decimal places in the precision parameter.
[0105] Because each set of precision parameters corresponds to a different precision, the reference values corresponding to the first texture coordinate F differ for different sets of precision parameters. For example, if reference value S1 corresponds to precision parameters (M=M1, N=N1) and the first texture coordinate F, and reference value S2 corresponds to precision parameters (M=M2, N=N2) and the first texture coordinate F, then reference value S2 can differ from reference value S1.
[0106] In a possible implementation, all reference values corresponding to the same first texture coordinate have the same true value.
[0107] For example, the reference value, first fixed-point number, second fixed-point number, and second texture coordinate obtained using a certain set of precision parameters and a first texture coordinate F can be considered to correspond to each other and all correspond to that set of precision parameters and the first texture coordinate F. Because the influence of the exponent on the conversion (W-exp) is removed and the influence of the number of decimal places used on the conversion (W-exp+N) is taken into account when determining the reference value, all reference values corresponding to the first texture coordinate F have the same true value. The second texture coordinate determined from each reference value and the corresponding second fixed-point number is calculated with the exponents aligned, making the precision loss during the conversion process comparable for multiple second texture coordinates obtained using multiple sets of precision parameters and the first texture coordinate F.
[0108] The calculation of the reference value can be performed in parallel with the calculation of the first and second fixed-point numbers. Calculating the reference value in advance can speed up the texture coordinate processing, enabling multi-precision conversion of texture coordinates while increasing the flexibility of setting precision parameters.
[0109] The second texture coordinates can be determined based on the reference value and the second fixed-point number. This step can be performed by the address and offset calculation unit. In one example, address mode calculation and offset calculation can be performed on the second fixed-point number according to the DirectX 11 (DX11) specification. During the calculation process, the reference value is used as the calculation unit, and the calculation result is the second texture coordinates. For example, when the true value of the reference value is 1, if the true value represented by the second fixed-point number needs to be increased by 1, the second fixed-point number can be directly added to the reference value. The address mode calculation and offset calculation can be implemented based on existing technologies, and the specific calculation process will not be repeated here. An exemplary calculation process is provided later.
[0110] The following describes an exemplary method for determining the precision difference between the second texture coordinate and the reference value (the precision loss of the second texture coordinate during the conversion process).
[0111] In one possible implementation, determining the accuracy difference between each second texture coordinate and a reference value corresponding to the second texture coordinate includes:
[0112] Rounding the reference value to retain the integer digit and X decimal digits of the reference value, where X is the number of decimal digits of the second texture coordinate, and X is a positive integer;
[0113] The numerical difference between the second texture coordinate and the reference value is used as the precision difference between the second texture coordinate and the reference value corresponding to the second texture coordinate.
[0114] For example, the reference value is a fixed-point number converted without loss of precision. When the first texture coordinate F is a 32-bit floating-point number, the reference value can be regarded as the value of the second texture coordinate obtained by processing the first texture coordinate using 41 integer digits and 23 decimal digits. Typically, the number of decimal digits of the reference value is greater than the number of decimal digits X of the second texture coordinate. The reference value can be rounded first, retaining the integer digits and X decimal digits of the reference value. Among them, rounding algorithms such as Round to Nearest Even (RTE) can be used for rounding. Other rounding algorithms, such as rounding up or rounding down, can also be used. The embodiments of the present disclosure do not limit the specific implementation of the rounding operation.
[0115] After the reference value is rounded, the numerical difference between the second texture coordinate and the reference value can be used as the precision difference between the second texture coordinate and the reference value, that is, the precision loss of the second texture coordinate.
[0116] In this way, the credibility of the precision loss can be guaranteed.
[0117] The following example describes how to obtain the second texture coordinate and the precision difference, taking the first texture coordinate as a floating point number 0x3E4CCCCD (corresponding to the decimal number 0.2), the integer number M as 15, and the decimal number N as 8.
[0118] Assume that the first texture coordinate is the width coordinate and the texture mapping parameter is the width mapping parameter and is equal to 100. The address calculation uses the repeat tiling mode (REPEAT). In this mode, texture coordinates outside the range [0, 1] will be tiled in a loop within the texture.
[0119] Then, in the conversion module, the exponent bit exp output by the bit field separation unit may be -3, the mantissa bit may be 0xCCCCCD, and the sign bit may be 0.
[0120] Assume that the number of mantissa bits is 23. The reference value calculated by the reference value calculation unit may be 1×2^(23-(-3)+8)=2^34. In bitwise operation, this is equivalent to shifting 0x1 left by 34 bits (0x1 << 34), resulting in 0x4 0000 0000.
[0121] The precision adjustment unit converts 0xCC CCCD into a first fixed-point number with 15 integer digits and 8 decimal digits. In the bitwise operation, this is equivalent to shifting the mantissa left by 8 bits, and the result is 0xCCCC CD00.
[0122] The texture mapping unit calculates the product of the first fixed-point number and the texture mapping parameter to obtain a second fixed-point number. Therefore, the second fixed-point number=0xCCCC CD00×100=0x50 0000 1400.
[0123] The address and offset calculation unit determines the coordinates of the upper bound of the texture as 0x40000 0000×100 = 0x19000000000 based on the reference value and the texture mapping parameters.
[0124] In repeat tiling mode, the address calculation result can be the modulo operation between the second fixed-point number and the coordinates of the upper texture bound. To eliminate the effect of the exponent bit, the coordinates of the upper texture bound can be right-shifted by an amount equal to the exponent bit before the modulo operation. That is, the result of the address calculation is 0x50 0000 1400 % 0xC80 0000 0000 = 0x50 00001400.
[0125] Assuming the texture has no offset and no texture coordinate filter is set, the second texture coordinate can be obtained by right-shifting the address calculation result by 23-(-3) bits. In this case, the second texture coordinate is 0x50 0000 1400 >> 26 = 0x1400.
[0126] In the comparison module, the reference value may be 0.2×100=20. The integer part of the second texture coordinate 0x1400 is 20, the decimal part is 0, and the precision difference between the second texture coordinate and the reference value is 0.
[0127] The following example uses the first texture coordinate as the floating point number 0x3FE6502F (corresponding to the decimal number 1.799322), the integer number M is 15, and the decimal number N is 16 to introduce the example of obtaining the second texture coordinate and the precision difference.
[0128] Assume that the first texture coordinate is the width coordinate, and the texture mapping parameter is the width mapping parameter and is equal to 20. The address calculation uses the repeat tiling mode (REPEAT). In this mode, texture coordinates outside the range [0, 1] will be tiled in a loop within the texture.
[0129] Then, in the conversion module, the exponent bit exp output by the bit field separation unit may be 0, the mantissa bit may be 0x E6502F, and the sign bit may be 0.
[0130] Assume that the number of mantissa bits is 23. The reference value calculated by the reference value calculation unit may be 1×2^(23-0+16)=2^39. In bitwise operation, this is equivalent to shifting 0x1 left by 39 bits (0x1 << 39), resulting in 0x80 0000 0000.
[0131] The precision adjustment unit converts 0x E6 502F into a first fixed-point number with 15 integer digits and 16 decimal places. In the bitwise operation, this is equivalent to shifting the mantissa left by 16 bits, and the result is E6 502F 0000.
[0132] The texture mapping unit calculates the product of the first fixed-point number and the texture mapping parameter to obtain a second fixed-point number. Therefore, the second fixed-point number = E6 502F 0000×20=0xA00 0000 0000.
[0133] The address and offset calculation unit determines the coordinates of the upper bound of the texture as 0x40000 0000×100 = 0x19000000000 based on the reference value and the texture mapping parameters.
[0134] In repeat tiling mode, the address calculation result can be the modulo operation result of the second fixed-point number and the coordinates of the upper bound of the texture. Because the exponent bit is 0, there is no need to shift the coordinates of the upper bound of the texture. In other words, the result of the address calculation is 0x11FE 43AC 0000 % 0xA00 0000 0000 = 0x 7FE 43AC 0000.
[0135] Assuming the texture offset is +2 and the texture coordinate filter is not set, the second texture coordinate can be obtained by right-shifting the address calculation result by 23-(0). In this case, the second texture coordinate is 0x 7FE 43AC 0000 >> (23- 0) = 0x F FC87.
[0136] In the comparison module, the reference value can be (1.799322×20)%20=15.98644. The integer part of the second texture coordinate 0x FFC87 is 15, and the decimal part is 0.986. The precision difference between the second texture coordinate and the reference value is 0.
[0137] The present disclosure also provides a texture coordinate processing device. Figure 5 A schematic diagram illustrating the structure of a texture coordinate processing device according to an embodiment of the present disclosure.
[0138] like Figure 5 As shown, in a possible implementation, the texture coordinate processing device includes:
[0139] A receiving module 51 is configured to receive at least one first texture coordinate and multiple sets of precision parameters, wherein the first texture coordinate is a floating point number;
[0140] a conversion module 52 for converting each first texture coordinate using the multiple sets of precision parameters to obtain a plurality of second texture coordinates, where the second texture coordinates are fixed-point numbers;
[0141] The determination module 53 is used to determine the accuracy difference between each second texture coordinate and the reference value corresponding to the second texture coordinate for each of the multiple second texture coordinates converted from the first texture coordinate, and determine the second texture coordinate with the largest accuracy difference from the reference value as the processed texture coordinate.
[0142] The texture coordinate processing device may be the software model described above. The conversion module 52 implements the function of the conversion module of the software model. The determination module 53 implements the function of the comparison module of the software model.
[0143] In a possible implementation, each set of precision parameters includes the number of integer digits and the number of decimal digits.
[0144] In one possible implementation, the first texture coordinate includes an exponent bit, a mantissa bit, and a sign bit, and the use of the multiple sets of precision parameters to convert the first texture coordinates respectively includes: when using any set of precision parameters to convert the first texture coordinates, determining the mantissa corresponding to the first texture coordinate according to the mantissa bit and the sign bit of the first texture coordinate; determining a reference value corresponding to the set of precision parameters and the first texture coordinate according to the number of bits of the mantissa bits, the exponent bits, and the number of decimal places included in the set of precision parameters; converting the mantissa using the set of precision parameters to obtain a first fixed-point number; determining a second fixed-point number according to the first fixed-point number and texture mapping parameters; and determining the second texture coordinate according to the reference value and the second fixed-point number.
[0145] In a possible implementation, all reference values corresponding to the same first texture coordinate have the same true value.
[0146] In a possible implementation, when the first texture coordinate is a width coordinate, the texture mapping parameter is a width mapping parameter; when the first texture coordinate is a height coordinate, the texture mapping parameter is a height mapping parameter; when the first texture coordinate is a depth coordinate, the texture mapping parameter is a depth mapping parameter.
[0147] In one possible implementation, the reference value corresponding to any set of precision parameters and any first texture coordinate is equal to the maximum value that can be expressed by a Y-bit binary number, where Y is equal to the result of subtracting the number of mantissa bits of the first texture coordinate from the exponent bits of the first texture coordinate and adding the result to the number of decimal places included in the set of precision parameters, and Y is a positive integer.
[0148] In one possible implementation, determining the precision difference between each second texture coordinate and a reference value corresponding to the second texture coordinate includes: rounding the reference value to retain an integer digit and X decimal digits of the reference value, where X is the number of decimal digits of the second texture coordinate and is a positive integer; and using the numerical difference between the second texture coordinate and the reference value as the precision difference between the second texture coordinate and the reference value corresponding to the second texture coordinate.
[0149] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiment. Its specific implementation can refer to the description of the above method embodiment. For the sake of brevity, it will not be repeated here.
[0150] An embodiment of the present disclosure further provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above method.
[0151] An embodiment of the present disclosure further provides a non-volatile computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0152] An embodiment of the present disclosure further provides a computer program product, including a computer program, or a non-volatile computer-readable storage medium carrying the computer program, wherein the computer program implements the steps of the above method when executed by a processor.
[0153] Figure 6 FIG1 shows a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 can be provided as a server or a terminal device. Figure 6 The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute the instructions to perform the above-described method.
[0154] The electronic device 1900 may further include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2003. TM , Mac OS X TM , Unix TM , Linux TM , FreeBSD TM or similar.
[0155] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions that can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.
[0156] A computer-readable storage medium can be a tangible device that can hold and store programs / instructions used by an instruction execution device. A computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or raised structure within a groove on which instructions are stored, and any suitable combination thereof. As used herein, a computer-readable storage medium is not to be construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted via wires.
[0157] The computer programs (or computer-readable program instructions) described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage medium in the respective computing / processing device for storage.
[0158] The computer program (or computer program instructions) used to perform the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, the state information of the computer-readable program instructions is used to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), so that the electronic circuit can execute the computer-readable program instructions, thereby implementing various aspects of the present disclosure.
[0159] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.
[0160] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0161] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0162] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the prescribed logical function. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the prescribed function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0163] While various embodiments of the present disclosure have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technological improvements in the marketplace, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A texture coordinate processing method, characterized in that: The method comprises: receiving at least one first texture coordinate and multiple sets of precision parameters, wherein the first texture coordinate is a floating point number; For each first texture coordinate, use the multiple sets of precision parameters to convert the first texture coordinate respectively to obtain multiple second texture coordinates, where the second texture coordinates are fixed-point numbers; For each of the multiple second texture coordinates converted from the first texture coordinate, determine the accuracy difference between each second texture coordinate and the reference value corresponding to the second texture coordinate, and determine the second texture coordinate with the largest accuracy difference from the reference value as the processed texture coordinate.
2. The method according to claim 1, characterized in that Each set of precision parameters includes the number of integer digits and the number of decimal places.
3. The method according to claim 2, characterized in that The first texture coordinate includes an exponent bit, a mantissa bit, and a sign bit. The converting the first texture coordinates respectively using the multiple sets of precision parameters includes: When the first texture coordinate is transformed using any set of precision parameters, Determining a mantissa corresponding to the first texture coordinate according to the mantissa bit and the sign bit of the first texture coordinate; determining a reference value corresponding to the set of precision parameters and the first texture coordinate according to the number of the mantissa bits, the exponent bits, and the number of decimal places included in the set of precision parameters; Convert the mantissa using the set of precision parameters to obtain a first fixed-point number; Determining a second fixed-point number according to the first fixed-point number and texture mapping parameters; The second texture coordinates are determined according to the reference value and the second fixed-point number.
4. The method according to claim 3, characterized in that All reference values corresponding to the same first texture coordinate have the same true value.
5. The method according to claim 3, characterized in that When the first texture coordinate is a width coordinate, the texture mapping parameter is a width mapping parameter; When the first texture coordinate is a height coordinate, the texture mapping parameter is a height mapping parameter; When the first texture coordinate is a depth coordinate, the texture mapping parameter is a depth mapping parameter.
6. The method according to claim 3, characterized in that The reference value corresponding to any set of precision parameters and any first texture coordinate is equal to the maximum value that can be expressed by a Y-bit binary number, where Y is equal to the result of subtracting the number of mantissa bits of the first texture coordinate from the exponent bits of the first texture coordinate and adding the result to the number of decimal places included in the set of precision parameters, and Y is a positive integer.
7. The method according to claim 1, characterized in that Determining the accuracy difference between each second texture coordinate and a reference value corresponding to the second texture coordinate includes: performing a rounding operation on the reference value, retaining an integer digit and X decimal digits of the reference value, where X is the number of decimal digits of the second texture coordinate, and X is a positive integer; The numerical difference between the second texture coordinate and the reference value is used as the precision difference between the second texture coordinate and the reference value corresponding to the second texture coordinate.
8. A texture coordinate processing device, characterized in that: The device comprises: A receiving module, configured to receive at least one first texture coordinate and multiple sets of precision parameters, wherein the first texture coordinate is a floating point number; a conversion module, configured to convert each first texture coordinate using the multiple sets of precision parameters to obtain a plurality of second texture coordinates, wherein the second texture coordinates are fixed-point numbers; A determination module is used to determine the accuracy difference between each second texture coordinate and a reference value corresponding to the second texture coordinate for each of the multiple second texture coordinates converted from the first texture coordinate, and determine the second texture coordinate with the largest accuracy difference from the reference value as the processed texture coordinate.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.
10. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Texture detail level obtaining method and device
CN112465887A
Floating point to fixed point device and method, electronic equipment and storage medium
CN113625990A
Floating-point number processing method and device based on FPGA, electronic equipment and storage medium
CN113781217A
Precision conversion method and device, data processing method, processor and electronic equipment
CN118170347A
Floating point data processing method and device, computer equipment and storage medium
CN119473216A
Cited By
Texture data processing method and device, equipment, medium and program product
CN121329753A
Texture data processing methods, apparatus, equipment, media and program products
CN121329753B
