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

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

Issue 2339203002: Stop flattening GrCoordTransforms in parent GrFragmentProcessors. (Closed)
Patch Set: Fix issue of taking ref to a temporary Created 4 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/GrGLProgram.h ('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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 /////////////////////////////////////////////////////////////////////////////// 65 ///////////////////////////////////////////////////////////////////////////////
66 66
67 void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline & pipeline) { 67 void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline & pipeline) {
68 this->setRenderTargetState(primProc, pipeline); 68 this->setRenderTargetState(primProc, pipeline);
69 69
70 // we set the textures, and uniforms for installed processors in a generic w ay, but subclasses 70 // we set the textures, and uniforms for installed processors in a generic w ay, but subclasses
71 // of GLProgram determine how to set coord transforms 71 // of GLProgram determine how to set coord transforms
72 int nextSamplerIdx = 0; 72 int nextSamplerIdx = 0;
73 fGeometryProcessor->setData(fProgramDataManager, primProc); 73 fGeometryProcessor->setData(fProgramDataManager, primProc,
74 GrFragmentProcessor::CoordTransformIter(pipeline ));
74 this->bindTextures(primProc, pipeline.getAllowSRGBInputs(), &nextSamplerIdx) ; 75 this->bindTextures(primProc, pipeline.getAllowSRGBInputs(), &nextSamplerIdx) ;
75 76
76 this->setFragmentData(primProc, pipeline, &nextSamplerIdx); 77 this->setFragmentData(primProc, pipeline, &nextSamplerIdx);
77 78
78 if (primProc.getPixelLocalStorageState() != 79 if (primProc.getPixelLocalStorageState() !=
79 GrPixelLocalStorageState::kDraw_GrPixelLocalStorageState) { 80 GrPixelLocalStorageState::kDraw_GrPixelLocalStorageState) {
80 const GrXferProcessor& xp = pipeline.getXferProcessor(); 81 const GrXferProcessor& xp = pipeline.getXferProcessor();
81 fXferProcessor->setData(fProgramDataManager, xp); 82 fXferProcessor->setData(fProgramDataManager, xp);
82 this->bindTextures(xp, pipeline.getAllowSRGBInputs(), &nextSamplerIdx); 83 this->bindTextures(xp, pipeline.getAllowSRGBInputs(), &nextSamplerIdx);
83 } 84 }
(...skipping 16 matching lines...) Expand all
100 } 101 }
101 } 102 }
102 103
103 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc, 104 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc,
104 const GrPipeline& pipeline, 105 const GrPipeline& pipeline,
105 int* nextSamplerIdx) { 106 int* nextSamplerIdx) {
106 int numProcessors = fFragmentProcessors.count(); 107 int numProcessors = fFragmentProcessors.count();
107 for (int i = 0; i < numProcessors; ++i) { 108 for (int i = 0; i < numProcessors; ++i) {
108 const GrFragmentProcessor& processor = pipeline.getFragmentProcessor(i); 109 const GrFragmentProcessor& processor = pipeline.getFragmentProcessor(i);
109 fFragmentProcessors[i]->setData(fProgramDataManager, processor); 110 fFragmentProcessors[i]->setData(fProgramDataManager, processor);
110 this->setTransformData(primProc, processor, i);
111 this->bindTextures(processor, pipeline.getAllowSRGBInputs(), nextSampler Idx); 111 this->bindTextures(processor, pipeline.getAllowSRGBInputs(), nextSampler Idx);
112 } 112 }
113 } 113 }
114 void GrGLProgram::setTransformData(const GrPrimitiveProcessor& primProc, 114
115 const GrFragmentProcessor& processor,
116 int index) {
117 fGeometryProcessor->setTransformData(primProc, fProgramDataManager, index,
118 processor.coordTransforms());
119 }
120 115
121 void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc, 116 void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc,
122 const GrPipeline& pipeline) { 117 const GrPipeline& pipeline) {
123 // Load the RT height uniform if it is needed to y-flip gl_FragCoord. 118 // Load the RT height uniform if it is needed to y-flip gl_FragCoord.
124 if (fBuiltinUniformHandles.fRTHeightUni.isValid() && 119 if (fBuiltinUniformHandles.fRTHeightUni.isValid() &&
125 fRenderTargetState.fRenderTargetSize.fHeight != pipeline.getRenderTarget ()->height()) { 120 fRenderTargetState.fRenderTargetSize.fHeight != pipeline.getRenderTarget ()->height()) {
126 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni, 121 fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni,
127 SkIntToScalar(pipeline.getRenderTarget()->hei ght())); 122 SkIntToScalar(pipeline.getRenderTarget()->hei ght()));
128 } 123 }
129 124
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 160 }
166 161
167 void GrGLProgram::generateMipmaps(const GrProcessor& processor, 162 void GrGLProgram::generateMipmaps(const GrProcessor& processor,
168 bool allowSRGBInputs) { 163 bool allowSRGBInputs) {
169 for (int i = 0; i < processor.numTextures(); ++i) { 164 for (int i = 0; i < processor.numTextures(); ++i) {
170 const GrTextureAccess& access = processor.textureAccess(i); 165 const GrTextureAccess& access = processor.textureAccess(i);
171 fGpu->generateMipmaps(access.getParams(), allowSRGBInputs, 166 fGpu->generateMipmaps(access.getParams(), allowSRGBInputs,
172 static_cast<GrGLTexture*>(access.getTexture())); 167 static_cast<GrGLTexture*>(access.getTexture()));
173 } 168 }
174 } 169 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/glsl/GrGLSLFragmentProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698