Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit b2855e0

Browse files
[Impeller] Increase precision of texture coordinate input (#40803)
[Impeller] Increase precision of texture coordinate input
1 parent b83d7dc commit b2855e0

File tree

6 files changed

+91
-93
lines changed

6 files changed

+91
-93
lines changed

impeller/compiler/shader_lib/impeller/texture.glsl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,11 @@ const float16_t kTileModeDecalHf = 3.0hf;
100100
/// This is useful for Impeller graphics backend that don't have native support
101101
/// for Decal.
102102
f16vec4 IPHalfSampleWithTileMode(f16sampler2D tex,
103-
f16vec2 coords,
103+
vec2 coords,
104104
float16_t x_tile_mode,
105105
float16_t y_tile_mode) {
106-
if (x_tile_mode == kTileModeDecalHf &&
107-
(coords.x < 0.0hf || coords.x >= 1.0hf) ||
108-
y_tile_mode == kTileModeDecalHf &&
109-
(coords.y < 0.0hf || coords.y >= 1.0hf)) {
106+
if (x_tile_mode == kTileModeDecalHf && (coords.x < 0.0 || coords.x >= 1.0) ||
107+
y_tile_mode == kTileModeDecalHf && (coords.y < 0.0 || coords.y >= 1.0)) {
110108
return f16vec4(0.0hf);
111109
}
112110

impeller/entity/shaders/texture_fill.frag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ uniform FragInfo {
1111
}
1212
frag_info;
1313

14-
in f16vec2 v_texture_coords;
14+
in highp vec2 v_texture_coords;
1515

1616
out f16vec4 frag_color;
1717

impeller/entity/shaders/texture_fill.vert

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ uniform FrameInfo {
1111
}
1212
frame_info;
1313

14-
in vec2 position;
14+
in highp vec2 position;
1515
in vec2 texture_coords;
1616

17-
out f16vec2 v_texture_coords;
17+
out highp vec2 v_texture_coords;
1818

1919
void main() {
2020
gl_Position = frame_info.mvp * vec4(position, 0.0, 1.0);
21-
v_texture_coords = f16vec2(
22-
IPRemapCoords(texture_coords, frame_info.texture_sampler_y_coord_scale));
21+
v_texture_coords =
22+
IPRemapCoords(texture_coords, frame_info.texture_sampler_y_coord_scale);
2323
}

impeller/entity/shaders/tiled_texture_fill.frag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ uniform FragInfo {
1414
}
1515
frag_info;
1616

17-
in f16vec2 v_texture_coords;
17+
in highp vec2 v_texture_coords;
1818

1919
out f16vec4 frag_color;
2020

impeller/entity/shaders/tiled_texture_fill.vert

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ uniform FrameInfo {
1111
}
1212
frame_info;
1313

14-
in vec2 position;
15-
in vec2 texture_coords;
14+
in highp vec2 position;
15+
in highp vec2 texture_coords;
1616

17-
out f16vec2 v_texture_coords;
17+
out highp vec2 v_texture_coords;
1818

1919
void main() {
2020
gl_Position = frame_info.mvp * vec4(position, 0.0, 1.0);
21-
v_texture_coords = f16vec2(
22-
IPRemapCoords(texture_coords, frame_info.texture_sampler_y_coord_scale));
21+
v_texture_coords =
22+
IPRemapCoords(texture_coords, frame_info.texture_sampler_y_coord_scale);
2323
}

0 commit comments

Comments
 (0)