Sets parameters for the Geometry shader.
public:
void GSSetParameters(
const D3D11X_GS_PARAMETERS *pGsParameters
)
pGsParameters
Type: D3D11X_GS_PARAMETERS *
[in, optional] Parameters to use for the Geometry shader, as a pointer to a D3D11X_GS_PARAMETERS structure.
If the parameter is NULL, that reverts the driver to its default behavior (as if this function had never been called).
The geometry shader on Xbox One can run in either offchip or onchip mode. The default is offchip.
In both offchip and onchip mode, the GPU assigns input primitives to subgroups. Subgroups are data chunks large enough to hold at most VerticesPerSubgroup input vertices, as well as the output for at most PrimitivesPerSubgroup input primitives. A single primitive’s output space must be large enough to hold all output attributes, for the declared maximum number of output vertices, multiplied by the geometry shader instance count (or 1 if no instance count is specified). Subgroups are considered filled when either the number of unique vertices (taking into account vertex reuse across adjacent primitives) reaches VerticesPerSubgroup or the number of input primitives reaches PrimitivesPerSubgroup.
In offchip mode, all subgroup data is stored to main system memory, trading potentially large bandwidth usage for the ability to distribute work more efficiently across the GPU.
In onchip mode, subgroup data is stored to local data store (LDS) memory. This eliminates bandwidth to main memory, but forces all work related to a subgroup to execute on the same compute unit (CU). This restricts the GPU’s ability to load balance variable amounts of geometry shader work, and also limits the amount of parallelism within a CU. Because all subgroup data must fit into limited LDS space, the number of primitives (and as a result, the number of threads per threadgroup) that a CU can process will be severely restricted for geometry shaders that produce large amounts of output data per input primitive, either through a large number of output vertex attributes or data amplification (turning one primitive into many primitives). LDS space consumed by the geometry shader also becomes temporarily unavailable to other shader stages, potentially introducing bottlenecks for compute shaders that require LDS, tessellation control point generation (the vertex and hull stages), and pixel shader attribute interpolation.
When onchip geometry shader mode is enabled, tessellation is forced to use always-offchip mode. In always-offchip mode, vertex and hull shader threadgroups will consume LDS while active, but will dump all control point data to main system memory prior to the hardware tessellation stage.
If GSSetParameters has not been previously called, the driver attempts to calculate reasonable default values for the fields in D3D11X_GS_PARAMETERS and uses offchip geometry shader mode. To enable onchip geometry shader mode, set the D3D11X_GS_ONCHIP flag bit on the Flags field. To override the default driver-calculated values, fill the appropriate D3D11X_GS_PARAMETERS field and set the matching D3D11X_GS_FLAGS bit on the Flags field. The driver will clamp overridden values to valid ranges. To retrieve the driver-generated D3D11X_GS_PARAMETERS values used by the previous draw, call ID3D11DeviceContextX::GSGetLastUsedParameters. GSGetLastUsedParameters can also be used to query the last values submitted to GSSetParameters, taking into account any clamping of overridden values by the driver. To revert to the default parameters, call GSSetParameters with nullptr as the argument.
When onchip geometry shader mode is enabled, the driver attempts to size VerticesPerSubgroup and PrimitivesPerSubgroup to fit within a 32kb LDS allocation. A ratio of one unique input vertex per input primitive is assumed, which can be overridden with the VerticesPerPrimitiveRatio field. The 32kb LDS allocation target can be restricted with the LdsAllocationLimit field. VerticesPerSubgroup and PrimitivesPerSubgroup can be set explicitly through their respective fields, bypassing the default heuristic. If VerticesPerSubgroup and/or PrimitivesPerSubgroup are overridden, and VerticesPerPrimitiveRatio and/or LdsAllocationLimit are also overridden, the driver will perform the default heuristic, but will use the supplied VerticesPerSubgroup and PrimitivesPerSubgroup as upper limits for the calculation.
While it is possible to override VerticesPerSubgroup and PrimitivesPerSubgroup for offchip mode, this is not expected to provide a noticeable benefit.
Header: Declared in d3d11_x.h.
Library: Use d3d11_x.lib.