diff --git a/util/test/tests/GL/GL_Buffer_Updates.py b/util/test/tests/GL/GL_Buffer_Updates.py index c6e2641ad3..7c11736fa4 100644 --- a/util/test/tests/GL/GL_Buffer_Updates.py +++ b/util/test/tests/GL/GL_Buffer_Updates.py @@ -30,15 +30,6 @@ def check_capture(self): rdtest.log.success("Draws are all green") - # Now save the backbuffer to disk - ref_path = rdtest.get_tmp_path('backbuffer.png') - - save_data = rd.TextureSave() - save_data.resourceId = tex - save_data.destType = rd.FileType.PNG - - self.controller.SaveTexture(save_data, ref_path) - # Open the capture and grab the thumbnail, check that it is all green too (dirty way of verifying we didn't # break in-app updates but somehow end up with the right data) cap = rd.OpenCaptureFile() @@ -58,9 +49,33 @@ def check_capture(self): with open(tmp_path, 'wb') as f: f.write(thumb.data) - # The original thumbnail should also be identical, since we have the uncompressed extended thumbnail. + test_reader = rdtest.png.Reader(filename=tmp_path) + + test_w, test_h, test_data, test_info = test_reader.read() + + box_w = test_w//8 + rows = test_h//box_w + + offset = box_w//2 + + rows_data = list(test_data) + + comps = 4 if test_info['alpha'] else 3 + + for row in range(0,rows): + y = row * box_w + offset + + row_data = rows_data[y] + + for col in range(0, 8): + x = col * box_w + offset + + pixel = (row_data[x * comps + 0]/255, row_data[x * comps + 1]/255, + row_data[x * comps + 2]/255) - if not rdtest.png_compare(tmp_path, ref_path): - raise rdtest.TestFailureException("Reference backbuffer and thumbnail image differ", tmp_path, ref_path) + if (not rdtest.value_compare((0.2, 0.2, 0.2), pixel, 1) and + not rdtest.value_compare((0.0, 1.0, 0.0), pixel, 1)): + raise rdtest.TestFailureException( + f"Thumbnail of backbuffer at {x},{y} has bad pixel: {pixel}", tmp_path) - rdtest.log.success("Thumbnail is identical to reference") + rdtest.log.success("Thumbnail is as expected")