@@ -65,27 +65,19 @@ const char* gVS_Header_Varyings_HasTexture =
6565const char * gVS_Header_Varyings_IsAA =
6666 " varying float widthProportion;\n "
6767 " varying float lengthProportion;\n " ;
68- const char * gVS_Header_Varyings_HasBitmap [2 ] = {
69- // Default precision
70- " varying vec2 outBitmapTexCoords;\n " ,
71- // High precision
72- " varying highp vec2 outBitmapTexCoords;\n "
73- };
74- const char * gVS_Header_Varyings_PointHasBitmap [2 ] = {
75- // Default precision
76- " varying vec2 outPointBitmapTexCoords;\n " ,
77- // High precision
78- " varying highp vec2 outPointBitmapTexCoords;\n "
79- };
68+ const char * gVS_Header_Varyings_HasBitmap =
69+ " varying highp vec2 outBitmapTexCoords;\n " ;
70+ const char * gVS_Header_Varyings_PointHasBitmap =
71+ " varying highp vec2 outPointBitmapTexCoords;\n " ;
8072// TODO: These values are used to sample from textures,
8173// they may need to be highp
8274const char * gVS_Header_Varyings_HasGradient [3 ] = {
8375 // Linear
84- " varying vec2 linear;\n " ,
76+ " varying highp vec2 linear;\n " ,
8577 // Circular
86- " varying vec2 circular;\n " ,
78+ " varying highp vec2 circular;\n " ,
8779 // Sweep
88- " varying vec2 sweep;\n "
80+ " varying highp vec2 sweep;\n "
8981};
9082const char * gVS_Main =
9183 " \n void main(void) {\n " ;
@@ -169,7 +161,7 @@ const char* gFS_Main =
169161 " lowp vec4 fragColor;\n " ;
170162
171163const char * gFS_Main_PointBitmapTexCoords =
172- " vec2 outBitmapTexCoords = outPointBitmapTexCoords + "
164+ " highp vec2 outBitmapTexCoords = outPointBitmapTexCoords + "
173165 " ((gl_PointCoord - vec2(0.5, 0.5)) * textureDimension * vec2(pointSize, pointSize));\n " ;
174166
175167// Fast cases
@@ -244,10 +236,10 @@ const char* gFS_Main_FetchGradient[3] = {
244236 // Linear
245237 " vec4 gradientColor = texture2D(gradientSampler, linear);\n " ,
246238 // Circular
247- " float index = length(circular);\n "
239+ " highp float index = length(circular);\n "
248240 " vec4 gradientColor = texture2D(gradientSampler, vec2(index, 0.5));\n " ,
249241 // Sweep
250- " float index = atan(sweep.y, sweep.x) * 0.15915494309; // inv(2 * PI)\n "
242+ " highp float index = atan(sweep.y, sweep.x) * 0.15915494309; // inv(2 * PI)\n "
251243 " vec4 gradientColor = texture2D(gradientSampler, vec2(index - floor(index), 0.5));\n "
252244};
253245const char * gFS_Main_FetchBitmap =
@@ -441,10 +433,9 @@ String8 ProgramCache::generateVertexShader(const ProgramDescription& description
441433 shader.append (gVS_Header_Varyings_HasGradient [description.gradientType ]);
442434 }
443435 if (description.hasBitmap ) {
444- int index = Caches::getInstance ().extensions .needsHighpTexCoords () ? 1 : 0 ;
445436 shader.append (description.isPoint ?
446- gVS_Header_Varyings_PointHasBitmap [index] :
447- gVS_Header_Varyings_HasBitmap [index] );
437+ gVS_Header_Varyings_PointHasBitmap :
438+ gVS_Header_Varyings_HasBitmap );
448439 }
449440
450441 // Begin the shader
@@ -503,10 +494,9 @@ String8 ProgramCache::generateFragmentShader(const ProgramDescription& descripti
503494 shader.append (gVS_Header_Varyings_HasGradient [description.gradientType ]);
504495 }
505496 if (description.hasBitmap ) {
506- int index = Caches::getInstance ().extensions .needsHighpTexCoords () ? 1 : 0 ;
507497 shader.append (description.isPoint ?
508- gVS_Header_Varyings_PointHasBitmap [index] :
509- gVS_Header_Varyings_HasBitmap [index] );
498+ gVS_Header_Varyings_PointHasBitmap :
499+ gVS_Header_Varyings_HasBitmap );
510500 }
511501
512502 // Uniforms
@@ -706,13 +696,13 @@ void ProgramCache::generateBlend(String8& shader, const char* name, SkXfermode::
706696}
707697
708698void ProgramCache::generateTextureWrap (String8& shader, GLenum wrapS, GLenum wrapT) {
709- shader.append (" \n vec2 wrap(vec2 texCoords) {\n " );
699+ shader.append (" \n highp vec2 wrap(highp vec2 texCoords) {\n " );
710700 if (wrapS == GL_MIRRORED_REPEAT) {
711- shader.append (" float xMod2 = mod(texCoords.x, 2.0);\n " );
701+ shader.append (" highp float xMod2 = mod(texCoords.x, 2.0);\n " );
712702 shader.append (" if (xMod2 > 1.0) xMod2 = 2.0 - xMod2;\n " );
713703 }
714704 if (wrapT == GL_MIRRORED_REPEAT) {
715- shader.append (" float yMod2 = mod(texCoords.y, 2.0);\n " );
705+ shader.append (" highp float yMod2 = mod(texCoords.y, 2.0);\n " );
716706 shader.append (" if (yMod2 > 1.0) yMod2 = 2.0 - yMod2;\n " );
717707 }
718708 shader.append (" return vec2(" );
0 commit comments