Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: src/gpu/gl/GrGLGpuProgramCache.cpp

Issue 2318523006: Merge GrGLSLProgramDesc into GrProgramDesc (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrProgramDesc.cpp ('k') | src/gpu/gl/GrGLProgram.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLGpu.h" 8 #include "GrGLGpu.h"
9 9
10 #include "builders/GrGLProgramBuilder.h" 10 #include "builders/GrGLProgramBuilder.h"
11 #include "GrProcessor.h" 11 #include "GrProcessor.h"
12 #include "GrProgramDesc.h"
12 #include "GrGLPathRendering.h" 13 #include "GrGLPathRendering.h"
13 #include "glsl/GrGLSLFragmentProcessor.h" 14 #include "glsl/GrGLSLFragmentProcessor.h"
14 #include "glsl/GrGLSLProgramDataManager.h" 15 #include "glsl/GrGLSLProgramDataManager.h"
15 #include "glsl/GrGLSLProgramDesc.h"
16 #include "SkTSearch.h" 16 #include "SkTSearch.h"
17 17
18 #ifdef PROGRAM_CACHE_STATS 18 #ifdef PROGRAM_CACHE_STATS
19 // Display program cache usage 19 // Display program cache usage
20 static const bool c_DisplayCache{false}; 20 static const bool c_DisplayCache{false};
21 #endif 21 #endif
22 22
23 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; 23 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
24 24
25 struct GrGLGpu::ProgramCache::Entry { 25 struct GrGLGpu::ProgramCache::Entry {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 GrGLProgram* GrGLGpu::ProgramCache::refProgram(const GrGLGpu* gpu, 107 GrGLProgram* GrGLGpu::ProgramCache::refProgram(const GrGLGpu* gpu,
108 const GrPipeline& pipeline, 108 const GrPipeline& pipeline,
109 const GrPrimitiveProcessor& primP roc) { 109 const GrPrimitiveProcessor& primP roc) {
110 #ifdef PROGRAM_CACHE_STATS 110 #ifdef PROGRAM_CACHE_STATS
111 ++fTotalRequests; 111 ++fTotalRequests;
112 #endif 112 #endif
113 113
114 // Get GrGLProgramDesc 114 // Get GrGLProgramDesc
115 GrGLSLProgramDesc desc; 115 GrProgramDesc desc;
116 if (!GrGLSLProgramDescBuilder::Build(&desc, primProc, pipeline, *gpu->glCaps ().glslCaps())) { 116 if (!GrProgramDesc::Build(&desc, primProc, pipeline, *gpu->glCaps().glslCaps ())) {
117 GrCapsDebugf(gpu->caps(), "Failed to gl program descriptor!\n"); 117 GrCapsDebugf(gpu->caps(), "Failed to gl program descriptor!\n");
118 return nullptr; 118 return nullptr;
119 } 119 }
120 desc.finalize();
120 121
121 Entry* entry = nullptr; 122 Entry* entry = nullptr;
122 123
123 uint32_t hashIdx = desc.getChecksum(); 124 uint32_t hashIdx = desc.getChecksum();
124 hashIdx ^= hashIdx >> 16; 125 hashIdx ^= hashIdx >> 16;
125 if (kHashBits <= 8) { 126 if (kHashBits <= 8) {
126 hashIdx ^= hashIdx >> 8; 127 hashIdx ^= hashIdx >> 8;
127 } 128 }
128 hashIdx &=((1 << kHashBits) - 1); 129 hashIdx &=((1 << kHashBits) - 1);
129 Entry* hashedEntry = fHashTable[hashIdx]; 130 Entry* hashedEntry = fHashTable[hashIdx];
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 212
212 if (SK_MaxU32 == fCurrLRUStamp) { 213 if (SK_MaxU32 == fCurrLRUStamp) {
213 // wrap around! just trash our LRU, one time hit. 214 // wrap around! just trash our LRU, one time hit.
214 for (int i = 0; i < fCount; ++i) { 215 for (int i = 0; i < fCount; ++i) {
215 fEntries[i]->fLRUStamp = 0; 216 fEntries[i]->fLRUStamp = 0;
216 } 217 }
217 } 218 }
218 ++fCurrLRUStamp; 219 ++fCurrLRUStamp;
219 return SkRef(entry->fProgram.get()); 220 return SkRef(entry->fProgram.get());
220 } 221 }
OLDNEW
« no previous file with comments | « src/gpu/GrProgramDesc.cpp ('k') | src/gpu/gl/GrGLProgram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698