Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 3f22e19

Browse files
[web] correct float count in runtime effect (#38288)
1 parent 955447b commit 3f22e19

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

+3-2
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

+1-1
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)