src/third_party/angle/src/tests/gl_tests/IndexBufferOffsetTest.cpp
// Uses index buffer offset and 2 drawElement calls one of the other with different counts,
// makes sure the second drawElement call will have its data available.
Uses index buffer offset and 2 drawElement calls one of the other with different counts,
makes sure the second drawElement call will have its data available.
Uses index buffer offset and 2 drawElement calls one of the other with different counts makes sure the second drawElement call will have its data available .
TEST_P(IndexBufferOffsetTest, DrawWithDifferentCountsSameOffset)
{
    GLubyte indexData[] = {99, 0, 1, 2, 1, 2, 3};
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);
    size_t indexDataWidth = 7 * sizeof(GLubyte);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexDataWidth, indexData, GL_DYNAMIC_DRAW);
    glUseProgram(mProgram);
    glBindBuffer(GL_ARRAY_BUFFER, mVertexBuffer);
    glVertexAttribPointer(mPositionAttributeLocation, 2, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(mPositionAttributeLocation);
    glUniform4f(mColorUniformLocation, 1.0f, 0.0f, 0.0f, 1.0f);
    glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, reinterpret_cast<void *>(1));
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, reinterpret_cast<void *>(1));
    EXPECT_PIXEL_COLOR_EQ(0, getWindowHeight() / 4, GLColor::red);
    EXPECT_PIXEL_COLOR_EQ(getWindowWidth() - 1, getWindowHeight() - 1, GLColor::red);
    EXPECT_GL_NO_ERROR();
}
TEST_P ( IndexBufferOffsetTest , DrawWithDifferentCountsSameOffset ) { GLubyte indexData [ ] = { 99 , 0 , 1 , 2 , 1 , 2 , 3 } ; glClearColor ( 0.0f , 0.0f , 0.0f , 1.0f ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; size_t indexDataWidth = 7 * sizeof ( GLubyte ) ; glBufferData ( GL_ELEMENT_ARRAY_BUFFER , indexDataWidth , indexData , GL_DYNAMIC_DRAW ) ; glUseProgram ( mProgram ) ; glBindBuffer ( GL_ARRAY_BUFFER , mVertexBuffer ) ; glVertexAttribPointer ( mPositionAttributeLocation , 2 , GL_FLOAT , GL_FALSE , 0 , 0 ) ; glEnableVertexAttribArray ( mPositionAttributeLocation ) ; glUniform4f ( mColorUniformLocation , 1.0f , 0.0f , 0.0f , 1.0f ) ; glDrawElements ( GL_TRIANGLES , 3 , GL_UNSIGNED_BYTE , reinterpret_cast < void * > ( 1 ) ) ; glDrawElements ( GL_TRIANGLES , 6 , GL_UNSIGNED_BYTE , reinterpret_cast < void * > ( 1 ) ) ; EXPECT_PIXEL_COLOR_EQ ( 0 , getWindowHeight ( ) / 4 , GLColor :: red ) ; EXPECT_PIXEL_COLOR_EQ ( getWindowWidth ( ) - 1 , getWindowHeight ( ) - 1 , GLColor :: red ) ; EXPECT_GL_NO_ERROR ( ) ; }
Uses index buffer offset and 2 drawElement calls one of the other with different counts,
makes sure the second drawElement call will have its data available.
Uses index buffer offset and 2 drawElement calls one of the other with different counts makes sure the second drawElement call will have its data available .
// The first draw draws the first triangle, and the second draws a quad. // Check the upper left triangle // Check the down right triangle