# Patent

## Title
Method and system for computing pixel parameters

## Abstract

A method and system for computing pixel parameters is disclosed. In one embodiment, the rasterizing of a geometric primitive comprising a plurality of vertices wherein each vertex comprises a respective color value, is performed by a rasterization module of a graphics pipeline. The rasterizing includes interpolating a respective color value for each pixel of the geometric primitive, wherein the respective color value is of a first bit width. The rasterizing also includes transforming the respective color value to a second bit width to produce a respective transformed color value for each pixel. Additionally, the rasterizing includes altering the respective transformed color value using a screen-location based dither table to produce a dithered transformed color value for each pixel. After the rasterizing, propagating the respective dithered transformed color value of each pixel to downstream modules of the graphics pipeline is performed.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
This application is related to, and incorporates by reference, the following commonly assigned U.S. Patent Applications:
A METHOD AND SYSTEM FOR IMPLEMENTING CLAMPED Z VALUE INTERPOLATION IN A RASTER STAGE OF A GRAPHICS PIPELINE, by Ed Hutchins, filed on May 14, 2004, Ser. No. 10/845,992, A METHOD AND SYSTEM FOR IMPLEMENTING PARAMETER CLAMPING TO A VALID RANGE IN A RASTER STAGE OF A GRAPHICS PIPELINE, by Ed Hutchins, filed on May 14, 2004, Ser. No. 10/845,987, A METHOD AND SYSTEM FOR IMPLEMENTING MULTIPLE HIGH PRECISION AND LOW PRECISION INTERPOLATORS FOR A GRAPHICS PIPELINE, by Ed Hutchins et al., filed on May 14, 2004, Ser. No. 10/845,640, and
METHOD AND SYSTEM FOR A GENERAL INSTRUCTION RASTER STAGE THAT GENERATES PROGRAMMABLE PIXEL PACKETS, by Ed Hutchins et al., filed on May 14, 2004, Ser. No. 10/845,642.
FIELD OF THE INVENTION
Embodiments of the present invention relate to 3-D graphics. More specifically, embodiments of the present invention relate to methods and systems for computing pixel parameters using dithering techniques.
BACKGROUND ART
The rendering of three-dimensional graphical images is of interest in a variety of electronic games and other applications. Rendering is the general term that describes the overall multi-step process of transitioning from a database representation of a three-dimensional object to a two-dimensional projection of the object onto a viewing surface.
The rendering process involves a number of steps, such as, for example, setting up a polygon model that contains the information which is subsequently required by shading/texturing processes, applying linear transformations to the polygon mesh model, culling back facing polygons, clipping the polygons against a view volume, scan converting/rasterizing the polygons to a pixel coordinate set, and shading/lighting the individual pixels using interpolated or incremental shading techniques.
Graphics Processing Units (GPUs) are specialized integrated circuit devices that are commonly used in graphics systems to accelerate the performance of a 3-D rendering application. GPUs are commonly used in conjunction with a central processing unit (CPU) to generate three-dimensional images for one or more applications executing on a computer system. Modern GPUs typically utilize a graphics pipeline for processing data.
Prior art FIG. 1 shows a diagram depicting the various stages of a traditional prior art pipeline 100. The pipeline 100 is a conventional “deep” pipeline having stages dedicated to performing specific functions. A transform stage 105 performs geometrical calculations of primitives and may perform a clipping operation. A setup/raster stage 110 rasterizes the primitives. A texture address 115 and texture fetch 120 stage are utilized for texture mapping. A fog stage 130 implements a fog algorithm. An alpha test stage 135 performs an alpha test. A depth test 140 performs a depth test for culling occluded pixels. An alpha blend stage 145 performs an alpha blend color combination algorithm. A memory write stage 150 writes the output of the pipeline.
The stages of the traditional GPU pipeline architecture illustrated in FIG. 1 are typically optimized for high-speed rendering operations (e.g., texturing, lighting, shading, etc.) using a widely implemented graphics programming API (application programming interface), such as, for example, the OpenGLTM graphics language, Direct3DTM, and the like. The architecture of the pipeline 100 is configured as a multi-stage deep pipeline architecture in order to maximize the overall rendering throughput of the pipeline. Generally, deep pipeline architectures have sufficient data throughput (e.g., pixel fill rate, etc.) to implement fast, high quality rendering of even complex scenes.
There is an increasing interest in utilizing three-dimensional graphics in portable handheld devices where cost and power consumption are important design requirements. Such devices include, for example, wireless phones, personal digital assistants (PDAs), and the like. However, the traditional deep pipeline architecture requires a significant chip area, resulting in greater cost than desired. Additionally, a deep pipeline consumes significant power, even if the stages are performing comparatively little processing. This is because many of the stages consume about the same amount of power regardless of whether they are processing pixels.
As a result of cost and power considerations, the conventional deep pipeline architecture illustrated in FIG. 1 is unsuitable for many graphics applications, such as implementing three-dimensional games on wireless phones and PDAs. Therefore, what is desired is a processor architecture suitable for graphics processing applications but with reduced power and size requirements.
Prior to the traditional start of the graphics architecture pipeline, e.g., the rasterizing module, the power draw and the number of gates utilized by the upcoming pipeline are not considered. With respect to handheld computing devices not considering the power and gates used will deleterious effect overall operation. Specifically, the power and gate usage factors will result in extremely poor operation of the handheld device and any graphics shown thereon. One of the major contributors to power draw and gate utilization is color in an environment. In some cases, the graphics architecture may utilize 8, 16, or even 32-bit color throughout the pipeline to produce the desired graphics. In a device with limited power, e.g., a handheld computing device, a pipeline filled with that many bits of color will require many clock cycles to process and resolve the color value.
SUMMARY OF THE INVENTION
The present invention provides, in various embodiments, a method and system reducing power consumption for graphics architecture on a handheld computing device. Furthermore, the present invention provides a method and system reducing power consumption for graphics architecture on a handheld computing device which maintains the quality of the graphics output on the handheld computing device. In addition, the present invention provides a method and system for reducing power consumption for graphics architecture on a handheld computing device which is power, gate, and cost efficient.
Embodiments of the present invention pertain to methods and systems for computing pixel parameters. In one embodiment, the rasterizing of a geometric primitive comprising a plurality of vertices wherein each vertex comprises a respective color value is performed by a rasterization module of a graphics pipeline. The rasterizing includes interpolating a respective color value for each pixel of the geometric primitive, wherein the respective color value is of a first bit width. The rasterizing also includes transforming the respective color value to a second, smaller bit width to produce a respective transformed color value for each pixel. Additionally, the rasterizing includes altering the respective transformed color value using a screen-location based dither table to produce a dithered transformed color value for each pixel. After the rasterizing, the system includes propagating the respective dithered transformed color value of each pixel to downstream modules of the graphics pipeline.
In another embodiment, an apparatus for reducing power consumption for graphics architecture on a handheld computing device is disclosed. First, a color value is received. Next, a rasterizing module of a graphics architecture truncates and dithers the color value to transform the value to a lower bit width value thereby reducing the number of gates and the power necessary to complete a pipeline of the graphics architecture on the handheld computing device.
In its various embodiments, the present invention can significantly reduce the bandwidth requirements of a graphics architecture on a handheld computing device. In addition, the present invention reduces the power consumption of the graphics architecture on a handheld computing device. The present invention further reduces the number of gates used or graphics architecture on a handheld computing device.



BRIEF DESCRIPTION OF THE DRAWINGS
The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements.
Prior art FIG. 1 shows a diagram depicting the various stages of a traditional prior art pipeline.
FIG. 2 shows a computer system in accordance with one embodiment of the present invention.
FIG. 3 shows a computer system in accordance with a second embodiment of the present invention.
FIG. 4 is a block diagram illustrating the components comprising a programmable graphics processor in accordance with one embodiment of the present invention.
FIG. 5 shows an exemplary diagram of a plurality of high precision and low precision interpolators as implemented within a raster stage in accordance with one embodiment of the present invention.
FIG. 6 shows an exemplary flow diagram depicting the process whereby graphics primitives are received from the set up stage and are converted into their constituent pixel packets by the raster stage in accordance with one embodiment of the present invention.
FIG. 7 is a data flow diagram showing the processing of a pixel packet in a pipeline in accordance with one embodiment of the present invention.
FIG. 8 is a block diagram of pixel data loaded into a register is shown in accordance with one embodiment of the present invention.
FIG. 9 shows a flowchart of the steps of the process in accordance with one embodiment of the present invention.
FIG. 10 illustrates a data flow diagram for reducing color value size in accordance with one embodiment of the present invention.
FIG. 11 is a block diagram of a color value reduction in accordance with one embodiment of the present invention.
FIG. 12 is a flowchart of an exemplary process for reducing power consumption for graphic architecture on a handheld computing device in accordance with one embodiment of the present invention.
FIG. 13 is a block diagram of a geometric primitive in accordance with an embodiment of the present invention.
FIG. 14 shows a diagram depicting a polygon and a bounding box as used in a clamped z value interpolation process in accordance with one embodiment of the present invention.
FIG. 15 shows a flowchart of the steps of a clamped z value interpolation process in accordance with one embodiment of the present invention.
FIG. 16 shows a diagram of an exemplary texture map (e.g. a “texture”) as used by embodiments of the present invention.
FIG. 17 shows a polygon having a wrapped version of a texture applied in accordance with one embodiment of the present invention.
FIG. 18 shows a polygon having a clamped version of the texture applied in accordance with one embodiment of the present invention.
FIG. 19 shows an exemplary flowchart of the steps of a texture coordinate parameter clamping process in accordance with one embodiment of the present invention.
FIG. 20 shows a diagram of an exemplary mip mapping process in accordance with one embodiment of the present invention.
FIG. 21 shows a flowchart of the steps of an LOD parameter clamping process 1000 in accordance with one embodiment of the present invention.



DETAILED DESCRIPTION OF THE INVENTION
Reference will now be made in detail to the preferred embodiments of the present invention, examples of which are illustrated in the accompanying drawings. While the invention will be described in conjunction with the preferred embodiments, it will be understood that they are not intended to limit the invention to these embodiments. On the contrary, the invention is intended to cover alternatives, modifications and equivalents, which may be included within the spirit and scope of the invention as defined by the appended claims. Furthermore, in the following detailed description of embodiments of the present invention, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be recognized by one of ordinary skill in the art that the present invention may be practiced without these specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail as not to unnecessarily obscure aspects of the embodiments of the present invention.
Notation and Nomenclature:
Some portions of the detailed descriptions, which follow, are presented in terms of procedures, steps, logic blocks, processing, and other symbolic representations of operations on data bits within a computer memory. These descriptions and representations are the means used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art. A procedure, computer executed step, logic block, process, etc., is here, and generally, conceived to be a self-consistent sequence of steps or instructions leading to a desired result. The steps are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, and otherwise manipulated in a computer system. It has proven convenient at times, principally for reasons of common usage, to refer to these signals as bits, values, elements, symbols, characters, terms, numbers, or the like.
It should be borne in mind, however, that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise as apparent from the following discussions, it is appreciated that throughout the present invention, discussions utilizing terms such as “processing” or “accessing” or “executing” or “storing” or “rendering” or the like, refer to the action and processes of a computer system (e.g., computer system 200 of FIG. 2), or similar electronic computing device, that manipulates and transforms data represented as physical (electronic) quantities within the computer system's registers and memories into other data similarly represented as physical quantities within the computer system memories or registers or other such information storage, transmission or display devices.
Computer System Platform:
With reference now to FIG. 2, a computer system 200 in accordance with one embodiment of the present invention is shown. Computer system 200 in accordance with one embodiment of the present invention provides the execution platform for implementing certain software-based functionality of the present invention. As depicted in FIG. 2, the computer system 200 includes a CPU 201 coupled to a graphics processor 205 via a host interface 202. The host interface 202 translates data and commands passing between the CPU 201 and the graphics processor 205 into their respective formats. Both the CPU 201 and the graphics processor 205 are coupled to a memory 221 via a memory controller 220. In the system 200 embodiment, the memory 221 is a shared memory, which refers to the property whereby the memory 221 stores instructions and data for both the CPU 201 and the graphics processor 205. Access to the shared memory 221 is through the memory controller 220. The shared memory 221 also stores data comprising a video frame buffer which drives a coupled display 225.
As described above, certain processes and steps of the present invention are realized, in one embodiment, as a series of instructions (e.g., software program) that reside within computer readable memory (e.g., memory 221) of a computer system (e.g., system 200) and are executed by the CPU 201 and graphics processor 205 of system 200. When executed, the instructions cause the computer system 200 to implement the functionality of the present invention as described below.
As shown in FIG. 2, system 200 shows the basic components of a computer system platform that implements the functionality of the present invention. Accordingly, system 200 can be implemented as, for example, a number of different types of portable handheld electronic devices. Such devices can include, for example, portable phones, PDAs, handheld gaming devices, and the like. In such embodiments, components would be included that are designed to add peripheral buses, specialized communications components, support for specialized 10 devices, and the like.
Additionally, it should be appreciated that although the components 201-225 are depicted in FIG. 2 as a discrete components, several of the components 201-225 can be implemented as a single monolithic integrated circuit device (e.g., a single integrated circuit die) configured to take advantage of the high levels of integration provided by modern semiconductor fabrication processes. For example, in one embodiment, the CPU 201, host interface 202, graphics processor 205, and memory controller 220 are fabricated as a single integrated circuit die.
FIG. 3 shows a computer system 300 in accordance with one alternative embodiment of the present invention. Computer system 300 is substantially similar to computer system 200 of FIG. 2. Computer system 300, however, utilizes the processor 201 having a dedicated system memory 321, and the graphics processor 205 having a dedicated graphics memory 322. In the system 300 embodiment, the system memory 321 stores instructions and data for processes/threads executing on the CPU 201 and the graphics memory 322 stores instructions and data for those processes/threads executing on the graphics processor 205. The graphics memory 322 stores data the video frame buffer which drives the display 225. As with computer system 200 of FIG. 2, one or more of the components 201-322 of computer system 300 can be integrated onto a single integrated circuit die.
FIG. 4 is a block diagram illustrating the components comprising an exemplary programmable graphics processor 205 in accordance with one embodiment of the present invention. As depicted in FIG. 4, the graphics processor 205 includes a setup stage 405, a raster stage 410, a gatekeeper stage 420, a data fetch stage 430, Arithmetic Logic Unit (ALU) pipeline 440, and a data write stage 455. In one embodiment, programmable graphics processor 205 includes ALUs 440 configured to execute a shader program to implement 3D graphics operations such as a texture combine, fog, alpha blend, alpha test, or other shading algorithms. However, it will be understood throughout the following discussion that programmable graphics processor 205 may also be configured to perform other types of processing operations.
A setup stage 405 receives instructions and graphics primitives from a host, such as a software application running on the CPU 201. In one embodiment, setup stage 405 performs the functions of geometrical transformation of coordinates (X-form), clipping, and setup. The setup unit takes vertex information (e.g., x, y, z, color and/or texture attributes, etc.) from primitives and applies a user defined view transform to calculate screen space coordinates for each geometric primitive (often referred to as triangles because primitives are typically implemented as triangles), which is then sent to the raster stage 410 to draw the given triangle. A vertex buffer 408 may be included to provide a buffer for vertex data used by setup stage 405. In one embodiment, setup stage 405 sets up barycentric coordinate transforms. In one implementation, setup stage 405 is a floating point Very Large Instruction Word (VLIW) machine that supports 32-bit IEEE fl, S15.16 fixed point and packed 0.8 formats.
Raster stage 410 receives data from setup stage 405 regarding triangles that are to be rendered (e.g., converted into pixels). Raster stage 410 processes parameters for each pixel of a given triangle by interpolation and determines shader attributes that need to be interpolated for a pixel as part of rendering, such as calculating color, texture, and fog blend factors. In one embodiment, raster stage 410 calculates barycentric coordinates for pixel packets. In a barycentric coordinate system, distances in a triangle are measured with respect to its vertices. The use of barycentric coordinates reduces the required dynamic range, which permits using fixed point calculations that require less power than floating point calculations.
Raster stage 410 generates at least one pixel packet for each pixel of a triangle that is to be processed. Each pixel packet includes fields for a payload of pixel attributes required for processing (e.g., color, texture, depth, fog, (x,y) location) along with sideband information, and an instruction sequence of operations to be performed on the pixel packet. An instruction area in raster stage 410 (not shown) assigns instruction sequence numbers to pixel packets. The sideband information may also include a valid field, and a kill field. The pixel packet may include one or more rows of pixel information.
Gatekeeper stage 420 performs a data flow control function to the downstream units. In one embodiment, gatekeeper stage 420 has an associated scoreboard 425 for scheduling, load balancing, resource allocation, and hazard avoidance of pixel packets. Scoreboard 425 tracks the entry and retirement of pixels. Pixel packets entering gatekeeper stage 420 set the scoreboard and the scoreboard is reset as the pixel packets drain (e.g., retire) out of graphics processor 205 after completion of processing, or marked as killed.
Data fetch stage 430 fetches data for pixel packets passed on by gatekeeper 420. This may include, for example, fetching color, depth, and texture data by performing appropriate color, depth, or texture data reads for each row of pixel packets. The data fetch stage 430 may, for example, fetch pixel data from a frame buffer (not shown), fetch texel data from a texture map, and may also manage a local texture/fog cache 432 and a color/depth cache 434. Data that is fetched is placed onto a pixel packet field prior to sending the pixel packet on to the next stage.
The row of pixel packets enter an arithmetic logic unit (ALU) pipeline 440 for processing. ALU pipeline 440 has a sequence of ALUs. While four ALUs are illustrated, more or less ALUs may be used in ALU pipeline 440 depending upon the application.
The output of ALU pipeline 440 goes to data write stage 455. The data write stage 455 converts pixel packets into pixel data and stores the result (e.g., color, z depths, etc.) in a write buffer 452 or directly to a frame buffer in memory. Examples of functions that data write stage 455 may perform include color and depth write back, and format conversion.
FIG. 5 shows a diagram of a plurality of simultaneously operable interpolators 501-508 as implemented within the raster stage 410 in accordance with one embodiment of the present invention. As depicted in FIG. 5, a set of high precision interpolators (e.g., four interpolators 501-504) and a set of low precision interpolators (e.g., four low precision interpolators 505-508) are shown.
As described above, the raster stage 410 receives data from setup stage 405 regarding triangles that are to be rendered (e.g., converted into pixels). For each received triangle, the raster stage 410 rasterizes the triangle into each of its constituent pixels with a number parameters interpolated for each pixel. The rasterizer computes rendering parameters for each of the pixels of the triangle by systematically evaluating each of the pixels in a deterministic, sequential manner (e.g., “walking” the triangle). The parameters are computed through an interpolation process from the data associated with the triangle's vertices.
The raster stage 410 advantageously utilizes an array of programmable interpolators 501-508 to compute the parameters in parallel. As the raster stage 410 walks each pixel, the parameters for that pixel are iterated, and the resulting data is passed down to subsequent stages of the pipeline (e.g., as a pixel packet). The interpolated results can be placed in programmably selectable positions in the pixel packet. As is generally known, complex 3D scenes can typically have a large number of polygons, and additionally, a large number of rendering parameters for each polygon. Such parameters include, for example, color, texture coordinates, transparency, depth, level of detail (LOD), and the like. A real-time 3D rendering pipeline needs to perform many millions of calculations per second to maintain the pixel throughput (e.g., fill rate) required to draw a realistic 60-70 frames per second. The raster stage 410 utilizes the parallel array of interpolators 501-508 to maintain the required pixel fill rate while conserving power consumption and silicon area.
The outputs of the interpolators 501-508 are used to construct a plurality of pixel packet rows (e.g., a data structure in a memory array). In the present embodiment, a programmable packing logic module 510 (e.g., including a crossbar switch) functions by arranging the outputs of the interpolators 501-508 into a pixel packet row and formatting the fields of the row for the pixel parameters required for subsequent processing (e.g., color, texture, depth, fog, etc.). The placement of the outputs (e.g., of the interpolators 501-508) into the rows is programmable. In addition to these parameters, the packing logic module 510 arranges processing instructions (e.g., for the subsequent operations to be performed on the pixel packet) into the pixel packet row. For example, as a pixel is iterated, the computed parameters produced by the interpolators 501-508 enable subsequent stages of the graphics pipeline to fetch the required surface attributes (e.g., color, texture, etc.) needed to complete the pixel's rendering. For a simple 3D scene, a given pixel can be described using a single row (e.g., a one row pixel packet). In comparison, for a more complex 3D scene, a given pixel description may require a plurality of rows (e.g., a four row pixel packet).
In the present embodiment, the interpolators 501-508 are programmable and can be flexibly assigned interpolation computations. In other words, the parameter assignment to the interpolators is programmable. The assigned interpolation computations can be software scheduled such that each of the eight interpolators is kept busy as much as possible (e.g., on a per clock basis). In one embodiment, a software scheduler ensures the interpolators 501-508 are kept busy and that latency/idle time is avoided. In this manner, a given pixel parameter computation can be flexibly assigned to any one of the interpolators 501-508. Once made for a triangle, the parameter assignment to the interpolators is fixed for each of the pixels of that triangle. The parameter assignment can be reprogrammed, or otherwise reconfigured, for the next triangle. In this manner, the parameter assignment to the interpolators is programmable on a per triangle basis.
In the present embodiment, the array of interpolators 501-508 are divided into high precision interpolators (e.g., interpolators 501-504) and low precision interpolators (e.g., interpolators 505-508). The division is configured to maintain the flexible assignability of interpolation computations, while simultaneously conserving silicon area dedicated to the interpolator array. The division is configured to take advantage of the fact that some parameters need to be computed in high precision (e.g., texture coordinates) while other parameters do not. For such low precision parameters, the extra precision afforded by a high precision computation provides no significant contribution to the resulting image. Accordingly, low precision parameters can be assigned to the low precision interpolators 505-508. The low precision interpolators 505-508 require significantly less silicon area for their implementation. Additionally, the low precision interpolators 505-508 consume less power per clock cycle. These are important design considerations for a handheld device.
In one embodiment, the interpolators 501-508 use barycentric coordinates for their parameter computations. As described above, the use of barycentric coordinates permits the use of fixed point calculations that require less power than floating point calculations. In one embodiment, the high precision interpolators 501-504 produce a plurality of 14-bit interpolant coefficients and the low precision interpolators 505-508 produce a plurality of 8-bit interpolant coefficients, although any resolution range can be implemented. Generally, the precision selected for the interpolant coefficients is dictated by the maximum allowed error tolerable for the resulting high and low precision interpolated values.
Additionally, in one embodiment, the interpolators 501-508 use perspective corrected barycentric coordinates for their parameter computations. This allows interpolation perspective corrected parameters by the interpolators 501-508. In one embodiment, the perspective correction process uses a perspective correction pixel parameter “w” that is computed in floating point precision once for each pixel of a triangle.
FIG. 6 shows a flow diagram depicting the process whereby graphics primitives (e.g., polygon 630) are received from the set up stage 405 and are converted into their constituent pixel packets by the raster stage 410 in accordance with one embodiment of the present invention.
As described above, the raster stage 410 receives data from setup stage 405 regarding triangles (e.g., polygons) that are to be rendered (e.g., converted into pixels). This is illustrated in FIG. 6 as the triangle 630 propagating down to the raster stage 410 from the set up stage 405. The triangle 630 comprises a geometric primitive having associated therewith instructions (e.g., instructions 631) indicating the manner in which the triangle is to be rasterized and rendered, and primitive data (e.g., parameter data such as color, texture coordinates, transparency, xy, depth, etc.).
The raster stage 410 includes an instruction unit 635 that receives and processes the instructions 631 associated with the triangle 630, and controls the manner in which the primitive data 632 is loaded and processed by the interpolator array (e.g., interpolators 501-508). The instructions 631 include raster interpolation instructions that control the manner in which the primitive data 632 of the triangle 630 is to be interpolated across each of the triangle's pixels. As described above, the parameters for each of the triangle's pixels are interpolated from the primitive data 632 associated with the triangle's vertices. The raster instructions 631 control which parameter (e.g., of the primitive data 632) is processed by which of the high precision interpolators (e.g., interpolators 501-504) or low precision interpolators (e.g., interpolators 505-508). In other words, the instruction unit implements a programmable software-based scheduler that schedules and allocates the parameter data interpolation computations to the interpolators 501-508 in accordance with the raster instructions 631.
The raster instructions 631 also control the locations where the interpolation results from the interpolators 501-508 will be loaded into each row of a generated pixel packet. The instruction unit 635 interacts with the packing logic 510 to implement the desired row load out.
In this manner, the raster instructions 631 control the building of the pixel packets of the triangle 630. For example, for each pixel of the triangle 630, the raster instructions 631 determine the parameter inputs for each of the interpolators 501-508, and also determine the row locations of the interpolated parameter outputs, fields for the pixel parameters required for subsequent processing (e.g., color, texture, depth, fog, etc.), and processing instruction sequence numbers for the subsequent operations for the pixel packet. In typical operation, one row of a pixel packet is formed each clock cycle. Thus, two row pixel packets are built in two clock cycles, three row pixel packets are built in three clock cycles, and accordingly, n row pixel packets are built in n clock cycles. As the pixel packets are formed (e.g., pixel packets 641-642), they are propagated to subsequent stages of the pipeline.
As described above, it should be noted that in one embodiment, the programming of the allocation of the primitive data 632 to the interpolator array 636 (e.g., which parameters are assigned to which of the interpolators 501-508) is programmable on a per polygon basis. For example, once the instruction unit 635 configures the interpolator array 636 to build the pixel packets of the triangle 630, that configuration remains constant for each of the constituent pixels of the triangle 630.
FIG. 7 shows a data flow diagram illustrating a pixel packet 520 in accordance with one embodiment of the present invention. As mentioned above, a pixel packet is, in general, a complete set of descriptions for a pixel in a graphical display. In the present embodiment, pixel packet 520 includes sideband information 710 and payload information 720. In one such embodiment, payload information 720 includes, for example, color information, depth information, and texture information for the pixel that is associated with pixel packet 520.
In the present embodiment, sideband information 710 includes a “type” field 711 of one or more bits. There may be different types of data packets flowing through the pipeline 400 of FIG. 4. The type field is used to identify pixel packet 520 as a row of a pixel packet containing pixel data.
In the present embodiment, sideband information 710 of FIG. 7 may include an “even/odd” (e/o) field 712. In one embodiment, the e/o field 712 is a single bit in length. Additionally, sideband information of FIG. 7 also includes a “kill” field 713. In one embodiment, the kill field 713 is a single bit in length. As mentioned above, if the kill bit is set somewhere in the pipeline 400 of FIG. 4, then the pixel packet will proceed through the remainder of the pipeline 400 without active processing.
In the present embodiment, the sideband information 710 of FIG. 7 includes a “sequence” field 714. In one embodiment, the sequence field is three bits in length. The sequence bits link pixel packet 520 to an instruction that is to be applied to the pixel packet in the subsequent stages (e.g. DF 430, ALU stages 440, and DW 455).
Continuing with reference to FIG. 7, in the present embodiment, the data in payload portion 720 of pixel packet 520 is separated into one or more “rows” 0, 1, . . . , N in raster stage 410 of FIG. 4. That is, the payload portion 720 may consist of a single row of data, or it may consist of a group of rows.
The sideband information 710 for pixel packet 520 is associated with each row or rows formed from the payload portion 720. In one embodiment, each row includes the sideband information 710 and 80 bits of pixel data, as illustrated in FIG. 7.
Each row of pixel packet 520 is processed in succession in pipeline 400 of FIG. 4 with each new clock cycle. For example, row 0 starts down pipeline 400 on a first clock, followed by row 1 on the next clock, and so on. Once all of the rows associated with pixel packet 520 are loaded into pipeline 400, rows associated with the next pixel packet are loaded into pipeline 400. In one embodiment, rows of pixel data for one pixel packet are interleaved with rows of pixel data from the next pixel packet. By interleaving rows of pixel packets in this fashion, stalls due to functional unit latencies in the pipeline 400 can be avoided.
With reference now to FIG. 8, a block diagram of pixel data loaded into a register is shown in accordance with one embodiment of the present invention. The pixel data in each row 821 is 80 bits in length. In one such embodiment, the pixel data in each row 821 is represented using four (4) sets of 20-bit values (e.g., 822-825). Each of the sets of 20-bit values may represent one or more instances of pixel data. Examples of pixel attributes that may be included in a 20-bit set of pixel data include, but are not limited to: 16-bit Z depth values 835; 16-bit (s,t) texture coordinates 850 and a 4-bit level of detail value 830; a pair of color values 840, each with ten (10) bits of precision (e.g., 10 bits high precision and 10 bits low precision); or packed 5555 RGBA 845 (red, green, blue, alpha) values, each five (5) bits in length. The particular data layout or packing format depends on how the interpolators are programmed by the raster instructions for the primitive.
As described herein, the instructions commanding the iterating (e.g., the 4 high precision 4 low precision instructions) are assigning one of the 4 high precision interpolators to take one parameter that the pixel setup stage 405 is sending and perform the interpolation on it. Moreover, the destination in the instruction indicates how to pack the interpolated data in the row 821. For example, the raster stage 410 walks pixel-by-pixel across the geometric primitive (e.g., triangle or the like) interpolating all parameters and packing them into an 80 bit value for flowing down the pipeline 400.
In one embodiment, the raster stage 410 can perform the 4 high precision and 4 low precision iterated values per clock. The software operating on the raster stage 410 will program the interpolators with the clock length of the pixel. For example, if the pixel packet will take only one row 821 of 80 bits, or if it has enough texture to require a plurality of rows 821 to contain all the data for the pixel. Moreover, the assignment of the pixel data to the 20-bit set (e.g., 822-825) of the row 821 may also be changed per geometric primitive. That is, the assignment and instructions per geometric primitives are fixed in the raster stage 410, but they are variable between geometric primitives.
FIG. 9 shows a flowchart of the steps of the process 900 in accordance with one embodiment of the present invention. As depicted in FIG. 9, process 900 illustrates the steps involved in the build out of a flexible pixel packet by raster stage 410 in accordance with one embodiment of the present invention.
Process 900 begins in step 901, where the raster stage 410 receives, or otherwise accesses, a polygon from the set up stage 405 of the graphics pipeline. In step 902, the polygon is rasterized into a plurality of constituent pixels. In step 903, parameter computations for the pixels are allocated to a set of low precision interpolators (e.g., interpolators 505-508) and a set of high precision interpolators (e.g., interpolators 501-504) in accordance with raster instructions for the polygon. As described above, the polygon comprises constituent geometric primitive data and associated raster instructions (e.g., that control the build out of the pixel packets for the polygon). An instruction unit 635 within the raster stage 410 configures the interpolators 501-508 to process the pixels of the polygon and build the pixel packets.
In step 904, the allocated interpolator calculations are executed in parallel. In step 905, the resulting interpolator outputs are loaded into a row of a pixel packet in accordance with the raster instructions for the polygon. As described above, the instruction unit 635 configures the packing logic 510 to build the pixel packet row in the specified manner. In step 906, if the pixel processing is complete, in step 908, process 900 outputs the completed pixel packet to the subsequent stages of the graphics pipeline. Otherwise, process 900 proceeds to step 907, and executes the allocated interpolation calculations in parallel for the next row of the pixel packet. In this manner, successive rows of the pixel packet are built until the pixel's description is complete. As described above, a simple 3D scene can often have one row per pixel packet, while a comparatively complex scene can have two, three or more rows per pixel packet.
With reference now to FIG. 10, a data flow diagram of a method for reducing color value size is shown in accordance with one embodiment of the present invention. Specifically, FIG. 10 shows a geometric primitive 1005 of any size (e.g., a triangle) entering the raster module 410 of the present invention. As the geometric primitive 1005 enters the rasterizing module 410 of the graphics pipeline, the rasterizing module 410 interpolates the geometric primitive 1005 via interpolator 1010 to produce a first color value 1020. In general, the interpolator 1010 interpolates the geometric primitive in a pixel-by-pixel manner to transform the data from geometric primitive 1005 data to pixel data. In one embodiment, the first color value 1020 is a high bit color value (e.g., 8-bit or greater).
The first color value 1020 is then truncated at the truncation 1025 portion of the raster module 410. In general, truncation removes the least significant bits from a set of bits. For example, the truncation 1025 portion may truncate the first color value 1020 (e.g., an 8-bit color value) to produce a truncated color value 1030 (e.g., a 5-bit color value). The rasterizing module 410 then utilizes a dither table 1040 to dither the truncated color value to produce a truncated and dithered color value 1050. In general, dithering is used to reduce the banding effect normally associated with truncated color values 1030. The truncated and dithered color value 1050 is then propagated from the rasterizing module 410 and enters the remainder of the downstream pipeline 1055. In so doing, the power use is minimized regarding propagation of and processing of the color values. It should be noted that the selection of said truncation and/or dithering may be a programmable attribute, such that software applications can choose whether to use the full color precision or the truncated/dithered version of the color value, assuming the remainder of the pipeline is likewise programmable. This is desirable since simple pixels (i.e. pixels which are only using interpolated color values) may need higher precision to be visually pleasing, while complicated pixels (i.e. pixels which involve many processing steps such as texturing, fog, etc.) have a lower total contribution from iterated color and thus have less need of full color precision in order to maintain high overall visual quality. It is further desirable to allow the choice of dithering to be independent of the choice to truncate the color value since some graphics APIs (i.e. OpenGL) require this flexibility.
With reference now to FIG. 11, a block diagram of a color value reduction, via truncation, is shown in accordance with one embodiment of the present invention. In general, diagram 1100 illustrates a first color value 1020 having N bits with a length of 1110. In the reduced file 1120, a portion of the transformed color value 1030 has been truncated or removed. The resulting 1120 is therefore smaller and easier to process than the original N-bit file.
For example, the original file size 1110 may be 8-bits, e.g., N would be eight, color value 1130 may be three bits wide and would result in a truncated color value size 1120 of 5-bits. The 5-bits would then be processed through the pipeline. It is noted that the 5-bits is simply one of the plurality of possible truncated size options. Moreover, it is well known that the color value 1110 or 1120 bit size is per color. That is, 1110 (or 1120) may be a red color value, or blue color value, or green color value, or any other parameter desired by the designer. However, it is only a single color value and other color values are treated in the same way. Therefore, if the graphics pipeline used a three-color application, in one embodiment, there would be three 1120-bit sections to be processed through the pipeline. Not a single 1120 bit section covering all the colors.
With reference now to FIG. 12, a flowchart 1200 of a process for reducing power consumption for graphic architecture on a handheld computing device is shown in accordance with one embodiment of the present invention that uses reduced bit width color values.
Referring now to step 1202 of FIG. 12, a triangle primitive is received by the raster stage 410 from the setup stage 405 of the graphics pipeline (e.g., graphics pipeline 205). As described above, the triangle has a number of parameters that control the manner in which its constituent pixels are rendered by the graphics pipeline of the hand held computing device. As stated herein, the handheld computing device may be a mobile phone, pager, personal digital assistant, or the like. Moreover, the graphics pipeline may be a plug-and-play component coupled with the processor or logic of the handheld computing device. In another embodiment, the graphics pipeline may be fixedly coupled with the handheld computing device at the time of manufacture.
With reference now to step 1204 of FIG. 12 and to FIG. 10, in one embodiment, a color value 1020 is generated via interpolation at interpolator 1010 of rasterizing module 410 of the graphics pipeline. As stated herein, the color value 1020 may be of any size, e.g., 8-bit, 16-bit, 32-bit, or the like. In one embodiment, the computing of pixel parameters includes interpolating the geometric primitive 1005 including a plurality of vertices wherein each vertex has a respective color value, and the interpolating is performed by an interpolator portion 1010 of a rasterizing module 410. For example, the rasterizer initially interpolates a respective color value for each pixel of the geometric primitive, wherein the respective color value is of a first bit width (e.g., 8-bits, 16-bits, 32-bits, etc.).
Referring now to step 1206 of FIG. 12 and to FIG. 10, in one embodiment, the interpolated color value 1020 is truncated at the truncation portion 1025. In one embodiment, the truncation may result in a truncated color value 1030 reduced to a second bit width to produce a respective truncated color value. In one embodiment, the second bit width may be any number of bits between 2 and 7. As is well known in the art, truncation is simply the reduction of the possible number of variations for a color. For example, a color block or file may be introduced to the truncating portion 1025 as a variation of red. The initial color reference may be pink (e.g., 8-bit color), during the truncation process at the truncation portion 1025, the new color reference (e.g., truncated color value 1030) may be light red (e.g., a 5-bit color). In this case, the least significant 3 bits are discarded. Therefore, as is well known in the art, the color value size and actual reference color has been changed.
With reference now to step 1208 of FIG. 12 and to FIG. 10, in one embodiment, the resulting truncated (e.g., transforming, or the like) color value 1030 is altered (e.g., dithered or the like) by the dither table 1040. For example, the transformed color value 1030 may be dithered using a screen location based dither table 1040 to produce a truncated dithered color value 1050. Additionally, the respective truncated dithered color value 1050 may be propagated to downstream modules 1055 of the graphics pipeline. In one embodiment, the screen-location based dither table 1040 returns a dither value based on a screen position of each pixel and wherein the dither value is used to alter the respective color value of each pixel to prevent visual artifacts that may result from the color formations.
As is well known in the art, dithering is the process that is used to improve the image when the full range of colors in a particular image are not available (e.g., due to truncation or reduced palette size). For example, if a gradient is to be displayed and the system does not have the resources to display all of the shades that make up the gradient, then the image (or colors) are dithered. That is, the remaining colors are mixed in such a way as to recreate the missing colors by trading spatial resolution for color resolution. For example, if the called for color is pink, the raster module 410 may intersperse a few white pixels within a plurality of red pixels. In so doing, the eye blends the interspersed white with the red and “sees” pink. Thus, in the gradient example, the color smoothly transitions from red to white via the introduction of more white and less red interspersed throughout the gradient. This can be based on the screen location of the pixel being dithered.
By producing a truncated dithered color value 1050 at the rasterizing module 410, the number of gates and the power necessary to complete the pipeline of the graphics pipeline on the handheld computing device is reduced.
In addition to the truncation and dithering of color values, in one embodiment, the rasterizing module 410 can truncate and dither iterated color values. Moreover, the rasterizing module 410 may apply mathematical operations to the iterated color values after truncating and dithering the files.
With reference now to FIG. 13, a block diagram of a geometric primitive is shown in accordance with an embodiment of the present invention. In general, the geometric primitive is, in one embodiment, a triangle with three vertices 1330. As is well known in the art, the three vertices 1330 are the coordinates necessary to establish the a triangle. The banding issues 1310 are shown in the color variation of geometric primitive 1300. The bands are caused by the reduction in bit-color and the resulting reduced color palate. The dithering portion 1320 illustrates an exemplary embodiment of dithering resulting in a smoother apparent color transition on a limited color palate. Although one version of dithering is shown, there are numerous dithering methods which are well known in the art, and which may be used by the present invention.
FIG. 14 shows a diagram depicting a polygon 1401 and a bounding box 1402 as used in z value interpolation process in accordance with one embodiment of the present invention. As depicted in FIG. 14, the polygon 1401 is shown with respect to a z axis 1405 and x-axis 1406. The y axis (not shown) is orthogonal to the z axis 1405 and the x-axis 1406.
In one embodiment, the raster stage 410 accesses the primitives comprising the polygon 1401 (e.g., triangle) and rasterizes the triangle into its constituent pixels. The bounding box 1411 is used by the rasterizer module (e.g., rasterizer) of the raster stage 410 in the rasterization process of the triangle 1401. Associated parameters for each pixel are then interpolated from the vertices 1411-1413. These parameters include a depth parameter, z. During rasterization of the triangle 1401, respective z values are interpolated by the raster stage 410 for each pixel of the triangle 1401. Each z value is represented within a predefined numerical range (e.g., an integer portion of zero and a fractional portion ranging from zero to one) which substantially corresponds to a depth range between a near clipping plane 1408 and a far clipping plane 1407, as related to a view volume. Z values outside the clipping planes are not screen displayable positions.
As is generally known, the z values between the near clipping plane 1408 and the far clipping plane 1407 comprise the inner and outer boundaries of the view volume. Thus triangle 1401 may have a significant portion that is further from the viewpoint than the far clipping plane 1407 (e.g., those z values greater than one) and/or a significant portion which is closer than the near clipping plane 1408 (e.g., those z values that are less than zero). In this manner, the normal Z range is for those pixels which contribute to the scene is 0.0 to 1.0 (e.g., between the near and far clipping planes). Accordingly, the bounding box 1402 extends significantly beyond this range.
In one embodiment, the raster stage 410 takes advantage of the fact that the valid range for the z value is modular, ranging from 0.0 to 1.0, and repeats consistently and deterministically as is the integer value of the z parameter increases or decreases. For example, in the prior art, a graphics pipeline would need to accommodate a very large range for z values that extend beyond the valid range. In contrast, in the raster stage 410, during the iteration of the z values for each pixel, the fractional portion of the z values are allowed to “roll over” within this modular framework and repeat with each new integer increment or decrement, and the integer value is allowed to increment and decrement outside the valid range (e.g., increment above one and decrement less than zero). A flag can be recorded when the Z value is determined to be outside the near/far clipping planes.
Thus, for example, even though a z stepper of the raster stage 410 may begin at −2.0 z value, by the time the raster stage 410 steps into the view volume (e.g., z values between 0.0 and 1.0) the fractional portion will behave correctly and consistently. Similarly, in a case where the z stepping process begins at positive 6.0 z value, the fractional portion of z will consistently and deterministically roll over as the integer value steps from 6.0 to 0.0. It is possible to take advantage of this behavior because other separately iterated parameters (the barycentric coefficients) determine which pixels are within the two-dimensional x, y projection of the primitive. Rasterizing correct z values is only important within this two-dimensional projection of the primitive in the x,y plane; outside of this region the z stepper need only act as an error term such that the correct z values are generated once the rasterizer steps into the triangle.
The modularity characteristic of the z stepping function allows the integer portion to increment and decrement as necessary, while the raster stage 410 need only keep accurate track of the modular fractional portion of z (e.g., from 0.0 to 1.0). For example, if z is increasing outside the view volume, positive integers can be discarded. Similarly, if z is decreasing outside the view volume, negative integers can be discarded. This allows the raster stage 410 to use fewer bits for the integer portion of z (e.g., outside the 0.0 to 1.0 range). In both cases, some number of integer z bits (e.g., three bits) can be retained as a multi-bit indicator to indicate when the z stepping process is in the positive or negative range outside the view volume. This is necessary since in general the z stepper will not be exactly precise in relation to the other coefficients which precisely determine pixel membership in the two dimensional x,y projection of the triangle (i.e. the barycentric coefficients). In this manner, the z parameter values produced by the z stepping process are clamped to remain substantially within the valid range of the view volume for transitional pixels at the edges of the primitive.
In one embodiment, for a 1K pixel screen, 16 z bit precision (e.g., a 16-bit wide depth buffer) is used to track the fractional z value and 10 error bits are used (e.g., in order to have less than one part in a thousand z error for a maximally sized primitive). Additionally, two or three error bits can be used for the integer portion. These bits will indicate the sign of the z value (e.g., when the z value is outside either the near or far plane), and become guard bits to indicate when the z stepping process penetrates the near or far clipping planes. The number of indicator bits selected determines the allowable multiple of the 0 to 1 z range at which true clipping must be performed on a primitive if any of the z values at the vertices exceed said range (e.g. for three indicator bits, primitives with z values between −3.0 and +3.0 can be rasterized correctly). Note that due to the modular nature of the z fractional bits, this is only a requirement for pixels which are inside the two dimensional x,y projection of the triangle (it is still possible to iterate “outside” pixels correctly even when they exceed the multiple of the z range since the z value will roll over into the legal range prior to stepping into an “inside” pixel).
In one embodiment, the z stepping process implemented by the raster stage 410 can be used to implement a per pixel clipping process. As is well-known, traditional clipping is a computationally expensive process. The integer guard bits enable a per pixel clipping process, whereby the geometric computations involved in a traditional clipping process are avoided. For example, those pixels having a z value greater than 1.0 are further than the far clipping plane 1407 and are outside the view volume, and can be discarded or bypassed. Similarly, those pixels having a z value less than 0.0 are inside the near clipping plane and can similarly be discarded or bypassed. In this manner, if the iterated z value of a pixel is outside the clamped range, that pixel can essentially be clipped, thereby performing clipping at the pixel level as opposed to the polygon level. Per pixel clipping is less computationally expensive than traditional per polygon clipping. It should be noted that in addition to clipping, the clamped z value stepping process can be beneficial to other types of rendering operations, such as, for example, stencil shadows.
Thus, the z stepping logic of the raster stage 410 can be designed to compute the z values with less precision in comparison to typical prior art implementations, while the devoting a larger domain to the z value range within the near/far clipping planes. For example, while traditional z stepping logic needed to be implemented with 56 bits (e.g., for a 1K pixel screen), z stepping logic in accordance with one embodiment of the present invention can be implemented with 29 bits (e.g., 3 guard bits, 16 z bits, and 10 error bits). This makes hardware significantly less expensive in terms of silicon area consumed and in terms of power requirements, while devoting excellent resolution to the range between the near/far clipping planes.
FIG. 15 shows a flowchart of the steps of an exemplary process 1500 in accordance with one embodiment of the present invention. As depicted in FIG. 15, process 1500 illustrates the steps involved in a clamped z value interpolation process in accordance with one embodiment of the present invention.
Process 1500 begins in step 1501, where the raster stage 410 accesses a geographic primitive comprising a plurality of vertices of a polygon. In step 1502, the primitive is rasterized into a plurality of corresponding pixels. In step 1503, the raster stage 410 computes z parameter values for each pixel of the polygon, wherein each z parameter value comprises an integer portion and a fractional portion.
In step 1504, the integer portion of the z parameter is clamped to a valid range (bit width) plus a guard indicator (e.g., a small number of integer bits) to indicate the sign of the z parameter. Additionally, in step 1504, the computed z values are allowed to roll over within the valid range upon an overflow condition. This sets the guard bit to indicate overflows. In step 1505, per pixel clipping is implemented using the guard indicator of the z parameter. As described above, the guard bits can indicate those pixels which are further than the far clipping plane (e.g., far clipping plane 1407) or closer than the near clipping plane (e.g., near clipping plane 1408). These pixels can then be discarded or ignored in the rendering process. Optionally (e.g., under software control), such pixels can be clamped to the near or far z values instead of being clipped, which may be useful for some software algorithms.
FIG. 16 shows a diagram of an exemplary texture map (e.g. a “texture”) as used by embodiments of the present invention. As described above, embodiments of the present invention implementing parameter clamping to a valid range in a raster stage (e.g., raster stage 410) of a graphics pipeline. As parameters are computed by the raster stage 410 during the rasterization process, the raster stage 410 is configured to clamp parameter data to a valid range usable by the subsequent stages of the pipeline. The clamping functionality comprises discarding data that is outside the valid range of a given pixel parameter, thereby only sending the necessary parameter data, which minimizes the number of bits which need to be transmitted down the graphics pipeline, and thereby minimizing power expenditure.
In one embodiment, texture parameters are computed by the raster stage 410, and these texture parameters are clamped to a valid range. In other words, as texture coordinates are computed by the raster stage 410 (e.g., “s” and “t” coordinates), the computed textures are clamped to a valid range early in the pipeline (e.g., in the raster stage 410) as opposed to later in the pipeline.
FIG. 16 illustrates the coordinates (s,t) of the texture 1600. As generally known, the texture coordinates (s,t) range from zero to one in accordance with well-established convention. Accordingly, the coordinates at the lower left corner of the texture 1600 are “0,0” while the coordinates at the upper right corner of the texture 1600 are “1,1” and so on. Thus, a fractional representation, ranging from zero to one, is the information required by the data fetch stage 430 to access the texture 1600 (e.g., in memory) and retrieve the corresponding texels for the computed coordinate. A pixel may have one or more texture coordinates associated with it. Clamping refers to the fact that even though a deterministic formula may be used to compute texture coordinates, and even though this formula may result in both an integer portion and a fractional portion, only the fractional portion is required by the data fetch stage 430.
In one embodiment, the fractional portion is represented as a 16-bit value. In a typical implementation, the 16 bit each s and t coordinates of the texture map are used to fetch the addressed texel and one or more adjacent texels for a blending operation. The fractional portion allows the data fetch stage 430 to fetch the correct adjacent texels for the blending interpolation.
In one embodiment, the raster stage 410 computes texture coordinates in accordance with a “wrap” texture mapping mode. In the wrap mode, the texture 1600 repeats itself as the integer portion of the computed texture increments or decrements. In the wrap mode, at the edges of the texture 1600 (e.g., s or t at 1 or 0), the data fetch stage 430 fetches adjacent texels from the adjacent edge of the next repeating version of the texture map to do the interpolation. In this way, the textures wrap around without visible seams or artifacts.
In another embodiment, the raster stage 410 computes texture coordinates in accordance with a “clamp” texture mapping mode. In the clamp mode, the fractional portion does not wrap around. At the edges, the texture is clamped to the value at the edge. In the clamp mode, the texel colors are replicated or “smeared” off and repeated for any value that is greater than 1 or less than 0.
Operation in the clamp mode needs to be identified to subsequent stages in the pipeline. In one embodiment, an additional bit (e.g., a clamp flag or clamp bit) is sent down the pipeline to identify the clamp mode of texture mapping. The bit for each pixel can be transmitted as side band information in the manner described above. This information is used by the data fetch stage 430 during its texture fetch in order to configure itself not to fetch “wrap around” adjacent texels of the edge of the texture to do interpolation. The clamp mode is typically is programmed by an application through a graphics API.
It should be noted that in another embodiment, the raster stage 410 can be configured to compute texture coordinates in accordance with a “mirror” mode, where the texture coordinates are mirrored with different integer version of the texture coordinate value (e.g., those s and t values that are outside the range zero to one). As with the clamp mode, the mirror mode is identified to subsequent stages of the pipeline (e.g., through the use of a flag or bit).
In this manner, the raster stage 410 performs parameter clamping, wherein computed parameters are clamped to their valid range to save on the number of bits/information that needs to be pushed down the pipeline. In this case, the clamping involves discarding the integer portion of the computed texture coordinates and only sending the fractional portion within the range 0-1. This work is performed in the raster stage 410 as opposed to other later stages in the pipeline. The clamping functionality only sends the necessary parameter data, which minimizes the number of bits which need to be transmitted down the graphics pipeline, and thereby minimizing power expenditure.
FIG. 17 shows a polygon 1700 having a wrapped version of the texture 1600 applied (e.g., as indicated by the arrow 1701). As described above, the wrapped version of the texture repeats itself as the coordinates are computed.
FIG. 18 shows a polygon 1800 having a clamped version of the texture 1600 applied (e.g., as indicated by the arrow 1801). As described above, the clamped version of the texture is merely the same color as the outside edge of the texture 1600 duplicated into the direction the texture coordinates are computed.
FIG. 19 shows a flowchart of the steps of a texture coordinate parameter clamping process 1900 in accordance with one embodiment of the present invention. As illustrated in FIG. 19, process 1900 shows the steps involved in a computed texture coordinate clamping process as implemented in a raster stage (e.g., raster stage 410) in accordance with one embodiment of the present intention.
Process 1900 begins in step 1901, where the raster stage accesses a geometric primitive comprising its respective vertices of a polygon (e.g., triangle). In step 1902, the geometric primitive is rasterized into a plurality of corresponding pixels. In step 1903, the raster stage 410 processes each pixel of the triangle and computes texture coordinates to be used in subsequent stages of the pipeline. As described above, the computed texture coordinates comprise both an integer portion and a fractional portion. In step 1904, the fractional portion is propagated downstream to the data fetch stage 430.
In step 1905, in accordance with instructions from an application executing on the computer system, a determination is made as to whether a clamp mode or wrap mode will be implemented. In step 1906, in clamp mode, the raster stage 410 computes texture coordinates in accordance with a “clamp” texture mapping mode and propagates a clamping flag down the pipeline. As described above, at the edges of the texture 1600, the texture color is clamped to the value at the edge. In step 1907, texture coordinates are fetched by the data fetch stage 430 to implement clamp mode texture mapping (e.g., as depicted in FIG. 18). In step 1908, in wrap mode, texture coordinates are fetched by the data fetch stage 430 to implement wrap mode texture mapping (e.g., as depicted in FIG. 17).
FIG. 20 shows a diagram of an exemplary mip mapping process in accordance with one embodiment of the present invention. As depicted in FIG. 20, five different resolution versions 2001-2005 of a 2-D texture map are shown.
As known by those skilled in the art, mip mapping is a widely used type of LOD filtering. The LOD filtering is configured to prevent moiré interference patterns, aliasing, and rendering artifacts by scaling and filtering a full resolution texture map 2001 into multiple lower resolution versions 2002-2005. For example, the full resolution version 2001 contains all the surface details of an object. At close distances to the viewpoint, the full resolution version 2001 renders in its original full detail. As the distances increase, successively smaller resolution versions of the texture (e.g., versions 2002-2005) are used. By choosing the appropriate texture resolution and detail, mip mapping ensures that pixels do not get lost at further distances. Instead, properly averaged smaller versions of the original texture are used. At the furthest distances, a single texel 2005 is used. Each of these stages is known as a mip map level (e.g., level 0 through level 4 shown in FIG. 20). It should be noted that although FIG. 20 shows five levels 2001-2005, embodiments of the present invention can be implemented other numbers of versions (e.g., 3, 7, 10, etc.).
In one embodiment, the raster stage 410 implements LOD parameter clamping, wherein a computed LOD parameter is clamped to a valid range in the raster stage 410 of the graphics pipeline. The clamping functionality in this case comprises accessing a geometric primitive (e.g., triangle) comprising a plurality of vertices wherein each vertex has associated therewith a plurality of parameters including a level of detail (LOD) value. During rasterization of the primitive, a respective LOD value for each pixel of the primitive is computed (e.g., using interpolation). This LOD value is computed using a full precision function. Accordingly, each LOD value of each pixel comprises an integer portion and a fractional portion.
The integer portion of the computed LOD value is used to select the correct mip map level corresponding to the primitive's distance from the viewpoint. The fractional portion of the computed LOD value is used to configure a blending operation performed on adjacent texels of adjacent mip map levels (e.g., where the fractional portion is used to assign different weights to texels of different mip maps). This is shown in FIG. 20 by the arrow 2010 indicating adjacent texels of different mip map levels used in a blending operation in accordance with an LOD fractional portion.
The raster stage 410 is configured to clamp the LOD value to a maximum value if a computed LOD value is greater than the predetermined range (e.g., clamped to the maximum value). Similarly, the raster stage 410 is also configured to clamp the LOD value to a minimum value if a computed LOD value is less than the predetermined range (e.g., clamped to the minimum value). In other words, where the computed LOD parameter indicates a texel:pixel ratio for the primitive which is larger than the coarsest (smallest) mip map level (e.g., version 2005), the LOD value can be clamped to this maximum value (e.g., level 4) and no higher LOD integer values need be computed, stored, or propagated down the pipeline. Where the computed LOD parameter indicates a texel:pixel ratio which is smaller than the finest (largest) mip map level (e.g., level 0), the LOD integer value can be clamped to this minimum value and no lower LOD integer values (e.g., negative LOD integer values) need be computed, stored, or propagated. These clamped LOD parameter values are then propagated down the pipeline to the data fetch stage 430.
In one embodiment, once the maximum or minimum value has been clamped, the fractional portion can also be clamped. For example, in a case where the maximum LOD parameter value has been greatly exceeded (e.g., a parameter indicating a mip map level 10), the lowest resolution version (e.g., level 4) is already being returned, the fractional portion would be insignificant with respect to any blending interpolate. In such a case, the fractional portion can also be clamped to its maximum value. Alternatively, in one embodiment, the fractional portion can merely be discarded (e.g., as having no significant contribution to fragment color).
In one embodiment, a four bit value is used to represent the integer portion of the LOD parameter, and a four bit value is used to present the fractional portion of the LOD parameter.
FIG. 21 shows a flowchart of the steps of an LOD parameter clamping process 2100 in accordance with one embodiment of the present invention. As illustrated in FIG. 21, process 2100 shows the steps involved in a computed LOD value clamping process as implemented in a raster stage (e.g., raster stage 410) in accordance with one embodiment of the present invention.
Process 2100 begins in step 2101, where the raster stage accesses a geometric primitive comprising its respective vertices of a polygon (e.g., triangle). In step 2102, the geometric primitive is rasterized into a plurality of corresponding pixels. In step 2103, the raster stage 410 processes each pixel of the triangle and computes an LOD value to be used in subsequent stages of the pipeline. As described above, the computed LOD value comprises both an integer portion and a fractional portion.
In step 2104, the integer portion and the fractional portion of the LOD parameter are clamped to a valid range. As described above, when the computed LOD parameter exceeds the valid range, the parameter is clamped to its maximum value. When the computed LOD parameter is less than the valid range, the parameter is clamped to its minimum value. In step 2105, the clamped LOD parameter is propagated downstream to the data fetch stage 430 of the pipeline.
In this manner, as with the texture coordinates values, LOD parameters are clamped to a valid range early in the rendering process by the raster stage 410 to save in the number of bits that must be pushed down the pipeline, thereby minimizing power expenditure.
The foregoing descriptions of specific embodiments of the present invention have been presented for purposes of illustration and description. They are not intended to be exhaustive or to limit the invention to the precise forms disclosed, and obviously many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application, to thereby enable others skilled in the art to best utilize the invention and various embodiments with various modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the claims appended hereto and their equivalents.

## Claims

1. A method for reducing power consumption for graphics architecture on a handheld computing device and rendering an image comprising:
receiving a geometric primitive at a raster portion of a graphics pipeline;
interpolating said geometric primitive at the raster portion to generate a color value;
truncating the color value at the raster portion, wherein said truncating comprises truncating at least one least significant bit of said color value;
dithering the resulting truncated color value at the raster portion to produce a truncated dithered color value;
outputting the geometric primitive from the raster portion, wherein processing of the truncated dithered color value utilizes less power than processing of the color value and the power used in processing the truncated dithered color value is based on the bitwidth of the truncated dithered color value, wherein the truncated dithered color has a smaller bitwidth than a bitwidth of the color value; and
performing a texturing operation on the geometric primitive from the raster portion, wherein said texturing operation is configured to utilize less power for a smaller bitwidth color value than a larger bitwidth color value.

2. The method of claim 1 wherein the generated color value is an 8-bit color value.

3. The method of claim 2 wherein the truncated color value results in a 5-bit color value.

4. The method of claim 1 further comprising propagating said truncated dithered color value to downstream portions of the graphics pipeline.

5. The method of claim 1 wherein the truncated color value results in a 5-bit color value.

6. The method of claim 5 wherein the raster portion further comprises:
applying mathematical operations to the iterated color values after truncating and dithering.

7. The method of claim 1 further comprising:
utilizing a screen location based dither table to dither the truncated color value.

8. A method as described in claim 1 wherein said truncating and said dithering are performed based on pixel complexity.

9. A computer system comprising:
a bus;
a memory unit coupled with the bus; and
a graphics processor coupled with the bus and comprising a rasterization stage for executing a method comprising:
receiving a geometric primitive at a raster portion of a graphics pipeline;
interpolating said geometric primitive at the raster portion to generate a color value;
truncating the color value at the raster portion, wherein said truncating comprises truncating at least one least significant bit of said color value;
dithering the resulting truncated color value at the raster portion to produce a truncated dithered color value, wherein said truncating and dithering are performed based on pixel complexity;
outputting the geometric primitive from the raster portion, wherein processing of the truncated dithered color value utilizes less power than processing of the color value and the power used in processing the truncated dithered color value is based on the bitwidth of the truncated dithered color value, wherein the truncated dithered color value has a smaller bitwidth than a bitwidth of the color value; and
performing a texturing operation on the geometric primitive from the raster portion, wherein said texturing operation is configured to utilize less power for a smaller bitwidth color value than a larger bitwidth color value.

10. The computer system of claim 9 wherein the color value is an 8-bit color value.

11. The computer system of claim 10 wherein the truncated color value results in a 5-bit color value.

12. The computer system of claim 9 further comprising supplying the truncated dithered color value to a downstream module of a graphics pipeline.

13. The computer system of claim 9 wherein the truncated color value results in a 5-bit color value.

14. The computer system of claim 9 wherein said dithering comprises utilizing a dither table to dither the truncated color value.

15. An apparatus for reducing power consumption for graphics architecture on a handheld computing device comprising:
a raster stage of a graphics architecture, said raster stage iterating color values for a graphics primitive at a first bit width and further truncating and dithering said truncated color values to produce transformed color values of a second smaller bit width, and for outputting said graphics primitive and said color values for a subsequent texturing operation, wherein said texturing operation is configured to utilize less power for a smaller bitwidth color value than a larger bitwidth color value and the power used in processing the transformed color value is based on the bitwidth of the transformed color value and wherein said truncating comprises truncating at least one least significant bit of said color value, and wherein processing of each of the transformed color values utilize less power than processing of each of the respective color values, wherein each of the transformed color values have a smaller bitwidth than each of the corresponding color values.

16. The apparatus of claim 15 wherein each color value is an 8-bit color value.

17. The apparatus of claim 15 wherein the truncating of each color value results in a 5-bit color value.

18. The apparatus of claim 15 wherein the raster stage further supplies the transformed color values to a downstream pipeline module.

19. The apparatus of claim 15 wherein the raster stage further comprises:
applying mathematical operations to the transformed color values after the truncating and dithering operations are complete.

20. The apparatus of claim 15 further comprising:
utilizing a dither table to perform a dither operation on the truncated color values.

21. The apparatus of claim 15 wherein a second iterating dither operation occurs at a data write portion of the graphics pipeline.

22. A method of computing pixel parameters for rendering an image comprising:
rasterizing a geometric primitive comprising a plurality of vertices wherein each vertex comprises a respective color value, said rasterizing performed by a rasterization module of a graphics pipeline and wherein said rasterizing comprises:
interpolating a respective color value for each pixel of said geometric primitive, wherein said respective color value is of a first bit width;
transforming said respective color value to a second bit width to produce a respective transformed color value for each pixel, wherein said transforming comprises removing at least one least significant bit of said color value; and
altering said respective transformed color value using a screen-location based dither table to produce a dithered transformed color value for each pixel;
propagating said respective dithered transformed color value of each pixel to downstream modules of said graphics pipeline, wherein said propagating of said respective dithered transformed color value utilizes less power than propagating of the color value and the power used in processing the respective dithered transformed color value is based on the bitwidth of the respective dithered transformed color value, wherein the dithered transformed color value has a smaller bitwidth than a bitwidth of the color value; and
performing a texturing operation on the geometric primitive corresponding to the respective dithered transformed color value, wherein said texturing operation is configured to utilize less power for a smaller bitwidth color value than a larger bitwidth color value.

23. A method as described in claim 22 wherein said first bit width is 8 bits wide.

24. A method as described in claim 23 wherein said second bit width is 5 bits wide.

25. A method as described in claim 24 wherein said transforming is truncating.

26. A method as described in claim 22 wherein said transforming is truncating.

27. A method as described in claim 22 wherein said screen-location based dither table returns a dither value based on a screen position of each pixel and wherein said dither value is used to alter said respective color value of each pixel.

28. A method as described in claim 22 wherein said second bit width is less than said first bit width.

29. A method as described in claim 28 wherein said transforming is truncating.

30. In a rasterizer module of a graphics pipeline, a method of computing pixel parameters for rendering an image comprising:
interpolating a respective color value for each pixel of a geometric primitive, wherein said respective color value is of a first bit width;
transforming said respective color value to a second bit width to produce a respective transformed color value for each pixel, wherein said transforming comprises removing at least one least significant bit of said color value; and
dithering said respective transformed color value to produce a dithered transformed color value for each pixel; and
propagating said respective dithered transformed color value of each pixel to downstream graphics rendering modules of said graphics pipeline, wherein said downstream graphics rendering modules are configured to utilize less power for said respective transformed color value than said respective color value and the power used in processing the respective transformed color value is based on the bitwidth of the respective transformed color value, wherein said respective transformed color value has a smaller bitwidth than a bitwidth of said respective color value.

31. A method as described in claim 30 wherein said first bit width is 8 bits wide and said second bit width is 5 bits wide.

32. A method as described in claim 31 wherein said transforming is truncating.

33. A method as described in claim 30 wherein said transforming is truncating.

34. A method as described in claim 30 wherein said dithering is performed using a screen-location based dither table that returns a dither value based on a screen position of each pixel and wherein said dither value is used to dither said respective color value of each pixel.

35. A method as described in claim 30 wherein said second bit width is less than said first bit width.

36. A method as described in claim 35 wherein said transforming is truncating.

37. A method as described in claim 30 wherein said transforming is a programmable attribute.

38. A method as described in claim 30 wherein said dithering is performed independent of the transforming of the color value.