Emulate large and negative viewports on D3D11 Feature Level 9_3
Like D3D9, D3D11 Feature Level 9_3 doesn't support large or negative
viewports. We have to emulate these in the vertex shader.
BUG=angle:858
Change-Id: I2bd53e3921dc3590cc7193164d73596deafca9ea
Reviewed-on: https://chromium-review.googlesource.com/236040
Tested-by: Austin Kinross <aukinros@microsoft.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 488f2e3..9445b09 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -511,14 +511,21 @@
if (mOutputType == SH_HLSL11_OUTPUT)
{
+ out << "cbuffer DriverConstants : register(b1)\n"
+ "{\n";
+
if (mUsesDepthRange)
{
- out << "cbuffer DriverConstants : register(b1)\n"
- "{\n"
- " float3 dx_DepthRange : packoffset(c0);\n"
- "};\n"
- "\n";
+ out << " float3 dx_DepthRange : packoffset(c0);\n";
}
+
+ // dx_ViewAdjust will only be used in Feature Level 9 shaders.
+ // However, we declare it for all shaders (including Feature Level 10+).
+ // The bytecode is the same whether we declare it or not, since D3DCompiler removes it if it's unused.
+ out << " float4 dx_ViewAdjust : packoffset(c1);\n";
+
+ out << "};\n"
+ "\n";
}
else
{