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/GrGLProgram.cpp

Issue 2365943003: Stop aggregating texture/buffer access objects in GrFragmentProcessor parents. (Closed)
Patch Set: Readd base class, rebase 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/GrPipeline.cpp ('k') | src/gpu/glsl/GrGLSLFragmentProcessor.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 2011 Google Inc. 2 * Copyright 2011 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 "GrGLProgram.h" 8 #include "GrGLProgram.h"
9 9
10 #include "GrAllocator.h" 10 #include "GrAllocator.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 const GrXferProcessor& xp = pipeline.getXferProcessor(); 81 const GrXferProcessor& xp = pipeline.getXferProcessor();
82 fXferProcessor->setData(fProgramDataManager, xp); 82 fXferProcessor->setData(fProgramDataManager, xp);
83 this->bindTextures(xp, pipeline.getAllowSRGBInputs(), &nextSamplerIdx); 83 this->bindTextures(xp, pipeline.getAllowSRGBInputs(), &nextSamplerIdx);
84 } 84 }
85 } 85 }
86 86
87 void GrGLProgram::generateMipmaps(const GrPrimitiveProcessor& primProc, 87 void GrGLProgram::generateMipmaps(const GrPrimitiveProcessor& primProc,
88 const GrPipeline& pipeline) { 88 const GrPipeline& pipeline) {
89 this->generateMipmaps(primProc, pipeline.getAllowSRGBInputs()); 89 this->generateMipmaps(primProc, pipeline.getAllowSRGBInputs());
90 90
91 int numProcessors = fFragmentProcessors.count(); 91 GrFragmentProcessor::Iter iter(pipeline);
92 for (int i = 0; i < numProcessors; ++i) { 92 while (const GrFragmentProcessor* fp = iter.next()) {
93 const GrFragmentProcessor& processor = pipeline.getFragmentProcessor(i); 93 this->generateMipmaps(*fp, pipeline.getAllowSRGBInputs());
94 this->generateMipmaps(processor, pipeline.getAllowSRGBInputs());
95 } 94 }
96 95
97 if (primProc.getPixelLocalStorageState() != 96 if (primProc.getPixelLocalStorageState() !=
98 GrPixelLocalStorageState::kDraw_GrPixelLocalStorageState) { 97 GrPixelLocalStorageState::kDraw_GrPixelLocalStorageState) {
99 const GrXferProcessor& xp = pipeline.getXferProcessor(); 98 const GrXferProcessor& xp = pipeline.getXferProcessor();
100 this->generateMipmaps(xp, pipeline.getAllowSRGBInputs()); 99 this->generateMipmaps(xp, pipeline.getAllowSRGBInputs());
101 } 100 }
102 } 101 }
103 102
104 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc, 103 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc,
105 const GrPipeline& pipeline, 104 const GrPipeline& pipeline,
106 int* nextSamplerIdx) { 105 int* nextSamplerIdx) {
107 int numProcessors = fFragmentProcessors.count(); 106 GrFragmentProcessor::Iter iter(pipeline);
108 for (int i = 0; i < numProcessors; ++i) { 107 GrGLSLFragmentProcessor::Iter glslIter(fFragmentProcessors.begin(),
109 const GrFragmentProcessor& processor = pipeline.getFragmentProcessor(i); 108 fFragmentProcessors.count());
110 fFragmentProcessors[i]->setData(fProgramDataManager, processor); 109 const GrFragmentProcessor* fp = iter.next();
111 this->bindTextures(processor, pipeline.getAllowSRGBInputs(), nextSampler Idx); 110 GrGLSLFragmentProcessor* glslFP = glslIter.next();
111 while (fp && glslFP) {
112 glslFP->setData(fProgramDataManager, *fp);
113 this->bindTextures(*fp, pipeline.getAllowSRGBInputs(), nextSamplerIdx);
114 fp = iter.next(), glslFP = glslIter.next();
112 } 115 }
116 SkASSERT(!fp && !glslFP);
113 } 117 }
114 118
115 119
116 void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc, 120 void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc,
117 const GrPipeline& pipeline) { 121 const GrPipeline& pipeline) {
118 // Load the RT height uniform if it is needed to y-flip gl_FragCoord. 122 // Load the RT height uniform if it is needed to y-flip gl_FragCoord.
119 if (fBuiltinUniformHandles.fRTHeightUni.isValid() && 123 if (fBuiltinUniformHandles.fRTHeightUni.isValid() &&
120 fRenderTargetState.fRenderTargetSize.fHeight != pipeline.getRenderTarget ()->height()) { 124 fRenderTargetState.fRenderTargetSize.fHeight != pipeline.getRenderTarget ()->height()) {
121 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, 125 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni,
122 SkIntToScalar(pipeline.getRenderTarget()->hei ght())); 126 SkIntToScalar(pipeline.getRenderTarget()->hei ght()));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 164 }
161 165
162 void GrGLProgram::generateMipmaps(const GrProcessor& processor, 166 void GrGLProgram::generateMipmaps(const GrProcessor& processor,
163 bool allowSRGBInputs) { 167 bool allowSRGBInputs) {
164 for (int i = 0; i < processor.numTextures(); ++i) { 168 for (int i = 0; i < processor.numTextures(); ++i) {
165 const GrTextureAccess& access = processor.textureAccess(i); 169 const GrTextureAccess& access = processor.textureAccess(i);
166 fGpu->generateMipmaps(access.getParams(), allowSRGBInputs, 170 fGpu->generateMipmaps(access.getParams(), allowSRGBInputs,
167 static_cast<GrGLTexture*>(access.getTexture())); 171 static_cast<GrGLTexture*>(access.getTexture()));
168 } 172 }
169 } 173 }
OLDNEW
« no previous file with comments | « src/gpu/GrPipeline.cpp ('k') | src/gpu/glsl/GrGLSLFragmentProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698