summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge L. Albany <Megacake1234@gmail.com>2024-10-17 16:02:59 +0000
committerGitHub <noreply@github.com>2024-10-17 16:02:59 +0000
commite5ab9262b126c5a53b8cfad90a87e78a1161d876 (patch)
tree54a88bd2d69a8f949e2ed273505be8d74e4fcc51
parentfe04f5ff9bf3775a15e448794024b4aa44c2c2dc (diff)
parentf922687d3a5697323275dae4614d8e989ef45924 (diff)
downloadredot-engine-e5ab9262b126c5a53b8cfad90a87e78a1161d876.tar.gz
Merge pull request #746 from Spartan322/4.3-fix/pixel-snap
[4.3] Calculate pixel snap in canvas space instead of world space
-rw-r--r--drivers/gles3/shaders/canvas.glsl4
-rw-r--r--servers/rendering/renderer_rd/shaders/canvas.glsl4
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl
index e358230747..76881c8032 100644
--- a/drivers/gles3/shaders/canvas.glsl
+++ b/drivers/gles3/shaders/canvas.glsl
@@ -262,6 +262,8 @@ void main() {
color_interp = color;
+ vertex = (canvas_transform * vec4(vertex, 0.0, 1.0)).xy;
+
if (use_pixel_snap) {
vertex = floor(vertex + 0.5);
// precision issue on some hardware creates artifacts within texture
@@ -269,8 +271,6 @@ void main() {
uv += 1e-5;
}
- vertex = (canvas_transform * vec4(vertex, 0.0, 1.0)).xy;
-
vertex_interp = vertex;
uv_interp = uv;
diff --git a/servers/rendering/renderer_rd/shaders/canvas.glsl b/servers/rendering/renderer_rd/shaders/canvas.glsl
index 4426d9eb66..3b86386fc9 100644
--- a/servers/rendering/renderer_rd/shaders/canvas.glsl
+++ b/servers/rendering/renderer_rd/shaders/canvas.glsl
@@ -214,6 +214,8 @@ void main() {
color_interp = color;
+ vertex = (canvas_data.canvas_transform * vec4(vertex, 0.0, 1.0)).xy;
+
if (canvas_data.use_pixel_snap) {
vertex = floor(vertex + 0.5);
// precision issue on some hardware creates artifacts within texture
@@ -221,8 +223,6 @@ void main() {
uv += 1e-5;
}
- vertex = (canvas_data.canvas_transform * vec4(vertex, 0.0, 1.0)).xy;
-
vertex_interp = vertex;
uv_interp = uv;