Fix failing test

This commit is contained in:
Luke Benstead 2026-06-23 06:23:52 +01:00
parent c3a7776f30
commit 9f83169b7a
2 changed files with 9 additions and 0 deletions

View File

@ -188,6 +188,11 @@ public:
/* ------------------------------------------------- glTexSubImage2D */
void test_subimage_updates_only_target_region() {
/* The 2-wide RGB sub-image below is tightly packed (6 bytes/row), so it
* does not satisfy the default GL_UNPACK_ALIGNMENT of 4 (which would pad
* each row to 8 bytes). Tell GL the rows are tightly packed. */
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
/* Start with an all-black 16x16 RGB565 texture. */
std::vector<uint8_t> img(16 * 16 * 3, 0);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 16, 0, GL_RGB, GL_UNSIGNED_BYTE, img.data());

View File

@ -78,6 +78,10 @@ public:
glDepthFunc(GL_LESS);
glShadeModel(GL_SMOOTH);
/* Restore the spec default so a test that changes pixel-store state
* doesn't leak into the next (we no longer re-init per test). */
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glBindTexture(GL_TEXTURE_2D, 0);
glMatrixMode(GL_PROJECTION); glLoadIdentity();