Start D3D constant register allocations from 1 on NVIDIA

Recent NVIDIA drivers have a bug where a specific optimized path
inside the driver doesn't handle constant register 0 correctly. Work
around this by starting constant register allocations from 1. This
should make sure that the bug doesn't trigger if the ordering of
uniforms is changed on the D3D backend.

The repro case seems to require some specific driver state to be set
that's used inside Chromium. Because of this we have not been able to
develop a standalone test case so far.

The maximum number of available uniform slots is reduced accordingly.
This should not take them below required minimums in the spec.

BUG=angleproject:2294
TEST=WebGL tests on passthrough command buffer,
     angle_end2end_tests --gtest_filter=*GLSLTest*Uniform*

Change-Id: I92fff71efe5432ea7f15a7e90d497492514c65dc
Reviewed-on: https://chromium-review.googlesource.com/847481
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index f4342b4..ac61d31 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -191,10 +191,14 @@
     mExcessiveLoopIndex = nullptr;
 
     mStructureHLSL       = new StructureHLSL;
-    mUniformHLSL         = new UniformHLSL(shaderType, mStructureHLSL, outputType, uniforms);
     mTextureFunctionHLSL = new TextureFunctionHLSL;
     mImageFunctionHLSL   = new ImageFunctionHLSL;
 
+    unsigned int firstUniformRegister =
+        ((compileOptions & SH_SKIP_D3D_CONSTANT_REGISTER_ZERO) != 0) ? 1u : 0u;
+    mUniformHLSL =
+        new UniformHLSL(shaderType, mStructureHLSL, outputType, uniforms, firstUniformRegister);
+
     if (mOutputType == SH_HLSL_3_0_OUTPUT)
     {
         // Fragment shaders need dx_DepthRange, dx_ViewCoords and dx_DepthFront.