File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 1010 #else
1111 precision mediump sampler2DArray ;
1212 #endif
13+
14+ // Sampler default precision is lowp on mobile GPUs.
15+ // This causes RGBA32F texture data to be clamped to 16 bit floats on some GPUs (e.g. Mali-T880).
16+ // Define highp precision macro to allow lossless FLOAT texture sampling.
17+ #define HIGHP_SAMPLER_FLOAT highp
18+ #else
19+ #define HIGHP_SAMPLER_FLOAT
1320 #endif
21+ #else
22+ #define HIGHP_SAMPLER_FLOAT
1423#endif
1524
1625#define PST_TOP_LEFT 0
@@ -118,7 +127,7 @@ ivec2 get_resource_cache_uv(int address) {
118127 address / WR_MAX_VERTEX_TEXTURE_WIDTH);
119128}
120129
121- uniform sampler2D sResourceCache;
130+ uniform HIGHP_SAMPLER_FLOAT sampler2D sResourceCache;
122131
123132vec4 [2 ] fetch_from_resource_cache_2(int address) {
124133 ivec2 uv = get_resource_cache_uv(address);
@@ -137,10 +146,10 @@ vec4[2] fetch_from_resource_cache_2(int address) {
137146#define VECS_PER_GRADIENT 3
138147#define VECS_PER_GRADIENT_STOP 2
139148
140- uniform sampler2D sLayers;
141- uniform sampler2D sRenderTasks;
149+ uniform HIGHP_SAMPLER_FLOAT sampler2D sLayers;
150+ uniform HIGHP_SAMPLER_FLOAT sampler2D sRenderTasks;
142151
143- uniform sampler2D sData32;
152+ uniform HIGHP_SAMPLER_FLOAT sampler2D sData32;
144153
145154// Instanced attributes
146155in ivec4 aData0;
You can’t perform that action at this time.
0 commit comments