When using cached program binaries, always get uniform locations
If we have the BindUniformLocation extension, we normally use that to
tell GL what location to use for each uniform, before linking. But with
cached binaries, the result is already linked, and we still need to ask
for locations.
Change-Id: Ia29f1faef9d3c9354b92cfb34332854d6c6be1b7
Bug: chromium:977938
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223982
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index c830fad..0b56289 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -220,6 +220,7 @@
checkLinked = true;
#endif
bool cached = fCached.get() != nullptr;
+ bool usedProgramBinaries = false;
SkSL::String glsl[kGrShaderTypeCount];
SkSL::String* sksl[kGrShaderTypeCount] = {
&fVS.fCompilerString,
@@ -252,6 +253,7 @@
} else {
cached = false;
}
+ usedProgramBinaries = cached;
#if GR_TEST_UTILS
} else if (fGpu->getContext()->priv().options().fCacheSKSL) {
// Only switch to the stored SkSL if it unpacks correctly
@@ -364,7 +366,7 @@
}
}
}
- this->resolveProgramResourceLocations(programID);
+ this->resolveProgramResourceLocations(programID, usedProgramBinaries);
this->cleanupShaders(shadersToDelete);
if (!cached) {
@@ -443,8 +445,8 @@
return SkToBool(linked);
}
-void GrGLProgramBuilder::resolveProgramResourceLocations(GrGLuint programID) {
- fUniformHandler.getUniformLocations(programID, fGpu->glCaps());
+void GrGLProgramBuilder::resolveProgramResourceLocations(GrGLuint programID, bool force) {
+ fUniformHandler.getUniformLocations(programID, fGpu->glCaps(), force);
// handle NVPR separable varyings
if (!fGpu->glCaps().shaderCaps()->pathRenderingSupport() ||