Fix shader initialization on a cache hit

Bug: skia:
Change-Id: I1ad93442df1b53ce5f1cfb7285479c6b860b7e24
Reviewed-on: https://skia-review.googlesource.com/71461
Reviewed-by: Stan Iliev <stani@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Ethan Nicholas 2017-11-14 14:35:57 -05:00 committed by Skia Commit-Bot
parent 443a913b8f
commit 907204f326

View File

@ -151,11 +151,15 @@ GrGLProgram* GrGLProgramBuilder::finalize() {
SkTDArray<GrGLuint> shadersToDelete;
bool cached = nullptr != fCached.get();
if (cached) {
this->bindProgramResourceLocations(programID);
// cache hit, just hand the binary to GL
const uint8_t* bytes = fCached->bytes();
size_t offset = 0;
memcpy(&inputs, bytes + offset, sizeof(inputs));
offset += sizeof(inputs);
if (inputs.fRTHeight) {
this->addRTHeightUniform(SKSL_RTHEIGHT_NAME);
}
int binaryFormat;
memcpy(&binaryFormat, bytes + offset, sizeof(binaryFormat));
offset += sizeof(binaryFormat);