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

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

Issue 1734163002: Replace fWillReadFragmentPosition with a bitfield (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: BuiltInState -> RequiredFeatures Created 4 years, 9 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/GrProcOptInfo.cpp ('k') | src/gpu/glsl/GrGLSLFragmentShaderBuilder.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 "GrProcessor.h" 9 #include "GrProcessor.h"
10 #include "GrPipeline.h" 10 #include "GrPipeline.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 glDesc->key().reset(); 113 glDesc->key().reset();
114 glDesc->key().push_back_n(kProcessorKeysOffset); 114 glDesc->key().push_back_n(kProcessorKeysOffset);
115 115
116 GrProcessorKeyBuilder b(&glDesc->key()); 116 GrProcessorKeyBuilder b(&glDesc->key());
117 117
118 primProc.getGLSLProcessorKey(glslCaps, &b); 118 primProc.getGLSLProcessorKey(glslCaps, &b);
119 if (!gen_meta_key(primProc, glslCaps, 0, &b)) { 119 if (!gen_meta_key(primProc, glslCaps, 0, &b)) {
120 glDesc->key().reset(); 120 glDesc->key().reset();
121 return false; 121 return false;
122 } 122 }
123 GrProcessor::RequiredFeatures requiredFeatures = primProc.requiredFeatures() ;
123 124
124 for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) { 125 for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) {
125 const GrFragmentProcessor& fp = pipeline.getFragmentProcessor(i); 126 const GrFragmentProcessor& fp = pipeline.getFragmentProcessor(i);
126 if (!gen_frag_proc_and_meta_keys(primProc, fp, glslCaps, &b)) { 127 if (!gen_frag_proc_and_meta_keys(primProc, fp, glslCaps, &b)) {
127 glDesc->key().reset(); 128 glDesc->key().reset();
128 return false; 129 return false;
129 } 130 }
131 requiredFeatures |= fp.requiredFeatures();
130 } 132 }
131 133
132 const GrXferProcessor& xp = pipeline.getXferProcessor(); 134 const GrXferProcessor& xp = pipeline.getXferProcessor();
133 xp.getGLSLProcessorKey(glslCaps, &b); 135 xp.getGLSLProcessorKey(glslCaps, &b);
134 if (!gen_meta_key(xp, glslCaps, 0, &b)) { 136 if (!gen_meta_key(xp, glslCaps, 0, &b)) {
135 glDesc->key().reset(); 137 glDesc->key().reset();
136 return false; 138 return false;
137 } 139 }
140 requiredFeatures |= xp.requiredFeatures();
138 141
139 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- ------------------- 142 // --------DO NOT MOVE HEADER ABOVE THIS LINE------------------------------- -------------------
140 // Because header is a pointer into the dynamic array, we can't push any new data into the key 143 // Because header is a pointer into the dynamic array, we can't push any new data into the key
141 // below here. 144 // below here.
142 KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>(); 145 KeyHeader* header = glDesc->atOffset<KeyHeader, kHeaderOffset>();
143 146
144 // make sure any padding in the header is zeroed. 147 // make sure any padding in the header is zeroed.
145 memset(header, 0, kHeaderSize); 148 memset(header, 0, kHeaderSize);
146 149
147 if (pipeline.readsFragPosition()) { 150 if (requiredFeatures & GrProcessor::kFragmentPosition_RequiredFeature) {
148 header->fFragPosKey = 151 header->fFragPosKey =
149 GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.get RenderTarget()); 152 GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.get RenderTarget());
150 } else { 153 } else {
151 header->fFragPosKey = 0; 154 header->fFragPosKey = 0;
152 } 155 }
153 156
154 header->fOutputSwizzle = 157 header->fOutputSwizzle =
155 glslCaps.configOutputSwizzle(pipeline.getRenderTarget()->config()).asKey (); 158 glslCaps.configOutputSwizzle(pipeline.getRenderTarget()->config()).asKey ();
156 159
157 if (pipeline.ignoresCoverage()) { 160 if (pipeline.ignoresCoverage()) {
158 header->fIgnoresCoverage = 1; 161 header->fIgnoresCoverage = 1;
159 } else { 162 } else {
160 header->fIgnoresCoverage = 0; 163 header->fIgnoresCoverage = 0;
161 } 164 }
162 165
163 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); 166 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters();
164 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); 167 header->fColorEffectCnt = pipeline.numColorFragmentProcessors();
165 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); 168 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors();
166 glDesc->finalize(); 169 glDesc->finalize();
167 return true; 170 return true;
168 } 171 }
OLDNEW
« no previous file with comments | « src/gpu/GrProcOptInfo.cpp ('k') | src/gpu/glsl/GrGLSLFragmentShaderBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698