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

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

Issue 678953002: Default geometry processor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix Created 6 years, 1 month 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/GrBezierEffect.cpp ('k') | src/gpu/effects/GrDashingEffect.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 "GrCustomCoordsTextureEffect.h" 8 #include "GrCustomCoordsTextureEffect.h"
9 #include "gl/builders/GrGLProgramBuilder.h" 9 #include "gl/builders/GrGLProgramBuilder.h"
10 #include "gl/GrGLProcessor.h" 10 #include "gl/GrGLProcessor.h"
(...skipping 13 matching lines...) Expand all
24 args.fGP.cast<GrCustomCoordsTextureEffect>(); 24 args.fGP.cast<GrCustomCoordsTextureEffect>();
25 SkASSERT(1 == customCoordsTextureEffect.getVertexAttribs().count()); 25 SkASSERT(1 == customCoordsTextureEffect.getVertexAttribs().count());
26 26
27 GrGLVertToFrag v(kVec2f_GrSLType); 27 GrGLVertToFrag v(kVec2f_GrSLType);
28 args.fPB->addVarying("TextureCoords", &v); 28 args.fPB->addVarying("TextureCoords", &v);
29 29
30 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); 30 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
31 const GrShaderVar& inTextureCoords = customCoordsTextureEffect.inTexture Coords(); 31 const GrShaderVar& inTextureCoords = customCoordsTextureEffect.inTexture Coords();
32 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), inTextureCoords.c_str()); 32 vsBuilder->codeAppendf("%s = %s;", v.vsOut(), inTextureCoords.c_str());
33 33
34 // setup position varying
35 vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", vsBuilder->glPosition() ,
36 vsBuilder->uViewM(), vsBuilder->inPosition());
37
34 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 38 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
35 fsBuilder->codeAppendf("%s = ", args.fOutput); 39 fsBuilder->codeAppendf("%s = ", args.fOutput);
36 fsBuilder->appendTextureLookupAndModulate(args.fInput, 40 fsBuilder->appendTextureLookupAndModulate(args.fInput,
37 args.fSamplers[0], 41 args.fSamplers[0],
38 v.fsIn(), 42 v.fsIn(),
39 kVec2f_GrSLType); 43 kVec2f_GrSLType);
40 fsBuilder->codeAppend(";"); 44 fsBuilder->codeAppend(";");
41 } 45 }
42 46
43 virtual void setData(const GrGLProgramDataManager&, 47 virtual void setData(const GrGLProgramDataManager&,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 }; 95 };
92 SkShader::TileMode tileModes[] = { 96 SkShader::TileMode tileModes[] = {
93 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], 97 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
94 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], 98 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
95 }; 99 };
96 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil erp_FilterMode : 100 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil erp_FilterMode :
97 GrTextureParams::kNon e_FilterMode); 101 GrTextureParams::kNon e_FilterMode);
98 102
99 return GrCustomCoordsTextureEffect::Create(textures[texIdx], params); 103 return GrCustomCoordsTextureEffect::Create(textures[texIdx], params);
100 } 104 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBezierEffect.cpp ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698