Reproject DataTiles using WebGL instead of 2d canvas. #15860
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have made an implementation of the
ol/src/reproj:render()
function using webgl instead of 2d canvas. This solves three problems:Since this will be used for datatiles, it should be okay to do it in webgl, as datatiles are used for webgl based rendering anyway.
It does all the work for a datatile reprojection using a single
WebGLRenderingContext
. Whereas the current implementation computes an affine transformation from the source to the target explicitly, this is not needed when doing the work in WebGL as the transformation is built-in.This makes it possible to do up 4band f32/u8 reprojection in 1 pass which means that you never need to do multiple passes as that is what a tiletexture can hold as well as far as I understand. It produces the same output in examples/numpytile for example which is supposedly 5-bands. I have not A/B tested the speed difference.
This means you can do interpolation when reprojection instead of always having to do nearest neighbour. It is even possible for f32 data if the webgl extension is available. Below is a comparison on some elevation-data. You can still see some artifacts because reprojected tiles have no gutter (also on the main branch), which I intend to fix in a future pull-request.
This fixes the same reprojection artifacts in Firefox as #14099, as well as the ones that could not be fixed in that PR.