Commit 66a0819c by Jamie Madill Committed by Commit Bot

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/437724Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 94d8222f
......@@ -267,16 +267,21 @@ std::string DynamicHLSL::generatePixelShaderForOutputSignature(
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
......
......@@ -40,10 +40,19 @@ class ShaderD3D;
struct PixelShaderOutputVariable
{
GLenum type;
PixelShaderOutputVariable() {}
PixelShaderOutputVariable(GLenum typeIn,
const std::string &nameIn,
const std::string &sourceIn,
size_t outputIndexIn)
: type(typeIn), name(nameIn), source(sourceIn), outputIndex(outputIndexIn)
{
}
GLenum type = GL_NONE;
std::string name;
std::string source;
size_t outputIndex;
size_t outputIndex = 0;
};
struct BuiltinVarying final : angle::NonCopyable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment