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

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

Issue 900883002: Revert of Move DstCopy on gpu into the GrXferProcessor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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/GrGLGpu.cpp ('k') | src/gpu/gl/GrGLProgramDesc.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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 } 55 }
56 56
57 void GrGLProgram::abandon() { 57 void GrGLProgram::abandon() {
58 fProgramID = 0; 58 fProgramID = 0;
59 } 59 }
60 60
61 void GrGLProgram::initSamplerUniforms() { 61 void GrGLProgram::initSamplerUniforms() {
62 GL_CALL(UseProgram(fProgramID)); 62 GL_CALL(UseProgram(fProgramID));
63 GrGLint texUnitIdx = 0; 63 GrGLint texUnitIdx = 0;
64 if (fBuiltinUniformHandles.fDstCopySamplerUni.isValid()) {
65 fProgramDataManager.setSampler(fBuiltinUniformHandles.fDstCopySamplerUni , texUnitIdx);
66 fDstCopyTexUnit = texUnitIdx++;
67 }
64 this->initSamplers(fGeometryProcessor.get(), &texUnitIdx); 68 this->initSamplers(fGeometryProcessor.get(), &texUnitIdx);
65 if (fXferProcessor.get()) { 69 if (fXferProcessor.get()) {
66 this->initSamplers(fXferProcessor.get(), &texUnitIdx); 70 this->initSamplers(fXferProcessor.get(), &texUnitIdx);
67 } 71 }
68 int numProcs = fFragmentProcessors->fProcs.count(); 72 int numProcs = fFragmentProcessors->fProcs.count();
69 for (int i = 0; i < numProcs; i++) { 73 for (int i = 0; i < numProcs; i++) {
70 this->initSamplers(fFragmentProcessors->fProcs[i], &texUnitIdx); 74 this->initSamplers(fFragmentProcessors->fProcs[i], &texUnitIdx);
71 } 75 }
72 } 76 }
73 77
(...skipping 22 matching lines...) Expand all
96 } 100 }
97 } 101 }
98 102
99 103
100 /////////////////////////////////////////////////////////////////////////////// 104 ///////////////////////////////////////////////////////////////////////////////
101 105
102 void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline & pipeline, 106 void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline & pipeline,
103 const GrBatchTracker& batchTracker) { 107 const GrBatchTracker& batchTracker) {
104 this->setRenderTargetState(primProc, pipeline); 108 this->setRenderTargetState(primProc, pipeline);
105 109
110 const GrDeviceCoordTexture* dstCopy = pipeline.getDstCopy();
111 if (dstCopy) {
112 if (fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid()) {
113 fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyTopLeftUni,
114 static_cast<GrGLfloat>(dstCopy->offset(). fX),
115 static_cast<GrGLfloat>(dstCopy->offset(). fY));
116 fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyScaleUni,
117 1.f / dstCopy->texture()->width(),
118 1.f / dstCopy->texture()->height());
119 GrGLTexture* texture = static_cast<GrGLTexture*>(dstCopy->texture()) ;
120 static GrTextureParams kParams; // the default is clamp, nearest fil tering.
121 fGpu->bindTexture(fDstCopyTexUnit, kParams, texture);
122 } else {
123 SkASSERT(!fBuiltinUniformHandles.fDstCopyScaleUni.isValid());
124 SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid());
125 }
126 } else {
127 SkASSERT(!fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid());
128 SkASSERT(!fBuiltinUniformHandles.fDstCopyScaleUni.isValid());
129 SkASSERT(!fBuiltinUniformHandles.fDstCopySamplerUni.isValid());
130 }
131
106 // we set the textures, and uniforms for installed processors in a generic w ay, but subclasses 132 // we set the textures, and uniforms for installed processors in a generic w ay, but subclasses
107 // of GLProgram determine how to set coord transforms 133 // of GLProgram determine how to set coord transforms
108 fGeometryProcessor->fGLProc->setData(fProgramDataManager, primProc, batchTra cker); 134 fGeometryProcessor->fGLProc->setData(fProgramDataManager, primProc, batchTra cker);
109 this->bindTextures(fGeometryProcessor.get(), primProc); 135 this->bindTextures(fGeometryProcessor.get(), primProc);
110 136
111 const GrXferProcessor& xp = *pipeline.getXferProcessor(); 137 if (fXferProcessor.get()) {
112 fXferProcessor->fGLProc->setData(fProgramDataManager, xp); 138 const GrXferProcessor& xp = *pipeline.getXferProcessor();
113 this->bindTextures(fXferProcessor.get(), xp); 139 fXferProcessor->fGLProc->setData(fProgramDataManager, xp);
114 140 this->bindTextures(fXferProcessor.get(), xp);
141 }
115 this->setFragmentData(primProc, pipeline); 142 this->setFragmentData(primProc, pipeline);
116 143
117 // Some of GrGLProgram subclasses need to update state here 144 // Some of GrGLProgram subclasses need to update state here
118 this->didSetData(); 145 this->didSetData();
119 } 146 }
120 147
121 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc, 148 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc,
122 const GrPipeline& pipeline) { 149 const GrPipeline& pipeline) {
123 int numProcessors = fFragmentProcessors->fProcs.count(); 150 int numProcessors = fFragmentProcessors->fProcs.count();
124 for (int e = 0; e < numProcessors; ++e) { 151 for (int e = 0; e < numProcessors; ++e) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 229
203 void GrGLNvprProgram::onSetRenderTargetState(const GrPrimitiveProcessor& primPro c, 230 void GrGLNvprProgram::onSetRenderTargetState(const GrPrimitiveProcessor& primPro c,
204 const GrPipeline& pipeline) { 231 const GrPipeline& pipeline) {
205 SkASSERT(!primProc.willUseGeoShader() && primProc.numAttribs() == 0); 232 SkASSERT(!primProc.willUseGeoShader() && primProc.numAttribs() == 0);
206 const GrRenderTarget* rt = pipeline.getRenderTarget(); 233 const GrRenderTarget* rt = pipeline.getRenderTarget();
207 SkISize size; 234 SkISize size;
208 size.set(rt->width(), rt->height()); 235 size.set(rt->width(), rt->height());
209 fGpu->glPathRendering()->setProjectionMatrix(primProc.viewMatrix(), 236 fGpu->glPathRendering()->setProjectionMatrix(primProc.viewMatrix(),
210 size, rt->origin()); 237 size, rt->origin());
211 } 238 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.cpp ('k') | src/gpu/gl/GrGLProgramDesc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698