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

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

Issue 628293002: Plumb OptDrawState down to VertexShaderBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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/gl/GrGpuGL.h ('k') | src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.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 "GrGpuGL.h" 8 #include "GrGpuGL.h"
9 9
10 #include "GrProcessor.h" 10 #include "GrProcessor.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 SkDELETE(fEntries[i]); 83 SkDELETE(fEntries[i]);
84 } 84 }
85 fCount = 0; 85 fCount = 0;
86 } 86 }
87 87
88 int GrGpuGL::ProgramCache::search(const GrGLProgramDesc& desc) const { 88 int GrGpuGL::ProgramCache::search(const GrGLProgramDesc& desc) const {
89 ProgDescLess less; 89 ProgDescLess less;
90 return SkTSearch(fEntries, fCount, desc, sizeof(Entry*), less); 90 return SkTSearch(fEntries, fCount, desc, sizeof(Entry*), less);
91 } 91 }
92 92
93 GrGLProgram* GrGpuGL::ProgramCache::getProgram(const GrGLProgramDesc& desc, 93 GrGLProgram* GrGpuGL::ProgramCache::getProgram(const GrOptDrawState& optState,
94 const GrGLProgramDesc& desc,
94 const GrGeometryStage* geometryPr ocessor, 95 const GrGeometryStage* geometryPr ocessor,
95 const GrFragmentStage* colorStage s[], 96 const GrFragmentStage* colorStage s[],
96 const GrFragmentStage* coverageSt ages[]) { 97 const GrFragmentStage* coverageSt ages[]) {
97 #ifdef PROGRAM_CACHE_STATS 98 #ifdef PROGRAM_CACHE_STATS
98 ++fTotalRequests; 99 ++fTotalRequests;
99 #endif 100 #endif
100 101
101 Entry* entry = NULL; 102 Entry* entry = NULL;
102 103
103 uint32_t hashIdx = desc.getChecksum(); 104 uint32_t hashIdx = desc.getChecksum();
(...skipping 17 matching lines...) Expand all
121 ++fHashMisses; 122 ++fHashMisses;
122 #endif 123 #endif
123 } 124 }
124 } 125 }
125 126
126 if (NULL == entry) { 127 if (NULL == entry) {
127 // We have a cache miss 128 // We have a cache miss
128 #ifdef PROGRAM_CACHE_STATS 129 #ifdef PROGRAM_CACHE_STATS
129 ++fCacheMisses; 130 ++fCacheMisses;
130 #endif 131 #endif
131 GrGLProgram* program = GrGLProgram::Create(fGpu, desc, geometryProcessor , 132 GrGLProgram* program = GrGLProgram::Create(fGpu, optState, desc, geometr yProcessor,
132 colorStages, coverageStages); 133 colorStages, coverageStages);
133 if (NULL == program) { 134 if (NULL == program) {
134 return NULL; 135 return NULL;
135 } 136 }
136 int purgeIdx = 0; 137 int purgeIdx = 0;
137 if (fCount < kMaxEntries) { 138 if (fCount < kMaxEntries) {
138 entry = SkNEW(Entry); 139 entry = SkNEW(Entry);
139 purgeIdx = fCount++; 140 purgeIdx = fCount++;
140 fEntries[purgeIdx] = entry; 141 fEntries[purgeIdx] = entry;
141 } else { 142 } else {
142 SkASSERT(fCount == kMaxEntries); 143 SkASSERT(fCount == kMaxEntries);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 this, 239 this,
239 dstCopy, 240 dstCopy,
240 &geometryProcessor, 241 &geometryProcessor,
241 &colorStages, 242 &colorStages,
242 &coverageStages, 243 &coverageStages,
243 &desc)) { 244 &desc)) {
244 SkDEBUGFAIL("Failed to generate GL program descriptor"); 245 SkDEBUGFAIL("Failed to generate GL program descriptor");
245 return false; 246 return false;
246 } 247 }
247 248
248 fCurrentProgram.reset(fProgramCache->getProgram(desc, 249 fCurrentProgram.reset(fProgramCache->getProgram(*optState.get(),
250 desc,
249 geometryProcessor, 251 geometryProcessor,
250 colorStages.begin(), 252 colorStages.begin(),
251 coverageStages.begin())) ; 253 coverageStages.begin())) ;
252 if (NULL == fCurrentProgram.get()) { 254 if (NULL == fCurrentProgram.get()) {
253 SkDEBUGFAIL("Failed to create program!"); 255 SkDEBUGFAIL("Failed to create program!");
254 return false; 256 return false;
255 } 257 }
256 258
257 fCurrentProgram.get()->ref(); 259 fCurrentProgram.get()->ref();
258 260
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 GrGLAttribTypeToLayout(attribType).fCount, 364 GrGLAttribTypeToLayout(attribType).fCount,
363 GrGLAttribTypeToLayout(attribType).fType, 365 GrGLAttribTypeToLayout(attribType).fType,
364 GrGLAttribTypeToLayout(attribType).fNormalized, 366 GrGLAttribTypeToLayout(attribType).fNormalized,
365 stride, 367 stride,
366 reinterpret_cast<GrGLvoid*>( 368 reinterpret_cast<GrGLvoid*>(
367 vertexOffsetInBytes + vertexAttrib->fOffset)); 369 vertexOffsetInBytes + vertexAttrib->fOffset));
368 } 370 }
369 attribState->disableUnusedArrays(this, usedAttribArraysMask); 371 attribState->disableUnusedArrays(this, usedAttribArraysMask);
370 } 372 }
371 } 373 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698