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

Side by Side Diff: src/gpu/GrProgramDesc.cpp

Issue 2358843002: Conditionally insert gl_PointSize into shaders. (Closed)
Patch Set: minor Created 4 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/GrProgramDesc.h ('k') | src/gpu/gl/GrGLGpu.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 2016 Google Inc. 2 * Copyright 2016 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 "GrProgramDesc.h" 7 #include "GrProgramDesc.h"
8 8
9 #include "GrProcessor.h" 9 #include "GrProcessor.h"
10 #include "GrPipeline.h" 10 #include "GrPipeline.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 100
101 fp.getGLSLProcessorKey(glslCaps, b); 101 fp.getGLSLProcessorKey(glslCaps, b);
102 102
103 return gen_meta_key(fp, glslCaps, primProc.getTransformKey(fp.coordTransform s(), 103 return gen_meta_key(fp, glslCaps, primProc.getTransformKey(fp.coordTransform s(),
104 fp.numCoordTransf orms()), b); 104 fp.numCoordTransf orms()), b);
105 } 105 }
106 106
107 bool GrProgramDesc::Build(GrProgramDesc* desc, 107 bool GrProgramDesc::Build(GrProgramDesc* desc,
108 const GrPrimitiveProcessor& primProc, 108 const GrPrimitiveProcessor& primProc,
109 bool hasPointSize,
109 const GrPipeline& pipeline, 110 const GrPipeline& pipeline,
110 const GrGLSLCaps& glslCaps) { 111 const GrGLSLCaps& glslCaps) {
111 // The descriptor is used as a cache key. Thus when a field of the 112 // The descriptor is used as a cache key. Thus when a field of the
112 // descriptor will not affect program generation (because of the attribute 113 // descriptor will not affect program generation (because of the attribute
113 // bindings in use or other descriptor field settings) it should be set 114 // bindings in use or other descriptor field settings) it should be set
114 // to a canonical value to avoid duplicate programs with different keys. 115 // to a canonical value to avoid duplicate programs with different keys.
115 116
116 GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t)); 117 GR_STATIC_ASSERT(0 == kProcessorKeysOffset % sizeof(uint32_t));
117 // Make room for everything up to the effect keys. 118 // Make room for everything up to the effect keys.
118 desc->key().reset(); 119 desc->key().reset();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if (requiredFeatures & GrProcessor::kSampleLocations_RequiredFeature) { 165 if (requiredFeatures & GrProcessor::kSampleLocations_RequiredFeature) {
165 SkASSERT(pipeline.isHWAntialiasState()); 166 SkASSERT(pipeline.isHWAntialiasState());
166 header->fSamplePatternKey = 167 header->fSamplePatternKey =
167 rt->renderTargetPriv().getMultisampleSpecs(pipeline.getStencil()).fU niqueID; 168 rt->renderTargetPriv().getMultisampleSpecs(pipeline.getStencil()).fU niqueID;
168 } else { 169 } else {
169 header->fSamplePatternKey = 0; 170 header->fSamplePatternKey = 0;
170 } 171 }
171 172
172 header->fOutputSwizzle = glslCaps.configOutputSwizzle(rt->config()).asKey(); 173 header->fOutputSwizzle = glslCaps.configOutputSwizzle(rt->config()).asKey();
173 174
174 if (pipeline.ignoresCoverage()) { 175 header->fIgnoresCoverage = pipeline.ignoresCoverage() ? 1 : 0;
175 header->fIgnoresCoverage = 1;
176 } else {
177 header->fIgnoresCoverage = 0;
178 }
179 176
180 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); 177 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters();
181 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); 178 header->fColorFragmentProcessorCnt = pipeline.numColorFragmentProcessors();
182 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); 179 header->fCoverageFragmentProcessorCnt = pipeline.numCoverageFragmentProcesso rs();
180 // Fail if the client requested more processors than the key can fit.
181 if (header->fColorFragmentProcessorCnt != pipeline.numColorFragmentProcessor s() ||
182 header->fCoverageFragmentProcessorCnt != pipeline.numCoverageFragmentPro cessors()) {
183 return false;
184 }
185 header->fHasPointSize = hasPointSize ? 1 : 0;
183 return true; 186 return true;
184 } 187 }
OLDNEW
« no previous file with comments | « src/gpu/GrProgramDesc.h ('k') | src/gpu/gl/GrGLGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698