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

Skwasm Renderer - initial implementation #39072

Merged
merged 51 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f2be860
Started porting prototype over.
eyebrowsoffire Sep 27, 2022
b5a42f4
A few fixes.
eyebrowsoffire Sep 28, 2022
313a055
Converted wasm pragmas to FfiNative annotations.
eyebrowsoffire Sep 29, 2022
5c953e6
Implement a few methods of the renderer.
eyebrowsoffire Sep 29, 2022
1badfec
Some little lint errors.
eyebrowsoffire Nov 3, 2022
7cb9a08
A bit of wiring up of the test harness.
eyebrowsoffire Nov 4, 2022
73ee925
Fix some formatting issues.
eyebrowsoffire Nov 4, 2022
cb65c7b
Minor changes to skwasm renderer.
eyebrowsoffire Nov 8, 2022
1b6f39b
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Dec 6, 2022
f3192dd
A few fixes to get things compiling via dart2wasm.
eyebrowsoffire Dec 9, 2022
dbe87a1
Use `futureToPromise`.
eyebrowsoffire Dec 9, 2022
8397290
Some more fixes for dart2wasm.
eyebrowsoffire Dec 12, 2022
69c4c86
Allow promises to have nullable objects.
eyebrowsoffire Dec 12, 2022
7d61204
Merge branch 'main' into wasm_fixes
eyebrowsoffire Dec 12, 2022
ea59128
Merge branch 'wasm_fixes' into skwasm_renderer
eyebrowsoffire Dec 12, 2022
831be2e
Some changes to skwasm.
eyebrowsoffire Dec 13, 2022
ace664b
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Dec 14, 2022
5db2a4a
Fix up some signatures.
eyebrowsoffire Dec 14, 2022
bfbb993
More expressive warnings.
eyebrowsoffire Dec 14, 2022
adef70b
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Jan 23, 2023
1927e0c
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Jan 23, 2023
8fc257c
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Jan 25, 2023
6e4ddd1
Switch @FfiNative to @Native.
eyebrowsoffire Jan 25, 2023
0461799
Unit tests partially working.
eyebrowsoffire Jan 27, 2023
f45f7ff
License headers.
eyebrowsoffire Jan 28, 2023
7a80ffe
Implemented path metrics.
eyebrowsoffire Jan 28, 2023
38ef597
Only run general UI tests on skwasm if we're in wasm mode.
eyebrowsoffire Jan 28, 2023
8b589a8
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Jan 28, 2023
156f9bc
Update license goldens.
eyebrowsoffire Jan 28, 2023
406fb8b
Converted picture test to a generic ui test.
eyebrowsoffire Jan 28, 2023
91de627
Converted canvas_test.dart to a ui test.
eyebrowsoffire Jan 29, 2023
d787922
Port path_metrics_test.dart to ui.
eyebrowsoffire Jan 29, 2023
9304cb1
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Jan 29, 2023
4eaa927
Coop/Coep headers.
eyebrowsoffire Jan 30, 2023
604627a
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Feb 1, 2023
704d299
Make `felt build` take ninja targets as arguments.
eyebrowsoffire Feb 1, 2023
7ff5d86
Formatting stuff.
eyebrowsoffire Feb 1, 2023
54bad71
Remove --skwasm flag from felt test.
eyebrowsoffire Feb 9, 2023
21f4f5d
Only include COOP/COEP headers when compiling to wasm with skwasm ren…
eyebrowsoffire Feb 9, 2023
7732340
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Feb 10, 2023
a490f9a
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Feb 17, 2023
4561035
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Feb 17, 2023
7fcbc8e
Update sdk_rewriter_test.
eyebrowsoffire Feb 17, 2023
864080f
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Feb 25, 2023
f58b5bc
Update lib/web_ui/dev/test_dart2wasm.js
eyebrowsoffire Feb 27, 2023
6cfe644
Fixed some skwasm build rules.
eyebrowsoffire Feb 27, 2023
885bef4
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Feb 27, 2023
ec5b08e
Whoops, we reversed the isSkwasm logic. Fixed.
eyebrowsoffire Feb 27, 2023
fd91011
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Feb 28, 2023
68110f9
Merge branch 'main' into skwasm_renderer
eyebrowsoffire Mar 1, 2023
9b43948
Address Harry's comments and change the archive structure.
eyebrowsoffire Mar 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Switch @FfiNative to @Native.
  • Loading branch information
eyebrowsoffire committed Jan 25, 2023
commit 6e4ddd1e7b08c04f4e75ecb2c66f8e59c3bde7fc
48 changes: 24 additions & 24 deletions lib/web_ui/lib/src/engine/skwasm/skwasm_impl/raw/raw_canvas.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,81 +8,81 @@ import 'raw_picture.dart';
class CanvasWrapper extends Opaque {}
typedef CanvasHandle = Pointer<CanvasWrapper>;

@FfiNative<Void Function(CanvasHandle)>('skwasm.canvas_destroy', isLeaf: true)
@Native<Void Function(CanvasHandle)>(symbol: 'skwasm.canvas_destroy', isLeaf: true)
external void canvasDestroy(CanvasHandle canvas);

@FfiNative<Void Function(CanvasHandle)>('skwasm.canvas_save', isLeaf: true)
@Native<Void Function(CanvasHandle)>(symbol: 'skwasm.canvas_save', isLeaf: true)
external void canvasSave(CanvasHandle canvas);

@FfiNative<Void Function(CanvasHandle, RawRect, PaintHandle)>('skwasm.canvas_saveLayer', isLeaf: true)
@Native<Void Function(CanvasHandle, RawRect, PaintHandle)>(symbol: 'skwasm.canvas_saveLayer', isLeaf: true)
external void canvasSaveLayer(
CanvasHandle canvas, RawRect rect, PaintHandle paint);

@FfiNative<Void Function(CanvasHandle)>('skwasm.canvas_restore', isLeaf: true)
@Native<Void Function(CanvasHandle)>(symbol: 'skwasm.canvas_restore', isLeaf: true)
external void canvasRestore(CanvasHandle canvas);

@FfiNative<Int Function(CanvasHandle)>('skwasm.canvas_getSaveCount', isLeaf: true)
@Native<Int Function(CanvasHandle)>(symbol: 'skwasm.canvas_getSaveCount', isLeaf: true)
external int canvasGetSaveCount(CanvasHandle canvas);

@FfiNative<Void Function(CanvasHandle, Float, Float)>('skwasm.canvas_translate', isLeaf: true)
@Native<Void Function(CanvasHandle, Float, Float)>(symbol: 'skwasm.canvas_translate', isLeaf: true)
external void canvasTranslate(CanvasHandle canvas, double dx, double dy);

@FfiNative<Void Function(CanvasHandle, Float, Float)>('skwasm.canvas_scale', isLeaf: true)
@Native<Void Function(CanvasHandle, Float, Float)>(symbol: 'skwasm.canvas_scale', isLeaf: true)
external void canvasScale(CanvasHandle canvas, double sx, double sy);

@FfiNative<Void Function(CanvasHandle, Float)>('skwasm.canvas_rotate', isLeaf: true)
@Native<Void Function(CanvasHandle, Float)>(symbol: 'skwasm.canvas_rotate', isLeaf: true)
external void canvasRotate(CanvasHandle canvas, double degrees);

@FfiNative<Void Function(CanvasHandle, Float, Float)>('skwasm.canvas_skew', isLeaf: true)
@Native<Void Function(CanvasHandle, Float, Float)>(symbol: 'skwasm.canvas_skew', isLeaf: true)
external void canvasSkew(CanvasHandle canvas, double sx, double sy);

@FfiNative<Void Function(CanvasHandle, RawMatrix44)>('skwasm.canvas_transform', isLeaf: true)
@Native<Void Function(CanvasHandle, RawMatrix44)>(symbol: 'skwasm.canvas_transform', isLeaf: true)
external void canvasTransform(CanvasHandle canvas, RawMatrix44 matrix);

@FfiNative<Void Function(CanvasHandle, RawRect, Int, Bool)>('skwasm.canvas_clipRect', isLeaf: true)
@Native<Void Function(CanvasHandle, RawRect, Int, Bool)>(symbol: 'skwasm.canvas_clipRect', isLeaf: true)
external void canvasClipRect(
CanvasHandle canvas, RawRect rect, int op, bool antialias);

@FfiNative<Void Function(CanvasHandle, RawRRect, Bool)>('skwasm.canvas_clipRRect', isLeaf: true)
@Native<Void Function(CanvasHandle, RawRRect, Bool)>(symbol: 'skwasm.canvas_clipRRect', isLeaf: true)
external void canvasClipRRect(
CanvasHandle canvas, RawRRect rrect, bool antialias);

@FfiNative<Void Function(CanvasHandle, PathHandle, Bool)>('skwasm.canvas_clipPath', isLeaf: true)
@Native<Void Function(CanvasHandle, PathHandle, Bool)>(symbol: 'skwasm.canvas_clipPath', isLeaf: true)
external void canvasClipPath(
CanvasHandle canvas, PathHandle path, bool antialias);

@FfiNative<Void Function(CanvasHandle, Int32, Int)>('skwasm.canvas_drawColor', isLeaf: true)
@Native<Void Function(CanvasHandle, Int32, Int)>(symbol: 'skwasm.canvas_drawColor', isLeaf: true)
external void canvasDrawColor(
CanvasHandle canvas, int color, int blendMode);

@FfiNative<Void Function(CanvasHandle, Float, Float, Float, Float, PaintHandle)>('skwasm.canvas_drawLine', isLeaf: true)
@Native<Void Function(CanvasHandle, Float, Float, Float, Float, PaintHandle)>(symbol: 'skwasm.canvas_drawLine', isLeaf: true)
external void canvasDrawLine(CanvasHandle canvas, double x1, double y1,
double x2, double y2, PaintHandle paint);

@FfiNative<Void Function(CanvasHandle, PaintHandle)>('skwasm.canvas_drawPaint', isLeaf: true)
@Native<Void Function(CanvasHandle, PaintHandle)>(symbol: 'skwasm.canvas_drawPaint', isLeaf: true)
external void canvasDrawPaint(CanvasHandle canvas, PaintHandle paint);

@FfiNative<Void Function(CanvasHandle, RawRect, PaintHandle)>('skwasm.canvas_drawRect', isLeaf: true)
@Native<Void Function(CanvasHandle, RawRect, PaintHandle)>(symbol: 'skwasm.canvas_drawRect', isLeaf: true)
external void canvasDrawRect(
CanvasHandle canvas, RawRect rect, PaintHandle paint);

@FfiNative<Void Function(CanvasHandle, RawRRect, PaintHandle)>('skwasm.canvas_drawRRect', isLeaf: true)
@Native<Void Function(CanvasHandle, RawRRect, PaintHandle)>(symbol: 'skwasm.canvas_drawRRect', isLeaf: true)
external void canvasDrawRRect(
CanvasHandle canvas, RawRRect rrect, PaintHandle paint);

@FfiNative<Void Function(CanvasHandle, RawRRect, RawRRect, PaintHandle)>('skwasm.canvas_drawDRRect', isLeaf: true)
@Native<Void Function(CanvasHandle, RawRRect, RawRRect, PaintHandle)>(symbol: 'skwasm.canvas_drawDRRect', isLeaf: true)
external void canvasDrawDRRect(
CanvasHandle canvas, RawRRect outer, RawRRect inner, PaintHandle paint);

@FfiNative<Void Function(CanvasHandle, RawRect, PaintHandle)>('skwasm.canvas_drawOval', isLeaf: true)
@Native<Void Function(CanvasHandle, RawRect, PaintHandle)>(symbol: 'skwasm.canvas_drawOval', isLeaf: true)
external void canvasDrawOval(
CanvasHandle canvas, RawRect oval, PaintHandle paint);

@FfiNative<Void Function(CanvasHandle, Float, Float, Float, PaintHandle)>('skwasm.canvas_drawCircle', isLeaf: true)
@Native<Void Function(CanvasHandle, Float, Float, Float, PaintHandle)>(symbol: 'skwasm.canvas_drawCircle', isLeaf: true)
external void canvasDrawCircle(CanvasHandle canvas, double x, double y,
double radius, PaintHandle paint);

@FfiNative<Void Function(CanvasHandle, RawRect, Float, Float, Bool, PaintHandle)>('skwasm.canvas_drawCircle', isLeaf: true)
@Native<Void Function(CanvasHandle, RawRect, Float, Float, Bool, PaintHandle)>(symbol: 'skwasm.canvas_drawCircle', isLeaf: true)
external void canvasDrawArc(
CanvasHandle canvas,
RawRect rect,
Expand All @@ -91,9 +91,9 @@ external void canvasDrawArc(
bool useCenter,
PaintHandle paint);

@FfiNative<Void Function(CanvasHandle, PathHandle, PaintHandle)>('skwasm.canvas_drawPath', isLeaf: true)
@Native<Void Function(CanvasHandle, PathHandle, PaintHandle)>(symbol: 'skwasm.canvas_drawPath', isLeaf: true)
external void canvasDrawPath(
CanvasHandle canvas, PathHandle path, PaintHandle paint);

@FfiNative<Void Function(CanvasHandle, PictureHandle)>('skwasm.canvas_drawPicture', isLeaf: true)
@Native<Void Function(CanvasHandle, PictureHandle)>(symbol: 'skwasm.canvas_drawPicture', isLeaf: true)
external void canvasDrawPicture(CanvasHandle canvas, PictureHandle picture);
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class Stack extends Opaque {}
typedef StackPointer = Pointer<Stack>;

/// Generic linear memory allocation
@FfiNative<StackPointer Function(Size)>('skwasm.stackAlloc', isLeaf: true)
@Native<StackPointer Function(Size)>(symbol: 'skwasm.stackAlloc', isLeaf: true)
external StackPointer stackAlloc(int length);

@FfiNative<StackPointer Function()>('skwasm.stackSave', isLeaf: true)
@Native<StackPointer Function()>(symbol: 'skwasm.stackSave', isLeaf: true)
external StackPointer stackSave();

@FfiNative<Void Function(StackPointer)>('skwasm.stackRestore', isLeaf: true)
@Native<Void Function(StackPointer)>(symbol: 'skwasm.stackRestore', isLeaf: true)
external void stackRestore(StackPointer pointer);

class StackScope {
Expand Down
34 changes: 17 additions & 17 deletions lib/web_ui/lib/src/engine/skwasm/skwasm_impl/raw/raw_paint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,53 @@ class RawPaint extends Opaque {}

typedef PaintHandle = Pointer<RawPaint>;

@FfiNative<PaintHandle Function()>('skwasm.paint_create', isLeaf: true)
@Native<PaintHandle Function()>(symbol: 'skwasm.paint_create', isLeaf: true)
external PaintHandle paintCreate();

@FfiNative<Void Function(PaintHandle)>('skwasm.paint_destroy', isLeaf: true)
@Native<Void Function(PaintHandle)>(symbol: 'skwasm.paint_destroy', isLeaf: true)
external void paintDestroy(PaintHandle paint);

@FfiNative<Void Function(PaintHandle, Int)>('skwasm.paint_setBlendMode', isLeaf: true)
@Native<Void Function(PaintHandle, Int)>(symbol: 'skwasm.paint_setBlendMode', isLeaf: true)
external void paintSetBlendMode(PaintHandle paint, int blendMode);

@FfiNative<Void Function(PaintHandle, Int)>('skwasm.paint_setStyle', isLeaf: true)
@Native<Void Function(PaintHandle, Int)>(symbol: 'skwasm.paint_setStyle', isLeaf: true)
external void paintSetStyle(PaintHandle paint, int paintStyle);

@FfiNative<Int Function(PaintHandle)>('skwasm.paint_getStyle', isLeaf: true)
@Native<Int Function(PaintHandle)>(symbol: 'skwasm.paint_getStyle', isLeaf: true)
external int paintGetStyle(PaintHandle paint);

@FfiNative<Void Function(PaintHandle, Float)>('skwasm.paint_setStrokeWidth', isLeaf: true)
@Native<Void Function(PaintHandle, Float)>(symbol: 'skwasm.paint_setStrokeWidth', isLeaf: true)
external void paintSetStrokeWidth(PaintHandle paint, double strokeWidth);

@FfiNative<Float Function(PaintHandle)>('skwasm.paint_getStrokeWidth', isLeaf: true)
@Native<Float Function(PaintHandle)>(symbol: 'skwasm.paint_getStrokeWidth', isLeaf: true)
external double paintGetStrokeWidth(PaintHandle paint);

@FfiNative<Void Function(PaintHandle, Int)>('skwasm.paint_setStrokeCap', isLeaf: true)
@Native<Void Function(PaintHandle, Int)>(symbol: 'skwasm.paint_setStrokeCap', isLeaf: true)
external void paintSetStrokeCap(PaintHandle paint, int cap);

@FfiNative<Int Function(PaintHandle)>('skwasm.paint_getStrokeCap', isLeaf: true)
@Native<Int Function(PaintHandle)>(symbol: 'skwasm.paint_getStrokeCap', isLeaf: true)
external int paintGetStrokeCap(PaintHandle paint);

@FfiNative<Void Function(PaintHandle, Int)>('skwasm.paint_setStrokeJoin', isLeaf: true)
@Native<Void Function(PaintHandle, Int)>(symbol: 'skwasm.paint_setStrokeJoin', isLeaf: true)
external void paintSetStrokeJoin(PaintHandle paint, int join);

@FfiNative<Int Function(PaintHandle)>('skwasm.paint_getStrokeJoin', isLeaf: true)
@Native<Int Function(PaintHandle)>(symbol: 'skwasm.paint_getStrokeJoin', isLeaf: true)
external int paintGetStrokeJoin(PaintHandle paint);

@FfiNative<Void Function(PaintHandle, Bool)>('skwasm.paint_setAntiAlias', isLeaf: true)
@Native<Void Function(PaintHandle, Bool)>(symbol: 'skwasm.paint_setAntiAlias', isLeaf: true)
external void paintSetAntiAlias(PaintHandle paint, bool antiAlias);

@FfiNative<Bool Function(PaintHandle)>('skwasm.paint_getAntiAlias', isLeaf: true)
@Native<Bool Function(PaintHandle)>(symbol: 'skwasm.paint_getAntiAlias', isLeaf: true)
external bool paintGetAntiAlias(PaintHandle paint);

@FfiNative<Void Function(PaintHandle, Uint32)>('skwasm.paint_setColorInt', isLeaf: true)
@Native<Void Function(PaintHandle, Uint32)>(symbol: 'skwasm.paint_setColorInt', isLeaf: true)
external void paintSetColorInt(PaintHandle paint, int color);

@FfiNative<Uint32 Function(PaintHandle)>('skwasm.paint_getColorInt', isLeaf: true)
@Native<Uint32 Function(PaintHandle)>(symbol: 'skwasm.paint_getColorInt', isLeaf: true)
external int paintGetColorInt(PaintHandle paint);

@FfiNative<Void Function(PaintHandle, Float)>('skwasm.paint_setMiterLimit', isLeaf: true)
@Native<Void Function(PaintHandle, Float)>(symbol: 'skwasm.paint_setMiterLimit', isLeaf: true)
external void paintSetMiterLimit(PaintHandle paint, double miterLimit);

@FfiNative<Float Function(PaintHandle)>('skwasm.paint_getMiterLimit', isLeaf: true)
@Native<Float Function(PaintHandle)>(symbol: 'skwasm.paint_getMiterLimit', isLeaf: true)
external double paintGetMiterLimit(PaintHandle paint);
Loading