-
Bug
-
Resolution: Unresolved
-
None
-
1.17.1
-
Community Consensus
-
(Unassigned)
adding this line to the uniforms section of the shader json causes my custom shader to fail to parse:
{ "name": "NormalMat", "type": "matrix3x3", "count": 9, "values": [ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 ]}
This is caused because the size of the array used to set the uniform has a minimum size of 16:
This float array is then passed into Uniform#set(float[] values), which assumes that the array is the right size for the FloatBuffer used to store the values.
This can be fixed by either changing the default size of the array, or limiting the number of copied values into the buffer. The simplest change is to change line 255 in the image above to the following:
floatBuffer.put(src, 0, count);