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

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

Issue 586793002: Change GrGLProgramDesc header to have DoPathRendering flag instead of RequiresVertexShader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cast to bool Created 6 years, 3 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/GrGLFragmentOnlyProgramBuilder.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 7
8 #include "gl/builders/GrGLProgramBuilder.h" 8 #include "gl/builders/GrGLProgramBuilder.h"
9 #include "GrGLProgramDesc.h" 9 #include "GrGLProgramDesc.h"
10 #include "GrBackendEffectFactory.h" 10 #include "GrBackendEffectFactory.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (!gen_effect_meta_key(stage, useExplicitLocalCoords, caps, b)) { 156 if (!gen_effect_meta_key(stage, useExplicitLocalCoords, caps, b)) {
157 return false; 157 return false;
158 } 158 }
159 return true; 159 return true;
160 } 160 }
161 161
162 bool GrGLProgramDesc::Build(const GrOptDrawState& optState, 162 bool GrGLProgramDesc::Build(const GrOptDrawState& optState,
163 GrGpu::DrawType drawType, 163 GrGpu::DrawType drawType,
164 GrBlendCoeff srcCoeff, 164 GrBlendCoeff srcCoeff,
165 GrBlendCoeff dstCoeff, 165 GrBlendCoeff dstCoeff,
166 const GrGpuGL* gpu, 166 GrGpuGL* gpu,
167 const GrDeviceCoordTexture* dstCopy, 167 const GrDeviceCoordTexture* dstCopy,
168 const GrEffectStage** geometryProcessor, 168 const GrEffectStage** geometryProcessor,
169 SkTArray<const GrEffectStage*, true>* colorStages, 169 SkTArray<const GrEffectStage*, true>* colorStages,
170 SkTArray<const GrEffectStage*, true>* coverageStages , 170 SkTArray<const GrEffectStage*, true>* coverageStages ,
171 GrGLProgramDesc* desc) { 171 GrGLProgramDesc* desc) {
172 colorStages->reset(); 172 colorStages->reset();
173 coverageStages->reset(); 173 coverageStages->reset();
174 174
175 bool inputColorIsUsed = optState.inputColorIsUsed(); 175 bool inputColorIsUsed = optState.inputColorIsUsed();
176 bool inputCoverageIsUsed = optState.inputColorIsUsed(); 176 bool inputCoverageIsUsed = optState.inputColorIsUsed();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 253 }
254 254
255 if (!effectKeySuccess) { 255 if (!effectKeySuccess) {
256 desc->fKey.reset(); 256 desc->fKey.reset();
257 return false; 257 return false;
258 } 258 }
259 259
260 // Because header is a pointer into the dynamic array, we can't push any new data into the key 260 // Because header is a pointer into the dynamic array, we can't push any new data into the key
261 // below here. 261 // below here.
262 262
263 // We will only require a vertex shader if we have more than just the positi on VA attrib. 263 header->fUseFragShaderOnly = gpu->caps()->pathRenderingSupport() &&
264 // If we have a geom processor we must us a vertex shader and we should not have a geometry 264 GrGpu::IsPathRenderingDrawType(drawType) &&
265 // processor if we are doing path rendering. 265 gpu->glPathRendering()->texturingMode() == GrGLPathRendering::FixedFunct ion_TexturingMode;
266 SkASSERT(!GrGpu::IsPathRenderingDrawType(drawType) || !optState.requiresVert exShader()); 266 SkASSERT(!header->fUseFragShaderOnly || !optState.hasGeometryProcessor());
267 header->fRequiresVertexShader = optState.requiresVertexShader() || 267
268 !GrGpu::IsPathRenderingDrawType(drawType);
269 header->fEmitsPointSize = GrGpu::kDrawPoints_DrawType == drawType; 268 header->fEmitsPointSize = GrGpu::kDrawPoints_DrawType == drawType;
270 269
271 // Currently the experimental GS will only work with triangle prims (and it doesn't do anything 270 // Currently the experimental GS will only work with triangle prims (and it doesn't do anything
272 // other than pass through values from the VS to the FS anyway). 271 // other than pass through values from the VS to the FS anyway).
273 #if GR_GL_EXPERIMENTAL_GS 272 #if GR_GL_EXPERIMENTAL_GS
274 #if 0 273 #if 0
275 header->fExperimentalGS = gpu->caps().geometryShaderSupport(); 274 header->fExperimentalGS = gpu->caps().geometryShaderSupport();
276 #else 275 #else
277 header->fExperimentalGS = false; 276 header->fExperimentalGS = false;
278 #endif 277 #endif
279 #endif 278 #endif
280 bool defaultToUniformInputs = GR_GL_NO_CONSTANT_ATTRIBUTES || gpu->caps()->p athRenderingSupport(); 279 bool defaultToUniformInputs = GR_GL_NO_CONSTANT_ATTRIBUTES || header->fUseFr agShaderOnly;
281 280
282 if (!inputColorIsUsed) { 281 if (!inputColorIsUsed) {
283 header->fColorInput = kAllOnes_ColorInput; 282 header->fColorInput = kAllOnes_ColorInput;
284 } else if (defaultToUniformInputs && !requiresColorAttrib) { 283 } else if (defaultToUniformInputs && !requiresColorAttrib) {
285 header->fColorInput = kUniform_ColorInput; 284 header->fColorInput = kUniform_ColorInput;
286 } else { 285 } else {
287 header->fColorInput = kAttribute_ColorInput; 286 header->fColorInput = kAttribute_ColorInput;
288 header->fRequiresVertexShader = true; 287 header->fUseFragShaderOnly = false;
289 } 288 }
290 289
291 bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == optState.get CoverageColor(); 290 bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == optState.get CoverageColor();
292 291
293 if (covIsSolidWhite || !inputCoverageIsUsed) { 292 if (covIsSolidWhite || !inputCoverageIsUsed) {
294 header->fCoverageInput = kAllOnes_ColorInput; 293 header->fCoverageInput = kAllOnes_ColorInput;
295 } else if (defaultToUniformInputs && !requiresCoverageAttrib) { 294 } else if (defaultToUniformInputs && !requiresCoverageAttrib) {
296 header->fCoverageInput = kUniform_ColorInput; 295 header->fCoverageInput = kUniform_ColorInput;
297 } else { 296 } else {
298 header->fCoverageInput = kAttribute_ColorInput; 297 header->fCoverageInput = kAttribute_ColorInput;
299 header->fRequiresVertexShader = true; 298 header->fUseFragShaderOnly = false;
300 } 299 }
301 300
302 if (optState.readsDst()) { 301 if (optState.readsDst()) {
303 SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport()); 302 SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport());
304 const GrTexture* dstCopyTexture = NULL; 303 const GrTexture* dstCopyTexture = NULL;
305 if (dstCopy) { 304 if (dstCopy) {
306 dstCopyTexture = dstCopy->texture(); 305 dstCopyTexture = dstCopy->texture();
307 } 306 }
308 header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTe xture, 307 header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTe xture,
309 gpu->glCaps()); 308 gpu->glCaps());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 *checksum = 0; 406 *checksum = 0;
408 *checksum = SkChecksum::Compute(reinterpret_cast<uint32_t*>(fKey.begin()), k eyLength); 407 *checksum = SkChecksum::Compute(reinterpret_cast<uint32_t*>(fKey.begin()), k eyLength);
409 } 408 }
410 409
411 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) { 410 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) {
412 size_t keyLength = other.keyLength(); 411 size_t keyLength = other.keyLength();
413 fKey.reset(keyLength); 412 fKey.reset(keyLength);
414 memcpy(fKey.begin(), other.fKey.begin(), keyLength); 413 memcpy(fKey.begin(), other.fKey.begin(), keyLength);
415 return *this; 414 return *this;
416 } 415 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.h ('k') | src/gpu/gl/builders/GrGLFragmentOnlyProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698