Finalize gpu shaders in ProgramBuilding.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1689703002
Review URL: https://codereview.chromium.org/1689703002
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 905fcde..b1d5980 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -134,9 +134,10 @@
return nullptr;
}
+ this->finalizeShaders();
+
// compile shaders and bind attributes / uniforms
SkTDArray<GrGLuint> shadersToDelete;
- fVS.finalize(GrGLSLUniformHandler::kVertex_Visibility);
if (!this->compileAndAttachShaders(fVS, programID, GR_GL_VERTEX_SHADER, &shadersToDelete)) {
this->cleanupProgram(programID, shadersToDelete);
return nullptr;
@@ -153,7 +154,6 @@
}
}
- fFS.finalize(GrGLSLUniformHandler::kFragment_Visibility);
if (!this->compileAndAttachShaders(fFS, programID, GR_GL_FRAGMENT_SHADER, &shadersToDelete)) {
this->cleanupProgram(programID, shadersToDelete);
return nullptr;
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 900b6ee..45570c2 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -10,6 +10,7 @@
#include "GrPipeline.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLGeometryProcessor.h"
+#include "glsl/GrGLSLVarying.h"
#include "glsl/GrGLSLXferProcessor.h"
const int GrGLSLProgramBuilder::kVarsPerBlock = 8;
@@ -286,3 +287,9 @@
}
}
+void GrGLSLProgramBuilder::finalizeShaders() {
+ this->varyingHandler()->finalize();
+ fVS.finalize(GrGLSLUniformHandler::kVertex_Visibility);
+ fFS.finalize(GrGLSLUniformHandler::kFragment_Visibility);
+
+}
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h
index a277595..fae8df0 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.h
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.h
@@ -98,6 +98,8 @@
void cleanupFragmentProcessors();
+ void finalizeShaders();
+
private:
// reset is called by program creator between each processor's emit code. It increments the
// stage offset for variable name mangling, and also ensures verfication variables in the