Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions lib/web_ui/lib/src/engine/canvaskit/painting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,12 @@ class CkFragmentProgram implements ui.FragmentProgram {
if (type == UniformType.SampledImage) {
textureCount += 1;
} else {
final Object? rows = rawUniformData['rows'];
final Object? bitWidth = rawUniformData['bit_width'];
if (bitWidth is! int) {
if (bitWidth is! int || rows is! int) {
throw const FormatException('Invalid Shader Data');
}
floatCount += bitWidth ~/ 32;
floatCount += (bitWidth ~/ 32) * rows;
}
uniforms[location] = UniformData(
name: name,
Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/test/canvaskit/fragment_program_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void testMain() {
final CkFragmentProgram program = await CkFragmentProgram.fromBytes('test', data);

expect(program.effect, isNotNull);
expect(program.floatCount, 17);
expect(program.floatCount, 32);
expect(program.textureCount, 0);
expect(program.uniforms, hasLength(17));
expect(program.name, 'test');
Expand Down