From f1d350703a726540d65dab35c50e47601720ac24 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Fri, 22 Mar 2024 19:55:17 -0300 Subject: [PATCH] tests: another attempt at fixing the shader pixel coordinate test --- .../expected/love.test.graphics.Canvas-4.png | Bin 327 -> 319 bytes testing/tests/graphics.lua | 6 +++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/testing/output/expected/love.test.graphics.Canvas-4.png b/testing/output/expected/love.test.graphics.Canvas-4.png index d3e9c37f8bc3899bba97bfaff675fbbb0688b8f6..9dbe75c204330592e451546b73304e055366f9f1 100644 GIT binary patch delta 148 zcmX@kw4Z5$iUXUci(^Q|oVS+^xf%>aSP!}s|2Ov5I;a(G9n7I**8jKoTw#A<@AsdT zwtv2~*I%zINPBzHV(}V>$i_`f$*kuLCVo`nB%LEAD%Zoq+~wPrW6S^qp00i_>zopr E01`zyxc~qF literal 327 zcmeAS@N?(olHy`uVBq!ia0vp^DImb-_`K-hvc z2O=7cd8UX$I1Z7Go0w8rPjO8VmC!C|gL7~zJ;pUBalslSeN<6Of&&mro0vOln7by4 SrzHRbh{4m<&t;ucLK6USId^;j diff --git a/testing/tests/graphics.lua b/testing/tests/graphics.lua index 6e61ad830..acbf74087 100644 --- a/testing/tests/graphics.lua +++ b/testing/tests/graphics.lua @@ -209,7 +209,11 @@ love.test.graphics.Canvas = function(test) ]] local shader2 = love.graphics.newShader[[ vec4 effect(vec4 c, Image tex, vec2 tc, vec2 pc) { - return vec4(pc / love_ScreenSize.xy, 0.0, 1.0); + // rounding during quantization from float to unorm8 doesn't seem to be + // totally consistent across devices, lets do it ourselves. + vec2 value = pc / love_ScreenSize.xy; + vec2 quantized = (floor(255.0 * value + 0.5) + 0.1) / 255.0; + return vec4(quantized, 0.0, 1.0); } ]] local img = love.graphics.newImage(love.image.newImageData(1, 1))