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

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

Issue 212753002: Use fixed function pipeline only when drawing paths (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 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/gl/GrGpuGL.cpp ('k') | src/gpu/gl/android/GrGLCreateNativeInterface_android.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 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 GrBlendCoeff dstCoeff; 226 GrBlendCoeff dstCoeff;
227 GrDrawState::BlendOptFlags blendOpts = drawState.getBlendOpts(false, &sr cCoeff, &dstCoeff); 227 GrDrawState::BlendOptFlags blendOpts = drawState.getBlendOpts(false, &sr cCoeff, &dstCoeff);
228 if (GrDrawState::kSkipDraw_BlendOptFlag & blendOpts) { 228 if (GrDrawState::kSkipDraw_BlendOptFlag & blendOpts) {
229 return false; 229 return false;
230 } 230 }
231 231
232 SkSTArray<8, const GrEffectStage*, true> colorStages; 232 SkSTArray<8, const GrEffectStage*, true> colorStages;
233 SkSTArray<8, const GrEffectStage*, true> coverageStages; 233 SkSTArray<8, const GrEffectStage*, true> coverageStages;
234 GrGLProgramDesc desc; 234 GrGLProgramDesc desc;
235 GrGLProgramDesc::Build(this->getDrawState(), 235 GrGLProgramDesc::Build(this->getDrawState(),
236 kDrawPoints_DrawType == type, 236 type,
237 blendOpts, 237 blendOpts,
238 srcCoeff, 238 srcCoeff,
239 dstCoeff, 239 dstCoeff,
240 this, 240 this,
241 dstCopy, 241 dstCopy,
242 &colorStages, 242 &colorStages,
243 &coverageStages, 243 &coverageStages,
244 &desc); 244 &desc);
245 245
246 fCurrentProgram.reset(fProgramCache->getProgram(desc, 246 fCurrentProgram.reset(fProgramCache->getProgram(desc,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 GrCrash("Unknown geometry src type!"); 336 GrCrash("Unknown geometry src type!");
337 } 337 }
338 338
339 SkASSERT(NULL != ibuf); 339 SkASSERT(NULL != ibuf);
340 SkASSERT(!ibuf->isLocked()); 340 SkASSERT(!ibuf->isLocked());
341 *indexOffsetInBytes += ibuf->baseOffset(); 341 *indexOffsetInBytes += ibuf->baseOffset();
342 } 342 }
343 GrGLAttribArrayState* attribState = 343 GrGLAttribArrayState* attribState =
344 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf); 344 fHWGeometryState.bindArrayAndBuffersToDraw(this, vbuf, ibuf);
345 345
346 if (!fCurrentProgram->hasVertexShader()) { 346 if (fCurrentProgram->hasVertexShader()) {
347 int posIdx = this->getDrawState().positionAttributeIndex();
348 const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttri bs() + posIdx;
349 GrVertexAttribType attribType = vertexAttrib->fType;
350 SkASSERT(!GrGLAttribTypeToLayout(attribType).fNormalized);
351 SkASSERT(GrGLAttribTypeToLayout(attribType).fCount == 2);
352
353 // Attrib at location 0 is defined to be bound to vertex in fixed-functi on pipe. Asserts
354 // above should make sure position attribute goes to location 0 when bel ow code is executed.
355
356 attribState->set(this,
357 0,
358 vbuf,
359 GrGLAttribTypeToLayout(attribType).fCount,
360 GrGLAttribTypeToLayout(attribType).fType,
361 GrGLAttribTypeToLayout(attribType).fNormalized,
362 stride,
363 reinterpret_cast<GrGLvoid*>(
364 vertexOffsetInBytes + vertexAttrib->fOffset));
365 attribState->disableUnusedArrays(this, 1);
366 } else {
367 int vertexAttribCount = this->getDrawState().getVertexAttribCount(); 347 int vertexAttribCount = this->getDrawState().getVertexAttribCount();
368 uint32_t usedAttribArraysMask = 0; 348 uint32_t usedAttribArraysMask = 0;
369 const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttri bs(); 349 const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttri bs();
370 350
371 for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount; 351 for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount;
372 ++vertexAttribIndex, ++vertexAttrib) { 352 ++vertexAttribIndex, ++vertexAttrib) {
373 353
374 usedAttribArraysMask |= (1 << vertexAttribIndex); 354 usedAttribArraysMask |= (1 << vertexAttribIndex);
375 GrVertexAttribType attribType = vertexAttrib->fType; 355 GrVertexAttribType attribType = vertexAttrib->fType;
376 attribState->set(this, 356 attribState->set(this,
377 vertexAttribIndex, 357 vertexAttribIndex,
378 vbuf, 358 vbuf,
379 GrGLAttribTypeToLayout(attribType).fCount, 359 GrGLAttribTypeToLayout(attribType).fCount,
380 GrGLAttribTypeToLayout(attribType).fType, 360 GrGLAttribTypeToLayout(attribType).fType,
381 GrGLAttribTypeToLayout(attribType).fNormalized, 361 GrGLAttribTypeToLayout(attribType).fNormalized,
382 stride, 362 stride,
383 reinterpret_cast<GrGLvoid*>( 363 reinterpret_cast<GrGLvoid*>(
384 vertexOffsetInBytes + vertexAttrib->fOffset)); 364 vertexOffsetInBytes + vertexAttrib->fOffset));
385 } 365 }
386 attribState->disableUnusedArrays(this, usedAttribArraysMask); 366 attribState->disableUnusedArrays(this, usedAttribArraysMask);
387 } 367 }
388 } 368 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGpuGL.cpp ('k') | src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698