Color setting method, graphics processing unit, and system-on-chip

By introducing a preset table into the GPU user-space driver, the problem of limited storage space for texture boundary colors is solved, enabling a wider range of color formats and higher precision texture boundary color settings, thereby improving rendering effects and user experience.

CN121010685BActive Publication Date: 2026-01-30LOONGSON TECH CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511535758.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-24
Publication Date
2026-01-30
Estimated Expiration
2045-10-24

AI Technical Summary

Technical Problem

In existing technologies, the storage space for texture boundary colors is limited, which restricts the choice of color format, resulting in limited texture boundary color settings and affecting rendering effects.

Method used

By introducing a preset table in the GPU user-space driver, the storage range of texture boundary colors is expanded. The preset table is used to store boundary colors whose target color format exceeds the number of bits of the sampling descriptor. The preset table is located in memory. A first identifier points to the preset table and writes the target color into the preset table. A second identifier is stored in the second bit field of the sampling descriptor for the GPU hardware to look up.

Benefits of technology

It expands the storage format and precision of texture boundary colors, improves the user experience, reduces the limitation on target color storage space, and enables richer color selection and higher rendering quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121010685B_ABST
    Figure CN121010685B_ABST
Patent Text Reader

Abstract

This application provides a color setting method, a graphics processing unit, and a system-on-a-chip. The method applied to a GPU user-mode driver includes: upon receiving a rendering preparation instruction, setting the first field of a sampling descriptor to a first identifier, whereby the first identifier points to a preset table in memory, which stores boundary colors whose color format exceeds the number of bits in the sampling descriptor; writing the target color carried in the rendering preparation instruction into the preset table; obtaining a second identifier of the target color in the preset table; writing the second identifier of the target color in the preset table into a second bit field of the sampling descriptor; and sending the sampling descriptor to the GPU hardware, allowing the GPU hardware to set the texture boundary color based on the sampling descriptor. This application can extend the format and precision of target color storage, thus improving the setting of texture boundary colors and enhancing the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a color setting method, a graphics processing unit, and a system-on-a-chip. Background Technology

[0002] Texture boundary filling refers to filling the uncovered parts with a pre-configured texture boundary color when the texture used in the 3D texture sampling process cannot cover the 3D graphics surface.

[0003] Texture boundary colors are typically configured directly by the Graphics Processing Unit (GPU). When a boundary overflow occurs during rendering, if the border color mode is selected, the texture boundary color configured in the sampling descriptor will be used as the fill color for the overflowing portion. However, the sampling descriptor can only store boundary colors within a certain range, limiting the selection of texture boundary colors. Summary of the Invention

[0004] In view of the above problems, embodiments of this application are proposed to provide a color setting method that overcomes or at least partially solves the above problems, which can expand the storage range of boundary colors and increase the selection of texture boundary colors.

[0005] Accordingly, embodiments of this application also provide a color setting device, a graphics processing unit, and an electronic system to ensure the implementation and application of the above methods.

[0006] In a first aspect, embodiments of this application disclose a color setting method applied to a GPU user-space driver, the method comprising:

[0007] Upon receiving a rendering preparation instruction, the first field of the sampling descriptor is set to a first identifier, which is used to point to a preset table located in memory, the preset table being used to store boundary colors whose color format exceeds the number of bits of the sampling descriptor;

[0008] Write the target color carried in the rendering preparation instruction into the preset table;

[0009] Obtain the second identifier of the target color in the preset table;

[0010] The second identifier of the target color in the preset table is written into the second bit field of the sampling descriptor, and the sampling descriptor is sent to the GPU hardware so that the GPU hardware can set the texture boundary color according to the sampling descriptor.

[0011] Secondly, embodiments of this application disclose a color setting method applied to GPU hardware, the method comprising:

[0012] If the coverage of the target texture does not match the subject to be rendered, look up the sampling descriptor sent by the GPU user-mode driver;

[0013] The target color corresponding to the second identifier in the sampling descriptor is obtained by querying the preset table pointed to by the sampling descriptor according to the second identifier in the preset table;

[0014] The texture boundary color of the subject to be rendered is set according to the target color. Furthermore, embodiments of this application also provide a system-on-a-chip and a graphics processing unit.

[0015] The embodiments of this application have the following advantages:

[0016] The embodiments of this application propose the concept of a preset table. The preset table is located outside the sampling descriptor and is independently situated in memory. It stores the target color used to set texture boundary colors. Specifically, upon receiving a rendering preparation instruction, the first field of the sampling descriptor is set to a first identifier, which points to the preset table; the target color carried in the rendering preparation instruction is then written into the preset table. The second identifier of the target color in the preset table is obtained and stored in the second bit field of the sampling descriptor. This allows the GPU hardware to look up the target color in the preset table using the second identifier when setting texture boundary colors, thus completing the texture boundary color setting. In the color setting method proposed in this application, a preset table outside the sampling descriptor is used to store the target color. The preset table has a large storage space, supporting various color formats and high-precision colors that require high storage space. Compared to using a limited preset area in the sampling descriptor to store the target color, this reduces the limitation on target color storage space, expands the format and precision of target color storage, improves texture boundary color setting, and enhances the user experience. Attached Figure Description

[0017] Figure 1 This is a schematic diagram of the color setting method for GPU memory drivers provided in this application;

[0018] Figure 2 This is a flowchart illustrating one color setting method of this application;

[0019] Figure 3 This is a schematic diagram of the color setting method for GPU hardware provided in this application;

[0020] Figure 4 This is a schematic diagram of the color setting device for GPU user-mode drivers provided in this application;

[0021] Figure 5This is a schematic diagram of the color setting device for GPU hardware provided in this application;

[0022] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0023] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, this application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0024] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and are not limited in number; for example, a first object can be one or more. Furthermore, the term "and / or" in the specification and claims is used to describe the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. In the embodiments of this application, the term "multiple" refers to two or more, and other quantifiers are similar.

[0025] In 3D rendering, the primary process involves attaching a 2D target texture to the surface of a 3D model (the subject to be rendered) using mapped coordinates, thus adding detail to the model's surface. When the effective area of ​​the target texture is smaller than the surface area of ​​the 3D model (the subject to be rendered), some UV coordinates on the model's surface will inevitably exceed the effective range of the target texture, meaning the UV coordinates will break through the [0.0, 1.0] range. The UV coordinates are the mapped coordinate system of the 2D target texture, using the U (horizontal) and V (vertical) axes to locate the image pixels of the target texture and map them to the surface of the 3D model. Their coordinate range is typically normalized to [0.0, 1.0]. To ensure the visual continuity of the 3D model's surface, a reasonable color filling scheme is needed for these coordinates that exceed the effective range; that is, a scheme for setting the texture boundary color.

[0026] In common approaches, a sampling descriptor is introduced as the core control structure to guide the color filling process. The sampling descriptor not only contains the basic properties of the target texture, but also includes key parameters specifically for edge rendering, such as the texture boundary color used to render edge areas that cannot be covered by the target texture.

[0027] Texture boundary color is a component of the sampling descriptor configured by the Graphics Processing Unit (GPU) during 3D rendering. When the target texture cannot cover the surface of the 3D model (the subject to be rendered), the configured texture boundary color is used to fill the uncovered portion. In some implementations, the GPU driver directly configures the required texture boundary color into the sampling descriptor. When the GPU hardware handles the issue of the subject's boundary exceeding the target texture, if the border color mode is selected, the texture boundary color stored in the sampling descriptor will be used to fill the portion that the target texture cannot cover.

[0028] However, the space available for storing texture boundary colors in the sampling descriptor is limited, and different color formats require different numbers of bits of storage, so the allowed color formats are greatly restricted.

[0029] For example, if only 32-bit registers are provided to store texture boundary colors, then color values ​​in the R8G8B8A8_UNORM format can be filled in; where the RGBA parameters have 4 channels, each occupying 8 bits of register space, requiring a total of 32 bits of register space. If you want to store colors in the R16G16B16A16_FLOAT format, you need 64 bits of register space for 4 channels. This cannot be achieved with only 32 bits of registers; you must either abandon the storage or convert to a lower-precision format to achieve storage.

[0030] To address the aforementioned issues, this application provides a color setting method that expands the storage range of boundary colors and increases the selection of texture boundary colors.

[0031] Reference Figure 1 The diagram illustrates a flowchart of an embodiment of a color setting method according to this application. The method is applied to a GPU user-space driver and may include the following steps:

[0032] Step 101: Upon receiving a rendering preparation instruction, set the first field of the sampling descriptor to a first identifier. The first identifier is used to point to a preset table located in memory. The preset table is used to store boundary colors whose color format exceeds the number of bits of the sampling descriptor.

[0033] Step 102: Write the target color carried in the rendering preparation instruction into the preset table;

[0034] Step 103: Obtain the second identifier of the target color in the preset table;

[0035] Step 104: Write the second identifier of the target color in the preset table into the second bit field of the sampling descriptor, and send the sampling descriptor to the GPU hardware so that the GPU hardware can set the texture boundary color according to the sampling descriptor.

[0036] In a computer, the GPU is responsible for rendering images to the display. Specifically, it executes rendering commands from user programs, draws the image to be displayed on the screen, and then transmits the rendered image to the display, allowing the user to view it. The software component that assists the GPU hardware in completing the entire image rendering process is the GPU driver. Based on their access permissions to system resources, GPU drivers are further divided into user-mode drivers and kernel-mode drivers. The GPU user-mode driver is responsible for parsing the rendering commands from user programs, translating them into hardware instructions executable by the GPU hardware.

[0037] As is understandable, the GPU user-space driver acts as an intermediary between software and hardware. It translates rendering-related commands from the user program into a command stream executable by the GPU hardware and manages the resources used for rendering (such as target textures and target colors). The GPU hardware then executes the aforementioned command stream, performs 3D rendering of the subject to be rendered based on the resources sent by the GPU user-space driver, and finally outputs the target image.

[0038] For example, a first identifier is used to point to a preset table located in memory, which stores boundary colors whose color formats exceed the bit depth of the sampling descriptor. Since the preset table resides in memory, i.e., outside the sampling descriptor, the size of its storage space is not limited by the size of the sampling descriptor. It is understood that the size of the preset table can be set to be larger than the storage space in the sampling descriptor used to store the target color format. This addresses the issue that the sampling descriptor, due to storage space limitations, cannot store target colors requiring larger color formats. Because the preset table provides more storage space, it can store target colors requiring larger space, i.e., it can store more types and higher precision target colors, expanding the range of target color selection and improving the user experience.

[0039] Specifically, after the target color carried in the rendering preparation instruction is written to the preset table, the boundary colors stored in the preset table include the target color. The color format of the boundary color is, for example, R8G8B8A8_UNORM, R16G16B16A16_FLOAT, etc., and different color formats require different numbers of register bits or storage space bits. For example, the boundary color or target color is stored in the preset table in its actual color format. The sampling descriptor bit depth refers to the number of bits in the sampling descriptor used to store the boundary color.

[0040] The color setting method provided in this embodiment is applied to the GPU user-space driver, providing more color choices when the GPU implements texture boundary color settings. Specifically, by writing the target color into a preset table outside the sampling descriptor, the storage space for the target color is expanded, reducing the format limitations of the storage space for the target color, thereby enabling an expansion of the target color selection range. The sampling descriptor used to implement texture boundary color settings is improved; the first field in the sampling descriptor stores a first identifier, which points to the preset table, which stores the target color. This avoids directly storing the target color in the limited space of the sampling descriptor, providing more space for complete storage of the target color.

[0041] Specifically, upon receiving a rendering preparation instruction, the first field of the sampling descriptor is set to a first identifier. The rendering preparation instruction provides the GPU hardware with the necessary preparation parameters for rendering before rendering the subject, including a target color for texture boundaries. Simultaneously, after updating the sampling descriptor according to the first identifier, the target color carried in the rendering preparation instruction is written to a preset table. The preset table stores the target color for the GPU hardware to look up and retrieve when setting texture boundaries. The GPU user-space driver also obtains a second identifier for the target color in the preset table; this second identifier serves as a guide for the GPU hardware to look up the target color in the preset table; the second identifier is stored in the second bit field of the sampling descriptor.

[0042] Referring to Table 1, an example of a 32-bit register involved in setting the texture boundary color in a sampling descriptor is shown. The illustration shows registers bits 96 to 127 of the sampling descriptor, with the first field being, for example, located in registers bits 127-126; the second field being, for example, located in any consecutive position within bits 107-96, or, for example, located in any consecutive position within bits 125-96.

[0043] Table 1

[0044]

[0045] It is understandable that the boundary color table Bct is a preset table. Bits 125-108 can be set as reserved bits to provide space for future program expansion designs.

[0046] Here, 01 is the first identifier, used to identify that the target color is obtained using a preset table. Specifically, 01 can point to a preset table located in memory, so that after the GPU hardware detects the first identifier 01 in the first field, it jumps to the location of the preset table pointed to by 01 and queries the target color in the preset table according to the second identifier.

[0047] As shown in Table 1, in this embodiment, the sampling descriptor provides a first field and a second field. The first field stores an identifier indicating that a preset table lookup method is needed to obtain the target color. The second field stores a second identifier of the target color in the preset table. The GPU hardware can then look up the target color in the preset table using this second identifier. In other words, the function and stored content of the registers in the sampling descriptor have been improved. The 32-bit register used to store the target color in the sampling descriptor has been modified to combine with a preset table to achieve both target color storage and retrieval. This expands the target color storage space, allowing for the storage of more formats and higher precision target colors, thus improving the user experience.

[0048] It should be noted that, depending on the parameters set by different GPU hardware, the location of the parameters storing texture boundary color settings in the sampling descriptor may not be a 127-96 bit register. Table 1 above is only an example. The positions of the first and second fields in the specific sampling descriptor can be adjusted according to the relevant parameters of the actual GPU hardware used, so that the GPU hardware can correctly read the parameters of the first and second fields.

[0049] Optionally, in some embodiments, for data security reasons, the GPU user-space driver cannot directly send the sampling descriptor to the GPU hardware. In this case, the GPU user-space driver needs to send the sampling descriptor to the GPU hardware through a secure channel established by the GPU firmware. Specifically, the GPU user-space driver sends the sampling descriptor to the GPU firmware, which then forwards it to the GPU hardware. That is, it can be understood that the GPU includes GPU hardware, GPU firmware, and GPU driver, and the GPU driver includes user-space driver and kernel-space driver. Among them, the GPU hardware is used to implement image rendering; the GPU driver translates the application's instructions, such as rendering instructions, into a language that the GPU hardware can understand and sends it to the GPU hardware; when hardware initialization, configuration updates, and specific operations (such as some low-level management operations) are involved, the GPU driver needs to transfer relevant data to the GPU hardware through the GPU firmware. In addition, when GPU is mentioned alone, it usually refers to the GPU hardware.

[0050] In practice, the GPU user-space driver integrates the information required for a single GPU hardware rendering process into a data packet conforming to the GPU specification, called a drawcall packet. This drawcall packet can include a sampling descriptor with updated parameters in the first and second fields. In other words, the GPU user-space driver sends the drawcall packet containing the sampling descriptor to the GPU firmware, which then forwards it to the GPU hardware for setting texture boundary colors.

[0051] In this embodiment, a preset table concept is proposed. Located outside the sampling descriptor and independently in memory, the preset table stores the target color used to set texture boundary colors. Specifically, upon receiving a rendering preparation command, the first field of the sampling descriptor is set to a first identifier, which points to the preset table; the target color carried in the rendering preparation command is then written to the preset table. The second identifier of the target color in the preset table is obtained and stored in the second bit field of the sampling descriptor. This allows the GPU hardware to look up the target color in the preset table using the second identifier when setting texture boundary colors, thus completing the texture boundary color setting. In the color setting method proposed in this application, a preset table outside the sampling descriptor is used to store the target color. The preset table has a large storage space, supporting various color formats and high-precision colors that require high storage space. Compared to using a limited preset area in the sampling descriptor to store the target color, this reduces the limitation on target color storage space, expands the format and precision of target color storage, improves texture boundary color setting, and enhances the user experience.

[0052] In one optional embodiment of this application, before receiving the rendering preparation instruction, the method further includes:

[0053] S01, request memory space for the preset table;

[0054] S02, send the address of the memory space to the GPU hardware, so that the GPU hardware can store the address of the memory space of the preset table into the address register and update the identifier in the enable register to the enable identifier; wherein, the first identifier is used to point to the address register, and the enable identifier is used to enable the GPU hardware to read the first bit field in the sampling descriptor first.

[0055] In this embodiment, before updating the sampling descriptor according to the rendering preparation instruction, it is necessary to initialize the relevant parameters of this scheme (steps 101-104), such as enabling the target color acquisition method through the preset table and presetting the preset table.

[0056] Specifically, the preset table is stored in a memory location accessible to the GPU, such as a memory location within the CPU that the GPU can access. The contents of the preset table are written by the GPU user-mode driver executed by the CPU, and the GPU hardware reads it when needed. During initialization, the GPU user-mode driver executed by the CPU requests the memory space for the preset table, and after acquiring the memory space, sends the address of that memory space to the GPU hardware. The GPU hardware then uses this address to look up the preset table and retrieve the parameters from it. The memory address is written to the address register by the GPU hardware for lookup and retrieval during use.

[0057] When setting texture boundary colors, the GPU hardware can obtain the location of the address register through the first identifier, and further identify the preset table pointed to by the address stored in the address register. Then, it queries the preset table according to the second identifier to obtain the target color corresponding to the second identifier in the preset table.

[0058] Furthermore, after the address register is updated according to the received memory space address, the GPU hardware can also update the flag in the enable register to an "on" flag. When the flag in the enable register is "off", the GPU hardware will completely read the location in the sampling descriptor used to store the target color (e.g., a 32-bit register) to obtain the target color; when the flag in the enable register is "on", the GPU hardware will first read the parameters in the first field and determine the subsequent execution steps based on the parameters in the first field. That is, when the flag in the enable register is "on", the GPU hardware can implement the color setting scheme provided in the embodiments of this application to set the texture boundary color.

[0059] Optionally, the enable register can have a 0 for the disable flag and a 1 for the enable flag. That is, the enable register can occupy only 1 bit and store 1 bit of data. After receiving the memory address sent by the GPU user-mode driver, the GPU hardware updates the 0 in the enable register to 1.

[0060] In one example, the steps of writing the memory address to the address register and updating the enable register's disable flag to the enable flag are executed by the GPU hardware when the GPU hardware provides hardware commands that can directly set the border color table, thus bypassing GPU firmware isolation. When the GPU hardware does not provide such hardware commands, the steps are executed by the GPU firmware. The GPU firmware acts as a secure intermediary for data interaction between the GPU user-space driver and the GPU hardware.

[0061] Typically, if the GPU hardware provides hardware commands that can directly set the border color table, these commands are configured within the GPU hardware and implemented through specific hardware designs. Therefore, they are related to the GPU hardware architecture, and their existence can be determined by the GPU model. GPU user-mode drivers can pre-obtain the parameters (such as model number) of the GPU hardware they need to invoke. Therefore, they can determine in advance whether to send memory space address parameters to the GPU firmware or the GPU hardware for updating the address and enable registers.

[0062] For example, the GPU user-mode driver sends the address of the memory space of the preset table to the GPU firmware or GPU hardware via a command packet. The command packet is 12 bytes in size; the first 4 bytes are the command word of the command packet, used to enable the GPU firmware or GPU hardware to recognize the command packet; the last 8 bytes are used to store the virtual address of the memory space of the preset table.

[0063] It should be noted that the address register and enable register are set in the GPU hardware. Before reading the sampling descriptor, the GPU hardware has already detected that the identifier in the enable register has been updated to the enabled identifier. At the same time, after reading the first field of the sampling descriptor based on the enabled identifier in the enable register to obtain the first identifier, the address of the preset table stored in the address register is looked up based on the first identifier to read the preset table and further obtain the target color.

[0064] In one example, such as Figure 2 The diagram illustrates the process of setting texture boundary colors through interaction between the GPU user-space driver, GPU firmware, and GPU hardware in this embodiment of the application. In the illustrated process, the GPU hardware does not provide hardware commands to directly set the border color table; therefore, the GPU firmware receives the address information of the preset table and updates parameters such as the address register and enable register.

[0065] Before updating the sampling descriptor according to the rendering preparation instructions, this embodiment of the application includes an initialization preparation process for parameters such as the preset table. This includes: allocating memory space for the preset table; after completing the allocation, the GPU's user-mode driver sends the address of the memory space to the GPU hardware; updating the address register based on the address of the memory space; and using the address register for the GPU hardware to look up the target color when implementing texture boundary color settings. Furthermore, the enable register is updated so that the GPU hardware uses the color setting method described in this application when implementing texture boundary color settings, instead of completely reading the registers in the sampling descriptor used to store colors (e.g., a continuous 32-bit register), thus avoiding data corruption issues during steps 101-103.

[0066] In one optional embodiment of this application, the rendering preparation instruction carries the format of the target texture; the step of writing the target color carried in the rendering preparation instruction into the preset table includes:

[0067] S11, if it is detected that the format of the target color carried in the rendering preparation instruction is inconsistent with the format of the target texture, the format of the target color is updated according to the format of the target texture;

[0068] S12, write the target color into the preset table according to the updated target color format.

[0069] That is, the rendering preparation instruction carries not only the target color, but also at least the format of the target texture, for preprocessing the target color format.

[0070] If the target color format and the target texture format are detected to be different, the target color format can be adjusted according to the target texture format to ensure consistency between the two. The updated target color is then written to a preset table for the GPU hardware to read during rendering.

[0071] In this embodiment, the storage target color format is kept consistent with the target texture format, so that when the GPU performs 3D rendering on the subject to be rendered, it can obtain the target texture and the target color as the texture boundary color through the same format reading method. This reduces the data processing complexity of the GPU hardware in the 3D rendering step, reduces the probability of errors in the GPU hardware during 3D rendering, and ensures user experience.

[0072] In one optional embodiment of this application, the preset table includes multiple storage spaces with the same byte length, each storage space being used to store the target color in the order of writing; wherein, the byte length of the storage space is used in conjunction with the order value marked by the second identifier, so that the GPU hardware can obtain the target color through position calculation.

[0073] Understandably, when the GPU hardware reads the target color using the second identifier, since the preset table only stores the target color, the position of the target color can be directly determined by the length of the stored bytes. Simultaneously, because the storage space used to store the target color has the same byte length, the position of the target color can be directly calculated using the writing order and the byte length of the storage space.

[0074] For example, the second identifier can indicate the order in which target colors are written. For instance, the second identifier for the first target color written to the preset table is 0, the second identifier for the second target color written to the preset table is 1, the second identifier for the third target color written to the preset table is 2, and so on. The storage space can be set to a byte length of 16 bytes, a total of 128 bits of registers, enabling the storage of target colors in most formats.

[0075] When the GPU reads the target color from the preset table based on the second identifier, it combines the memory address, the byte length of the storage space, and the order value indicated by the second identifier to obtain the initial address to be read. Based on the initial address, it reads a parameter representing the byte length of a complete storage space to obtain the target color. For example, if the second identifier of the target color 'a' is 1, the byte length of a storage space is 16 bytes, and the memory address of the preset table is x, then: the initial address for reading the target color 'a' is x + 16 × 1 = x'. Reading begins from the next bit after x', and the data in 16 bytes is read completely to obtain the target color 'a'.

[0076] Optionally, when allocating memory space for the preset table, the storage format of the data in the table can be defined, or the byte length of each storage space in the preset table can be specified, and the space in the preset table can be divided according to the byte length for the target colors to be stored in sequence.

[0077] Table 2 shows a schematic of a preset table.

[0078] Table 2

[0079]

[0080] In this table, (255, 0, 0, 255) represents opaque red in Unorm format, (0, 1.0, 0, 1.0) represents opaque green in float format, and (0, 0, 255) represents blue in srgb format. This means the preset table supports storing multiple color formats.

[0081] Understandably, the current preset table supports most formats required by the OpenGL specification, such as RGBA and its related R, RG, RGB, BGRA formats, or sRGB, Luminance, and depth_stencil formats. That is, the color acquisition method provided in this application significantly expands the storage of target colors in terms of both format and fineness. For example, the storage space for a single target color is increased to 16 bytes, which is four times larger than the 4 bytes (32-bit register) provided by the sampling descriptor in some related technologies, greatly improving the fineness of the stored colors. Due to the increased storage space, it also supports storing various space-intensive formats.

[0082] For example, the same color (R=0.5, G=0.5, B=0.5, A=1.0) can be stored using both R8G8B8A8_UNORM and R16G16B16A16_SFLOAT. R8G8B8A8_UNORM is 8 bits per channel, requiring 4 bytes (32 bits) of register space; R16G16B16A16_SFLOAT is 16 bits per channel, requiring 8 bytes (128 bits) of register space. When only 4 bytes (32 bits) of register space are available, only the R8G8B8A8_UNORM format can be used. However, if the storage space is large enough, R16G16B16A16_SFLOAT can be used, resulting in higher color precision, richer detail, and a wider range of colors that can be stored.

[0083] In this embodiment, the preset table only stores the color value of the target color. Compared to storing color values ​​plus an index, it does not require storing index values ​​or other auxiliary query data, thus requiring less storage space, and consequently, the preset table itself occupies less space. Furthermore, GPU hardware typically reads information using an initial address and a certain offset. The process of reading parameters from the preset table using the second identifier in this solution conforms to the typical hardware reading logic; the certain offset is, for example, the length of the storage space in bytes. Moreover, compared to the method of first looking up the index and then obtaining the target color based on the correspondence between the index and the target color, although this embodiment involves a calculation process, the computational load and time required are very small and do not affect the normal operation of the hardware. Therefore, the preset table obtained according to this embodiment can achieve fast querying with a small storage space footprint, improving the user experience.

[0084] In one optional embodiment of this application, updating the first field of the sampling descriptor to a first identifier upon receiving a rendering preparation instruction, the first identifier being used to point to a preset table, includes:

[0085] S21, upon receiving a rendering preparation instruction, obtain the target color carried in the rendering preparation instruction;

[0086] S22, if the target color is the same as any preset color, update the first field of the sampling descriptor to the identifier of the preset color;

[0087] S23, if the target color is different from any preset color, update the first field of the sampling descriptor to a first identifier, the first identifier being used to point to a preset table.

[0088] It is understood that preset colors exist in this embodiment. These preset colors may be, for example, several frequently used colors obtained from historical data of 3D rendering performed by the user program. If the target color carried in this rendering preparation instruction is one of multiple preset colors, the identifier of the preset color is directly filled in the sampling descriptor. It is not necessary to set the first field to the first identifier. Subsequently, the target color is stored and searched according to the preset table.

[0089] For example, the preset colors are transparent black, opaque black, and opaque white. Transparent black is identified as 00, opaque black as 10, and opaque white as 11. When the target color carried in the rendering preparation instruction is opaque black, registers 127-126 in Table 1 (i.e., the first field) are set to 10, and the relevant parameters in the second field are not updated. Under this premise, when the GPU hardware reads that the first field in the sampling descriptor is 10, it sets the texture boundary color according to the preset opaque black parameters.

[0090] Optionally, the preset colors are configured in the GPU hardware, specifically in the logic circuitry of the GPU chip. Upon recognizing the corresponding preset color identifier, a pre-designed circuit signal is output, representing the preset color that the GPU hardware can quickly obtain. Compared to storing preset colors in the CPU's memory, this eliminates the need for memory access, resulting in faster retrieval, a simpler operation process, and lower power consumption.

[0091] In this embodiment, after obtaining the target color according to the rendering preparation instructions, the GPU memory driver first determines whether the target color is consistent with the existing preset color. If the target color is consistent with the preset color, the first field of the sampling descriptor is updated to the identifier corresponding to the preset color, instead of the first identifier. Subsequently, the GPU hardware sets the texture boundary color according to the identifier and the corresponding preset color, without writing or calling parameters to the preset table. This allows the GPU to more conveniently read the target color and quickly complete the texture boundary color setting.

[0092] In one optional embodiment of this application, writing the target color carried in the rendering preparation instruction into the preset table includes:

[0093] Check if the target color exists in the preset table;

[0094] If the target color does not exist in the preset table, the target color carried in the rendering preparation instruction is written into the preset table.

[0095] That is, by not storing the target color repeatedly, redundancy in the preset table can be further reduced.

[0096] Understandably, the preset table is a reusable data area, and therefore stores historical target colors. Before writing the target color carried in the current rendering preparation command, the target color stored in the preset table is retrieved. If a historical target color exists that is the same as the target color to be written, the current target color is not written, and the second identifier of that historical target color in the preset table is obtained as the second identifier of the target color to be written.

[0097] Optionally, the aforementioned similarities include the same target color format. For example, the same red color is represented as (255, 0, 0) in RGB integer format, (1.0, 0.0, 0.0) in RGB floating-point format, and #FF0000 in hexadecimal color code (HEX) format. That is, the same color has different representations in different formats. In this scheme, the target color to be written and the historical target color are considered to be the same color only if their storage formats are also the same. This ensures that the target color and the target texture maintain the same format, making it easier for the GPU hardware to read according to a unified format and facilitating the setting of texture boundary colors.

[0098] Reference Figure 3 This paper illustrates a color setting method in an embodiment of this application, applied to GPU hardware. The method includes:

[0099] Step 201: If the coverage area of ​​the target texture does not match the subject to be rendered, locate the sampling descriptor sent by the GPU user-mode driver.

[0100] Step 202: Query the preset table pointed to by the sampling descriptor according to the second identifier in the sampling descriptor, and obtain the target color corresponding to the second identifier in the preset table;

[0101] Step 203: Set the texture boundary color of the subject to be rendered according to the target color.

[0102] In this embodiment, during the rendering process of the subject to be rendered according to the rendering command of the user program, if the GPU hardware detects that the coverage area of ​​the target texture does not match the subject to be rendered (such as a 3D model), that is, the area of ​​the target texture is insufficient to cover the surface of the subject to be rendered, then the part that the target texture cannot cover is filled according to a pre-set target color. In other words, the texture boundary color of the subject to be rendered is set according to the target color.

[0103] Specifically, the sampling descriptor sent by the GPU user-mode driver is first located. The preset table is then queried based on the first identifier in the sampling descriptor. The target color corresponding to the second identifier in the preset table is then queried based on the second identifier in the sampling descriptor. The texture boundary color is then set according to the target color.

[0104] Understandably, storing the target color in a preset table reduces the limitations on target color storage compared to storing it in a sampling descriptor. This allows for the storage of more target colors in various formats with higher precision, improving the quality of the target colors acquired by the GPU hardware and ensuring rendering quality.

[0105] The preset table is located in memory and is used to store boundary colors whose color format exceeds the number of bits of the sampling descriptor.

[0106] In this embodiment, when the GPU hardware performs 3D rendering, if the target texture cannot completely cover the surface of the subject to be rendered, it searches for the target color stored in a preset table using a sampling descriptor sent by the GPU memory driver to achieve texture boundary color setting. Compared to directly searching for the target color from the sampling descriptor, the preset table supports storing multiple and high-precision color types, allowing the GPU hardware to obtain a wider range of target color storage formats and precision when setting texture boundary colors, thus optimizing texture boundary color settings and improving user experience.

[0107] In one optional embodiment of this application, before searching for the sampling descriptor sent by the GPU user-mode driver when the coverage of the target texture does not match the subject to be rendered, the method further includes:

[0108] S31, Obtain the address of the memory space of the preset table sent by the GPU user-mode driver;

[0109] S32, store the address of the memory space of the preset table into the address register; wherein, the address register is the target pointed to by the sampling descriptor;

[0110] S33, update the flag in the enable register to an enable flag, the enable flag being used to enable the GPU hardware to preferentially read the first field in the sampling descriptor.

[0111] In other words, before the GPU hardware renders the subject to be rendered based on the parameters in the sampling descriptor, it can pre-configure registers according to the memory address of the preset table sent by the GPU user-mode driver. This includes updating the address register based on the memory address of the preset table and updating the disabled flag of the enable register to the enabled flag. Updating the enable register allows the GPU hardware to update the way it reads the sampling descriptor, i.e., update the way it obtains the target color; updating the address register allows the GPU hardware to look up the preset table through the address register to obtain the target color.

[0112] The reading method for updating the sampling descriptor includes changing the method of continuously reading a specified number of bits (e.g., 32 bits) of register to obtain the complete target color to first reading the parameters in the first field and determining the subsequent execution steps based on the parameters in the first field.

[0113] Understandably, if the GPU hardware provides hardware commands that can directly set the border color table, steps S31-S33 above are executed directly by the GPU hardware. If the GPU hardware cannot provide hardware commands that can directly set the border color table, the above steps are executed by the GPU firmware to maintain the security of device data usage.

[0114] In this embodiment, when the GPU hardware receives the address of the memory space in the preset table, it updates the method for obtaining the target color and updates the address of the memory space in the address register, so that the target color can be obtained when setting the texture boundary color of the subject to be rendered. This completes the preparation work for querying the target color through the preset table, so that the GPU hardware can successfully query the preset table to obtain the target color when setting the texture boundary color, thereby improving the user experience.

[0115] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of this application.

[0116] In some examples, a GPU user-space driver is also provided, which includes:

[0117] The first module is used to set the first field of the sampling descriptor to a first identifier when a rendering preparation instruction is received. The first identifier is used to indicate that the boundary color is set using a preset table. The preset table is allocated in memory by the user-mode driver and is used to store boundary colors with color formats that exceed the number of bits of the sampling descriptor.

[0118] The second module is used to write a second identifier indicating the position of the target color format in the preset table into the second bit field of the sampling descriptor. The second identifier is obtained by the GPU hardware from the sampling descriptor and is used by the GPU hardware as an index to the target color format.

[0119] The GPU hardware sets the texture boundary color according to the target color corresponding to the target color format.

[0120] Specifically, the first module is used to set the sampling descriptor, including adjusting the first field of the sampling descriptor to implement the texture boundary color setting using the method in this embodiment, that is, using a preset table to set the boundary color; the second module is used to write a second identifier representing the position of the target color format in the preset table into the sampling descriptor based on the method of setting the boundary color using the preset table, so that the GPU hardware can index the target color format in the preset table through the second identifier, and obtain the specific target color through the target color format.

[0121] The second identifier is obtained from the preset table by the GPU user-space driver and written into the second bit field of the sampling descriptor. The GPU hardware retrieves this second identifier from the sampling descriptor and uses it as an index to look up the target color in the preset table. Furthermore, since the target color is stored in the preset table in the form of a target color format, in practical use, this manifests as looking up the target color format in the preset table based on the second identifier.

[0122] For example, the second identifier can be the order value of the target color stored in the preset table. Since the preset table only stores the target color, and the storage space used to store the target color has the same byte length, the position of the target color can be directly calculated by the order value of the target color being written and the byte length of the storage space in the preset table.

[0123] In other embodiments, a graphics processing unit is also provided, including:

[0124] The memory stores a preset table for storing boundary colors whose color format exceeds the number of bits of the sampling descriptor;

[0125] A boundary color register stores the address of the preset table in memory; and

[0126] The texture unit queries a preset table pointed to by the sampling descriptor based on the second identifier in the sampling descriptor, and obtains the target color corresponding to the second identifier in the preset table;

[0127] The target color is used to set the texture boundary color of the subject to be rendered.

[0128] A simplified modern GPU rendering pipeline is as follows:

[0129] Vertex shader stage: Processes the vertex positions of the 3D model.

[0130] Primitive assembly: Assemble vertices into triangles.

[0131] Rasterization: Converting triangles into pixel fragments (i.e., segments) on the screen.

[0132] Fragment shader stage: This is the stage where the final color of each fragment is calculated.

[0133] When the fragment shader code executes a texture sampling instruction such as texture(sampler, texCoord), the GPU's texture units begin to work.

[0134] The texture unit checks the texture coordinates texCoord. If the coordinates are within the range of [0.0, 1.0], it reads the color directly from the preset texture image. If the coordinates are outside the range (this is the boundary case), the texture unit determines its behavior based on the "addressing mode" (Border color type) set in the sampling descriptor. When the addressing mode is set to 01 (i.e., the first field is marked as 01), the texture unit retrieves the "texture boundary color" (i.e., the target color) from the preset table in video memory.

[0135] In other embodiments, an electronic system, such as a system-on-a-chip (SoC), is also provided, including:

[0136] The processor executes the user-mode driver and sets the first field of the sampling descriptor to the first identifier, which is used to indicate that the boundary color is set using a preset table (i.e., to implement texture boundary color setting).

[0137] Write a second identifier indicating the position of the target color in the preset table into the second bit field of the sampling descriptor; and

[0138] The graphics processing unit described above.

[0139] In such an electronic system, the CPU operates during the resource setup phase before rendering begins, including:

[0140] Resource allocation and management: User-mode drivers executing on the CPU request memory space for a preset table and define the format of its members. For example, a user driver allocates a region in video memory as a preset table and determines the data format of each color entry in the table (e.g., R32G32B32A32_FLOAT).

[0141] During initial configuration, the CPU sends commands to the GPU firmware through the GPU user-mode driver, informing the GPU of the address of the preset table in memory and requesting the GPU hardware to switch to the new boundary color resolution mode.

[0142] The data is filled by inserting the boundary color (for example, the target color required in this case) into the preset table. For complex boundary colors (such as R32G32B32A32_FLOAT), the CPU's user-space driver no longer directly writes the color to the sampling descriptor, but instead writes this high-precision color value to a certain position in the preset table; and

[0143] The configuration command allows the user-mode driver to fill in the sampling descriptor, configure the first field of the border color type to use the Bct ID lookup table, and fill in the ID of the color to be used (i.e. the target color) in the border color table into the Bct ID bit field.

[0144] The actions of the GPU (hardware + firmware) include:

[0145] The firmware configures the hardware. After receiving commands from the CPU, the GPU firmware configures the GPU hardware, including setting the border colortable address into the cb reg register (i.e., the address register); and

[0146] The process involves parsing descriptors, texture sampling, and rendering. It reads the sampling descriptor, parses the border color type and BctID, and if the border color type specifies the border color parsing mode, it determines and renders the border texture color by combining the table address (of the preset table) in the cb reg register and the Bct ID.

[0147] Reference Figure 4 The diagram illustrates a structural block diagram of a color setting device according to this application, applied to a GPU user-space driver. The color setting device may include:

[0148] The update module 301 is used to update the first field of the sampling descriptor to a first identifier when a rendering preparation instruction is received. The first identifier is used to point to a preset table located in memory. The preset table is used to store boundary colors whose color format exceeds the number of bits of the sampling descriptor.

[0149] The writing module 302 is used to write the target color carried in the rendering preparation instruction into the preset table;

[0150] Feedback module 303 is used to obtain the second identifier of the target color in the preset table;

[0151] The sending module 304 is used to write the second identifier of the target color in the preset table into the second bit field of the sampling descriptor, and send the sampling descriptor to the GPU hardware so that the GPU hardware can set the texture boundary color according to the sampling descriptor.

[0152] Optionally, before receiving the rendering preparation instruction, the apparatus further includes:

[0153] The application module is used to apply for memory space for the preset table;

[0154] The sending module is used to send the address of the memory space to the GPU hardware, so that the GPU hardware can store the address of the memory space of the preset table into the address register and update the identifier in the enable register to the enable identifier; wherein, the first identifier is used to point to the address register, and the enable identifier is used to enable the GPU hardware to read the first bit field in the sampling descriptor first.

[0155] Optionally, the rendering preparation instruction carries the format of the target texture; the writing module 202 specifically includes:

[0156] The format adjustment module is used to update the format of the target color according to the format of the target texture when it is detected that the format of the target color carried in the rendering preparation instruction is inconsistent with the format of the target texture.

[0157] The format writing module is used to write the target color into the preset table according to the updated target color format.

[0158] Optionally, the preset table includes multiple storage spaces with the same byte length, each storage space being used to store the target color in the order it was written; wherein, the byte length of the storage space is used in conjunction with the order value marked by the second identifier, so that the GPU hardware can obtain the target color through position calculation.

[0159] Optionally, the update module 301 specifically includes:

[0160] The acquisition module is used to acquire the target color carried in the rendering preparation instruction when a rendering preparation instruction is received.

[0161] The first update module is used to update the first field of the sampling descriptor to the identifier of the preset color when the target color is the same as any preset color.

[0162] The second update module is used to update the first field of the sampling descriptor to a first identifier when the target color is different from any preset color. The first identifier is used to point to a preset table.

[0163] This application provides a color setting device and proposes a preset table concept. The preset table is located outside the sampling descriptor and stores target colors used to set texture boundary colors. Specifically, upon receiving a rendering preparation command, the first field of the sampling descriptor is set to a first identifier, which points to the preset table; and the target color carried in the rendering preparation command is written into the preset table. By obtaining the second identifier of the target color in the preset table, the second identifier is stored in the second bit field of the sampling descriptor; when the GPU hardware performs texture boundary color setting, it can look up the target color in the preset table through the second identifier to complete the texture boundary color setting. In the color setting method proposed in this application, the target color is stored in a preset table outside the sampling descriptor. The preset table has a large storage space, supporting the storage of various color formats and high-precision colors that have high storage space requirements. Compared with using a limited preset area in the sampling descriptor to store the target color, it reduces the limitation on the target color storage space, expands the format and precision of target color storage, improves the setting of texture boundary colors, and enhances the user experience.

[0164] Reference Figure 5 This diagram illustrates a structural block diagram of a color setting device according to this application, applied to GPU hardware. The color setting device includes:

[0165] The lookup module 401 is used to look up the sampling descriptor sent by the GPU user-mode driver when the area of ​​the target texture does not match the subject to be rendered.

[0166] The acquisition module 402 is used to query the preset table pointed to by the sampling descriptor according to the second identifier in the sampling descriptor, and obtain the target color corresponding to the second identifier in the preset table; wherein, the preset table is located in memory, and the preset table is used to store boundary colors whose color format exceeds the number of bits of the sampling descriptor;

[0167] Setting module 403 is used to set the texture boundary color of the subject to be rendered according to the target color.

[0168] Optionally, before the search module 401, the device further includes;

[0169] The address acquisition module is used to acquire the address of the memory space of the preset table sent by the GPU user-mode driver;

[0170] The address storage module is used to store the address of the memory space of the preset table into the address register; wherein, the address register is the target pointed to by the sampling descriptor;

[0171] An enable update module is used to update the flag in the enable register to an enable flag, which is used to enable the GPU hardware to preferentially read the first field in the sampling descriptor.

[0172] In this embodiment, when the GPU hardware performs 3D rendering, if the target texture cannot completely cover the surface of the subject to be rendered, it searches for the target color stored in a preset table using a sampling descriptor sent by the GPU memory driver to achieve texture boundary color setting. Compared to directly searching for the target color from the sampling descriptor, the preset table supports storing multiple and high-precision color types, allowing the GPU hardware to obtain a wider range of target color storage formats and precision when setting texture boundary colors, thus optimizing texture boundary color settings and improving user experience.

[0173] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0174] Reference Figure 6 This is a schematic diagram of the structure of the electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device includes: a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface communicate with each other through the communication bus. The memory is used to store at least one executable instruction, which causes the processor to perform the steps of the color setting method of the aforementioned embodiment.

[0175] This application provides a non-transitory computer-readable storage medium that, when the instructions in the storage medium are executed by a terminal's program or processor, enables the terminal to perform the steps of the color setting method described in the foregoing embodiments.

[0176] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0177] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, electronic devices, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

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

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

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

[0181] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0182] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A color setting method characterized by, The method is applied to a GPU user mode driver, and the method comprises the following steps: In the case of receiving a rendering preparation instruction, a first bit field of a sampling descriptor is set to a first identifier, the first identifier is used to point to a preset table in a memory, and the preset table is used to store a boundary color of a color format exceeding a bit number of the sampling descriptor; A target color carried in the rendering preparation instruction is written into the preset table; A second identifier of the target color in the preset table is obtained; The second identifier of the target color in the preset table is written into a second bit field of the sampling descriptor, and the sampling descriptor is sent to GPU hardware, so that the GPU hardware implements texture boundary color setting according to the sampling descriptor.

2. The color setting method according to claim 1, wherein, Before the rendering preparation instruction is received, the method further comprises the following steps: A memory space of the preset table is applied for; An address of the memory space is sent to the GPU hardware, so that the GPU hardware stores the address of the memory space of the preset table into an address register, and an identifier in an enable register is updated to an open identifier; wherein the first identifier is used to point to the address register, and the open identifier is used to make the GPU hardware preferentially read the first bit field in the sampling descriptor.

3. The color setting method according to claim 1, wherein The rendering preparation instruction carries a format of a target texture; and the target color carried in the rendering preparation instruction is written into the preset table, which comprises the following steps: In the case that a format of the target color carried in the rendering preparation instruction is inconsistent with the format of the target texture, the format of the target color is updated according to the format of the target texture; The target color is written into the preset table according to the updated format of the target color.

4. The color setting method of claim 1, wherein The preset table comprises a plurality of occupied storage spaces with the same byte length, and each storage space is used to store the target color in a writing order respectively; The byte length of the storage space is used to combine a sequence value marked by the second identifier, so that the GPU hardware obtains the target color through position calculation.

5. The color setting method of claim 1, wherein In the case of receiving a rendering preparation instruction, the first bit field of the sampling descriptor is updated to the first identifier, and the first identifier is used to point to the preset table, which comprises the following steps: In the case of receiving a rendering preparation instruction, a target color carried in the rendering preparation instruction is obtained; In the case that the target color is the same as any preset color, the first bit field of the sampling descriptor is updated to an identifier of the preset color; In the case that the target color is different from any preset color, the first bit field of the sampling descriptor is updated to the first identifier, and the first identifier is used to point to the preset table.

6. A color setting method characterized by, The method is applied to GPU hardware, and the method comprises the following steps: In a case where it is identified that the coverage of the target texture does not match the to-be-rendered subject, a sampling descriptor sent by a GPU user mode driver is searched; wherein the sampling descriptor is set by the GPU user mode driver to a first identification in a first bit field of the sampling descriptor in a case where a rendering preparation instruction is received, the first identification is used to point to a preset table in a memory, and the preset table is used to store a boundary color of a color format exceeding a bit number of the sampling descriptor; a target color carried in the rendering preparation instruction is written into the preset table; a second identification of the target color in the preset table is obtained; and the second identification of the target color in the preset table is written into a second bit field of the sampling descriptor to obtain a result; A target color corresponding to the second identification in the preset table pointed to by the sampling descriptor is obtained according to the second identification in the sampling descriptor; The target color is used to implement texture boundary color setting of the to-be-rendered subject.

7. The color setting method according to claim 6, wherein Before the case where it is identified that the coverage of the target texture does not match the to-be-rendered subject, the method further comprises: An address of a memory space of the preset table sent by the GPU user mode driver is obtained; The address of the memory space of the preset table is stored in an address register; wherein the address register is a target pointed to by the sampling descriptor; An identification in an enable register is updated to an open identification, and the open identification is used to enable the GPU hardware to preferentially read the first bit field in the sampling descriptor.

8. A GPU user mode driver apparatus, comprising: The GPU user mode driver device is used to implement the color setting method in any one of claims 1-5, and the GPU user mode driver device comprises: A first module is configured to set a first bit field of a sampling descriptor to a first identification in a case where a rendering preparation instruction is received, and the first identification is used to indicate that a preset table is used to set a boundary color; the preset table is applied in a memory by a user mode driver, and is used to store a boundary color of a color format exceeding a bit number of the sampling descriptor; A second module is configured to write a second identification indicating a position of a target color format in the preset table into a second bit field of the sampling descriptor, the second identification is obtained from the sampling descriptor by GPU hardware, and is used by the GPU hardware as an index of the target color format.

9. A graphics processing unit, the graphics processing unit is used to implement the color setting method in any one of claims 6-7, and comprises: A boundary color register is configured to store an address of a preset table in a memory, and the preset table is used to store a boundary color of a color format exceeding a bit number of a sampling descriptor; and A texture unit is configured to obtain a target color corresponding to a second identification in a preset table pointed to by a sampling descriptor according to the second identification in the sampling descriptor; and the target color is used to implement texture boundary color setting of a to-be-rendered subject.

10. A system on chip, comprising: A processor is configured to execute a user mode driver, set a first bit field of a sampling descriptor to a first identification, and the first identification is used to indicate that a preset table is used to set a boundary color. ​ writing a second identification indicative of a location of a target color format in the preset table into a second bit field of the sample descriptor; and the graphics processing unit of claim 9.

Citation Information

Patent Citations

  • Pixel rendering method and device, equipment and storage medium

    CN113205580A

  • Texel extraction method and device, electronic equipment and storage medium

    CN117746059A