[web] correct float count in runtime effect (flutter/engine#38288)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user