Skip to content

Commit 6355347

Browse files
author
Romain Guy
committed
Remove vendor specific precision qualifier
Change-Id: I0a56ca7a5a399ec94993d3cea0c4aff6c0f86e39
1 parent 8e025de commit 6355347

File tree

2 files changed

+17
-36
lines changed

2 files changed

+17
-36
lines changed

libs/hwui/Extensions.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ namespace uirenderer {
3939
#define EXT_LOGD(...)
4040
#endif
4141

42-
// Vendor strings
43-
#define VENDOR_IMG "Imagination Technologies"
44-
4542
///////////////////////////////////////////////////////////////////////////////
4643
// Classes
4744
///////////////////////////////////////////////////////////////////////////////
@@ -69,10 +66,6 @@ class Extensions {
6966
mHasDebugMarker = hasExtension("GL_EXT_debug_marker");
7067
mHasDebugLabel = hasExtension("GL_EXT_debug_label");
7168

72-
const char* vendor = (const char*) glGetString(GL_VENDOR);
73-
EXT_LOGD("Vendor: %s", vendor);
74-
mNeedsHighpTexCoords = strcmp(vendor, VENDOR_IMG) == 0;
75-
7669
// We don't need to copy the string, the OpenGL ES spec
7770
// guarantees the result of glGetString to point to a
7871
// static string as long as our OpenGL context is valid
@@ -81,7 +74,6 @@ class Extensions {
8174

8275
inline bool hasNPot() const { return mHasNPot; }
8376
inline bool hasFramebufferFetch() const { return mHasFramebufferFetch; }
84-
inline bool needsHighpTexCoords() const { return mNeedsHighpTexCoords; }
8577
inline bool hasDiscardFramebuffer() const { return mHasDiscardFramebuffer; }
8678
inline bool hasDebugMarker() const { return mHasDebugMarker; }
8779
inline bool hasDebugLabel() const { return mHasDebugLabel; }
@@ -101,7 +93,6 @@ class Extensions {
10193
const char* mExtensions;
10294

10395
bool mHasNPot;
104-
bool mNeedsHighpTexCoords;
10596
bool mHasFramebufferFetch;
10697
bool mHasDiscardFramebuffer;
10798
bool mHasDebugMarker;

libs/hwui/ProgramCache.cpp

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,27 +65,19 @@ const char* gVS_Header_Varyings_HasTexture =
6565
const 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
8274
const 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
};
9082
const char* gVS_Main =
9183
"\nvoid main(void) {\n";
@@ -169,7 +161,7 @@ const char* gFS_Main =
169161
" lowp vec4 fragColor;\n";
170162

171163
const 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
};
253245
const 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

708698
void ProgramCache::generateTextureWrap(String8& shader, GLenum wrapS, GLenum wrapT) {
709-
shader.append("\nvec2 wrap(vec2 texCoords) {\n");
699+
shader.append("\nhighp 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

Comments
 (0)