Skip to content

Commit 75afa13

Browse files
Skipping intro_flutter_gpu due to breakage (#2279)
Working around bdero/flutter_scene#57 If you need help, consider asking for advice on the #hackers-devrel channel on [Discord]. [Effective Dart: Style]: https://dart.dev/guides/language/effective-dart/style
1 parent a24be6e commit 75afa13

File tree

38 files changed

+390
-383
lines changed

38 files changed

+390
-383
lines changed

flutter_ci_script_shared.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,14 @@ function ci_codelabs () {
5050

5151
# intro_flutter_gpu only runs with Impeller
5252
if [ $CODELAB = 'intro_flutter_gpu' ]; then
53-
if [ $RUNNER_OS = 'macOS' ] || [ $RUNNER_OS = 'Linux' ]; then
54-
flutter config --enable-native-assets
55-
flutter build `echo $RUNNER_OS | tr '[:upper:]' '[:lower:]'` --debug
56-
flutter test --enable-impeller
57-
else
53+
# Flutter scene is broken: https://github.com/bdero/flutter_scene/issues/57
54+
# if [ $RUNNER_OS = 'macOS' ] || [ $RUNNER_OS = 'Linux' ]; then
55+
# flutter config --enable-native-assets
56+
# flutter build `echo $RUNNER_OS | tr '[:upper:]' '[:lower:]'` --debug
57+
# flutter test --enable-impeller
58+
# else
5859
echo "Skipping $CODELAB on $RUNNER_OS"
59-
fi
60+
# fi
6061
else
6162
flutter test
6263
fi

intro_flutter_gpu/codelab_rebuild.yaml

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,6 @@ steps:
137137
size.width.ceil(),
138138
size.height.ceil(),
139139
);
140-
if (texture == null) {
141-
throw Exception('Failed to create texture');
142-
}
143140
144141
// Create a render target for the texture
145142
final renderTarget = gpu.RenderTarget.singleColor(
@@ -172,9 +169,6 @@ steps:
172169
final verticesDeviceBuffer = gpu.gpuContext.createDeviceBufferWithCopy(
173170
ByteData.sublistView(vertices),
174171
);
175-
if (verticesDeviceBuffer == null) {
176-
throw Exception('Failed to create vertices device buffer');
177-
}
178172
179173
// Bind the pipeline and vertex buffer
180174
renderPass.bindPipeline(pipeline);
@@ -337,17 +331,16 @@ steps:
337331
patch-u: |
338332
--- b/intro_flutter_gpu/step_02/lib/main.dart
339333
+++ a/intro_flutter_gpu/step_02/lib/main.dart
340-
@@ -33,7 +33,6 @@ class TrianglePainter extends CustomPainter {
334+
@@ -33,23 +33,19 @@ class TrianglePainter extends CustomPainter {
341335
342336
@override
343337
void paint(Canvas canvas, Size size) {
344338
- // Create a texture to render to
345339
final texture = gpu.gpuContext.createTexture(
346340
gpu.StorageMode.devicePrivate,
347341
size.width.ceil(),
348-
@@ -43,16 +42,13 @@ class TrianglePainter extends CustomPainter {
349-
throw Exception('Failed to create texture');
350-
}
342+
size.height.ceil(),
343+
);
351344
352345
- // Create a render target for the texture
353346
final renderTarget = gpu.RenderTarget.singleColor(
@@ -362,7 +355,7 @@ steps:
362355
final vert = shaderLibrary['SimpleVertex'];
363356
if (vert == null) {
364357
throw Exception('Failed to load SimpleVertex vertex shader');
365-
@@ -63,14 +59,16 @@ class TrianglePainter extends CustomPainter {
358+
@@ -60,19 +56,20 @@ class TrianglePainter extends CustomPainter {
366359
throw Exception('Failed to load SimpleFragment fragment shader');
367360
}
368361
@@ -384,15 +377,12 @@ steps:
384377
final verticesDeviceBuffer = gpu.gpuContext.createDeviceBufferWithCopy(
385378
ByteData.sublistView(vertices),
386379
);
387-
@@ -78,7 +76,6 @@ class TrianglePainter extends CustomPainter {
388-
throw Exception('Failed to create vertices device buffer');
389-
}
390380
391381
- // Bind the pipeline and vertex buffer
392382
renderPass.bindPipeline(pipeline);
393383
394384
final verticesView = gpu.BufferView(
395-
@@ -91,10 +88,8 @@ class TrianglePainter extends CustomPainter {
385+
@@ -85,10 +82,8 @@ class TrianglePainter extends CustomPainter {
396386
vertices.length ~/ floatsPerVertex,
397387
);
398388
@@ -451,7 +441,7 @@ steps:
451441
patch-u: |
452442
--- b/intro_flutter_gpu/step_03/lib/main.dart
453443
+++ a/intro_flutter_gpu/step_03/lib/main.dart
454-
@@ -61,12 +61,18 @@ class TrianglePainter extends CustomPainter {
444+
@@ -58,12 +58,18 @@ class TrianglePainter extends CustomPainter {
455445
456446
final pipeline = gpu.gpuContext.createRenderPipeline(vert, frag);
457447
@@ -486,7 +476,7 @@ steps:
486476
patch-u: |
487477
--- b/intro_flutter_gpu/step_04/lib/main.dart
488478
+++ a/intro_flutter_gpu/step_04/lib/main.dart
489-
@@ -66,13 +66,13 @@ class TrianglePainter extends CustomPainter {
479+
@@ -63,13 +63,13 @@ class TrianglePainter extends CustomPainter {
490480
// Format: x, y, r, g, b
491481
492482
// Triangle #1
@@ -520,7 +510,7 @@ steps:
520510
patch-u: |
521511
--- b/intro_flutter_gpu/step_05/lib/main.dart
522512
+++ a/intro_flutter_gpu/step_05/lib/main.dart
523-
@@ -61,18 +61,18 @@ class TrianglePainter extends CustomPainter {
513+
@@ -58,18 +58,18 @@ class TrianglePainter extends CustomPainter {
524514
525515
final pipeline = gpu.gpuContext.createRenderPipeline(vert, frag);
526516
@@ -606,7 +596,7 @@ steps:
606596
patch-u: |
607597
--- b/intro_flutter_gpu/step_06/lib/main.dart
608598
+++ a/intro_flutter_gpu/step_06/lib/main.dart
609-
@@ -61,18 +61,18 @@ class TrianglePainter extends CustomPainter {
599+
@@ -58,18 +58,18 @@ class TrianglePainter extends CustomPainter {
610600
611601
final pipeline = gpu.gpuContext.createRenderPipeline(vert, frag);
612602
@@ -760,7 +750,7 @@ steps:
760750
761751
@override
762752
void paint(Canvas canvas, Size size) {
763-
@@ -61,15 +98,12 @@ class TrianglePainter extends CustomPainter {
753+
@@ -58,15 +95,12 @@ class TrianglePainter extends CustomPainter {
764754
765755
final pipeline = gpu.gpuContext.createRenderPipeline(vert, frag);
766756
@@ -777,9 +767,9 @@ steps:
777767
0.8, -0.8, 1.0, -1.0,
778768
0.8, 0.8, 1.0, 1.0,
779769
-0.8, 0.8, -1.0, 1.0,
780-
@@ -82,6 +116,22 @@ class TrianglePainter extends CustomPainter {
781-
throw Exception('Failed to create vertices device buffer');
782-
}
770+
@@ -76,6 +110,18 @@ class TrianglePainter extends CustomPainter {
771+
ByteData.sublistView(vertices),
772+
);
783773
784774
+ // Create model matrix for rotation
785775
+ final model = vm.Matrix4.rotationY(angle);
@@ -792,15 +782,11 @@ steps:
792782
+ Float32List.fromList(vertUniforms.expand((m) => m.storage).toList()),
793783
+ ),
794784
+ );
795-
+
796-
+ if (vertUniformsDeviceBuffer == null) {
797-
+ throw Exception('Failed to create vert uniforms device buffer');
798-
+ }
799785
+
800786
renderPass.bindPipeline(pipeline);
801787
802788
final verticesView = gpu.BufferView(
803-
@@ -94,6 +144,14 @@ class TrianglePainter extends CustomPainter {
789+
@@ -88,6 +134,14 @@ class TrianglePainter extends CustomPainter {
804790
vertices.length ~/ floatsPerVertex,
805791
);
806792
@@ -860,9 +846,9 @@ steps:
860846
patch-u: |
861847
--- b/intro_flutter_gpu/step_08/lib/main.dart
862848
+++ a/intro_flutter_gpu/step_08/lib/main.dart
863-
@@ -116,11 +116,18 @@ class TrianglePainter extends CustomPainter {
864-
throw Exception('Failed to create vertices device buffer');
865-
}
849+
@@ -110,11 +110,18 @@ class TrianglePainter extends CustomPainter {
850+
ByteData.sublistView(vertices),
851+
);
866852
867853
- // Create model matrix for rotation
868854
+ // Create transformation matrices
@@ -914,7 +900,7 @@ steps:
914900
patch-u: |
915901
--- b/intro_flutter_gpu/step_09/lib/main.dart
916902
+++ a/intro_flutter_gpu/step_09/lib/main.dart
917-
@@ -98,15 +98,57 @@ class TrianglePainter extends CustomPainter {
903+
@@ -95,22 +95,63 @@ class TrianglePainter extends CustomPainter {
918904
919905
final pipeline = gpu.gpuContext.createRenderPipeline(vert, frag);
920906
@@ -980,15 +966,14 @@ steps:
980966
]);
981967
982968
final verticesDeviceBuffer = gpu.gpuContext.createDeviceBufferWithCopy(
983-
@@ -116,7 +158,6 @@ class TrianglePainter extends CustomPainter {
984-
throw Exception('Failed to create vertices device buffer');
985-
}
969+
ByteData.sublistView(vertices),
970+
);
986971
987972
- // Create transformation matrices
988973
final model = vm.Matrix4.rotationY(angle);
989974
final view = vm.Matrix4.translation(vm.Vector3(0.0, 0.0, -2.0));
990975
final projection = vm.makePerspectiveMatrix(
991-
@@ -126,7 +167,6 @@ class TrianglePainter extends CustomPainter {
976+
@@ -120,7 +161,6 @@ class TrianglePainter extends CustomPainter {
992977
100.0,
993978
);
994979
@@ -1076,7 +1061,7 @@ steps:
10761061
patch-u: |
10771062
--- b/intro_flutter_gpu/step_10/lib/main.dart
10781063
+++ a/intro_flutter_gpu/step_10/lib/main.dart
1079-
@@ -98,7 +98,7 @@ class TrianglePainter extends CustomPainter {
1064+
@@ -95,7 +95,7 @@ class TrianglePainter extends CustomPainter {
10801065
10811066
final pipeline = gpu.gpuContext.createRenderPipeline(vert, frag);
10821067
@@ -1085,7 +1070,7 @@ steps:
10851070
final vertices = Float32List.fromList([
10861071
// Format: x, y, z, r, g, b
10871072
1088-
@@ -181,6 +181,9 @@ class TrianglePainter extends CustomPainter {
1073+
@@ -171,6 +171,9 @@ class TrianglePainter extends CustomPainter {
10891074
10901075
renderPass.bindPipeline(pipeline);
10911076
@@ -1123,9 +1108,9 @@ steps:
11231108
}
11241109
11251110
@override
1126-
@@ -158,8 +158,15 @@ class TrianglePainter extends CustomPainter {
1127-
throw Exception('Failed to create vertices device buffer');
1128-
}
1111+
@@ -152,8 +152,15 @@ class TrianglePainter extends CustomPainter {
1112+
ByteData.sublistView(vertices),
1113+
);
11291114
11301115
- final model = vm.Matrix4.rotationY(angle);
11311116
- final view = vm.Matrix4.translation(vm.Vector3(0.0, 0.0, -2.0));
@@ -1141,7 +1126,7 @@ steps:
11411126
final projection = vm.makePerspectiveMatrix(
11421127
vm.radians(45),
11431128
size.aspectRatio,
1144-
@@ -181,7 +188,6 @@ class TrianglePainter extends CustomPainter {
1129+
@@ -171,7 +178,6 @@ class TrianglePainter extends CustomPainter {
11451130
11461131
renderPass.bindPipeline(pipeline);
11471132

0 commit comments

Comments
 (0)