Auto merge of #11801 - mbrubeck:snaptopix, r=pcwalton

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

Fixes #11751. See servo/webrender#294 for some details. r? @pcwalton

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11801)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-06-29 22:35:54 -05:00 committed by GitHub
commit 461d7c4eeb
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;
}