This relates generally to graphics processing for integrated circuit processing devices.
In graphics processing, three dimensional objects can be represented as a series of triangles having three points. The three points can be used to establish the so- called plane equation that represents a plane including the three points. The plane equation indicates the orientation of each triangle point relative to a display screen plane.
Hidden surface removal or Z-buffering tracks the depth of pixels to reduce the processing carried out on polygons that are hidden behind other polygons in a scene.
Identifying and culling occluded pixels of polygons may represent a significant opportunity for performance improvement.
Referring to
The processor 1 may be coupled to a chipset core logic via bus 3. The chipset core logic 10, coupled to the graphics processor 12 via a bus 5, may be coupled to the frame buffer, as well as the Z-buffer 16 and hierarchical Z-buffer 17, via bus 6. The frame buffer 14, Z-buffer 16, and hierarchical Z-buffer 17 are coupled to the display screen 18 via bus 7, and display screen 18 is coupled to keyboard/mouse 20 via the bus 8.
Other user interface elements, such as audio speakers, microphones, joy sticks, steering wheels, printers, musical instrument digital interface keyboards, virtual reality hoods, moveable seats, and environments may be part of the processing system, to mention a few examples.
The architecture shown in
In accordance with some embodiments of the present invention, less than all the pixels of a group of pixels may be depth tested instead of testing all the pixels of the group. A depth test is a test of the distance of a particular pixel into the display screen. The depth testing may be used to determine pixels that are occluded. The occluded pixels of a polygon need not be processed. This elimination of occluded pixel processing can improve graphics performance.
Referring to
Thus, referring to
The graphics pipeline, including, for example, the flow of data through the graphics processor 12, may provide data that represents triangles, in turn, represented by three points. Each point is associated with a depth or Z value.
A plane equation characterizes the depth of each pixel within the triangle, where Z is the depth:
Z=C
0
+C
x(x−Xref)+Cy(y−Yref).
Thus, the plane equation defines a plane of the pixels forming a triangle and defines a tilt of that plane relative to a display screen. In some embodiments, the coefficients Cx and Cy and, particularly, their signs are used to determine worst case corners for the entire block, in a block using a rectangular array of pixels. The worst case corners are the corners with the minimum and the maximum depths of any pixels in the block.
As indicated in
The hierarchical Z-buffer or HZ-buffer 17 (
When testing against the values in the hierarchical Z-buffer, eight different tests are conventionally used in graphics processing. A “less than” test, a “less than or equal to” test, a “greater than” test, a “greater than or equal to” test, an “equal” test, a “not equal” test, an “always pass” test, and a “never pass” test are utilized. Generally, the always pass and the never pass involve no testing whatsoever and are of no interest in the present context.
Also, the test determines whether the plane equation coefficients CX is greater than or equal to zero, (i.e. is positive) and whether the plane equation coefficient CY is greater than or equal to zero (i.e. positive). Then the minimum corner and the maximum corners for the block consisting of the span zero and span one, is identified in the left and right most columns. (Of course, the column or structure defined in
Thus, the first horizontal line in
The fifth horizontal line is the situation where no pixel in span zero is lit, but at least one pixel in span one is lit. In this case, both coefficients CX and CY are positive. In such case, given the way that X and Y increase as indicated in
Once the minimum and maximum corners have been determined, the next step, in one embodiment, is to analyze the minimum and maximum corners for a given group of pixels against a value currently stored in the hierarchical Z-buffer 17. For example, if the application for the graphics system uses a “less than” test, then any depth that is lower than the minimum depth value in the hierarchical Z-buffer passes and any depth value larger than the maximum depth fails. In such case, the minimum corner is compared to the maximum value in the hierarchical Z-buffer. If the minimum corner is greater than the hierarchical Z-buffer maximum, then every pixel in the block is greater than the hierarchical Z-buffer maximum value and no pixel in the block passes. Then, the maximum corner in the block at issue is compared to the hierarchical Z-buffer minimum value. If the value of the maximum corner is less than the hierarchical Z-buffer minimum value, then all the pixels in the block are less than the hierarchical Z-buffer minimum value and, in this case, all the pixels of the block pass as a group, without analyzing every pixel.
If neither of these comparisons works, then the savings possible with embodiments of the present invention are not applicable and the values of every pixel may be conventionally compared in the block one-by-one against the values in the hierarchical Z-buffer. In such case, no time savings may be achieved, but, overall, because the tests described herein are often successful, in some embodiments significant time savings may be achieved.
Referring to
As indicated in block 40, the minimum and maximum pixel locations in a block are determined in an embodiment using a rectangular block. In some cases, it may also be determined whether any of the pixels in the block or any of the pixels in any span making up the block are lit. If none of the pixels are lit, the span or block may be ignored.
Then, the selected pixel locations representative of the minimum and maximum values of a block are tested against the minimum and maximum values in the hierarchical Z-buffer 17, as indicated in block 42. The exact test that is done is dependent upon the type of system implemented by the applicable application. In one example, a “less than” test may be utilized, but other tests may also be utilized. In such cases, it is possible to deduce, based on the minimum and maximum values of a group of pixels, whether or not all the pixels would pass or fail the depth test.
As indicated in
The size of the block and the constituent span or spans is subject to considerable variation, although in general it would seem to make sense to use at least four pixels in any analysis. In addition, the number of spans may be changed from two and could be any number from one span upwards. It does not matter that some pixels of a span are not lit. In addition, two sets of eight pixels can be analyzed in parallel, in one embodiment.
The graphics processing techniques described herein may be implemented in various hardware architectures. For example, graphics functionality may be integrated within a chipset. Alternatively, a discrete graphics processor may be used. As still another embodiment, the graphics functions may be implemented by a general purpose processor, including a multicore processor.
References throughout this specification to “one embodiment” or “an embodiment” mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one implementation encompassed within the present invention. Thus, appearances of the phrase “one embodiment” or “in an embodiment” are not necessarily referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be instituted in other suitable forms other than the particular embodiment illustrated and all such forms may be encompassed within the claims of the present application.
While the present invention has been described with respect to a limited number of embodiments, those skilled in the art will appreciate numerous modifications and variations therefrom. It is intended that the appended claims cover all such modifications and variations as fall within the true spirit and scope of this present invention.