Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support subpixel antialiasing of text #464

Closed
jrmuizel opened this issue Oct 21, 2016 · 7 comments
Closed

Support subpixel antialiasing of text #464

jrmuizel opened this issue Oct 21, 2016 · 7 comments

Comments

@jrmuizel
Copy link
Contributor

@jrmuizel jrmuizel commented Oct 21, 2016

Getting this done is will be important for getting more accurate performance numbers as it has a potentially negative impact on performance.

@jrmuizel jrmuizel mentioned this issue Oct 21, 2016
20 of 24 tasks complete
@jrmuizel
Copy link
Contributor Author

@jrmuizel jrmuizel commented Oct 24, 2016

So to support this we need to do blending with a rgb mask. There are some different strategies to do so:

  1. glBlendColor(textColor), glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR)
  2. dual source blending
  3. frame buffer read using GL_EXT_shader_framebuffer_fetch/GL_NV_texture_barrier
  4. A two pass approach described here http://anholt.livejournal.com/32058.html

Skia will use any of 1-3 depending on the capabilities of the hardware. Cairo uses 4.

@jrmuizel
Copy link
Contributor Author

@jrmuizel jrmuizel commented Oct 24, 2016

I confirmed today that Direct2D uses approach 1.

@glennw
Copy link
Member

@glennw glennw commented Oct 28, 2016

I'll start on this next week.

@kvark
Copy link
Member

@kvark kvark commented Oct 28, 2016

Seems like an exciting task to do! If our goal is just to measure performance, we might as well just enable blending and output all the text as non-opaque for the worst case, as a quick test.

@jwilm
Copy link

@jwilm jwilm commented Oct 28, 2016

Not sure if it's available on the systems webrender is targeting, but the GL_ARB_blend_func_extended extension could work here. Sounds like option 2 in the above list. With the extension, the blend function can be configured like this:

gl::BlendFunc(gl::SRC1_COLOR, gl::ONE_MINUS_SRC1_COLOR);

and then a per-channel mask can be output from the fragment shader in addition to the fragment color.

@glennw
Copy link
Member

@glennw glennw commented Nov 8, 2016

The initial implementation of this has landed in WR/Servo now - enable with -Z enable-subpixel-aa to test. @jrmuizel Are you fine with closing this and we'll open more fine grained issues for the remaining subpixel work?

@jrmuizel
Copy link
Contributor Author

@jrmuizel jrmuizel commented Nov 8, 2016

Yep.

@jrmuizel jrmuizel closed this Nov 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.