From b804c491b785185ff1496c81c0dfadf2a9a15fbc Mon Sep 17 00:00:00 2001 From: clayjohn Date: Sun, 3 Mar 2019 23:25:35 -0800 Subject: [PATCH] fixed pixel snap precision artifact --- drivers/gles2/shaders/canvas.glsl | 3 +++ drivers/gles3/shaders/canvas.glsl | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index b13801946f1..f72a0d288bb 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -162,6 +162,9 @@ VERTEX_SHADER_CODE #ifdef USE_PIXEL_SNAP outvec.xy = floor(outvec + 0.5).xy; + // precision issue on some hardware creates artifacts within texture + // offset uv by a small amount to avoid + uv += 1e-5; #endif #ifdef USE_SKELETON diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index 6c1806a6578..0d1e7ee4a1d 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -173,6 +173,9 @@ VERTEX_SHADER_CODE #ifdef USE_PIXEL_SNAP outvec.xy = floor(outvec + 0.5).xy; + // precision issue on some hardware creates artifacts within texture + // offset uv by a small amount to avoid + uv_interp += 1e-5; #endif #ifdef USE_SKELETON