webrender: Don't use OpenGL round() for snapping pixels

Fixes #11751.
This commit is contained in:
Matt Brubeck 2016-06-20 08:41:10 -07:00
parent bc2f4c3450
commit 6c00058c5d
6 changed files with 42 additions and 2 deletions

View file

@ -65,6 +65,6 @@ vec2 SnapToPixels(vec2 pos)
// Snap the vertex to pixel position to guarantee correct texture
// sampling when using bilinear filtering.
// TODO(gw): ES2 doesn't have round(). Do we ever get negative coords here?
// TODO(gw): Do we ever get negative coords here?
return floor(0.5 + pos * uDevicePixelRatio) / uDevicePixelRatio;
}

View file

@ -62,5 +62,8 @@ vec2 SnapToPixels(vec2 pos)
{
// Snap the vertex to pixel position to guarantee correct texture
// sampling when using bilinear filtering.
return round(pos * uDevicePixelRatio) / uDevicePixelRatio;
// Don't use round() because its behavior is implementation-defined on 0.5.
// TODO: Do we ever get negative coords here?
return floor(0.5 + pos * uDevicePixelRatio) / uDevicePixelRatio;
}