@@ -1036,6 +1036,65 @@ TEST_P(RobustBufferAccessBehaviorTest, OutOfBoundsIndexBuffers)
10361036 DrawAndVerifyOutOfBoundsIndex (/* StartIndex*/ numberOfQuads - 4 );
10371037}
10381038
1039+ // DrawArray with both color and position attribute data interleaved in the same buffer.
1040+ TEST_P (RobustBufferAccessBehaviorTest, DrawArraysWithInterleavedAttributeData)
1041+ {
1042+ ANGLE_SKIP_TEST_IF (!initExtension ());
1043+
1044+ constexpr char vert[] =
1045+ " attribute vec2 v_position;\n "
1046+ " attribute vec4 a_color;\n "
1047+ " varying vec4 v_color;\n "
1048+ " void main() {\n "
1049+ " gl_Position = vec4(v_position, 0.0, 1.0);\n "
1050+ " v_color = a_color;\n "
1051+ " }\n " ;
1052+
1053+ constexpr char frag[] =
1054+ " precision mediump float;\n "
1055+ " varying vec4 v_color;\n "
1056+ " void main() {\n "
1057+ " gl_FragColor = v_color;\n "
1058+ " }\n " ;
1059+
1060+ ANGLE_GL_PROGRAM (prog, vert, frag);
1061+
1062+ glClearColor (0 .0f , 0 .0f , 0 .0f , 1 .0f );
1063+ glClear (GL_COLOR_BUFFER_BIT);
1064+
1065+ // Draw a red quad covering the whole screen. On Xclipse devices this is
1066+ // rendered as if the final vertex is transparent black rather than red.
1067+ std::array<std::pair<Vector2, GLColor32F>, 6 > vertices = {{{{-1 .0f , 1 .0f }, kFloatRed },
1068+ {{-1 .0f , -1 .0f }, kFloatRed },
1069+ {{1 .0f , -1 .0f }, kFloatRed },
1070+ {{-1 .0f , 1 .0f }, kFloatRed },
1071+ {{1 .0f , -1 .0f }, kFloatRed },
1072+ {{1 .0f , 1 .0f }, kFloatRed }}};
1073+
1074+ GLBuffer vertexBuffer;
1075+ glBindBuffer (GL_ARRAY_BUFFER, vertexBuffer);
1076+ glBufferData (GL_ARRAY_BUFFER, sizeof (vertices[0 ]) * vertices.size (), vertices.data (),
1077+ GL_STATIC_DRAW);
1078+ glUseProgram (prog);
1079+ const GLint positionLocation = glGetAttribLocation (prog, " v_position" );
1080+ ASSERT_NE (-1 , positionLocation);
1081+ glVertexAttribPointer (positionLocation, 2 , GL_FLOAT, GL_FALSE, sizeof (vertices[0 ]), 0 );
1082+ glEnableVertexAttribArray (positionLocation);
1083+ const GLint colorLocation = glGetAttribLocation (prog, " a_color" );
1084+ ASSERT_NE (-1 , colorLocation);
1085+ glVertexAttribPointer (colorLocation, 4 , GL_FLOAT, GL_FALSE, sizeof (vertices[0 ]),
1086+ reinterpret_cast <const void *>(sizeof (Vector2)));
1087+ glEnableVertexAttribArray (colorLocation);
1088+
1089+ glDrawArrays (GL_TRIANGLES, 0 , 6 );
1090+
1091+ EXPECT_PIXEL_COLOR_EQ (0 , getWindowHeight () - 1 , GLColor::red);
1092+ EXPECT_PIXEL_COLOR_EQ (0 , 0 , GLColor::red);
1093+ EXPECT_PIXEL_COLOR_EQ (getWindowWidth () - 1 , 0 , GLColor::red);
1094+ EXPECT_PIXEL_COLOR_EQ (getWindowWidth () - 1 , getWindowHeight () - 1 , GLColor::red);
1095+ EXPECT_GL_NO_ERROR ();
1096+ }
1097+
10391098ANGLE_INSTANTIATE_TEST (RobustBufferAccessBehaviorTest,
10401099 WithNoFixture (ES3_VULKAN()),
10411100 WithNoFixture(ES3_OPENGL()),
0 commit comments