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

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

Issue 678073005: Patch to remove constant attributes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: trivial clean up Created 6 years, 1 month 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/GrGLProgram.cpp ('k') | src/gpu/gl/GrGpuGL.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 7
8 #include "gl/builders/GrGLFragmentShaderBuilder.h" 8 #include "gl/builders/GrGLFragmentShaderBuilder.h"
9 #include "GrGLProgramDesc.h" 9 #include "GrGLProgramDesc.h"
10 #include "GrBackendProcessorFactory.h" 10 #include "GrBackendProcessorFactory.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // below here. 250 // below here.
251 KeyHeader* header = desc->header(); 251 KeyHeader* header = desc->header();
252 252
253 // make sure any padding in the header is zeroed. 253 // make sure any padding in the header is zeroed.
254 memset(header, 0, kHeaderSize); 254 memset(header, 0, kHeaderSize);
255 255
256 header->fHasGeometryProcessor = optState.hasGeometryProcessor(); 256 header->fHasGeometryProcessor = optState.hasGeometryProcessor();
257 257
258 header->fEmitsPointSize = GrGpu::kDrawPoints_DrawType == drawType; 258 header->fEmitsPointSize = GrGpu::kDrawPoints_DrawType == drawType;
259 259
260 if (gpu->caps()->pathRenderingSupport() && 260 bool isPathRendering = GrGpu::IsPathRenderingDrawType(drawType);
261 GrGpu::IsPathRenderingDrawType(drawType) && 261 if (gpu->caps()->pathRenderingSupport() && isPathRendering &&
262 gpu->glPathRendering()->texturingMode() == GrGLPathRendering::FixedFunct ion_TexturingMode) { 262 gpu->glPathRendering()->texturingMode() == GrGLPathRendering::FixedFunct ion_TexturingMode) {
263 header->fUseFragShaderOnly = true; 263 header->fUseFragShaderOnly = true;
264 SkASSERT(!optState.hasGeometryProcessor()); 264 SkASSERT(!optState.hasGeometryProcessor());
265 } else { 265 } else {
266 header->fUseFragShaderOnly = false; 266 header->fUseFragShaderOnly = false;
267 } 267 }
268 268
269 bool defaultToUniformInputs = GrGpu::IsPathRenderingDrawType(drawType) || 269 bool hasUniformColor = inputColorIsUsed &&
270 GR_GL_NO_CONSTANT_ATTRIBUTES; 270 (isPathRendering || !optState.hasColorVertexAttribute ());
bsalomon 2014/10/27 20:32:26 Can you remove all references to this macro as wel
271
272 bool hasUniformCoverage = inputCoverageIsUsed &&
273 (isPathRendering || !optState.hasCoverageVertexAtt ribute());
271 274
272 if (!inputColorIsUsed) { 275 if (!inputColorIsUsed) {
273 header->fColorInput = kAllOnes_ColorInput; 276 header->fColorInput = kAllOnes_ColorInput;
274 } else if (defaultToUniformInputs && !optState.hasColorVertexAttribute()) { 277 } else if (hasUniformColor) {
275 header->fColorInput = kUniform_ColorInput; 278 header->fColorInput = kUniform_ColorInput;
276 } else { 279 } else {
277 header->fColorInput = kAttribute_ColorInput; 280 header->fColorInput = kAttribute_ColorInput;
278 SkASSERT(!header->fUseFragShaderOnly); 281 SkASSERT(!header->fUseFragShaderOnly);
279 } 282 }
280 283
281 bool covIsSolidWhite = !optState.hasCoverageVertexAttribute() && 284 bool covIsSolidWhite = !optState.hasCoverageVertexAttribute() &&
282 0xffffffff == optState.getCoverageColor(); 285 0xffffffff == optState.getCoverageColor();
283 286
284 if (covIsSolidWhite || !inputCoverageIsUsed) { 287 if (covIsSolidWhite || !inputCoverageIsUsed) {
285 header->fCoverageInput = kAllOnes_ColorInput; 288 header->fCoverageInput = kAllOnes_ColorInput;
286 } else if (defaultToUniformInputs && !optState.hasCoverageVertexAttribute()) { 289 } else if (hasUniformCoverage) {
287 header->fCoverageInput = kUniform_ColorInput; 290 header->fCoverageInput = kUniform_ColorInput;
288 } else { 291 } else {
289 header->fCoverageInput = kAttribute_ColorInput; 292 header->fCoverageInput = kAttribute_ColorInput;
290 SkASSERT(!header->fUseFragShaderOnly); 293 SkASSERT(!header->fUseFragShaderOnly);
291 } 294 }
292 295
293 if (optState.readsDst()) { 296 if (optState.readsDst()) {
294 SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport()); 297 SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport());
295 const GrTexture* dstCopyTexture = NULL; 298 const GrTexture* dstCopyTexture = NULL;
296 if (dstCopy) { 299 if (dstCopy) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 *checksum = 0; 357 *checksum = 0;
355 *checksum = SkChecksum::Compute(reinterpret_cast<uint32_t*>(fKey.begin()), k eyLength); 358 *checksum = SkChecksum::Compute(reinterpret_cast<uint32_t*>(fKey.begin()), k eyLength);
356 } 359 }
357 360
358 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) { 361 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) {
359 size_t keyLength = other.keyLength(); 362 size_t keyLength = other.keyLength();
360 fKey.reset(keyLength); 363 fKey.reset(keyLength);
361 memcpy(fKey.begin(), other.fKey.begin(), keyLength); 364 memcpy(fKey.begin(), other.fKey.begin(), keyLength);
362 return *this; 365 return *this;
363 } 366 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.cpp ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698