| Index: src/gpu/gl/GrGLGpuProgramCache.cpp
|
| diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp
|
| index df8cf60c7b3cf0d04298f61fe9c5e80c1bf1fe69..f37264aa1de14931035f4899f20164994dafb6a9 100644
|
| --- a/src/gpu/gl/GrGLGpuProgramCache.cpp
|
| +++ b/src/gpu/gl/GrGLGpuProgramCache.cpp
|
| @@ -108,28 +108,37 @@ int GrGLGpu::ProgramCache::search(const GrProgramDesc& desc) const {
|
| return SkTSearch(fEntries, fCount, desc, sizeof(Entry*), less);
|
| }
|
|
|
| -GrGLProgram* GrGLGpu::ProgramCache::refProgram(const DrawArgs& args) {
|
| +GrGLProgram* GrGLGpu::ProgramCache::refProgram(const GrGLGpu* gpu,
|
| + const GrPipeline& pipeline,
|
| + const GrPrimitiveProcessor& primProc) {
|
| #ifdef PROGRAM_CACHE_STATS
|
| ++fTotalRequests;
|
| #endif
|
|
|
| + // Get GrGLProgramDesc
|
| + GrGLProgramDesc desc;
|
| + if (!GrGLProgramDescBuilder::Build(&desc, primProc, pipeline, *gpu->glCaps().glslCaps())) {
|
| + GrCapsDebugf(gpu->caps(), "Failed to gl program descriptor!\n");
|
| + return nullptr;
|
| + }
|
| +
|
| Entry* entry = nullptr;
|
|
|
| - uint32_t hashIdx = args.fDesc->getChecksum();
|
| + uint32_t hashIdx = desc.getChecksum();
|
| hashIdx ^= hashIdx >> 16;
|
| if (kHashBits <= 8) {
|
| hashIdx ^= hashIdx >> 8;
|
| }
|
| hashIdx &=((1 << kHashBits) - 1);
|
| Entry* hashedEntry = fHashTable[hashIdx];
|
| - if (hashedEntry && hashedEntry->fProgram->getDesc() == *args.fDesc) {
|
| + if (hashedEntry && hashedEntry->fProgram->getDesc() == desc) {
|
| SkASSERT(hashedEntry->fProgram);
|
| entry = hashedEntry;
|
| }
|
|
|
| int entryIdx;
|
| if (nullptr == entry) {
|
| - entryIdx = this->search(*args.fDesc);
|
| + entryIdx = this->search(desc);
|
| if (entryIdx >= 0) {
|
| entry = fEntries[entryIdx];
|
| #ifdef PROGRAM_CACHE_STATS
|
| @@ -143,7 +152,7 @@ GrGLProgram* GrGLGpu::ProgramCache::refProgram(const DrawArgs& args) {
|
| #ifdef PROGRAM_CACHE_STATS
|
| ++fCacheMisses;
|
| #endif
|
| - GrGLProgram* program = GrGLProgramBuilder::CreateProgram(args, fGpu);
|
| + GrGLProgram* program = GrGLProgramBuilder::CreateProgram(pipeline, primProc, desc, fGpu);
|
| if (nullptr == program) {
|
| return nullptr;
|
| }
|
|
|