Commit a836b466 by Jamie Madill Committed by Commit Bot

D3D11: Allow no-op pixel shader output.

On HLSL 4+, the debug runtime issues a warning when we try to render to a color output in the pixel shader that doesn't have a matching render target bound. This happens when doing a depth or stencil-only render pass. We only need to bind a dummy output in HLSL 3, so tighten the workaround we had in place and fix the warning for D3D11. BUG=angleproject:2025 Change-Id: I16ba9e907f3a6e59afff93fe4583d084cbdf42c5 Reviewed-on: https://chromium-review.googlesource.com/617268Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent b18c33e9
......@@ -2853,7 +2853,7 @@ Error Context::prepareForDraw(GLenum drawMode)
InfoLog infoLog;
Error err = mImplementation->triggerDrawCallProgramRecompilation(this, &infoLog,
mMemoryProgramCache, drawMode);
if (err.isError())
if (err.isError() || infoLog.getLength() > 0)
{
WARN() << "Dynamic recompilation error log: " << infoLog.str();
}
......
......@@ -294,8 +294,13 @@ std::string DynamicHLSL::generatePixelShaderForOutputSignature(
declarationStream << "struct PS_OUTPUT\n"
"{\n";
size_t numOutputs = outputLayout.size();
// 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();
if (numOutputs == 0 && (shaderModel == 3 || !mRenderer->getShaderModelSuffix().empty()))
{
numOutputs = 1u;
}
const PixelShaderOutputVariable defaultOutput(GL_FLOAT_VEC4, "dummy", "float4(0, 0, 0, 1)", 0);
for (size_t layoutIndex = 0; layoutIndex < numOutputs; ++layoutIndex)
......
......@@ -326,6 +326,10 @@ gl::Error Context11::triggerDrawCallProgramRecompilation(const gl::Context *cont
{
ShaderExecutableD3D *vertexExe = nullptr;
ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(&vertexExe, infoLog));
if (!programD3D->hasVertexExecutableForCachedInputLayout())
{
return gl::InternalError() << "Error compiling dynamic vertex executable.";
}
}
if (recompileGS)
......@@ -333,12 +337,20 @@ gl::Error Context11::triggerDrawCallProgramRecompilation(const gl::Context *cont
ShaderExecutableD3D *geometryExe = nullptr;
ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(
context->getContextState(), drawMode, &geometryExe, infoLog));
if (!programD3D->hasGeometryExecutableForPrimitiveType(drawMode))
{
return gl::InternalError() << "Error compiling dynamic geometry executable.";
}
}
if (recompilePS)
{
ShaderExecutableD3D *pixelExe = nullptr;
ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(&pixelExe, infoLog));
if (!programD3D->hasPixelExecutableForCachedOutputLayout())
{
return gl::InternalError() << "Error compiling dynamic pixel executable.";
}
}
// Refresh the program cache entry.
......
......@@ -808,6 +808,12 @@ void WebGLFramebufferTest::testDrawingMissingAttachment()
// Determine if we can attach both color and depth or color and depth_stencil
TEST_P(WebGLFramebufferTest, CheckValidColorDepthCombination)
{
// In FL9_3, we don't have a good way to handle non-color framebuffer rendering.
if (IsD3D11_FL93())
{
ignoreD3D11SDKLayersWarnings();
}
GLenum depthFormat = GL_NONE;
GLenum depthAttachment = GL_NONE;
......
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