@@ -19,8 +19,13 @@ class ShaderData {
1919 if (rawShaderData is ! Map <String , Object ?>) {
2020 throw const FormatException ('Invalid Shader Data' );
2121 }
22- final Object ? source = rawShaderData['sksl' ];
23- final Object ? rawUniforms = rawShaderData['uniforms' ];
22+ final Object ? root = rawShaderData['sksl' ];
23+ if (root is ! Map <String , Object ?>) {
24+ throw const FormatException ('Invalid Shader Data' );
25+ }
26+
27+ final Object ? source = root['shader' ];
28+ final Object ? rawUniforms = root['uniforms' ];
2429 if (source is ! String || rawUniforms is ! List <Object ?>) {
2530 throw const FormatException ('Invalid Shader Data' );
2631 }
@@ -47,14 +52,30 @@ class ShaderData {
4752 if (type == UniformType .SampledImage ) {
4853 textureCount += 1 ;
4954 } else {
50- final Object ? rows = rawUniformData['rows' ];
5155 final Object ? bitWidth = rawUniformData['bit_width' ];
52- if (bitWidth is ! int || rows is ! int ) {
56+
57+ final Object ? arrayElements = rawUniformData['array_elements' ];
58+ final Object ? rows = rawUniformData['rows' ];
59+ final Object ? columns = rawUniformData['columns' ];
60+
61+ if (bitWidth is ! int ||
62+ rows is ! int ||
63+ arrayElements is ! int ||
64+ columns is ! int ) {
5365 throw const FormatException ('Invalid Shader Data' );
5466 }
55- floatCount += (bitWidth ~ / 32 ) * rows;
67+
68+ final int units = rows * columns;
69+
70+ int value = (bitWidth ~ / 32 ) * units;
71+
72+ if (arrayElements > 1 ) {
73+ value *= arrayElements;
74+ }
75+
76+ floatCount += value;
5677 }
57- uniforms[location ] = UniformData (
78+ uniforms[i ] = UniformData (
5879 name: name,
5980 location: location,
6081 type: type,
0 commit comments