Add error checks to the copyFrom functions.

Change-Id: Iac064c52eb58b05a94fa1c432304c6216256555b
This commit is contained in:
Jason Sams
2011-01-16 15:04:08 -08:00
parent 300406abd4
commit b97b251c26
4 changed files with 85 additions and 11 deletions

View File

@ -280,9 +280,10 @@ public class ProgramFragmentFixedFunction extends ProgramFragment {
pf.mTextureCount = MAX_TEXTURE;
if (!mVaryingColorEnable) {
Allocation constantData = Allocation.createTyped(mRS,constType);
float[] data = new float[4];
data[0] = data[1] = data[2] = data[3] = 1.0f;
constantData.copyFrom(data);
FieldPacker fp = new FieldPacker(16);
Float4 f4 = new Float4(1.f, 1.f, 1.f, 1.f);
fp.addF32(f4);
constantData.setFromFieldPacker(0, fp);
pf.bindConstants(constantData, 0);
}
return pf;