diff --git a/impeller/compiler/shader_lib/impeller/types.glsl b/impeller/compiler/shader_lib/impeller/types.glsl index d896c5e60659a..87c7eee666c69 100644 --- a/impeller/compiler/shader_lib/impeller/types.glsl +++ b/impeller/compiler/shader_lib/impeller/types.glsl @@ -5,6 +5,21 @@ #ifndef TYPES_GLSL_ #define TYPES_GLSL_ +#extension GL_AMD_gpu_shader_half_float : enable + +#ifndef IMPELLER_TARGET_METAL + +precision mediump sampler2D; +precision mediump float; + +#define float16_t float +#define f16vec2 vec2 +#define f16vec3 vec3 +#define f16vec4 vec4 +#define f16mat4 mat4 + +#endif // IMPELLER_TARGET_METAL + #define BoolF float #define BoolV2 vec2 #define BoolV3 vec3 diff --git a/impeller/entity/shaders/atlas_fill.frag b/impeller/entity/shaders/atlas_fill.frag index e211971ca1bb9..4862343926a78 100644 --- a/impeller/entity/shaders/atlas_fill.frag +++ b/impeller/entity/shaders/atlas_fill.frag @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform sampler2D texture_sampler; diff --git a/impeller/entity/shaders/atlas_fill.vert b/impeller/entity/shaders/atlas_fill.vert index 29d3c0a5be6e7..6140ad98788a4 100644 --- a/impeller/entity/shaders/atlas_fill.vert +++ b/impeller/entity/shaders/atlas_fill.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform VertInfo { mat4 mvp; } diff --git a/impeller/entity/shaders/blending/advanced_blend.glsl b/impeller/entity/shaders/blending/advanced_blend.glsl index a2b1650f904a2..4fd47b059c0c8 100644 --- a/impeller/entity/shaders/blending/advanced_blend.glsl +++ b/impeller/entity/shaders/blending/advanced_blend.glsl @@ -5,6 +5,7 @@ #include #include #include +#include uniform BlendInfo { float dst_input_alpha; diff --git a/impeller/entity/shaders/blending/advanced_blend.vert b/impeller/entity/shaders/blending/advanced_blend.vert index 715dd3dead9fe..cc72aeae97796 100644 --- a/impeller/entity/shaders/blending/advanced_blend.vert +++ b/impeller/entity/shaders/blending/advanced_blend.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform FrameInfo { mat4 mvp; } diff --git a/impeller/entity/shaders/blending/blend.frag b/impeller/entity/shaders/blending/blend.frag index 468a9bb67f7ce..af401a151d98d 100644 --- a/impeller/entity/shaders/blending/blend.frag +++ b/impeller/entity/shaders/blending/blend.frag @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform sampler2D texture_sampler_src; diff --git a/impeller/entity/shaders/blending/blend.vert b/impeller/entity/shaders/blending/blend.vert index 36bea41e390d8..3b4a4bd430445 100644 --- a/impeller/entity/shaders/blending/blend.vert +++ b/impeller/entity/shaders/blending/blend.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform FrameInfo { mat4 mvp; } diff --git a/impeller/entity/shaders/border_mask_blur.frag b/impeller/entity/shaders/border_mask_blur.frag index 85da0df8cdb76..a7652e5623967 100644 --- a/impeller/entity/shaders/border_mask_blur.frag +++ b/impeller/entity/shaders/border_mask_blur.frag @@ -4,6 +4,7 @@ #include #include +#include // Constant time mask blur for image borders. // diff --git a/impeller/entity/shaders/border_mask_blur.vert b/impeller/entity/shaders/border_mask_blur.vert index 3851a60aeb7fe..47a4d03e5978e 100644 --- a/impeller/entity/shaders/border_mask_blur.vert +++ b/impeller/entity/shaders/border_mask_blur.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform FrameInfo { mat4 mvp; diff --git a/impeller/entity/shaders/color_matrix_color_filter.frag b/impeller/entity/shaders/color_matrix_color_filter.frag index c021a93604b28..e169f476b788e 100644 --- a/impeller/entity/shaders/color_matrix_color_filter.frag +++ b/impeller/entity/shaders/color_matrix_color_filter.frag @@ -4,6 +4,7 @@ #include #include +#include // A color filter that transforms colors through a 4x5 color matrix. // diff --git a/impeller/entity/shaders/color_matrix_color_filter.vert b/impeller/entity/shaders/color_matrix_color_filter.vert index 29b0128258658..27b8ecedbf216 100644 --- a/impeller/entity/shaders/color_matrix_color_filter.vert +++ b/impeller/entity/shaders/color_matrix_color_filter.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform FrameInfo { mat4 mvp; } diff --git a/impeller/entity/shaders/gaussian_blur.frag b/impeller/entity/shaders/gaussian_blur.frag index 06bd0f389ff47..b831baa6f8c77 100644 --- a/impeller/entity/shaders/gaussian_blur.frag +++ b/impeller/entity/shaders/gaussian_blur.frag @@ -16,6 +16,7 @@ #include #include #include +#include uniform sampler2D texture_sampler; uniform sampler2D alpha_mask_sampler; diff --git a/impeller/entity/shaders/gaussian_blur.vert b/impeller/entity/shaders/gaussian_blur.vert index 0fd3595a2d267..1fac06eb058b8 100644 --- a/impeller/entity/shaders/gaussian_blur.vert +++ b/impeller/entity/shaders/gaussian_blur.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform FrameInfo { mat4 mvp; } diff --git a/impeller/entity/shaders/glyph_atlas.frag b/impeller/entity/shaders/glyph_atlas.frag index 4c9175bd9b16a..007748704f1d7 100644 --- a/impeller/entity/shaders/glyph_atlas.frag +++ b/impeller/entity/shaders/glyph_atlas.frag @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform sampler2D glyph_atlas_sampler; uniform FragInfo { diff --git a/impeller/entity/shaders/glyph_atlas.vert b/impeller/entity/shaders/glyph_atlas.vert index 365fc72b13b1e..bd527655c8984 100644 --- a/impeller/entity/shaders/glyph_atlas.vert +++ b/impeller/entity/shaders/glyph_atlas.vert @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform FrameInfo { mat4 mvp; diff --git a/impeller/entity/shaders/glyph_atlas_sdf.frag b/impeller/entity/shaders/glyph_atlas_sdf.frag index 9947566d150df..0ded6865c6371 100644 --- a/impeller/entity/shaders/glyph_atlas_sdf.frag +++ b/impeller/entity/shaders/glyph_atlas_sdf.frag @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform sampler2D glyph_atlas_sampler; uniform FragInfo { diff --git a/impeller/entity/shaders/glyph_atlas_sdf.vert b/impeller/entity/shaders/glyph_atlas_sdf.vert index cfbb2d353e7c6..4f6b62d059b5c 100644 --- a/impeller/entity/shaders/glyph_atlas_sdf.vert +++ b/impeller/entity/shaders/glyph_atlas_sdf.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #include uniform FrameInfo { diff --git a/impeller/entity/shaders/gradient_fill.vert b/impeller/entity/shaders/gradient_fill.vert index 86f4d1e228694..824f496ea8c22 100644 --- a/impeller/entity/shaders/gradient_fill.vert +++ b/impeller/entity/shaders/gradient_fill.vert @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform FrameInfo { mat4 mvp; diff --git a/impeller/entity/shaders/linear_gradient_fill.frag b/impeller/entity/shaders/linear_gradient_fill.frag index 0986cfa750018..008d0a562e255 100644 --- a/impeller/entity/shaders/linear_gradient_fill.frag +++ b/impeller/entity/shaders/linear_gradient_fill.frag @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform sampler2D texture_sampler; diff --git a/impeller/entity/shaders/linear_gradient_ssbo_fill.frag b/impeller/entity/shaders/linear_gradient_ssbo_fill.frag index 21041d7938550..a2443ece8cadf 100644 --- a/impeller/entity/shaders/linear_gradient_ssbo_fill.frag +++ b/impeller/entity/shaders/linear_gradient_ssbo_fill.frag @@ -4,6 +4,7 @@ #include #include +#include readonly buffer ColorData { vec4 colors[]; diff --git a/impeller/entity/shaders/linear_to_srgb_filter.frag b/impeller/entity/shaders/linear_to_srgb_filter.frag index 0b2a68da12368..0d6a99263df77 100644 --- a/impeller/entity/shaders/linear_to_srgb_filter.frag +++ b/impeller/entity/shaders/linear_to_srgb_filter.frag @@ -4,6 +4,7 @@ #include #include +#include // A color filter that applies the sRGB gamma curve to the color. // diff --git a/impeller/entity/shaders/linear_to_srgb_filter.vert b/impeller/entity/shaders/linear_to_srgb_filter.vert index 29b0128258658..27b8ecedbf216 100644 --- a/impeller/entity/shaders/linear_to_srgb_filter.vert +++ b/impeller/entity/shaders/linear_to_srgb_filter.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform FrameInfo { mat4 mvp; } diff --git a/impeller/entity/shaders/morphology_filter.frag b/impeller/entity/shaders/morphology_filter.frag index 27fa447baeb63..dc80727a80c92 100644 --- a/impeller/entity/shaders/morphology_filter.frag +++ b/impeller/entity/shaders/morphology_filter.frag @@ -4,6 +4,7 @@ #include #include +#include // These values must correspond to the order of the items in the // 'FilterContents::MorphType' enum class. diff --git a/impeller/entity/shaders/morphology_filter.vert b/impeller/entity/shaders/morphology_filter.vert index c76f3b8a57f48..a504e7a9e23c8 100644 --- a/impeller/entity/shaders/morphology_filter.vert +++ b/impeller/entity/shaders/morphology_filter.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform FrameInfo { mat4 mvp; } diff --git a/impeller/entity/shaders/position.vert b/impeller/entity/shaders/position.vert index 0b21229bcc05a..048062f0033f5 100644 --- a/impeller/entity/shaders/position.vert +++ b/impeller/entity/shaders/position.vert @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform VertInfo { mat4 mvp; diff --git a/impeller/entity/shaders/position_color.vert b/impeller/entity/shaders/position_color.vert index 6b4ef7f642079..f36ded01e0257 100644 --- a/impeller/entity/shaders/position_color.vert +++ b/impeller/entity/shaders/position_color.vert @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform VertInfo { mat4 mvp; diff --git a/impeller/entity/shaders/position_uv.vert b/impeller/entity/shaders/position_uv.vert index f60ec0dd6453c..e49949a801277 100644 --- a/impeller/entity/shaders/position_uv.vert +++ b/impeller/entity/shaders/position_uv.vert @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform VertInfo { mat4 mvp; diff --git a/impeller/entity/shaders/radial_gradient_fill.frag b/impeller/entity/shaders/radial_gradient_fill.frag index 3414e8edc648c..9d3a4d64bb7d1 100644 --- a/impeller/entity/shaders/radial_gradient_fill.frag +++ b/impeller/entity/shaders/radial_gradient_fill.frag @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform sampler2D texture_sampler; diff --git a/impeller/entity/shaders/radial_gradient_ssbo_fill.frag b/impeller/entity/shaders/radial_gradient_ssbo_fill.frag index 9b129f661fae9..0b6496c0d7a68 100644 --- a/impeller/entity/shaders/radial_gradient_ssbo_fill.frag +++ b/impeller/entity/shaders/radial_gradient_ssbo_fill.frag @@ -4,6 +4,7 @@ #include #include +#include readonly buffer ColorData { vec4 colors[]; diff --git a/impeller/entity/shaders/rrect_blur.frag b/impeller/entity/shaders/rrect_blur.frag index bc400d0354e06..7a82a57805e63 100644 --- a/impeller/entity/shaders/rrect_blur.frag +++ b/impeller/entity/shaders/rrect_blur.frag @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform FragInfo { vec4 color; diff --git a/impeller/entity/shaders/rrect_blur.vert b/impeller/entity/shaders/rrect_blur.vert index 36711c6ede5e0..8ada4365f4138 100644 --- a/impeller/entity/shaders/rrect_blur.vert +++ b/impeller/entity/shaders/rrect_blur.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform VertInfo { mat4 mvp; } diff --git a/impeller/entity/shaders/runtime_effect.vert b/impeller/entity/shaders/runtime_effect.vert index 10a3cba4654db..bf69bf1ed69a7 100644 --- a/impeller/entity/shaders/runtime_effect.vert +++ b/impeller/entity/shaders/runtime_effect.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform VertInfo { mat4 mvp; } diff --git a/impeller/entity/shaders/solid_fill.frag b/impeller/entity/shaders/solid_fill.frag index 5d9c83604dd68..28c7776da9e1d 100644 --- a/impeller/entity/shaders/solid_fill.frag +++ b/impeller/entity/shaders/solid_fill.frag @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform FragInfo { vec4 color; } diff --git a/impeller/entity/shaders/solid_fill.vert b/impeller/entity/shaders/solid_fill.vert index 8fdc5b1ea3f1e..3ced5986276c7 100644 --- a/impeller/entity/shaders/solid_fill.vert +++ b/impeller/entity/shaders/solid_fill.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform VertInfo { mat4 mvp; } diff --git a/impeller/entity/shaders/srgb_to_linear_filter.frag b/impeller/entity/shaders/srgb_to_linear_filter.frag index 9e4f90e900900..fcef8e99d545d 100644 --- a/impeller/entity/shaders/srgb_to_linear_filter.frag +++ b/impeller/entity/shaders/srgb_to_linear_filter.frag @@ -8,6 +8,8 @@ // Creates a color filter that applies the inverse of the sRGB gamma curve // to the RGB channels. +#include + uniform sampler2D input_texture; uniform FragInfo { diff --git a/impeller/entity/shaders/srgb_to_linear_filter.vert b/impeller/entity/shaders/srgb_to_linear_filter.vert index 29b0128258658..27b8ecedbf216 100644 --- a/impeller/entity/shaders/srgb_to_linear_filter.vert +++ b/impeller/entity/shaders/srgb_to_linear_filter.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform FrameInfo { mat4 mvp; } diff --git a/impeller/entity/shaders/sweep_gradient_fill.frag b/impeller/entity/shaders/sweep_gradient_fill.frag index 30cc3ec8a35dd..47d70f023a4c6 100644 --- a/impeller/entity/shaders/sweep_gradient_fill.frag +++ b/impeller/entity/shaders/sweep_gradient_fill.frag @@ -4,6 +4,7 @@ #include #include +#include uniform sampler2D texture_sampler; diff --git a/impeller/entity/shaders/sweep_gradient_ssbo_fill.frag b/impeller/entity/shaders/sweep_gradient_ssbo_fill.frag index 226a483c815bc..9fe30f94ad99c 100644 --- a/impeller/entity/shaders/sweep_gradient_ssbo_fill.frag +++ b/impeller/entity/shaders/sweep_gradient_ssbo_fill.frag @@ -5,6 +5,7 @@ #include #include #include +#include readonly buffer ColorData { vec4 colors[]; diff --git a/impeller/entity/shaders/texture_fill.frag b/impeller/entity/shaders/texture_fill.frag index 913cc7e1e8a70..9b8a8a6bab802 100644 --- a/impeller/entity/shaders/texture_fill.frag +++ b/impeller/entity/shaders/texture_fill.frag @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform sampler2D texture_sampler; diff --git a/impeller/entity/shaders/texture_fill.vert b/impeller/entity/shaders/texture_fill.vert index c8abc9aaabbce..212f9e288f34f 100644 --- a/impeller/entity/shaders/texture_fill.vert +++ b/impeller/entity/shaders/texture_fill.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform VertInfo { mat4 mvp; } diff --git a/impeller/entity/shaders/tiled_texture_fill.frag b/impeller/entity/shaders/tiled_texture_fill.frag index 459742b768f80..2c3c4ea8ab07a 100644 --- a/impeller/entity/shaders/tiled_texture_fill.frag +++ b/impeller/entity/shaders/tiled_texture_fill.frag @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform sampler2D texture_sampler; diff --git a/impeller/entity/shaders/tiled_texture_fill.vert b/impeller/entity/shaders/tiled_texture_fill.vert index db73769940067..dabcdf780bf54 100644 --- a/impeller/entity/shaders/tiled_texture_fill.vert +++ b/impeller/entity/shaders/tiled_texture_fill.vert @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include uniform VertInfo { mat4 mvp; diff --git a/impeller/entity/shaders/vertices.frag b/impeller/entity/shaders/vertices.frag index ccad5b7d3e141..c42e809ecc14d 100644 --- a/impeller/entity/shaders/vertices.frag +++ b/impeller/entity/shaders/vertices.frag @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + in vec4 v_color; out vec4 frag_color; diff --git a/impeller/entity/shaders/yuv_to_rgb_filter.frag b/impeller/entity/shaders/yuv_to_rgb_filter.frag index 73e416ce5b7ef..d33e0d541bc08 100644 --- a/impeller/entity/shaders/yuv_to_rgb_filter.frag +++ b/impeller/entity/shaders/yuv_to_rgb_filter.frag @@ -4,6 +4,7 @@ #include #include +#include uniform sampler2D y_texture; uniform sampler2D uv_texture; diff --git a/impeller/entity/shaders/yuv_to_rgb_filter.vert b/impeller/entity/shaders/yuv_to_rgb_filter.vert index 29b0128258658..27b8ecedbf216 100644 --- a/impeller/entity/shaders/yuv_to_rgb_filter.vert +++ b/impeller/entity/shaders/yuv_to_rgb_filter.vert @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform FrameInfo { mat4 mvp; }