D3D9: Write dummy output for depth/stencil only draw.
This prevents a spurious D3D runtime warning, which was clogging up
some of our test output.
BUG=angleproject:1660
Change-Id: I1a747ba7532323b989dbed1ee7c78b3b457768a6
Reviewed-on: https://chromium-review.googlesource.com/437724
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/DynamicHLSL.cpp b/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
index 2b8e2ec..e81fde1 100644
--- a/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
+++ b/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
@@ -267,16 +267,21 @@
declarationStream << "struct PS_OUTPUT\n"
"{\n";
- for (size_t layoutIndex = 0; layoutIndex < outputLayout.size(); ++layoutIndex)
+ // Workaround for HLSL 3.x: We can't do a depth/stencil only render, the runtime will complain.
+ size_t numOutputs = outputLayout.empty() ? 1u : outputLayout.size();
+ const PixelShaderOutputVariable defaultOutput(GL_FLOAT_VEC4, "dummy", "float4(0, 0, 0, 1)", 0);
+
+ for (size_t layoutIndex = 0; layoutIndex < numOutputs; ++layoutIndex)
{
- GLenum binding = outputLayout[layoutIndex];
+ GLenum binding = outputLayout.empty() ? GL_COLOR_ATTACHMENT0 : outputLayout[layoutIndex];
if (binding != GL_NONE)
{
unsigned int location = (binding - GL_COLOR_ATTACHMENT0);
const PixelShaderOutputVariable *outputVariable =
- FindOutputAtLocation(outputVariables, location);
+ outputLayout.empty() ? &defaultOutput
+ : FindOutputAtLocation(outputVariables, location);
// OpenGL ES 3.0 spec $4.2.1
// If [...] not all user-defined output variables are written, the values of fragment