#include "GrEffect.h"
#include "GrGLEffect.h"
#include "SkRTConf.h"
-#include "GrGLNameAllocator.h"
+#include "GrGLPathRendering.h"
#include "SkTSearch.h"
#ifdef PROGRAM_CACHE_STATS
"Display program cache usage.");
#endif
-typedef GrGLUniformManager::UniformHandle UniformHandle;
+typedef GrGLProgramDataManager::UniformHandle UniformHandle;
struct GrGpuGL::ProgramCache::Entry {
SK_DECLARE_INST_COUNT_ROOT(Entry);
for (int i = 0; i < fCount; ++i) {
SkASSERT(NULL != fEntries[i]->fProgram.get());
fEntries[i]->fProgram->abandon();
- fEntries[i]->fProgram.reset(NULL);
+ SkDELETE(fEntries[i]);
}
fCount = 0;
}
INHERITED::abandonResources();
fProgramCache->abandon();
fHWProgramID = 0;
- fPathNameAllocator.reset(NULL);
+ if (this->glCaps().pathRenderingSupport()) {
+ fPathRendering->abandonGpuResources();
+ }
}
////////////////////////////////////////////////////////////////////////////////
SkSTArray<8, const GrEffectStage*, true> colorStages;
SkSTArray<8, const GrEffectStage*, true> coverageStages;
GrGLProgramDesc desc;
- GrGLProgramDesc::Build(this->getDrawState(),
+ if (!GrGLProgramDesc::Build(this->getDrawState(),
type,
blendOpts,
srcCoeff,
dstCopy,
&colorStages,
&coverageStages,
- &desc);
+ &desc)) {
+ SkDEBUGFAIL("Failed to generate GL program descriptor");
+ return false;
+ }
fCurrentProgram.reset(fProgramCache->getProgram(desc,
colorStages.begin(),
uint32_t usedAttribArraysMask = 0;
const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttribs();
+ bool canIgnoreColorAttrib = this->getDrawState().canIgnoreColorAttribute();
+
for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount;
++vertexAttribIndex, ++vertexAttrib) {
+ if (kColor_GrVertexAttribBinding != vertexAttrib->fBinding || !canIgnoreColorAttrib) {
usedAttribArraysMask |= (1 << vertexAttribIndex);
GrVertexAttribType attribType = vertexAttrib->fType;
attribState->set(this,
stride,
reinterpret_cast<GrGLvoid*>(
vertexOffsetInBytes + vertexAttrib->fOffset));
+ }
}
attribState->disableUnusedArrays(this, usedAttribArraysMask);
}