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
This commit is contained in:
egdaniel 2016-02-10 09:50:38 -08:00 committed by Commit bot
parent 94edeb2d3b
commit 9f1d4151ee
3 changed files with 11 additions and 2 deletions

View File

@ -134,9 +134,10 @@ GrGLProgram* GrGLProgramBuilder::finalize() {
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 @@ GrGLProgram* GrGLProgramBuilder::finalize() {
}
}
fFS.finalize(GrGLSLUniformHandler::kFragment_Visibility);
if (!this->compileAndAttachShaders(fFS, programID, GR_GL_FRAGMENT_SHADER, &shadersToDelete)) {
this->cleanupProgram(programID, shadersToDelete);
return nullptr;

View File

@ -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::cleanupFragmentProcessors() {
}
}
void GrGLSLProgramBuilder::finalizeShaders() {
this->varyingHandler()->finalize();
fVS.finalize(GrGLSLUniformHandler::kVertex_Visibility);
fFS.finalize(GrGLSLUniformHandler::kFragment_Visibility);
}

View File

@ -98,6 +98,8 @@ protected:
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