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

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

Issue 1870893002: Implement texel buffers (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_texelfetch
Patch Set: GrBuffer(Access) into include/gpu Created 4 years, 8 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/GrBuffer.h ('k') | src/gpu/GrProcessor.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 2015 Google Inc. 2 * Copyright 2015 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 "GrFragmentProcessor.h" 8 #include "GrFragmentProcessor.h"
9 #include "GrCoordTransform.h" 9 #include "GrCoordTransform.h"
10 #include "GrInvariantOutput.h" 10 #include "GrInvariantOutput.h"
11 #include "GrProcOptInfo.h" 11 #include "GrProcOptInfo.h"
12 #include "glsl/GrGLSLFragmentProcessor.h" 12 #include "glsl/GrGLSLFragmentProcessor.h"
13 #include "glsl/GrGLSLFragmentShaderBuilder.h" 13 #include "glsl/GrGLSLFragmentShaderBuilder.h"
14 #include "glsl/GrGLSLProgramDataManager.h" 14 #include "glsl/GrGLSLProgramDataManager.h"
15 #include "glsl/GrGLSLUniformHandler.h" 15 #include "glsl/GrGLSLUniformHandler.h"
16 #include "effects/GrConstColorProcessor.h" 16 #include "effects/GrConstColorProcessor.h"
17 #include "effects/GrXfermodeFragmentProcessor.h" 17 #include "effects/GrXfermodeFragmentProcessor.h"
18 18
19 GrFragmentProcessor::~GrFragmentProcessor() { 19 GrFragmentProcessor::~GrFragmentProcessor() {
20 // If we got here then our ref count must have reached zero, so we will have converted refs 20 // If we got here then our ref count must have reached zero, so we will have converted refs
21 // to pending executions for all children. 21 // to pending executions for all children.
22 for (int i = 0; i < fChildProcessors.count(); ++i) { 22 for (int i = 0; i < fChildProcessors.count(); ++i) {
23 fChildProcessors[i]->completedExecution(); 23 fChildProcessors[i]->completedExecution();
24 } 24 }
25 } 25 }
26 26
27 bool GrFragmentProcessor::isEqual(const GrFragmentProcessor& that, 27 bool GrFragmentProcessor::isEqual(const GrFragmentProcessor& that,
28 bool ignoreCoordTransforms) const { 28 bool ignoreCoordTransforms) const {
29 if (this->classID() != that.classID() || 29 if (this->classID() != that.classID() ||
30 !this->hasSameTextureAccesses(that)) { 30 !this->hasSameSamplers(that)) {
31 return false; 31 return false;
32 } 32 }
33 if (ignoreCoordTransforms) { 33 if (ignoreCoordTransforms) {
34 if (this->numTransforms() != that.numTransforms()) { 34 if (this->numTransforms() != that.numTransforms()) {
35 return false; 35 return false;
36 } 36 }
37 } else if (!this->hasSameTransforms(that)) { 37 } else if (!this->hasSameTransforms(that)) {
38 return false; 38 return false;
39 } 39 }
40 if (!this->onIsEqual(that)) { 40 if (!this->onIsEqual(that)) {
(...skipping 21 matching lines...) Expand all
62 62
63 void GrFragmentProcessor::addTextureAccess(const GrTextureAccess* textureAccess) { 63 void GrFragmentProcessor::addTextureAccess(const GrTextureAccess* textureAccess) {
64 // Can't add texture accesses after registering any children since their tex ture accesses have 64 // Can't add texture accesses after registering any children since their tex ture accesses have
65 // already been bubbled up into our fTextureAccesses array 65 // already been bubbled up into our fTextureAccesses array
66 SkASSERT(fChildProcessors.empty()); 66 SkASSERT(fChildProcessors.empty());
67 67
68 INHERITED::addTextureAccess(textureAccess); 68 INHERITED::addTextureAccess(textureAccess);
69 fNumTexturesExclChildren++; 69 fNumTexturesExclChildren++;
70 } 70 }
71 71
72 void GrFragmentProcessor::addBufferAccess(const GrBufferAccess* bufferAccess) {
73 // Can't add buffer accesses after registering any children since their buff er accesses have
74 // already been bubbled up into our fBufferAccesses array
75 SkASSERT(fChildProcessors.empty());
76
77 INHERITED::addBufferAccess(bufferAccess);
78 fNumBuffersExclChildren++;
79 }
80
72 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { 81 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) {
73 // Can't add transforms after registering any children since their transform s have already been 82 // Can't add transforms after registering any children since their transform s have already been
74 // bubbled up into our fCoordTransforms array 83 // bubbled up into our fCoordTransforms array
75 SkASSERT(fChildProcessors.empty()); 84 SkASSERT(fChildProcessors.empty());
76 85
77 fCoordTransforms.push_back(transform); 86 fCoordTransforms.push_back(transform);
78 fUsesLocalCoords = fUsesLocalCoords || transform->sourceCoords() == kLocal_G rCoordSet; 87 fUsesLocalCoords = fUsesLocalCoords || transform->sourceCoords() == kLocal_G rCoordSet;
79 SkDEBUGCODE(transform->setInProcessor();) 88 SkDEBUGCODE(transform->setInProcessor();)
80 fNumTransformsExclChildren++; 89 fNumTransformsExclChildren++;
81 } 90 }
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 cnt -= firstIdx; 374 cnt -= firstIdx;
366 } 375 }
367 } 376 }
368 377
369 if (1 == cnt) { 378 if (1 == cnt) {
370 return SkRef(series[0]); 379 return SkRef(series[0]);
371 } else { 380 } else {
372 return new SeriesFragmentProcessor(series, cnt); 381 return new SeriesFragmentProcessor(series, cnt);
373 } 382 }
374 } 383 }
OLDNEW
« no previous file with comments | « src/gpu/GrBuffer.h ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698