0
\$\begingroup\$

I try this and work only first rect.

D3D11_RECT rc[2];
rc[0] = {0, 0, 16, 16};
rc[1] = {32, 32, 64, 64};

m_d3d11DevCon->RSSetScissorRects( 2, rc );
\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Documentation link: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476478(v=vs.85).aspx

Which scissor rectangle to use is determined by the SV_ViewportArrayIndex semantic output by a geometry shader (see shader semantic syntax). If a geometry shader does not make use of the SV_ViewportArrayIndex semantic then Direct3D will use the first scissor rectangle in the array.

Each scissor rectangle in the array corresponds to a viewport in an array of viewports (see ID3D11DeviceContext::RSSetViewports).

The conditions for being able to use multiple scissor rectangles are therefore:

  • You must also be using an array of viewports.
  • Each scissor rect needs a corresponding viewport.
  • the geometry shader stage must be active.
  • The geometry shader must write to SV_ViewportArrayIndex which determines both the viewport and scissor rect to use.

Otherwise the behaviour is that only the first scissor rect is used.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ The quote is a little misleading, but the next one on that MSDN page is most relevant: "Each scissor rectangle in the array corresponds to a viewport in an array of viewports (see ID3D11DeviceContext::RSSetViewports)." \$\endgroup\$ Commented Apr 23, 2018 at 5:26

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.