From f6cd2beacf6b6e838626659be746d71c141f2dfb Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 24 Oct 2024 12:16:05 +0900 Subject: [PATCH] internal/buildinshader: refactoring --- internal/builtinshader/shader.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/builtinshader/shader.go b/internal/builtinshader/shader.go index 2c41f24c2..4892ba2b9 100644 --- a/internal/builtinshader/shader.go +++ b/internal/builtinshader/shader.go @@ -60,7 +60,7 @@ var ColorMTranslation vec4 {{end}} {{if eq .Address .AddressRepeat}} -func adjustTexelForAddressRepeat(p vec2) vec2 { +func adjustSrcPosForAddressRepeat(p vec2) vec2 { origin := imageSrc0Origin() size := imageSrc0Size() return mod(p - origin, size) + origin @@ -74,15 +74,15 @@ func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 { {{else if eq .Address .AddressClampToZero}} clr := imageSrc0At(srcPos) {{else if eq .Address .AddressRepeat}} - clr := imageSrc0At(adjustTexelForAddressRepeat(srcPos)) + clr := imageSrc0At(adjustSrcPosForAddressRepeat(srcPos)) {{end}} {{else if eq .Filter .FilterLinear}} p0 := srcPos - 1/2.0 p1 := srcPos + 1/2.0 {{if eq .Address .AddressRepeat}} - p0 = adjustTexelForAddressRepeat(p0) - p1 = adjustTexelForAddressRepeat(p1) + p0 = adjustSrcPosForAddressRepeat(p0) + p1 = adjustSrcPosForAddressRepeat(p1) {{end}} {{if eq .Address .AddressUnsafe}}