mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-04 15:04:28 +01:00
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 atb5ca404c42
but worked at49582519c1
, which introduced the pixel mode. Updates #1212
This commit is contained in:
parent
60b7de6a3c
commit
009fb504ed
@ -29,10 +29,9 @@ const screenShaderSrc = `//kage:unit pixels
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
||||||
// Shift 1/512 [pixel] to avoid the tie-breaking issue.
|
|
||||||
pos := texCoord
|
pos := texCoord
|
||||||
p0 := pos - 1/2.0 + 1/512.0
|
p0 := pos - 1/2.0
|
||||||
p1 := pos + 1/2.0 + 1/512.0
|
p1 := pos + 1/2.0
|
||||||
|
|
||||||
// Texels must be in the source rect, so it is not necessary to check.
|
// Texels must be in the source rect, so it is not necessary to check.
|
||||||
c0 := imageSrc0UnsafeAt(p0)
|
c0 := imageSrc0UnsafeAt(p0)
|
||||||
|
@ -77,9 +77,8 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
|
|||||||
clr := imageSrc0At(adjustTexelForAddressRepeat(texCoord))
|
clr := imageSrc0At(adjustTexelForAddressRepeat(texCoord))
|
||||||
{{end}}
|
{{end}}
|
||||||
{{else if eq .Filter .FilterLinear}}
|
{{else if eq .Filter .FilterLinear}}
|
||||||
// Shift 1/512 [pixel] to avoid the tie-breaking issue (#1212).
|
p0 := texCoord - 1/2.0
|
||||||
p0 := texCoord - 1/2.0 + 1/512.0
|
p1 := texCoord + 1/2.0
|
||||||
p1 := texCoord + 1/2.0 + 1/512.0
|
|
||||||
|
|
||||||
{{if eq .Address .AddressRepeat}}
|
{{if eq .Address .AddressRepeat}}
|
||||||
p0 = adjustTexelForAddressRepeat(p0)
|
p0 = adjustTexelForAddressRepeat(p0)
|
||||||
|
Loading…
Reference in New Issue
Block a user