Webrender: Heavily-downscaled images look bad

Created on 10 Nov 2017  路  11Comments  路  Source: servo/webrender

https://bugzilla.mozilla.org/show_bug.cgi?id=1405469

This can be seen with the header image at https://www.reddit.com/r/firefox/: The header image file is 3,242px 脳 833px big and gets displayed at 175px x 45px, which is a downscale factor of 18.5 (or 9.25 on a HiDPI@2x display).

The downscaled image looks very pixellated with WebRender.

Maybe WebRender should be generating different mip map levels as required, using subsequent 0.5 scaling so that the pixellation doesn't occur?

bugzilled bug

Most helpful comment

@glennw I believe we don't need this for most of the images, so should be doing on demand only.

All 11 comments

Shouldn't Gecko's high quality downscaling be taking care of this?

@jrmuizel

Shouldn't Gecko's high quality downscaling be taking care of this?

Down-scaling can be expensive and maps to GPU somewhat nicely. Woudln't we want to do this in WR at the end of the day then anyway for performance reasons?

Down-scaling can be expensive and maps to GPU somewhat nicely. Woudln't we want to do this in WR at the end of the day then anyway for performance reasons?

Well, of course scaling is perfect task for WR. It just need to use proper interpolation, because like I stated in Bugzilla bug it currently is using Nearest Neighbour by the looks of that.

I added a ref test in https://github.com/servo/webrender/pull/2320 that can be used when working on this bug.

I think what we'll probably want to end up with is a render task that manually creates mip-maps for a given entry of the texture cache.

This seems like a reasonable guide with example code to creating mips manually for non-p2 textures - http://download.nvidia.com/developer/Papers/2005/NP2_Mipmapping/NP2_Mipmap_Creation.pdf.

@kvark Does the above make sense to you, or do you have other ideas?

@glennw makes sense. Your permanent render task cache comes handy :)

@kvark @nical One thing I'm unsure of is whether we choose to create mips for all items in the texture cache, or have some heuristic and try to create mips only where it makes sense. This could also complicate the shader and/or batching logic, depending on if we need to select a mode that use mips or not. Thoughts?

@glennw I believe we don't need this for most of the images, so should be doing on demand only.

This was fixed on the Gecko side in bug https://bugzilla.mozilla.org/show_bug.cgi?id=1183378. That fix is better than the mipmap generation.

because it doesn't have problems like #2519. It's probably best to just disable MipMap generation for now.

Was this page helpful?
0 / 5 - 0 ratings