Skip to content

Commit c05e7ff

Browse files
author
Jonah Williams
authored
[Impeller] opt float/sampler into relaxed precision for gles (flutter#37828)
* [Impeller] opt float/sampler into relaxed precision for gles * re-arrange define
1 parent 37e2aaa commit c05e7ff

45 files changed

Lines changed: 79 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

impeller/compiler/shader_lib/impeller/types.glsl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
#ifndef TYPES_GLSL_
66
#define TYPES_GLSL_
77

8+
#extension GL_AMD_gpu_shader_half_float : enable
9+
10+
#ifndef IMPELLER_TARGET_METAL
11+
12+
precision mediump sampler2D;
13+
precision mediump float;
14+
15+
#define float16_t float
16+
#define f16vec2 vec2
17+
#define f16vec3 vec3
18+
#define f16vec4 vec4
19+
#define f16mat4 mat4
20+
21+
#endif // IMPELLER_TARGET_METAL
22+
823
#define BoolF float
924
#define BoolV2 vec2
1025
#define BoolV3 vec3

impeller/entity/shaders/atlas_fill.frag

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// found in the LICENSE file.
44

55
#include <impeller/texture.glsl>
6+
#include <impeller/types.glsl>
67

78
uniform sampler2D texture_sampler;
89

impeller/entity/shaders/atlas_fill.vert

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
#include <impeller/types.glsl>
6+
57
uniform VertInfo {
68
mat4 mvp;
79
}

impeller/entity/shaders/blending/advanced_blend.glsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <impeller/blending.glsl>
66
#include <impeller/color.glsl>
77
#include <impeller/texture.glsl>
8+
#include <impeller/types.glsl>
89

910
uniform BlendInfo {
1011
float dst_input_alpha;

impeller/entity/shaders/blending/advanced_blend.vert

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
#include <impeller/types.glsl>
6+
57
uniform FrameInfo {
68
mat4 mvp;
79
}

impeller/entity/shaders/blending/blend.frag

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// found in the LICENSE file.
44

55
#include <impeller/texture.glsl>
6+
#include <impeller/types.glsl>
67

78
uniform sampler2D texture_sampler_src;
89

impeller/entity/shaders/blending/blend.vert

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
#include <impeller/types.glsl>
6+
57
uniform FrameInfo {
68
mat4 mvp;
79
}

impeller/entity/shaders/border_mask_blur.frag

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <impeller/gaussian.glsl>
66
#include <impeller/texture.glsl>
7+
#include <impeller/types.glsl>
78

89
// Constant time mask blur for image borders.
910
//

impeller/entity/shaders/border_mask_blur.vert

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
#include <impeller/types.glsl>
6+
57
uniform FrameInfo {
68
mat4 mvp;
79

impeller/entity/shaders/color_matrix_color_filter.frag

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <impeller/color.glsl>
66
#include <impeller/texture.glsl>
7+
#include <impeller/types.glsl>
78

89
// A color filter that transforms colors through a 4x5 color matrix.
910
//

0 commit comments

Comments
 (0)