Commit 93061d4e by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Support vertex-only line emulation draw with xfb

The code that patches the line raster emulation directive assumed both vertex and fragment shaders would be present. This is invalid if only a vertex shader is present. This change adds the directive to any stage that's available. This includes the possibility of a missing vertex shader also, which can be useful for separable shaders and program pipeline objects. Bug: angleproject:3394 Change-Id: I84555db81b59c318300003f7108a01f330e4259f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1982782 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent 35e6050f
......@@ -1280,22 +1280,16 @@ angle::Result GlslangGetShaderSpirvCode(GlslangErrorCallback callback,
gl::ShaderMap<std::string> patchedSources = shaderSources;
// #defines must come after the #version directive.
ANGLE_GLSLANG_CHECK(callback,
angle::ReplaceSubstring(&patchedSources[gl::ShaderType::Vertex],
kVersionDefine, kLineRasterDefine),
GlslangError::InvalidShader);
ANGLE_GLSLANG_CHECK(callback,
angle::ReplaceSubstring(&patchedSources[gl::ShaderType::Fragment],
kVersionDefine, kLineRasterDefine),
GlslangError::InvalidShader);
if (!shaderSources[gl::ShaderType::Geometry].empty())
for (const gl::ShaderType shaderType : gl::kAllGraphicsShaderTypes)
{
ANGLE_GLSLANG_CHECK(callback,
angle::ReplaceSubstring(&patchedSources[gl::ShaderType::Geometry],
kVersionDefine, kLineRasterDefine),
GlslangError::InvalidShader);
if (!shaderSources[shaderType].empty())
{
// #defines must come after the #version directive.
ANGLE_GLSLANG_CHECK(callback,
angle::ReplaceSubstring(&patchedSources[shaderType],
kVersionDefine, kLineRasterDefine),
GlslangError::InvalidShader);
}
}
return GetShaderSpirvCode(callback, glCaps, patchedSources, shaderCodeOut);
......
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