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

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 dm bug 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
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("vec3 pos3 = %s * vec3(%s, 1);", args.fGP.uViewM( ),
36 args.fGP.inPosition());
37 vsBuilder->transformPositionToDeviceSpace("pos3");
38
34 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); 39 GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
35 fsBuilder->codeAppendf("%s = ", args.fOutput); 40 fsBuilder->codeAppendf("%s = ", args.fOutput);
36 fsBuilder->appendTextureLookupAndModulate(args.fInput, 41 fsBuilder->appendTextureLookupAndModulate(args.fInput,
37 args.fSamplers[0], 42 args.fSamplers[0],
38 v.fsIn(), 43 v.fsIn(),
39 kVec2f_GrSLType); 44 kVec2f_GrSLType);
40 fsBuilder->codeAppend(";"); 45 fsBuilder->codeAppend(";");
41 } 46 }
42 47
43 virtual void setData(const GrGLProgramDataManager&, 48 virtual void setData(const GrGLProgramDataManager&,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 }; 96 };
92 SkShader::TileMode tileModes[] = { 97 SkShader::TileMode tileModes[] = {
93 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], 98 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
94 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], 99 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
95 }; 100 };
96 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil erp_FilterMode : 101 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil erp_FilterMode :
97 GrTextureParams::kNon e_FilterMode); 102 GrTextureParams::kNon e_FilterMode);
98 103
99 return GrCustomCoordsTextureEffect::Create(textures[texIdx], params); 104 return GrCustomCoordsTextureEffect::Create(textures[texIdx], params);
100 } 105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698