Hash :
fcb6b5a5
Author :
Date :
2020-11-25T22:16:15
Vulkan: Fix precision transformation for geometry shaders
When a varying precision mismatch is present between two stages, the
SPIR-V transformer transforms the following:
in precision1 type1 inVar;
out precision2 type2 outVar;
void main()
{
f(inVar);
outVar = g();
}
to:
in precision3 type1 inVarModified;
out precision4 type2 outVarModified;
precision1 type1 inVarTurnedPrivate;
precision2 type2 outVarTurnedPrivate;
void main()
{
// Input preamble
inVarTurnedPrivate = inVarModified;
f(inVarTurnedPrivate);
outVarTurnedPrivate = g();
// Output preamble
outVarModified = outVarTurnedPrivate;
}
This doesn't work for geometry shaders as they take the varying outputs
on EmitVertex() as opposed to return from main. This change simply
places the output preamble before every EmitVertex() instead of at the
end of the shader, if it's a geometry shader.
Bug: angleproject:5403
Change-Id: Ie395a3270c6903c54b49f64a26bc5297044cbaeb
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2561939
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>