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

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

Issue 815643005: Move program descriptor and primitive processor off of optstate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: bug fix Created 5 years, 11 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/GrGLProgramDesc.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.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 2013 Google Inc. 2 * Copyright 2013 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 #include "GrGLProgramDesc.h" 7 #include "GrGLProgramDesc.h"
8 8
9 #include "GrGLProcessor.h" 9 #include "GrGLProcessor.h"
10 #include "GrProcessor.h" 10 #include "GrProcessor.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (processorKeySize > SK_MaxU16) { 79 if (processorKeySize > SK_MaxU16) {
80 return false; 80 return false;
81 } 81 }
82 82
83 uint32_t* key = b->add32n(2); 83 uint32_t* key = b->add32n(2);
84 key[0] = (textureKey << 16 | transformKey); 84 key[0] = (textureKey << 16 | transformKey);
85 key[1] = (classID << 16 | SkToU16(processorKeySize)); 85 key[1] = (classID << 16 | SkToU16(processorKeySize));
86 return true; 86 return true;
87 } 87 }
88 88
89 bool GrGLProgramDescBuilder::Build(const GrOptDrawState& optState, 89 bool GrGLProgramDescBuilder::Build(GrProgramDesc* desc,
90 const GrPrimitiveProcessor& primProc,
91 const GrOptDrawState& optState,
90 const GrProgramDesc::DescInfo& descInfo, 92 const GrProgramDesc::DescInfo& descInfo,
91 GrGpu::DrawType drawType, 93 GrGpu::DrawType drawType,
92 GrGLGpu* gpu, 94 const GrGLGpu* gpu,
93 GrProgramDesc* desc) { 95 const GrBatchTracker& batchTracker) {
94 // The descriptor is used as a cache key. Thus when a field of the 96 // The descriptor is used as a cache key. Thus when a field of the
95 // descriptor will not affect program generation (because of the attribute 97 // descriptor will not affect program generation (because of the attribute
96 // bindings in use or other descriptor field settings) it should be set 98 // bindings in use or other descriptor field settings) it should be set
97 // to a canonical value to avoid duplicate programs with different keys. 99 // to a canonical value to avoid duplicate programs with different keys.
98 100
99 GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t)); 101 GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t));
100 // Make room for everything up to the effect keys. 102 // Make room for everything up to the effect keys.
101 desc->fKey.reset(); 103 desc->fKey.reset();
102 desc->fKey.push_back_n(kProcessorKeysOffset); 104 desc->fKey.push_back_n(kProcessorKeysOffset);
103 105
104 GrProcessorKeyBuilder b(&desc->fKey); 106 GrProcessorKeyBuilder b(&desc->fKey);
105 107
106 const GrPrimitiveProcessor& primProc = *optState.getPrimitiveProcessor(); 108 primProc.getGLProcessorKey(batchTracker, gpu->glCaps(), &b);
107 primProc.getGLProcessorKey(optState.getBatchTracker(), gpu->glCaps(), &b);
108 if (!get_meta_key(primProc, gpu->glCaps(), 0, &b)) { 109 if (!get_meta_key(primProc, gpu->glCaps(), 0, &b)) {
109 desc->fKey.reset(); 110 desc->fKey.reset();
110 return false; 111 return false;
111 } 112 }
112 113
113 for (int s = 0; s < optState.numFragmentStages(); ++s) { 114 for (int s = 0; s < optState.numFragmentStages(); ++s) {
114 const GrPendingFragmentStage& fps = optState.getFragmentStage(s); 115 const GrPendingFragmentStage& fps = optState.getFragmentStage(s);
115 const GrFragmentProcessor& fp = *fps.processor(); 116 const GrFragmentProcessor& fp = *fps.processor();
116 fp.getGLProcessorKey(gpu->glCaps(), &b); 117 fp.getGLProcessorKey(gpu->glCaps(), &b);
117 if (!get_meta_key(fp, gpu->glCaps(), primProc.getTransformKey(fp.coordTr ansforms()), &b)) { 118 if (!get_meta_key(fp, gpu->glCaps(), primProc.getTransformKey(fp.coordTr ansforms()), &b)) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 gpu->glCaps()) ; 156 gpu->glCaps()) ;
156 } else { 157 } else {
157 header->fFragPosKey = 0; 158 header->fFragPosKey = 0;
158 } 159 }
159 160
160 header->fColorEffectCnt = optState.numColorStages(); 161 header->fColorEffectCnt = optState.numColorStages();
161 header->fCoverageEffectCnt = optState.numCoverageStages(); 162 header->fCoverageEffectCnt = optState.numCoverageStages();
162 desc->finalize(); 163 desc->finalize();
163 return true; 164 return true;
164 } 165 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698