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

Side by Side Diff: src/gpu/effects/GrDistanceFieldGeoProc.cpp

Issue 1110033004: Make XPFragmentBuilder only Builder with access to DstCopy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/effects/GrDisableColorXP.cpp ('k') | src/gpu/effects/GrDitherEffect.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 2013 Google Inc. 2 * Copyright 2013 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 "GrDistanceFieldGeoProc.h" 8 #include "GrDistanceFieldGeoProc.h"
9 #include "GrFontAtlasSizes.h" 9 #include "GrFontAtlasSizes.h"
10 #include "GrInvariantOutput.h" 10 #include "GrInvariantOutput.h"
(...skipping 24 matching lines...) Expand all
35 #ifdef SK_GAMMA_APPLY_TO_A8 35 #ifdef SK_GAMMA_APPLY_TO_A8
36 , fDistanceAdjust(-1.0f) 36 , fDistanceAdjust(-1.0f)
37 #endif 37 #endif
38 {} 38 {}
39 39
40 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ 40 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
41 const GrDistanceFieldA8TextGeoProc& dfTexEffect = 41 const GrDistanceFieldA8TextGeoProc& dfTexEffect =
42 args.fGP.cast<GrDistanceFieldA8TextGeoProc>(); 42 args.fGP.cast<GrDistanceFieldA8TextGeoProc>();
43 const DistanceFieldBatchTracker& local = args.fBT.cast<DistanceFieldBatc hTracker>(); 43 const DistanceFieldBatchTracker& local = args.fBT.cast<DistanceFieldBatc hTracker>();
44 GrGLGPBuilder* pb = args.fPB; 44 GrGLGPBuilder* pb = args.fPB;
45 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 45 GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
46 SkAssertResult(fsBuilder->enableFeature( 46 SkAssertResult(fsBuilder->enableFeature(
47 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature)); 47 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
48 48
49 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); 49 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
50 50
51 // emit attributes 51 // emit attributes
52 vsBuilder->emitAttributes(dfTexEffect); 52 vsBuilder->emitAttributes(dfTexEffect);
53 53
54 #ifdef SK_GAMMA_APPLY_TO_A8 54 #ifdef SK_GAMMA_APPLY_TO_A8
55 // adjust based on gamma 55 // adjust based on gamma
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 public: 305 public:
306 GrGLDistanceFieldPathGeoProc(const GrGeometryProcessor&, 306 GrGLDistanceFieldPathGeoProc(const GrGeometryProcessor&,
307 const GrBatchTracker&) 307 const GrBatchTracker&)
308 : fColor(GrColor_ILLEGAL), fTextureSize(SkISize::Make(-1, -1)) {} 308 : fColor(GrColor_ILLEGAL), fTextureSize(SkISize::Make(-1, -1)) {}
309 309
310 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{ 310 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
311 const GrDistanceFieldPathGeoProc& dfTexEffect = args.fGP.cast<GrDistance FieldPathGeoProc>(); 311 const GrDistanceFieldPathGeoProc& dfTexEffect = args.fGP.cast<GrDistance FieldPathGeoProc>();
312 312
313 const DistanceFieldPathBatchTracker& local = args.fBT.cast<DistanceField PathBatchTracker>(); 313 const DistanceFieldPathBatchTracker& local = args.fBT.cast<DistanceField PathBatchTracker>();
314 GrGLGPBuilder* pb = args.fPB; 314 GrGLGPBuilder* pb = args.fPB;
315 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 315 GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
316 SkAssertResult(fsBuilder->enableFeature( 316 SkAssertResult(fsBuilder->enableFeature(
317 GrGLFragmentShaderBuilder::kStandardDerivat ives_GLSLFeature)); 317 GrGLFragmentShaderBuilder::kStandardDerivat ives_GLSLFeature));
318 318
319 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); 319 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
320 320
321 // emit attributes 321 // emit attributes
322 vsBuilder->emitAttributes(dfTexEffect); 322 vsBuilder->emitAttributes(dfTexEffect);
323 323
324 GrGLVertToFrag v(kVec2f_GrSLType); 324 GrGLVertToFrag v(kVec2f_GrSLType);
325 args.fPB->addVarying("TextureCoords", &v, kHigh_GrSLPrecision); 325 args.fPB->addVarying("TextureCoords", &v, kHigh_GrSLPrecision);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 vsBuilder->codeAppendf("%s = %s;", st.vsOut(), dfTexEffect.inTextureCoor ds()->fName); 580 vsBuilder->codeAppendf("%s = %s;", st.vsOut(), dfTexEffect.inTextureCoor ds()->fName);
581 581
582 GrGLVertToFrag uv(kVec2f_GrSLType); 582 GrGLVertToFrag uv(kVec2f_GrSLType);
583 args.fPB->addVarying("TextureCoords", &uv, kHigh_GrSLPrecision); 583 args.fPB->addVarying("TextureCoords", &uv, kHigh_GrSLPrecision);
584 // this is only used with text, so our texture bounds always match the g lyph atlas 584 // this is only used with text, so our texture bounds always match the g lyph atlas
585 vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_A8_RECIP_WIDTH ", " 585 vsBuilder->codeAppendf("%s = vec2(" GR_FONT_ATLAS_A8_RECIP_WIDTH ", "
586 GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", uv.vsOut(), 586 GR_FONT_ATLAS_RECIP_HEIGHT ")*%s;", uv.vsOut(),
587 dfTexEffect.inTextureCoords()->fName); 587 dfTexEffect.inTextureCoords()->fName);
588 588
589 // add frag shader code 589 // add frag shader code
590 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 590 GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
591 591
592 SkAssertResult(fsBuilder->enableFeature( 592 SkAssertResult(fsBuilder->enableFeature(
593 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature)); 593 GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
594 594
595 // create LCD offset adjusted by inverse of transform 595 // create LCD offset adjusted by inverse of transform
596 // Use highp to work around aliasing issues 596 // Use highp to work around aliasing issues
597 fsBuilder->codeAppend(GrGLShaderVar::PrecisionString(kHigh_GrSLPrecision , 597 fsBuilder->codeAppend(GrGLShaderVar::PrecisionString(kHigh_GrSLPrecision ,
598 pb->ctxInfo().stand ard())); 598 pb->ctxInfo().stand ard()));
599 fsBuilder->codeAppendf("vec2 uv = %s;\n", uv.fsIn()); 599 fsBuilder->codeAppendf("vec2 uv = %s;\n", uv.fsIn());
600 fsBuilder->codeAppend(GrGLShaderVar::PrecisionString(kHigh_GrSLPrecision , 600 fsBuilder->codeAppend(GrGLShaderVar::PrecisionString(kHigh_GrSLPrecision ,
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 DistanceAdjust wa = { 0.0f, 0.1f, -0.1f }; 816 DistanceAdjust wa = { 0.0f, 0.1f, -0.1f };
817 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; 817 uint32_t flags = kUseLCD_DistanceFieldEffectFlag;
818 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; 818 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0;
819 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; 819 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0;
820 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(random), 820 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(random),
821 GrTest::TestMatrix(random), 821 GrTest::TestMatrix(random),
822 textures[texIdx], params, 822 textures[texIdx], params,
823 wa, 823 wa,
824 flags); 824 flags);
825 } 825 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDisableColorXP.cpp ('k') | src/gpu/effects/GrDitherEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698