internal/builtinshader: remove adjustments for tie-breaking

This seems no longer needed with the pixel mode.

This was confirmed by this test:

```
go run . -run=TestImageLinearFilterGlitch2
```

The same change didn't work at b5ca404c42
but worked at 49582519c1, which
introduced the pixel mode.

Updates #1212
This commit is contained in:
Hajime Hoshi 2023-08-30 23:34:42 +09:00
parent 60b7de6a3c
commit 009fb504ed
2 changed files with 4 additions and 6 deletions

View File

@ -29,10 +29,9 @@ const screenShaderSrc = `//kage:unit pixels
package main
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
// Shift 1/512 [pixel] to avoid the tie-breaking issue.
pos := texCoord
p0 := pos - 1/2.0 + 1/512.0
p1 := pos + 1/2.0 + 1/512.0
p0 := pos - 1/2.0
p1 := pos + 1/2.0
// Texels must be in the source rect, so it is not necessary to check.
c0 := imageSrc0UnsafeAt(p0)

View File

@ -77,9 +77,8 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
clr := imageSrc0At(adjustTexelForAddressRepeat(texCoord))
{{end}}
{{else if eq .Filter .FilterLinear}}
// Shift 1/512 [pixel] to avoid the tie-breaking issue (#1212).
p0 := texCoord - 1/2.0 + 1/512.0
p1 := texCoord + 1/2.0 + 1/512.0
p0 := texCoord - 1/2.0
p1 := texCoord + 1/2.0
{{if eq .Address .AddressRepeat}}
p0 = adjustTexelForAddressRepeat(p0)