D3D11: Add support for multiview layered rendering

A branch is added in the geometry shader to select either the
viewport, or texture layer which is being rendered to based on the
value of a uniform in the driver constant buffer. Using this approach
there is no need for separate programs for side-by-side and layered
rendering.

BUG=angleproject:2062
TEST=angle_end2end_tests

Change-Id: I66701164ff02a851c13695d5409f8ad350534e69
Reviewed-on: https://chromium-review.googlesource.com/645547
Commit-Queue: Martin Radev <mradev@nvidia.com>
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 9bcfe8c..b19e81c 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -518,6 +518,13 @@
                 out << "    float2 dx_ViewScale : packoffset(c3);\n";
             }
 
+            if (mHasMultiviewExtensionEnabled)
+            {
+                // We have to add a value which we can use to keep track of which multi-view code
+                // path is to be selected in the GS.
+                out << "    float multiviewSelectViewportIndex : packoffset(c3.z);\n";
+            }
+
             if (mOutputType == SH_HLSL_4_1_OUTPUT)
             {
                 mUniformHLSL->samplerMetadataUniforms(out, "c4");
@@ -631,6 +638,13 @@
             out << "    float2 dx_ViewCoords : packoffset(c2);\n";
             out << "    float2 dx_ViewScale  : packoffset(c3);\n";
 
+            if (mHasMultiviewExtensionEnabled)
+            {
+                // We have to add a value which we can use to keep track of which multi-view code
+                // path is to be selected in the GS.
+                out << "    float multiviewSelectViewportIndex : packoffset(c3.z);\n";
+            }
+
             if (mOutputType == SH_HLSL_4_1_OUTPUT)
             {
                 mUniformHLSL->samplerMetadataUniforms(out, "c4");