Clamp point size to maximum point size from the API on NVIDIA
NVIDIA OpenGL drivers have a bug where the point size range is being
reported incorrectly - it appears the core GL driver incorrectly gives
the range for smooth points, when it should be giving the range for
aliased points. Clamp the actual point size to the maximum point size
reported from the API so that the GLES spec is followed.
The same workaround seems to be necessary also on Android. The issue
was revealed by the trybots, and has not been fully diagnosed though.
The newly added test fails on AMD OpenGL.
As a part of this change, the existing tests in PointSpritesTest are
refactored to use gl_raii.
BUG=chromium:740560
TEST=angle_end2end_tests
Change-Id: Ic4a66c9ea16f5ae76beb3bb6577716d10c3b226e
Reviewed-on: https://chromium-review.googlesource.com/574598
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index 3c3983a..ab89e9a 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -13,6 +13,7 @@
#include "compiler/translator/AddAndTrueToLoopCondition.h"
#include "compiler/translator/Cache.h"
#include "compiler/translator/CallDAG.h"
+#include "compiler/translator/ClampPointSize.h"
#include "compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h"
#include "compiler/translator/DeferGlobalInitializers.h"
#include "compiler/translator/EmulateGLFragColorBroadcast.h"
@@ -547,6 +548,12 @@
SeparateDeclarations(root);
InitializeUninitializedLocals(root, getShaderVersion());
}
+
+ if (success && getShaderType() == GL_VERTEX_SHADER &&
+ (compileOptions & SH_CLAMP_POINT_SIZE))
+ {
+ ClampPointSize(root, compileResources.MaxPointSize, &getSymbolTable());
+ }
}
if (success)