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

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

Issue 421823003: Fix for texture domain on imagination gpus (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: removing tabs Created 6 years, 4 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 | « no previous file | 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 2012 Google Inc. 2 * Copyright 2012 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 "GrTextureDomain.h" 8 #include "GrTextureDomain.h"
9 #include "GrSimpleTextureEffect.h" 9 #include "GrSimpleTextureEffect.h"
10 #include "GrTBackendEffectFactory.h" 10 #include "GrTBackendEffectFactory.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // call) causes the compilation error "Calls to any function tha t 89 // call) causes the compilation error "Calls to any function tha t
90 // may require a gradient calculation inside a conditional block 90 // may require a gradient calculation inside a conditional block
91 // may return undefined results". This appears to be an issue wi th 91 // may return undefined results". This appears to be an issue wi th
92 // the 'any' call since even the simple "result=black; if (any() ) 92 // the 'any' call since even the simple "result=black; if (any() )
93 // result=white;" code fails to compile. 93 // result=white;" code fails to compile.
94 builder->fsCodeAppend("\tvec4 outside = vec4(0.0, 0.0, 0.0, 0.0) ;\n"); 94 builder->fsCodeAppend("\tvec4 outside = vec4(0.0, 0.0, 0.0, 0.0) ;\n");
95 builder->fsCodeAppend("\tvec4 inside = "); 95 builder->fsCodeAppend("\tvec4 inside = ");
96 builder->fsAppendTextureLookupAndModulate(inModulateColor, sampl er, 96 builder->fsAppendTextureLookupAndModulate(inModulateColor, sampl er,
97 inCoords.c_str()); 97 inCoords.c_str());
98 builder->fsCodeAppend(";\n"); 98 builder->fsCodeAppend(";\n");
99 builder->fsCodeAppendf("\tfloat x = (%s).x;\n", inCoords.c_str() );
100 builder->fsCodeAppendf("\tfloat y = (%s).y;\n", inCoords.c_str() );
99 101
100 builder->fsCodeAppendf("\tfloat x = abs(2.0*(%s.x - %s.x)/(%s.z - %s.x) - 1.0);\n", 102 builder->fsCodeAppendf("\tx = abs(2.0*(x - %s.x)/(%s.z - %s.x) - 1.0);\n",
101 inCoords.c_str(), domain, domain, domain ); 103 domain, domain, domain);
102 builder->fsCodeAppendf("\tfloat y = abs(2.0*(%s.y - %s.y)/(%s.w - %s.y) - 1.0);\n", 104 builder->fsCodeAppendf("\ty = abs(2.0*(y - %s.y)/(%s.w - %s.y) - 1.0);\n",
103 inCoords.c_str(), domain, domain, domain ); 105 domain, domain, domain);
104 builder->fsCodeAppend("\tfloat blend = step(1.0, max(x, y));\n") ; 106 builder->fsCodeAppend("\tfloat blend = step(1.0, max(x, y));\n") ;
105 builder->fsCodeAppendf("\t%s = mix(inside, outside, blend);\n", outColor); 107 builder->fsCodeAppendf("\t%s = mix(inside, outside, blend);\n", outColor);
106 } else { 108 } else {
107 builder->fsCodeAppend("\tbvec4 outside;\n"); 109 builder->fsCodeAppend("\tbvec4 outside;\n");
108 builder->fsCodeAppendf("\toutside.xy = lessThan(%s, %s.xy);\n", inCoords.c_str(), 110 builder->fsCodeAppendf("\toutside.xy = lessThan(%s, %s.xy);\n", inCoords.c_str(),
109 domain); 111 domain);
110 builder->fsCodeAppendf("\toutside.zw = greaterThan(%s, %s.zw);\n ", inCoords.c_str(), 112 builder->fsCodeAppendf("\toutside.zw = greaterThan(%s, %s.zw);\n ", inCoords.c_str(),
111 domain); 113 domain);
112 builder->fsCodeAppendf("\t%s = any(outside) ? vec4(0.0, 0.0, 0.0 , 0.0) : ", 114 builder->fsCodeAppendf("\t%s = any(outside) ? vec4(0.0, 0.0, 0.0 , 0.0) : ",
113 outColor); 115 outColor);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); 294 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random);
293 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f alse; 295 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f alse;
294 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo rdSet; 296 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo rdSet;
295 return GrTextureDomainEffect::Create(textures[texIdx], 297 return GrTextureDomainEffect::Create(textures[texIdx],
296 matrix, 298 matrix,
297 domain, 299 domain,
298 mode, 300 mode,
299 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode, 301 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode,
300 coords); 302 coords);
301 } 303 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698