summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/tests/gl_tests/TransformFeedbackTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/angle/src/tests/gl_tests/TransformFeedbackTest.cpp')
-rwxr-xr-xgfx/angle/src/tests/gl_tests/TransformFeedbackTest.cpp77
1 files changed, 4 insertions, 73 deletions
diff --git a/gfx/angle/src/tests/gl_tests/TransformFeedbackTest.cpp b/gfx/angle/src/tests/gl_tests/TransformFeedbackTest.cpp
index 73c8a20d5..3370a0888 100755
--- a/gfx/angle/src/tests/gl_tests/TransformFeedbackTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/TransformFeedbackTest.cpp
@@ -742,20 +742,14 @@ TEST_P(TransformFeedbackTest, PackingBug)
GLint attrib1Loc = glGetAttribLocation(mProgram, "inAttrib1");
GLint attrib2Loc = glGetAttribLocation(mProgram, "inAttrib2");
- std::vector<Vector2> attrib1Data;
- std::vector<Vector2> attrib2Data;
- int counter = 0;
- for (size_t i = 0; i < 6; i++) {
- attrib1Data.push_back(Vector2(counter + 0.0f, counter + 1.0f));
- attrib2Data.push_back(Vector2(counter + 2.0f, counter + 3.0f));
- counter += 4;
- }
+ Vector2 attrib1Data[] = {Vector2(1.0, 2.0), Vector2(3.0, 4.0), Vector2(5.0, 6.0)};
+ Vector2 attrib2Data[] = {Vector2(11.0, 12.0), Vector2(13.0, 14.0), Vector2(15.0, 16.0)};
glEnableVertexAttribArray(attrib1Loc);
glEnableVertexAttribArray(attrib2Loc);
- glVertexAttribPointer(attrib1Loc, 2, GL_FLOAT, GL_FALSE, 0, attrib1Data.data());
- glVertexAttribPointer(attrib2Loc, 2, GL_FLOAT, GL_FALSE, 0, attrib2Data.data());
+ glVertexAttribPointer(attrib1Loc, 2, GL_FLOAT, GL_FALSE, 0, attrib1Data);
+ glVertexAttribPointer(attrib2Loc, 2, GL_FLOAT, GL_FALSE, 0, attrib2Data);
glUseProgram(mProgram);
glBeginTransformFeedback(GL_TRIANGLES);
@@ -829,69 +823,6 @@ TEST_P(TransformFeedbackTest, OptimizedVaryings)
ASSERT_NE(0u, mProgram);
}
-// Test an edge case where two varyings are unreferenced in the frag shader.
-TEST_P(TransformFeedbackTest, TwoUnreferencedInFragShader)
-{
- // TODO(jmadill): With points and rasterizer discard?
- const std::string &vertexShaderSource =
- "#version 300 es\n"
- "in vec3 position;\n"
- "out vec3 outAttrib1;\n"
- "out vec3 outAttrib2;\n"
- "void main() {"
- " outAttrib1 = position;\n"
- " outAttrib2 = position;\n"
- " gl_Position = vec4(position, 1);\n"
- "}";
-
- const std::string &fragmentShaderSource =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 color;\n"
- "in vec3 outAttrib1;\n"
- "in vec3 outAttrib2;\n"
- "void main() {\n"
- " color = vec4(0);\n"
- "}";
-
- std::vector<std::string> tfVaryings;
- tfVaryings.push_back("outAttrib1");
- tfVaryings.push_back("outAttrib2");
-
- mProgram = CompileProgramWithTransformFeedback(vertexShaderSource, fragmentShaderSource,
- tfVaryings, GL_INTERLEAVED_ATTRIBS);
- ASSERT_NE(0u, mProgram);
-
- glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, mTransformFeedbackBuffer);
- glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, sizeof(Vector3) * 2 * 6, nullptr, GL_STREAM_DRAW);
-
- glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, mTransformFeedback);
- glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, mTransformFeedbackBuffer);
-
- glUseProgram(mProgram);
- glBeginTransformFeedback(GL_TRIANGLES);
- drawQuad(mProgram, "position", 0.5f);
- glEndTransformFeedback();
- glUseProgram(0);
- ASSERT_GL_NO_ERROR();
-
- const GLvoid *mapPointer =
- glMapBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, sizeof(Vector2) * 2 * 6, GL_MAP_READ_BIT);
- ASSERT_NE(nullptr, mapPointer);
-
- const auto &quadVertices = GetQuadVertices();
-
- const Vector3 *vecPointer = static_cast<const Vector3 *>(mapPointer);
- for (unsigned int vectorIndex = 0; vectorIndex < 3; ++vectorIndex)
- {
- unsigned int stream1Index = vectorIndex * 2;
- unsigned int stream2Index = vectorIndex * 2 + 1;
- EXPECT_EQ(quadVertices[vectorIndex], vecPointer[stream1Index]);
- EXPECT_EQ(quadVertices[vectorIndex], vecPointer[stream2Index]);
- }
-
- ASSERT_GL_NO_ERROR();
-}
class TransformFeedbackLifetimeTest : public TransformFeedbackTest
{
protected: