D3D9: Improve varying packing failure mode.
D3D9 has a special limitation on varying packing, where each
variable takes up a full register width, and cannot share space
with other packed varyings.
A bug was counting registers incorrectly on D3D9. Fix this by
introducing a new limitation exposed to the ANGLE front-end via
the gl::Limitations structure. Now varying packing will fail
correctly in the ANGLE linking front-end with a more descriptive
error message, as such:
"Could not pack varying blah"
"Note: Additional non-conformant packing restrictions are enforced on D3D9."
Also change the packing so that input built-in variables are
counted towards varying limits (e.g. gl_PointSize), except for
gl_Position. On D3D9 we don't pack gl_PointSize, since it is
used in a special extra PSIZE register.
Also update some tests to be more robust.
Bug: chromium:804799
Change-Id: I9027266a8b66a28626f038f259bff42ebf09dcd2
Reviewed-on: https://chromium-review.googlesource.com/889898
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index fffaaab..657bc18 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -986,8 +986,16 @@
// Map the varyings to the register file
// In WebGL, we use a slightly different handling for packing variables.
- auto packMode = data.getExtensions().webglCompatibility ? PackMode::WEBGL_STRICT
- : PackMode::ANGLE_RELAXED;
+ gl::PackMode packMode = PackMode::ANGLE_RELAXED;
+ if (data.getLimitations().noFlexibleVaryingPacking)
+ {
+ // D3D9 pack mode is strictly more strict than WebGL, so takes priority.
+ packMode = PackMode::ANGLE_NON_CONFORMANT_D3D9;
+ }
+ else if (data.getExtensions().webglCompatibility)
+ {
+ packMode = PackMode::WEBGL_STRICT;
+ }
ProgramLinkedResources resources = {
{data.getCaps().maxVaryingVectors, packMode},