-
- // Allocate space for the bytecode in ShaderData
- mProgramData->AllocateBuffer(binaryLength);
- // Copy the bytecode to ShaderData
- CHECK_GL( mContext, mGlAbstraction.GetProgramBinary(mProgramId, binaryLength, NULL, &binaryFormat, mProgramData->buffer.data()) );
+ if( binaryLength > 0 )
+ {
+ // Allocate space for the bytecode in ShaderData
+ mProgramData->AllocateBuffer(binaryLength);
+ // Copy the bytecode to ShaderData
+ CHECK_GL( mGlAbstraction, mGlAbstraction.GetProgramBinary(mProgramId, binaryLength, NULL, &binaryFormat, mProgramData->GetBufferData()) );
+ mCache.StoreBinary( mProgramData );
+ }