Skip to content

Commit 2f6e25d

Browse files
jonahwilliamsloic-sharma
authored andcommitted
[web] correct float count in runtime effect (flutter#38288)
1 parent f8ab405 commit 2f6e25d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/web_ui/lib/src/engine/canvaskit/painting.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,12 @@ class CkFragmentProgram implements ui.FragmentProgram {
423423
if (type == UniformType.SampledImage) {
424424
textureCount += 1;
425425
} else {
426+
final Object? rows = rawUniformData['rows'];
426427
final Object? bitWidth = rawUniformData['bit_width'];
427-
if (bitWidth is! int) {
428+
if (bitWidth is! int || rows is! int) {
428429
throw const FormatException('Invalid Shader Data');
429430
}
430-
floatCount += bitWidth ~/ 32;
431+
floatCount += (bitWidth ~/ 32) * rows;
431432
}
432433
uniforms[location] = UniformData(
433434
name: name,

lib/web_ui/test/canvaskit/fragment_program_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ void testMain() {
192192
final CkFragmentProgram program = await CkFragmentProgram.fromBytes('test', data);
193193

194194
expect(program.effect, isNotNull);
195-
expect(program.floatCount, 17);
195+
expect(program.floatCount, 32);
196196
expect(program.textureCount, 0);
197197
expect(program.uniforms, hasLength(17));
198198
expect(program.name, 'test');

0 commit comments

Comments
 (0)