Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd WebGL impl and enable access to Outline, Contour and Scene #256
Conversation
| @@ -33,7 +33,7 @@ void computeVaryings() { | |||
| vec2 origin = vec2(aTileOrigin.xy) + vec2(aTileOrigin.z & 15u, aTileOrigin.z >> 4u) * 256.0; | |||
| vec2 position = (origin + vec2(aTessCoord)) * uTileSize; | |||
| vec2 maskTexCoordOrigin = computeTileOffset(uint(aTileIndex), uStencilTextureSize.x); | |||
| vec2 maskTexCoord = maskTexCoordOrigin + aTessCoord * uTileSize; | |||
| vec2 maskTexCoord = maskTexCoordOrigin + vec2(aTessCoord) * uTileSize; | |||
This comment has been minimized.
This comment has been minimized.
s3bk
Jan 31, 2020
•
Author
Contributor
The implicit cast turned out to make WebGL very unhappy, so I made it explicit.
| } | ||
| } | ||
|
|
||
| pub struct EmbeddedResourceLoader; |
This comment has been minimized.
This comment has been minimized.
s3bk
Jan 31, 2020
Author
Contributor
This can probably use some tuning in the future to only include the files actually needed. But it works for now.
This comment has been minimized.
This comment has been minimized.
pcwalton
Jan 31, 2020
•
Collaborator
Won't this cause a rebuild when changing the shaders? One of the benefits of the FilesystemResourceLoader is live shader editing without rebuilding. I know it's not possible to use the filesystem in WebAssembly, but maybe we should make this enabled on the wasm target only for now.
This comment has been minimized.
This comment has been minimized.
s3bk
Feb 1, 2020
Author
Contributor
I moved the EmbeddedResourceLoader into pathfinder_resources and added a bunch of feature flags to control what gets included.
The demo runs.
| @@ -53,6 +58,7 @@ impl<'a> SceneBuilder<'a> { | |||
| } | |||
|
|
|||
| pub fn build<E>(&mut self, executor: &E) where E: Executor { | |||
| #[cfg(not(target_arch = "wasm32"))] | |||
| let start_time = Instant::now(); | |||
This comment has been minimized.
This comment has been minimized.
| @@ -17,6 +17,7 @@ use pathfinder_geometry::transform3d::Perspective; | |||
| use pathfinder_geometry::vector::{Vector2F, Vector4F}; | |||
| use pathfinder_content::clip::PolygonClipper3D; | |||
|
|
|||
| // FIXME: Can this use &mut self ? (Sebastian Köln) | |||
This comment has been minimized.
This comment has been minimized.
| self.flush_current_contour(); | ||
| self.outline.transform(transform); | ||
| self | ||
| } |
This comment has been minimized.
This comment has been minimized.
|
Hmm. Maybe we should move the WebGL code into |
|
flip_y doesn't actually appear to be used |
|
hm. actually that broke something. |
|
So the EmbeddedResourceLoader is broken and I am not sure why. I didn't change anything from when it was working… |
|
working again. |
Put the DebugUiPresenter behind the debug_ui feature flag
|
As a side effect of adding fine control over what gets embedded, my wasm is now less than half the size. |
|
The latest commit is not actually WebGL specific. However it fixed glitches that appear to originate from the tile background texture lookup. |
Dollab
commented
Feb 25, 2020
|
This is really cool ! Would be awesome to merge this ! |
|
Reviewing this now. |
|
WebGL backend is merged: e2fbde8 |
|
Made the WebGL fixes, I believe: ee6c7e0 |
|
@pcwalton seems |
s3bk commentedJan 31, 2020
This is a squashed commit of my cleaned up collected modifications.