Commit 9c0e3063 by Yuly Novikov Committed by Commit Bot

Fix several of PointSpritesTest

PointWithoutAttributesCompliance, PointCoordRegressionTest, PointSpriteAlternatingDrawTypes were failing on Nexus 5X Vulkan, because pointSizeRange is [1,1] there, and the tests assume they can use point sizes larger than 1. Fix the tests to check whether the point size they want to use is available. Note: PointWithoutAttributesCompliance and PointSpriteAlternatingDrawTypes can actually work with size 1, though they need to calculate center pixel more accurately. However, looks like there is a bug in Nexus 5X driver, and no pixels are rendered. The tests do pass on Pixel 2. Bug: angleproject:2447 Change-Id: I511574b1b11f2516c10209b85f86b3e7052e6686 Reviewed-on: https://chromium-review.googlesource.com/1026979 Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 7ce4a151
...@@ -22,6 +22,9 @@ constexpr char kVertexShaderSource[] = ...@@ -22,6 +22,9 @@ constexpr char kVertexShaderSource[] =
gl_Position = vPosition; gl_Position = vPosition;
})"; })";
// TODO(ynovikov): Improve the tests to work with point size 1. http://anglebug.com/2553
constexpr GLfloat kMinMaxPointSize = 2.0f;
class PointSpritesTest : public ANGLETest class PointSpritesTest : public ANGLETest
{ {
protected: protected:
...@@ -170,9 +173,10 @@ TEST_P(PointSpritesTest, PointWithoutAttributesCompliance) ...@@ -170,9 +173,10 @@ TEST_P(PointSpritesTest, PointWithoutAttributesCompliance)
// http://anglebug.com/1643 // http://anglebug.com/1643
ANGLE_SKIP_TEST_IF(IsAMD() && IsDesktopOpenGL() && IsWindows()); ANGLE_SKIP_TEST_IF(IsAMD() && IsDesktopOpenGL() && IsWindows());
// TODO(lucferron): Failing on Android/Vulkan. Investigate and fix. GLfloat pointSizeRange[2] = {};
// http://anglebug.com/2447 glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pointSizeRange);
ANGLE_SKIP_TEST_IF(IsVulkan() && IsAndroid()); GLfloat maxPointSize = pointSizeRange[1];
ANGLE_SKIP_TEST_IF(maxPointSize < kMinMaxPointSize);
const std::string vs = const std::string vs =
R"(void main() R"(void main()
...@@ -201,9 +205,10 @@ TEST_P(PointSpritesTest, PointCoordRegressionTest) ...@@ -201,9 +205,10 @@ TEST_P(PointSpritesTest, PointCoordRegressionTest)
// http://anglebug.com/1643 // http://anglebug.com/1643
ANGLE_SKIP_TEST_IF(IsAMD() && IsDesktopOpenGL() && IsWindows()); ANGLE_SKIP_TEST_IF(IsAMD() && IsDesktopOpenGL() && IsWindows());
// TODO(lucferron): Failing on Android/Vulkan. Investigate and fix. GLfloat pointSizeRange[2] = {};
// http://anglebug.com/2447 glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pointSizeRange);
ANGLE_SKIP_TEST_IF(IsVulkan() && IsAndroid()); GLfloat maxPointSize = pointSizeRange[1];
ANGLE_SKIP_TEST_IF(maxPointSize < kMinMaxPointSize);
const std::string fs = const std::string fs =
R"(precision mediump float; R"(precision mediump float;
...@@ -238,13 +243,6 @@ TEST_P(PointSpritesTest, PointCoordRegressionTest) ...@@ -238,13 +243,6 @@ TEST_P(PointSpritesTest, PointCoordRegressionTest)
glUseProgram(program); glUseProgram(program);
GLfloat pointSizeRange[2] = {};
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pointSizeRange);
GLfloat maxPointSize = pointSizeRange[1];
ASSERT_TRUE(maxPointSize > 2);
glClearColor(0, 0, 0, 1); glClearColor(0, 0, 0, 1);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
...@@ -428,14 +426,17 @@ TEST_P(PointSpritesTest, PointSizeDeclaredButUnused) ...@@ -428,14 +426,17 @@ TEST_P(PointSpritesTest, PointSizeDeclaredButUnused)
// spites. // spites.
TEST_P(PointSpritesTest, PointSpriteAlternatingDrawTypes) TEST_P(PointSpritesTest, PointSpriteAlternatingDrawTypes)
{ {
// TODO(lucferron): Failing on Android/Vulkan. Investigate and fix. GLfloat pointSizeRange[2] = {};
// http://anglebug.com/2447 glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pointSizeRange);
ANGLE_SKIP_TEST_IF(IsVulkan() && IsAndroid()); GLfloat maxPointSize = pointSizeRange[1];
ANGLE_SKIP_TEST_IF(maxPointSize < kMinMaxPointSize);
const std::string pointVS = const std::string pointVS =
R"(void main() R"(uniform float u_pointSize;
void main()
{ {
gl_PointSize = 16.0; gl_PointSize = u_pointSize;
gl_Position = vec4(0.0, 0.0, 0.0, 1.0); gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
})"; })";
...@@ -460,6 +461,12 @@ TEST_P(PointSpritesTest, PointSpriteAlternatingDrawTypes) ...@@ -460,6 +461,12 @@ TEST_P(PointSpritesTest, PointSpriteAlternatingDrawTypes)
glDrawArrays(GL_TRIANGLES, 0, 6); glDrawArrays(GL_TRIANGLES, 0, 6);
glUseProgram(pointProgram); glUseProgram(pointProgram);
GLint pointSizeLoc = glGetUniformLocation(pointProgram, "u_pointSize");
ASSERT_GL_NO_ERROR();
GLfloat pointSize = std::min<GLfloat>(16.0f, maxPointSize);
glUniform1f(pointSizeLoc, pointSize);
ASSERT_GL_NO_ERROR();
glDrawArrays(GL_POINTS, 0, 1); glDrawArrays(GL_POINTS, 0, 1);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
......
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