Method and apparatus for performing shader operations
By receiving and preloading the texture area sampling frequency data in the processing device, the processing burden caused by the improvement of texture rendering quality on older hardware is solved, and the rendering efficiency is improved.
Patent Information
- Application Number
- CN202510140239.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-02-15
- Filing Date
- 2025-02-08
- Publication Date
- 2025-08-15
AI Technical Summary
The prior art has difficulty meeting the need for improving rendering quality on processing devices, especially the increased processing burden and waiting time caused by using higher quality textures on older hardware.
By receiving the texture area sampling frequency data of previous frames, the areas in the texture cache are preloaded, reducing the waiting time for the initial shader operation.
It effectively reduces the access waiting time of texture sampling and improves the rendering efficiency of processing equipment.
Smart Images

Figure CN120495501A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to methods and apparatus for performing shader operations. Background Art
[0002] The "background" description provided herein is for the purpose of generally presenting the context of the present disclosure. The work of the presently named inventors, to the extent it is described in this background section, and insofar as it may not have qualified as prior art at the time of filing, is neither explicitly nor implicitly admitted to be prior art against the present invention.
[0003] As processing speeds and display technology improve, user expectations for rendering quality also increase. This can place a significant burden on content rendering devices (such as game consoles or computers) because, despite advances in processing speeds, these increased expectations can be difficult to meet. For example, more detailed textures can be used to provide a higher quality appearance, but these textures can be associated with increased storage requirements and access time. When scaling up on multiple textures used in certain content (such as video games), this can result in a significant additional burden on the processing device.
[0004] Such problems may be more pronounced in situations where the user is using older hardware, as content is typically designed for more recent content to take advantage of the additional processing power. Therefore, opportunities to improve efficiency in the use of processing resources are considered desirable.
[0005] Therefore, it is considered advantageous to alleviate this additional burden in order to enable higher quality content to be provided utilizing available processing hardware.
[0006] It is against this background that the present disclosure arises. Summary of the Invention
[0007] In a first aspect, a method for performing a shader operation is provided. The method comprises the steps of: receiving data representing sampling frequencies of a plurality of regions of a texture during a fragment shader operation for at least one previous frame; preloading one or more of the regions of the texture into a texture cache based on the received data before performing an initial fragment shader operation for the current frame; and using at least one of the preloaded one or more regions of the texture during the initial fragment shader operation for the current frame.
[0008] In another aspect, a processing device is provided, comprising: receiving circuitry configured to receive data representing sampling frequencies of a plurality of regions of a texture during a fragment shader operation for at least one previous frame; preloading circuitry configured to preload one or more of the regions of the texture into a texture cache based on the received data before performing an initial fragment shader operation for the current frame; and shader circuitry configured to use at least one of the preloaded one or more regions of the texture during the initial fragment shader operation for the current frame.
[0009] In another aspect, a non-transitory machine-readable storage medium is provided. The non-transitory machine-readable storage medium stores computer software that, when executed by a computer, causes the computer to perform a method for performing a shader operation for a current frame, the method comprising the steps of: receiving data representing sampling frequencies of a plurality of regions of a texture during a fragment shader operation for at least one previous frame; preloading one or more of the regions of the texture into a texture cache based on the received data before performing an initial fragment shader operation for the current frame; and using at least one of the preloaded one or more regions of the texture during the initial fragment shader operation for the current frame.
[0010] Other corresponding aspects and features of the invention are defined in the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Embodiments of the present invention will now be described by way of example with reference to the accompanying drawings, in which:
[0012] - Figure 1 An example entertainment system is schematically illustrated;
[0013] - Figure 2 Schematically illustrates an example method; and
[0014] - Figure 3 An example processing device is schematically illustrated. DETAILED DESCRIPTION
[0015] In the following description, many specific details are presented in order to provide a thorough understanding of the embodiments of the present invention. However, it will be apparent to those skilled in the art that these specific details are not required to practice the present invention. Instead, for the sake of clarity, specific details known to those skilled in the art have been omitted where appropriate.
[0016] Reference Figure 1 , an example of the entertainment system 10 is a computer or a console.
[0017] The entertainment system 10 includes a central processing unit or CPU 20. The entertainment system also includes a graphics processing unit or GPU 30 and RAM 40. Two or more of the CPU, GPU, and RAM may be integrated into a system on a chip (SoC).
[0018] Further storage may be provided by disk 50, either as an external or internal hard drive, or as an external solid state drive, or as an internal solid state drive.
[0019] The entertainment device can optionally be connected to one or more data ports 60 (such as USB ports, port, port, It can also optionally receive data via an optical drive 70.
[0020] Audio / visual output from the entertainment device is typically provided through one or more A / V ports 90 or one or more of the data ports 60 .
[0021] Where components are not integrated, they may be connected by dedicated data links or via bus 100 as appropriate.
[0022] An example of a device for displaying images output by the entertainment system is a head mounted display “HMD” 120 worn by the user 1 .
[0023] Interaction with the system is typically provided using one or more handheld controllers 130 and / or in the case of an HMD, one or more VR controllers (130A-L, R).
[0024] A graphics processing unit (GPU), such as GPU 30, may include RAM, such as RAM 40. In the case of a GPU, RAM is sometimes referred to as video RAM or VRAM. The GPU uses VRAM to store data, including image data and texture data, to be used when rendering and displaying images.
[0025] As processing speeds and display technologies improve, user expectations for rendering capabilities also increase. At the same time, as rendering capabilities increase, some hardware requirements may not be able to keep up with the increased capabilities, which may lead to a bottleneck in rendering capabilities.
[0026] GPUs require high bandwidth and low latency to perform optimally. Therefore, GPUs may include a specialized cache known to those skilled in the art as a texture cache. A texture cache is used to buffer textures or texture data to reduce access latency for texture samples when executing shader operations.
[0027] When a region of a texture is sampled during a shader operation, regions of the texture that are spatially proximate to the accessed region are likely to be sampled in subsequent shader operations. Thus, when the texture is first sampled, the sampled region of the texture and regions of the texture that are spatially proximate to the sampled region are loaded into the texture cache for use in the shader operation. Therefore, since the spatially proximate regions are regions of the texture that are likely to be sampled when future shader operations are executed, access latency for texture sampling can be advantageously reduced when executing those future shader operations because these regions of the texture that are likely to be sampled have already been loaded into the texture cache.
[0028] However, when a region of a texture needs to be sampled for the initial fragment shader operation of a given frame, the region of the texture to be sampled will not be in the texture cache because no other spatially close regions of the texture will be sampled for the given frame. This is because the texture buffer memory will not contain any entries for the given frame until after the first request to sample the texture. Therefore, the initial shader operation for a given frame will have the highest latency of any shader operation executed for any given frame.
[0029] As mentioned above, GPUs require high bandwidth and low latency to perform optimally. Therefore, it is desirable to reduce the latency of the initial shader operation for a given frame.
[0030] Therefore, now turn to Figure 2 , a method 200 for performing shader operations on a current frame according to an embodiment of the present disclosure is provided.
[0031] The method 200 comprises the step of receiving 210 data representing sampling frequencies of a plurality of regions of a texture during fragment shader operations of at least one previous frame.
[0032] A region of a texture may be an individual pixel of the texture. However, it should be understood that a region may also be a group of pixels (or texels) of the texture. For example, a region may be a 2×2, 2×4, 4×2, 3×3, 100×300, or any other rectangular sized pixel. Additionally, a region is not limited to a rectangular shape. For example, in some cases, a region may be a group of pixels that fit within a circle of a given radius centered on a particular pixel. It should be understood that any other size and / or shape may be appropriately selected as the size and / or shape of a region.
[0033] The sampling frequency of a corresponding region of a texture is the number of times the corresponding region of the texture is sampled during a fragment shader operation for a corresponding frame. For example, if a region of a texture is sampled 100 times during a fragment shader operation for a given frame, then the region will have a sampling frequency of 100 for the given frame.
[0034] Data representing the sampling frequency may, for example, be stored in a specific buffer for use with method 200; otherwise, the data may be stored in association with the texture (e.g., as metadata), which may optionally be loaded into a specific buffer when the texture is first loaded. In some cases, the act of storing the data in the buffer may be considered a step of receiving 210. Alternatively or additionally, accessing or reading the data in the buffer may be considered a step of receiving 210.
[0035] It will be appreciated that the data representative of sampling frequency may be a heat map of sampling frequencies of a plurality of regions of the texture during fragment shader operation for at least one previous frame.
[0036] Alternatively, the at least one previous frame may be composed of a frame immediately before the current frame (ie, an immediately preceding frame). The immediately previous frame is a frame that has been rendered when the rendering operation of the current frame starts.
[0037] Alternatively, the at least one previous frame (for which the data representing the sampling frequencies of the plurality of regions of the texture during the fragment shader operation) may include a plurality of previous frames (which may or may not include the immediately previous frame). The number of previous frames included in the plurality of frames may be predetermined by a developer, for example. Although in some cases, the number of previous frames for which the data representing the sampling frequencies is used for the initial shading operation of the current frame may be dynamically set. For example, the data representing the sampling frequencies of a given previous frame may be used / retained until a cache hit rate for the data representing the sampling frequencies of the given previous frame falls below a predetermined threshold.
[0038] It should also be understood that, where the at least one previous frame includes multiple previous frames, corresponding frames in those previous frames may optionally not be temporally adjacent to other corresponding frames in those previous frames. As an example, when rendering frames for display on an HMD, frames for display on the left and right display panels of the HMD may be rendered in an alternating manner (e.g., first left frame, first right frame, second left frame, second right frame, etc.).
[0039] In this case, the plurality of previous frames may include only every other previous frame, since the left-HMD frame and the right-HMD frame may be rendered from different camera perspectives. Consequently, there may be reduced correlation between temporally adjacent left-HMD frames and right-HMD frames compared to temporally adjacent frames of the same perspective (i.e., only the left frame or only the right frame). It should be understood, however, that in this context, the term "same perspective" is used merely to highlight the difference between the left-eye / right-eye perspectives, since the viewpoint (and perspective) may change slightly between temporally adjacent left frames (or between temporally adjacent right frames), for example, in response to the user of the HMD moving their head or otherwise controlling the virtual viewpoint.
[0040] It should also be understood that in some cases, the at least one previous frame may consist of a frame immediately preceding the immediately previous frame. For example, in the case of performing the left / right HMD rendering described above but using only data representing the sampling frequency of a single previous frame, it may be advantageous to use the most recently rendered frame from the same camera perspective (i.e., if the current frame is a left (right) frame, then use the most recent left (right) frame).
[0041] Optionally, two or more data sets representing sampling frequencies may be stored in a specific buffer for use with method 200. This may be advantageous in situations where, for example, at least one previous frame does not include the immediately previous frame. For example, referring to the HMD example described above, a first data set may store data representing the sampling frequency for left frames, and a second data set may store data representing the sampling frequency for right frames. In this example, the step of receiving 210 may include receiving the first data set if the current frame is a left frame, and receiving the second data set if the current frame is a right frame. It should be understood that it is not necessary to determine whether a frame is a left frame or a right frame in order to receive the appropriate data set, as the data set to be received may simply alternate between the first data set and the second data set each time a new frame is to be rendered.
[0042] The method 200 further includes the step of preloading 220 one or more of the regions of the texture into a texture cache based on the received data before performing an initial fragment shader operation on the current frame.
[0043] In some cases, the initial fragment shader operation for the current frame may include, or may be, the first fragment shader operation performed by the corresponding texture unit for the current frame.
[0044] The inventors of the presently disclosed technology have recognized that a region of a texture that is sampled more than other regions of the texture during fragment shader operations for a given frame is a region of the texture that is more likely to be sampled during fragment shader operations for at least one frame after the given frame.
[0045] Additionally, if the preloaded regions of the texture are not used for executing the initial fragment shader operation for the current frame, the preloaded data in the cache can simply be overwritten, so there is no negative performance difference compared to not performing preloading. However, when at least one of the regions is used for one of the initial fragment shader operations, the access latency for the initial fragment shader operation for the current frame can be advantageously reduced.
[0046] Thus, because the preloaded areas of the texture are areas of the texture that are more likely to be sampled during the initial shader operation of the current frame, the access latency for the initial fragment shader operation for any given frame may be reduced.
[0047] The method 200 further comprises the step of using 230 at least one of the preloaded one or more regions of the texture during an initial fragment shader operation for the current frame.
[0048] For example, the step of using 230 may include sampling at least a portion of at least one of the preloaded one or more regions during an initial fragment shader operation for the current frame.
[0049] In some embodiments of the present disclosure, the one or more preloaded regions of the texture may be one or more regions of the texture having a sampling frequency higher than a threshold sampling frequency. In these embodiments, the step of preloading 220 may include preloading 220 the one or more regions of the texture having a sampling frequency higher than the threshold sampling frequency into the texture cache before performing an initial fragment shader operation on the current frame.
[0050] Optionally, in these embodiments of the present disclosure, the threshold sampling frequency can be set at a predetermined level. For example, the predetermined level of the threshold sampling frequency can be set by a software developer via appropriate software instructions or by a designer of the rendering hardware (e.g., a designer of a GPU).
[0051] Alternatively, in the embodiments of the present disclosure, the level of the threshold sampling frequency may be set according to whether the number of regions of texture having a sampling frequency higher than the threshold sampling frequency to be set is equal to or lower than a predetermined number of regions.
[0052] Therefore, in these embodiments, the level at which the threshold is set is variable so that the number of regions whose sampling frequency will be higher than the threshold (ie, the number of regions to be preloaded) is equal to or lower than a predetermined number of regions.
[0053] Therefore, in some embodiments of the present disclosure, method 200 further includes an optional (eg Figure 2 ) step of setting 212 the level of the threshold sampling frequency according to the number of regions of the texture having a sampling frequency higher than the threshold sampling frequency to be set being equal to or lower than a predetermined number of regions of the texture.
[0054] Of course, it should be understood that the threshold sampling frequency is not necessary for the presently disclosed technology. For example, in some embodiments of the present disclosure, the method may optionally (e.g., Figure 2 ) includes the following steps: sorting multiple regions of the texture according to the sampling frequency of the multiple regions 214.
[0055] For example, a region having a higher sampling frequency (indicated by the data received in step 210) may be ranked higher than a region of the texture having a lower sampling frequency. It will be appreciated that a higher sampling frequency for a given region of the texture indicates that the given region of the texture is sampled more frequently during fragment shader operation for a given frame than another region having a lower sampling frequency.
[0056] In these embodiments, the method may further include selecting 216 a predetermined number of regions of the plurality of regions as one or more regions of the texture for preloading 220 based on the ranking of the plurality of regions of the texture.
[0057] For example, if the predetermined number of regions is five regions, the five highest ranked regions may be selected as the one or more regions to be preloaded in the preloading step 220 .
[0058] Alternatively, in embodiments of the present disclosure that feature a predetermined number of regions for a texture (i.e., embodiments that feature the step of setting 212 or embodiments that feature the steps of sorting 214 and selecting 216), the predetermined number of regions can be determined based on the size of the texture cache. For example, when the texture cache is large, the predetermined number of regions can be higher, while when the texture cache is small, the predetermined number of regions can be lower. Thus, the predetermined number of regions can be set by the designer of the rendering hardware.
[0059] In some cases, texture units (which may perform fragment shader operations) may not know when the fragment shader operation for a given frame ends or when the fragment shader operation for a subsequent frame begins. Additionally, due to the parallelization of fragment shader operations, some texture units may be performing the final fragment shader operation for one frame while other texture units may be performing the initial fragment shader operation for a subsequent frame.
[0060] Therefore, in these cases, it may be advantageous to provide a signal indicating the end of the fragment shader operation for the immediately previous frame.Thus, in some embodiments of the present disclosure, the method 200 may include the step of receiving 218 a signal indicating the end of the fragment shader operation for the immediately previous frame.
[0061] For example, the signal can be provided via a command buffer that buffers commands for corresponding fragment shader operations. The command buffer can be, for example, a FIFO (first in, first out) buffer. In this case, the signal can be inserted as a command into the command buffer after the final fragment shader operation command for a given frame. Thus, after the final fragment shader operation command in the command buffer is issued, a signal can be provided to indicate that preloading of an area of the texture for the next frame to be rendered should be started. Thus, the signal can be provided (and preloading started) before the final fragment shader operation for the previous frame has ended (but after those shader operations have been started).
[0062] In these embodiments of the present disclosure, the step of preloading 220 may be performed in response to receiving a signal.
[0063] Method 200 may optionally include steps that may help reduce access latency when executing shader operations on at least one subsequent frame.
[0064] For example, in some embodiments of the present disclosure, the method may optionally (e.g. Figure 2 ) includes the following steps: providing 240 a signal for performing a shader operation on an immediately subsequent frame. The signal may indicate the end of the fragment shading operation for the current frame, as discussed elsewhere herein.
[0065] Alternatively or additionally, in some embodiments of the present disclosure, the method may optionally include the step of recording 250 data representing sampling frequencies of a plurality of regions of the texture during fragment shader operations of the current frame.
[0066] For example, the corresponding region may be associated with a corresponding value for recording data representing a sampling frequency for the given region. In this example, when a given region of the texture is accessed (or sampled) when a fragment shader operation is executed for a given frame, the value corresponding to the given region may be incremented to record data representing the sampling frequency for the given region.
[0067] In these embodiments, the method may include providing 260 the recorded data for use in performing shader operations on at least one subsequent frame. The shader operations for the at least one subsequent frame may then be performed according to method 200 (although the frame immediately subsequent to the current frame (i.e., the immediately subsequent frame) will then become the new current frame).
[0068] Alternatively, the at least one subsequent frame may consist of an immediately subsequent frame. Alternatively, the at least one subsequent frame may include a plurality of subsequent frames (which may or may not include an immediately subsequent frame). For example, the number of subsequent frames included in the plurality of frames may be predetermined by the developer. Although in some cases, the number of subsequent frames using recorded data from a given frame may be dynamically set. For example, it may be used for all subsequent frames until the cache hit rate of the recorded data falls below a predetermined threshold.
[0069] It should also be understood that, where at least one subsequent frame includes a plurality of subsequent frames, corresponding subsequent frames in those subsequent frames may not be temporally adjacent to other corresponding subsequent frames in those subsequent frames. As an example, when rendering frames for display at an HMD, frames for display at the left and right display panels of the HMD may be rendered in an alternating manner (i.e., first left frame, first right frame, second left frame, second right frame, etc.). In this case, the plurality of subsequent frames may only include every other subsequent frame, since the left and right HMD frames may be rendered from different camera perspectives, as explained elsewhere herein.
[0070] Alternatively, in these embodiments, the step of providing 260 may include the step of storing the recorded data in a dedicated buffer. For example, the recorded data may be stored in a random access buffer, where respective portions of the buffer correspond to respective regions of the texture. In this case, when a given region of the texture is accessed (or sampled) while executing a fragment shader operation for a given frame, the portion of the buffer corresponding to the given region may be incremented.
[0071] In these cases, when performing shader operations according to method 200 on a subsequent frame (even though the subsequent frame will now be the current frame), the step of receiving 210 may include reading the data recorded in the dedicated buffer.
[0072] Optionally, after the recorded data has been read from the dedicated buffer, the dedicated buffer may be cleared for recording 250 data representing the sampling frequency of the plurality of regions of the texture during fragment shader operations for the subsequent frame (which, as described above, is now the current frame).
[0073] However, in some cases, the recorded data may be retained for use with multiple subsequent frames. In these cases, a dedicated buffer may record the data for multiple previous frames as a rolling average.
[0074] Alternatively, a relative weight may be applied to the recorded data for each respective subsequent frame based on the number of frames that have been rendered since the recorded data for the respective subsequent frame was recorded. For example, the immediately preceding frame may be given a weight of 1, the frame immediately before the immediately preceding frame may be given a weight of 0.5, and the frame immediately before that frame may be given a weight of 0.25, etc. The sampling frequency in the recorded data for a given frame may be multiplied by its relative weight before being summed with the corresponding sampling frequencies of the other frames in the recorded data (also multiplied by their respective weights).
[0075] The above example illustrates an example where the weight decays exponentially by halving the weighted sampling frequency of the given frame for each additional frame between the time the given frame was rendered and the current frame. It will be appreciated that any other exponential decay may be used to apply a relative weight to the recorded data of each corresponding subsequent frame based on the number of frames that have been rendered since the corresponding recorded data was recorded. It will also be appreciated that any other decay (such as a linear or polynomial decay) may also be used.
[0076] However, it should be noted that using exponential decay for relative weighting can be particularly advantageous because it can simplify the data acquisition of the receiving step 210. In particular, the weighted sampling frequency for a given region can be stored as a single value for all previous frames for which data was stored (i.e., the sum of the corresponding weighted sampling frequencies). When a frame finishes rendering, this single stored value for the given frame can be halved (where the weight decays exponentially by halving the weighted sampling frequency for the given frame for each additional frame between the time the given frame was rendered and the current frame), and the sampling frequency for the given region of the frame that just finished rendering can be added to this now halved value to generate a new weighted sampling frequency for the given region for use in shader operations of frames rendered after the frame that just finished rendering.
[0077] Now go to Figure 3 In an embodiment of the present disclosure, a processing device 300 for performing a shader operation on a current frame is provided. The processing device 300 includes: a receiving circuit 310 configured to receive data representing sampling frequencies of a plurality of regions of a texture during a fragment shader operation for at least one previous frame; a preloading circuit 320 configured to: preload one or more of the regions of the texture into a texture cache based on the received data before performing an initial fragment shader operation on the current frame; and a shader circuit 330 configured to use at least one of the preloaded one or more regions of the texture during the initial fragment shader operation for the current frame.
[0078] Optionally (e.g. Figure 3In some embodiments of the present disclosure, the processing device 300 may include a buffer circuit 340 configured to record data representing sampling frequencies of multiple regions of a texture during fragment shader operations for a current frame.
[0079] Modifications to the processing device 300 corresponding to the modifications described elsewhere herein will be apparent to the skilled person. Additionally, modifications involving parallelizing the processing on a GPU or equivalent processor with parallel processing capabilities allow the use of preloaded regions of textures during initial fragment shader operations to proceed in parallel to speed up the overall generation of the image.
[0080] It will be appreciated that the above methods may be performed on conventional hardware suitably adapted for use by means of software instructions or by including or replacing dedicated hardware.
[0081] Thus, the desired adaptation of existing parts of conventional equivalent devices can be implemented in the form of a computer program product comprising processor-implementable instructions stored on a non-transitory machine-readable medium (such as a floppy disk, optical disk, hard disk, solid-state disk, PROM, RAM, flash memory, or any combination of these or other storage media), or implemented in hardware as an ASIC (Application Specific Integrated Circuit) or FPGA (Field Programmable Gate Array) or other configurable circuit suitable for adapting conventional equivalent devices. Separately, such a computer program can be sent via a data signal on a network such as Ethernet, a wireless network, the Internet, or any combination of these or other networks.
[0082] Thus, in the outlined embodiment of the present specification, the processing device 300 may be implemented on, for example, a server (not shown) or the entertainment device 10 .
[0083] Examples of the presently outlined embodiments that implement the methods and techniques described herein (eg, by using appropriate software instructions) are contemplated to be within the scope of this application.
[0084] The foregoing discussion discloses and describes only exemplary embodiments of the present invention. As will be appreciated by those skilled in the art, the present invention may be implemented in other specific forms without departing from the spirit or essential features of the present invention. Therefore, the disclosure of the present invention is intended to be illustrative, not limiting, of the scope of the present invention and other claims. The present disclosure (including any readily discernible variations taught herein) partially limits the scope of the aforementioned claim terms so that no inventive subject matter is dedicated to the public.
[0085] Embodiments of the present disclosure may be implemented according to any one or more of the following numbered clauses:
[0086] 1. A method for performing a shader operation on a current frame, the method comprising the following steps:
[0087] receiving data representing sampling frequencies of a plurality of regions of a texture during fragment shader operations for at least one previous frame;
[0088] prior to performing an initial fragment shader operation on the current frame, preloading one or more of the regions of the texture into a texture cache based on the received data; and
[0089] During the initial fragment shader operation for the current frame, at least one region of the preloaded one or more regions of the texture is used.
[0090] 2. The method of any preceding clause, wherein the initial fragment shader operation for the current frame comprises a first fragment shader operation performed by a corresponding texture unit on the current frame.
[0091] 3. A method according to any preceding clause, wherein the one or more preloaded regions of the texture are one or more regions of the texture having a sampling frequency above a threshold sampling frequency.
[0092] 4. The method of clause 3, wherein the threshold sampling frequency is set to a predetermined level.
[0093] 5. The method according to clause 3, comprising the step of setting the level of the threshold sampling frequency according to the number of areas of the texture having a sampling frequency higher than the threshold sampling frequency to be set being equal to or lower than a predetermined number of areas.
[0094] 6. The method according to any one of clauses 1 and 2, comprising the steps of:
[0095] sorting the regions of the texture according to the sampling frequencies of the regions; and
[0096] Based on the ranking of the plurality of regions of the texture, a predetermined number of regions among the plurality of regions are selected as the one or more regions of the texture for preloading.
[0097] 7. A method according to any of clauses 5 or 6, wherein the predetermined number of regions is based on the size of the texture cache.
[0098] 8. A method according to any preceding clause, comprising the step of receiving a signal indicating the end of fragment shader operations for an immediately previous frame, wherein the step of preloading is performed in response to receiving the signal.
[0099] 9. A method according to any preceding clause, comprising providing a signal for performing a shader operation on an immediately subsequent frame, the signal indicating the end of the fragment shading operation for the current frame.
[0100] 10. The method according to any of the preceding clauses, comprising the steps of:
[0101] recording data representing sampling frequencies of the plurality of regions of the texture during fragment shader operation for the current frame; and
[0102] The recorded data is provided for use in performing shader operations on at least one subsequent frame.
[0103] 11. The method of clause 10, wherein the step of providing comprises the step of storing the recorded data in a dedicated buffer.
[0104] 12. Computer software which, when executed by a computer, causes the computer to perform a method according to any of the preceding clauses.
[0105] 13. A non-transitory machine-readable storage medium storing computer software according to clause 12.
[0106] 14. A processing device for performing a shader operation on a current frame, the processing device comprising:
[0107] receiving circuitry configured to receive data representing sampling frequencies of a plurality of regions of a texture during fragment shader operations for at least one previous frame;
[0108] preloading circuitry configured to preload one or more of the regions of the texture into a texture cache based on the received data before performing an initial fragment shader operation on the current frame; and
[0109] A shader circuit is configured to use at least one of the preloaded one or more regions of the texture during the initial fragment shader operation for the current frame.
[0110] 15. The processing device of clause 14, comprising buffer circuitry configured to record data representing a sampling frequency of the plurality of regions of the texture during fragment shader operations for the current frame.
Claims
1. A method for performing a shader operation on a current frame, the method comprising the steps of: receiving data representing sampling frequencies of a plurality of regions of a texture during fragment shader operations for at least one previous frame; prior to performing an initial fragment shader operation on the current frame, preloading one or more of the regions of the texture into a texture cache based on the received data; as well as During the initial fragment shader operation for the current frame, at least one of the preloaded one or more regions of the texture is used.
2. The method according to claim 1, wherein The initial fragment shader operation for the current frame includes a first fragment shader operation performed by a corresponding texture unit on the current frame.
3. The method according to claim 1, wherein The one or more preloaded regions of the texture are one or more regions of the texture having a sampling frequency higher than a threshold sampling frequency.
4. The method according to claim 3, wherein: The threshold sampling frequency is set to a predetermined level.
5. The method according to claim 3, comprising the steps of: The level of the threshold sampling frequency is set according to whether the number of areas of the texture having a sampling frequency higher than the threshold sampling frequency to be set is equal to or lower than a predetermined number of areas.
6. The method according to claim 1, comprising the steps of: sorting the plurality of regions of the texture according to the sampling frequencies of the plurality of regions; as well as According to the ranking of the plurality of regions of the texture, a predetermined number of regions among the plurality of regions are selected as the one or more regions of the texture for preloading.
7. The method according to claim 5, wherein: The predetermined number of regions is based on a size of the texture cache.
8. The method according to claim 1, comprising the steps of: A signal is received indicating an end of fragment shader operation for an immediately previous frame, wherein the step of preloading is performed in response to receiving the signal.
9. The method according to claim 1, comprising the steps of: A signal is provided for performing a shader operation on an immediately subsequent frame, the signal indicating the end of the fragment shading operation for the current frame.
10. The method according to claim 1, comprising the steps of: recording data representing sampling frequencies of the plurality of regions of the texture during fragment shader operation for the current frame; as well as The recorded data is provided for use in performing shader operations on at least one subsequent frame.
11. The method according to claim 10, wherein: The step of providing includes the step of storing the recorded data into a dedicated buffer.
12. A non-transitory machine-readable storage medium storing computer software that, when executed by a computer, causes the computer to perform a method for performing shader operations on a current frame, the method comprising the steps of: receiving data representing sampling frequencies of a plurality of regions of a texture during fragment shader operations for at least one previous frame; prior to performing an initial fragment shader operation on the current frame, preloading one or more of the regions of the texture into a texture cache based on the received data; as well as During the initial fragment shader operation for the current frame, at least one region of the preloaded one or more regions of the texture is used.
13. A processing device for performing a shader operation on a current frame, the processing device comprising: receiving circuitry configured to receive data representing sampling frequencies of a plurality of regions of a texture during fragment shader operations for at least one previous frame; preloading circuitry configured to preload one or more of the regions of the texture into a texture cache based on the received data before performing an initial fragment shader operation on the current frame; as well as A shader circuit is configured to use at least one of the preloaded one or more regions of the texture during the initial fragment shader operation for the current frame.
14. The processing device of claim 13, comprising a buffer circuit configured to record data representing a sampling frequency of the plurality of regions of the texture during fragment shader operation for the current frame.