See the section "Centroid Sampling of Attributes when Multisample Antialiasing" in Rasterization rules. Attributes can be interpolated linearly, or with centroid sampling. Pixel shader attribute interpolation modes are declared in an input register declaration, on a per-element basis in either an argument or an input structure. Vertex attributes are interpolated (or evaluated) at pixel shader center locations. If a primitive gets clipped before rasterization, the interpolation mode is honored during the clipping process as well. Pixel shader inputs are interpolated from the vertex attributes of the primitive being rasterized, based on the interpolation mode declared. Pixel shader input data includes vertex attributes (that can be interpolated with or without perspective correction) or can be treated as per-primitive constants. Otherwise, a pixel shader can take up to 32, 32-bit, 4-component inputs. When the pipeline is configured without a geometry shader, a pixel shader is limited to 16, 32-bit, 4-component inputs. Typically, a hardware implementation runs a pixel shader on multiple pixels (for example a 2x2 grid) simultaneously, so that derivatives of quantities computed in the pixel shader can be reasonably approximated as deltas of the values at the same point of execution in adjacent pixels. The most common use for derivatives is to compute level-of-detail calculations for texture sampling and in the case of anisotropic filtering, selecting samples along the axis of anisotropy. The pixel shader intrinsic functions produce or use derivatives of quantities with respect to screen space x and y. Samples that pass the depth/stencil test are updated with the pixel shader output color. When multisampling a texture, a pixel shader is invoked once per-covered pixel while a depth/stencil test occurs for each covered multisample. The Rasterizer (RS) stage invokes a pixel shader once for each pixel covered by a primitive, however, it is possible to specify a NULL shader to avoid running a shader. A pixel shader is a program that combines constant variables, texture data, interpolated per-vertex values, and other data to produce per-pixel outputs. The Pixel Shader (PS) stage enables rich shading techniques such as per-pixel lighting and post-processing. This shader stage exposes its own unique functionality, built on the shader model 4.0 common-shader core. This is a programmable shader stage it is shown as a rounded block in the graphics pipeline diagram. The Pixel Shader (PS) stage receives interpolated data for a primitive, and generates per-pixel data such as color.
0 Comments
Leave a Reply. |