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

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

Issue 778453002: Remove backend factories (Closed) Base URL: https://skia.googlesource.com/skia.git@unichoice
Patch Set: more clang warnings Created 6 years 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/GrGLProcessor.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('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 "GrBackendProcessorFactory.h"
11 #include "GrProcessor.h" 10 #include "GrProcessor.h"
12 #include "GrGpuGL.h" 11 #include "GrGpuGL.h"
13 #include "GrOptDrawState.h" 12 #include "GrOptDrawState.h"
14 #include "SkChecksum.h" 13 #include "SkChecksum.h"
15 #include "gl/builders/GrGLFragmentShaderBuilder.h" 14 #include "gl/builders/GrGLFragmentShaderBuilder.h"
16 15
17 /** 16 /**
18 * The key for an individual coord transform is made up of a matrix type and a b it that 17 * The key for an individual coord transform is made up of a matrix type and a b it that
19 * indicates the source of the input coords. 18 * indicates the source of the input coords.
20 */ 19 */
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 * textures, transforms, etc, for the space allotted in the meta-key. NOTE, bot h FPs and GPs share 117 * textures, transforms, etc, for the space allotted in the meta-key. NOTE, bot h FPs and GPs share
119 * this function because it is hairy, though FPs do not have attribs, and GPs do not have transforms 118 * this function because it is hairy, though FPs do not have attribs, and GPs do not have transforms
120 */ 119 */
121 static bool get_meta_key(const GrProcessor& proc, 120 static bool get_meta_key(const GrProcessor& proc,
122 const GrGLCaps& caps, 121 const GrGLCaps& caps,
123 uint32_t transformKey, 122 uint32_t transformKey,
124 uint32_t attribKey, 123 uint32_t attribKey,
125 GrProcessorKeyBuilder* b) { 124 GrProcessorKeyBuilder* b) {
126 size_t processorKeySize = b->size(); 125 size_t processorKeySize = b->size();
127 uint32_t textureKey = gen_texture_key(proc, caps); 126 uint32_t textureKey = gen_texture_key(proc, caps);
128 uint32_t classID = proc.getFactory().classID(); 127 uint32_t classID = proc.classID();
129 128
130 // Currently we allow 16 bits for each of the above portions of the meta-key . Fail if they 129 // Currently we allow 16 bits for each of the above portions of the meta-key . Fail if they
131 // don't fit. 130 // don't fit.
132 static const uint32_t kMetaKeyInvalidMask = ~((uint32_t) SK_MaxU16); 131 static const uint32_t kMetaKeyInvalidMask = ~((uint32_t) SK_MaxU16);
133 if ((textureKey | transformKey | classID) & kMetaKeyInvalidMask) { 132 if ((textureKey | transformKey | classID) & kMetaKeyInvalidMask) {
134 return false; 133 return false;
135 } 134 }
136 if (processorKeySize > SK_MaxU16) { 135 if (processorKeySize > SK_MaxU16) {
137 return false; 136 return false;
138 } 137 }
(...skipping 21 matching lines...) Expand all
160 159
161 GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t)); 160 GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t));
162 // Make room for everything up to the effect keys. 161 // Make room for everything up to the effect keys.
163 desc->fKey.reset(); 162 desc->fKey.reset();
164 desc->fKey.push_back_n(kProcessorKeysOffset); 163 desc->fKey.push_back_n(kProcessorKeysOffset);
165 164
166 // We can only have one effect which touches the vertex shader 165 // We can only have one effect which touches the vertex shader
167 if (optState.hasGeometryProcessor()) { 166 if (optState.hasGeometryProcessor()) {
168 const GrGeometryProcessor& gp = *optState.getGeometryProcessor(); 167 const GrGeometryProcessor& gp = *optState.getGeometryProcessor();
169 GrProcessorKeyBuilder b(&desc->fKey); 168 GrProcessorKeyBuilder b(&desc->fKey);
170 const GrBackendGeometryProcessorFactory& factory = gp.getFactory(); 169 gp.getGLProcessorKey(optState.getBatchTracker(), gpu->glCaps(), &b);
171 factory.getGLProcessorKey(gp, optState.getBatchTracker(), gpu->glCaps(), &b);
172 if (!get_meta_key(gp, gpu->glCaps(), 0, gen_attrib_key(gp), &b)) { 170 if (!get_meta_key(gp, gpu->glCaps(), 0, gen_attrib_key(gp), &b)) {
173 desc->fKey.reset(); 171 desc->fKey.reset();
174 return false; 172 return false;
175 } 173 }
176 } 174 }
177 175
178 for (int s = 0; s < optState.numFragmentStages(); ++s) { 176 for (int s = 0; s < optState.numFragmentStages(); ++s) {
179 const GrPendingFragmentStage& fps = optState.getFragmentStage(s); 177 const GrPendingFragmentStage& fps = optState.getFragmentStage(s);
180 const GrFragmentProcessor& fp = *fps.getProcessor(); 178 const GrFragmentProcessor& fp = *fps.getProcessor();
181 GrProcessorKeyBuilder b(&desc->fKey); 179 GrProcessorKeyBuilder b(&desc->fKey);
182 const GrBackendFragmentProcessorFactory& factory = fp.getFactory(); 180 fp.getGLProcessorKey(gpu->glCaps(), &b);
183 factory.getGLProcessorKey(fp, gpu->glCaps(), &b);
184 if (!get_meta_key(*fps.getProcessor(), gpu->glCaps(), 181 if (!get_meta_key(*fps.getProcessor(), gpu->glCaps(),
185 gen_transform_key(fps, requiresLocalCoordAttrib), 0, &b )) { 182 gen_transform_key(fps, requiresLocalCoordAttrib), 0, &b )) {
186 desc->fKey.reset(); 183 desc->fKey.reset();
187 return false; 184 return false;
188 } 185 }
189 } 186 }
190 187
191 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- ------------------- 188 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- -------------------
192 // Because header is a pointer into the dynamic array, we can't push any new data into the key 189 // Because header is a pointer into the dynamic array, we can't push any new data into the key
193 // below here. 190 // below here.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 250 }
254 251
255 header->fPrimaryOutputType = descInfo.fPrimaryOutputType; 252 header->fPrimaryOutputType = descInfo.fPrimaryOutputType;
256 header->fSecondaryOutputType = descInfo.fSecondaryOutputType; 253 header->fSecondaryOutputType = descInfo.fSecondaryOutputType;
257 254
258 header->fColorEffectCnt = optState.numColorStages(); 255 header->fColorEffectCnt = optState.numColorStages();
259 header->fCoverageEffectCnt = optState.numCoverageStages(); 256 header->fCoverageEffectCnt = optState.numCoverageStages();
260 desc->finalize(); 257 desc->finalize();
261 return true; 258 return true;
262 } 259 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProcessor.h ('k') | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698