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

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

Issue 13314002: Add support for reading the dst pixel value in an effect. Use in a new effect for the kDarken xfer … (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Revert whitespace/comment changes accidentally made in GrGLProgramDesc.cpp Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | no next file » | 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 "GrGpuGL.h" 8 #include "GrGpuGL.h"
9 9
10 #include "GrEffect.h" 10 #include "GrEffect.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 SkScalarToFloat(m[SkMatrix::kMPersp2]) 151 SkScalarToFloat(m[SkMatrix::kMPersp2])
152 }; 152 };
153 GL_CALL(MatrixMode(GR_GL_PROJECTION)); 153 GL_CALL(MatrixMode(GR_GL_PROJECTION));
154 GL_CALL(LoadMatrixf(mv)); 154 GL_CALL(LoadMatrixf(mv));
155 fHWPathStencilMatrixState.fViewMatrix = vm; 155 fHWPathStencilMatrixState.fViewMatrix = vm;
156 fHWPathStencilMatrixState.fRenderTargetSize = size; 156 fHWPathStencilMatrixState.fRenderTargetSize = size;
157 fHWPathStencilMatrixState.fRenderTargetOrigin = rt->origin(); 157 fHWPathStencilMatrixState.fRenderTargetOrigin = rt->origin();
158 } 158 }
159 } 159 }
160 160
161 bool GrGpuGL::flushGraphicsState(DrawType type) { 161 bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC opy) {
162 const GrDrawState& drawState = this->getDrawState(); 162 const GrDrawState& drawState = this->getDrawState();
163 163
164 // GrGpu::setupClipAndFlushState should have already checked this and bailed if not true. 164 // GrGpu::setupClipAndFlushState should have already checked this and bailed if not true.
165 GrAssert(NULL != drawState.getRenderTarget()); 165 GrAssert(NULL != drawState.getRenderTarget());
166 166
167 if (kStencilPath_DrawType == type) { 167 if (kStencilPath_DrawType == type) {
168 this->flushPathStencilMatrix(); 168 this->flushPathStencilMatrix();
169 } else { 169 } else {
170 this->flushMiscFixedFunctionState(); 170 this->flushMiscFixedFunctionState();
171 171
172 GrBlendCoeff srcCoeff; 172 GrBlendCoeff srcCoeff;
173 GrBlendCoeff dstCoeff; 173 GrBlendCoeff dstCoeff;
174 GrDrawState::BlendOptFlags blendOpts = drawState.getBlendOpts(false, &sr cCoeff, &dstCoeff); 174 GrDrawState::BlendOptFlags blendOpts = drawState.getBlendOpts(false, &sr cCoeff, &dstCoeff);
175 if (GrDrawState::kSkipDraw_BlendOptFlag & blendOpts) { 175 if (GrDrawState::kSkipDraw_BlendOptFlag & blendOpts) {
176 return false; 176 return false;
177 } 177 }
178 178
179 const GrEffectStage* stages[GrDrawState::kNumStages]; 179 const GrEffectStage* stages[GrDrawState::kNumStages];
180 for (int i = 0; i < GrDrawState::kNumStages; ++i) { 180 for (int i = 0; i < GrDrawState::kNumStages; ++i) {
181 stages[i] = drawState.isStageEnabled(i) ? &drawState.getStage(i) : N ULL; 181 stages[i] = drawState.isStageEnabled(i) ? &drawState.getStage(i) : N ULL;
182 } 182 }
183 GrGLProgramDesc desc; 183 GrGLProgramDesc desc;
184 GrGLProgramDesc::Build(this->getDrawState(), 184 GrGLProgramDesc::Build(this->getDrawState(),
185 kDrawPoints_DrawType == type, 185 kDrawPoints_DrawType == type,
186 blendOpts, 186 blendOpts,
187 srcCoeff, 187 srcCoeff,
188 dstCoeff, 188 dstCoeff,
189 this, 189 this,
190 dstCopy,
190 &desc); 191 &desc);
191 192
192 fCurrentProgram.reset(fProgramCache->getProgram(desc, stages)); 193 fCurrentProgram.reset(fProgramCache->getProgram(desc, stages));
193 if (NULL == fCurrentProgram.get()) { 194 if (NULL == fCurrentProgram.get()) {
194 GrAssert(!"Failed to create program!"); 195 GrAssert(!"Failed to create program!");
195 return false; 196 return false;
196 } 197 }
197 fCurrentProgram.get()->ref(); 198 fCurrentProgram.get()->ref();
198 199
199 GrGLuint programID = fCurrentProgram->programID(); 200 GrGLuint programID = fCurrentProgram->programID();
(...skipping 10 matching lines...) Expand all
210 if (blendOpts & GrDrawState::kEmitTransBlack_BlendOptFlag) { 211 if (blendOpts & GrDrawState::kEmitTransBlack_BlendOptFlag) {
211 color = 0; 212 color = 0;
212 coverage = 0; 213 coverage = 0;
213 } else if (blendOpts & GrDrawState::kEmitCoverage_BlendOptFlag) { 214 } else if (blendOpts & GrDrawState::kEmitCoverage_BlendOptFlag) {
214 color = 0xffffffff; 215 color = 0xffffffff;
215 coverage = drawState.getCoverage(); 216 coverage = drawState.getCoverage();
216 } else { 217 } else {
217 color = drawState.getColor(); 218 color = drawState.getColor();
218 coverage = drawState.getCoverage(); 219 coverage = drawState.getCoverage();
219 } 220 }
220 fCurrentProgram->setData(this, color, coverage, &fSharedGLProgramState); 221 fCurrentProgram->setData(this, color, coverage, dstCopy, &fSharedGLProgr amState);
221 } 222 }
222 this->flushStencil(type); 223 this->flushStencil(type);
223 this->flushScissor(); 224 this->flushScissor();
224 this->flushAAState(type); 225 this->flushAAState(type);
225 226
226 GrIRect* devRect = NULL; 227 GrIRect* devRect = NULL;
227 GrIRect devClipBounds; 228 GrIRect devClipBounds;
228 if (drawState.isClipState()) { 229 if (drawState.isClipState()) {
229 this->getClip()->getConservativeBounds(drawState.getRenderTarget(), &dev ClipBounds); 230 this->getClip()->getConservativeBounds(drawState.getRenderTarget(), &dev ClipBounds);
230 devRect = &devClipBounds; 231 devRect = &devClipBounds;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 GrGLAttribTypeToLayout(attribType).fCount, 306 GrGLAttribTypeToLayout(attribType).fCount,
306 GrGLAttribTypeToLayout(attribType).fType, 307 GrGLAttribTypeToLayout(attribType).fType,
307 GrGLAttribTypeToLayout(attribType).fNormalized, 308 GrGLAttribTypeToLayout(attribType).fNormalized,
308 stride, 309 stride,
309 reinterpret_cast<GrGLvoid*>( 310 reinterpret_cast<GrGLvoid*>(
310 vertexOffsetInBytes + vertexAttrib->fOffset)); 311 vertexOffsetInBytes + vertexAttrib->fOffset));
311 } 312 }
312 313
313 attribState->disableUnusedAttribArrays(this, usedAttribArraysMask); 314 attribState->disableUnusedAttribArrays(this, usedAttribArraysMask);
314 } 315 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGpuGL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698