From 72382caf7265d905a48fe772762f850dd85b9c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 6 Oct 2024 16:58:18 +0200 Subject: [PATCH] Shaders: zero-initialize a partially uploaded texture in the test. Otherwise the difference fluctuates and makes the test appear flaky. --- src/Magnum/Shaders/Test/PhongGLTest.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Shaders/Test/PhongGLTest.cpp b/src/Magnum/Shaders/Test/PhongGLTest.cpp index 0a199a070..f0723eee5 100644 --- a/src/Magnum/Shaders/Test/PhongGLTest.cpp +++ b/src/Magnum/Shaders/Test/PhongGLTest.cpp @@ -5398,12 +5398,16 @@ void PhongGLTest::renderMulti() { .setSkip({image->size().x()/4, image->size().y()/2, 0}), image->format(), image->size()/2, image->data()}; + Vector3i size{image->size().x(), image->size().y()/2, 3}; + diffuseArray = GL::Texture2DArray{}; diffuseArray.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) .setWrapping(GL::SamplerWrapping::ClampToEdge) /* Each slice has half the height */ - .setStorage(1, TextureFormatRGB, {image->size().x(), image->size().y()/2, 3}) + .setStorage(1, TextureFormatRGB, size) + /* Clear to all zeros for reproducible output */ + .setSubImage(0, {}, Image3D{PixelFormat::RGB8Unorm, size, Containers::Array{ValueInit, std::size_t(size.product()*3)}}) .setSubImage(0, {0, 0, 0}, first) /* Put the second image on the right half to test that the per-instance offset is used together with the layer */