1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

LibGL: Immediately dereference vertex attribute data in display lists

According to the spec, pointers to client data need to be dereferenced
immediately when adding calls such as `glDrawElements` or
`glArrayElement` to a display list. We were trying to support display
lists for these calls but since they only invoke _other_ calls that also
support display lists, we can simply defer the display list
functionality to them.

This fixes the rendering of the ClassiCube port by cflip.
This commit is contained in:
Jelle Raaijmakers 2022-10-16 19:14:53 +02:00 committed by Linus Groh
parent 0ea4d228e6
commit 0cf3cb6279
4 changed files with 32 additions and 6 deletions

View file

@ -252,3 +252,29 @@ TEST_CASE(0008_test_pop_matrix_regression)
context->present();
expect_bitmap_equals_reference(context->frontbuffer(), "0008_test_pop_matrix_regression"sv);
}
TEST_CASE(0009_test_draw_elements_in_display_list)
{
auto context = create_testing_context(64, 64);
glColor3f(0.f, 0.f, 1.f);
glEnableClientState(GL_VERTEX_ARRAY);
auto const list_index = glGenLists(1);
glNewList(list_index, GL_COMPILE);
float vertices[] = { 0.f, .5f, -.5f, -.5f, .5f, -.5f };
glVertexPointer(2, GL_FLOAT, 0, &vertices);
u8 indices[] = { 0, 1, 2 };
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, &indices);
glEndList();
// Modifying an index here should not have an effect
indices[0] = 2;
glCallList(list_index);
EXPECT_EQ(glGetError(), 0u);
context->present();
expect_bitmap_equals_reference(context->frontbuffer(), "0009_test_draw_elements_in_display_list"sv);
}