Move stencil mask validation to before the draw.

ANGLE (and WebGL) restrict the back and front stencil masks
on draw, due to D3D restrictions. We would previously only
validate this if the stencil was enabled in D3D9. In D3D11
we would validate the stencil masks even if the stencil is
disabled, which is the behaviour the spec suggests.

Moving the error check to before the draw also prevents any
issue with interrupting a draw call mid-way through.

BUG=angle:571
BUG=378754

Change-Id: If7651c2be559eef64a872082e144dafa3b2c524b
Reviewed-on: https://chromium-review.googlesource.com/203299
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
5 files changed