Bug 124653 - [texmap] Borders on rotating images are hidden/wrongly rendered with edge distance antialiasing
Summary: [texmap] Borders on rotating images are hidden/wrongly rendered with edge dis...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All Unspecified
: P2 Normal
Assignee: José Dapena Paz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-20 07:04 PST by José Dapena Paz
Modified: 2014-05-08 13:10 PDT (History)
7 users (show)

See Also:


Attachments
Test case: rotating green box and circle are most obvious artifacts (2.22 KB, text/html)
2013-11-20 07:04 PST, José Dapena Paz
no flags Details
Patch (7.31 KB, patch)
2013-12-02 03:45 PST, José Dapena Paz
no flags Details | Formatted Diff | Diff
Patch (8.91 KB, patch)
2013-12-03 02:55 PST, José Dapena Paz
no flags Details | Formatted Diff | Diff
Patch (8.94 KB, patch)
2013-12-03 03:02 PST, José Dapena Paz
no flags Details | Formatted Diff | Diff
Fix to match the uniform precision qualifiers in Vertex and fragment (1.74 KB, patch)
2014-05-08 13:09 PDT, Prabhu Sundararaj
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description José Dapena Paz 2013-11-20 07:04:45 PST
Created attachment 217424 [details]
Test case: rotating green box and circle are most obvious artifacts

When TextureMapperGL has enabled edgeDistanceAntialiasing, the borders of the image fail to render properly, showing different artifacts. It is pretty obvious on circle images where the borders of the circle are exactly touching the image border.

This is reproducible at least in WebKit Qt and WebKit Gtk (though I expect it to also fail on WebKitEFL as it uses coordinated graphics).
Comment 1 José Dapena Paz 2013-12-02 03:45:36 PST
Created attachment 218159 [details]
Patch
Comment 2 Noam Rosenthal 2013-12-02 14:21:49 PST
Comment on attachment 218159 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=218159&action=review

Nice, see comments

> Source/WebCore/platform/graphics/texmap/TextureMapperShaderProgram.cpp:328
> +            vec4 clampedPosition = clamp(vec4(v_texCoord, 0., 1.), 0., 1.);
> +            vec2 texCoord = (u_textureSpaceMatrix * clampedPosition).xy;

It's not a good idea to do this for every pixel. We should only do this when there's an actual texture.
You should figure that into the other "optional" functions.
Comment 3 José Dapena Paz 2013-12-03 02:55:22 PST
Created attachment 218282 [details]
Patch
Comment 4 José Dapena Paz 2013-12-03 03:02:44 PST
Created attachment 218283 [details]
Patch
Comment 5 José Dapena Paz 2013-12-03 03:04:03 PST
(In reply to comment #4)
> Created an attachment (id=218283) [details]
> Patch

New patch:
* Now it only clamps on fragment shader when we have ENABLE_Texture and ENABLE_Antialiasing.
Comment 6 WebKit Commit Bot 2013-12-04 09:46:41 PST
Comment on attachment 218283 [details]
Patch

Clearing flags on attachment: 218283

Committed r160096: <http://trac.webkit.org/changeset/160096>
Comment 7 WebKit Commit Bot 2013-12-04 09:46:43 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Prabhu Sundararaj 2014-05-08 13:09:40 PDT
Created attachment 231095 [details]
Fix to match the uniform precision qualifiers in Vertex and fragment
Comment 9 Prabhu Sundararaj 2014-05-08 13:10:30 PDT
When the vertex and fragment shaders are linked together, then they will
share a single global uniform name space. Hence, types and precisions of
uniforms with the same name must match across all shaders that are linked
into a single executable.

As per GLSL_ES_Specification_3.00.3.pdf
Page 124 12.3 Numeric Precision
The fragment language has no default precision qualifier for floating point types.
Hence for float, floating point vector and matrix variable declarations, either
the declaration must include a precision qualifier or the default float
precision must have been previously declared.