Graphics Reference
In-Depth Information
In order to render a multisampled input SRV to a MSAA render target, we can use the pixel.
Position property along with the pixel shader SV_SampleIndex input semantic to sample
all the source samples without any loops. This effectively tells the pipeline to run the pixel
shader once for each sample rather than once for each pixel (that is, for an MSAA sample
count of four, it runs the pixel shader four times instead of once). The following code snippet
shows what this pixel shader might look like:
Texture2DMS<float4> TextureMS0 : register(t0);
float4 PSMainMultisample(PixelIn input,
uint sampleIndex: SV_SampleIndex) : SV_Target
{
int2 screenPos = int2(input.Position.xy);
return TextureMS0.Load(screenPos, sampleIndex);
}
See also
F The screen-aligned quad can be useful to preview the results of the image
processing recipes in Chapter 7 , Performing Image Processing Techniques
F We also make use of this screen-aligned quad throughout the remainder of
this chapter
F We use the multisampled anti-aliasing pixel shader shown here in the
Incorporating multisample anti-aliasing recipe later in this chapter
Reading the G-Buffer
In this recipe, we will look at the HLSL shader code necessary to read from the G-Buffer's
resources. We will then use the screen-aligned quad to implement a debug pixel shader for
displaying information from the G-Buffer to screen.
Getting ready
We will follow on from where we left off with Filling the G-Buffer using the same G-Buffer
layout as described in that recipe, and make use of the screen-aligned quad from
Implementing a screen-aligned quad renderer .
 
Search WWH ::




Custom Search