ID3D12GraphicsCommandList5::RSSetShadingRate method (d3d12.h)

Sets the base shading rate, and combiners, for variable-rate shading (VRS). For more info, see Variable-rate shading (VRS).

Syntax

void RSSetShadingRate(
  D3D12_SHADING_RATE                baseShadingRate,
  const D3D12_SHADING_RATE_COMBINER *combiners
);

Parameters

baseShadingRate

Type: D3D12_SHADING_RATE

A constant from the D3D12_SHADING_RATE enumeration describing the base shading rate to set.

combiners

Type: const D3D12_SHADING_RATE_COMBINER*

An optional pointer to a constant array of D3D12_SHADING_RATE_COMBINER containing the shading rate combiners to set. The count of D3D12_SHADING_RATE_COMBINER elements in the array must be equal to the constant D3D12_RS_SET_SHADING_RATE_COMBINER_COUNT, which is equal to 2.

Because per-primitive and screen-space image-based VRS isn't supported on Tier1 Variable-rate shading (VRS), for these values to be meaningful, the adapter requires Tier2 VRS support. See D3D12_FEATURE_DATA_D3D12_OPTIONS6 and D3D12_VARIABLE_SHADING_RATE_TIER.

A NULL pointer is equivalent to the default shading combiners, which are both D3D12_SHADING_RATE_COMBINER_PASSTHROUGH.

The algorithm for final shading-rate is determined by the following.

postRasterizerRate = ApplyCombiner(Combiners[0], CommandListShadingRate, Primitive->PrimitiveSpecifiedShadingRate);
finalRate = ApplyCombiner(Combiners[1], postRasterizerRate, ScreenSpaceImage[xy]);

where ApplyCombiner is

UINT ApplyCombiner(D3D12_SHADING_RATE_COMBINER combiner, UINT a, UINT b)
{
    MaxShadingRate = options6.AdditionalShadingRatesSupported ? 4 : 2;
    switch (combiner)
    {
        case D3D12_SHADING_RATE_COMBINER_PASSTHROUGH: // default
            return a;
        case D3D12_SHADING_RATE_COMBINER_OVERRIDE:
            return b;
        case D3D12_SHADING_RATE_COMBINER_MAX:
            return max(a, b);
        case D3D12_SHADING_RATE_COMBINER_MIN:
            return min(a, b);
        case D3D12_SHADING_RATE_COMBINER_SUM:
            return min(MaxShadingRate, a + b);
        case default:
            return a;
    }
}

Return value

None

Requirements

Requirement Value
Minimum supported client Windows 10 Build 20348
Minimum supported server Windows 10 Build 20348
Header d3d12.h

See also

Variable-rate shading (VRS)