diff --git a/engine/src/flutter/impeller/compiler/shader_lib/impeller/constants.glsl b/engine/src/flutter/impeller/compiler/shader_lib/impeller/constants.glsl index ccb73b5df9..f211cbae97 100644 --- a/engine/src/flutter/impeller/compiler/shader_lib/impeller/constants.glsl +++ b/engine/src/flutter/impeller/compiler/shader_lib/impeller/constants.glsl @@ -29,6 +29,5 @@ const float kSqrtThree = 1.73205080757; // which results in sharper looking images when mip sampling is enabled. This is // the same constant that Skia uses. const float kDefaultMipBias = -0.475; -const float kDefaultMipBiasHalf = -0.475hf; #endif diff --git a/engine/src/flutter/impeller/compiler/shader_lib/impeller/texture.glsl b/engine/src/flutter/impeller/compiler/shader_lib/impeller/texture.glsl index 56be817085..f699d70035 100644 --- a/engine/src/flutter/impeller/compiler/shader_lib/impeller/texture.glsl +++ b/engine/src/flutter/impeller/compiler/shader_lib/impeller/texture.glsl @@ -82,22 +82,20 @@ vec4 IPSampleWithTileMode(sampler2D tex, return texture(tex, coords, kDefaultMipBias); } -const float16_t kTileModeDecalHf = 3.0hf; - /// Sample a texture, emulating a specific tile mode. /// /// This is useful for Impeller graphics backend that don't have native support /// for Decal. f16vec4 IPHalfSampleWithTileMode(f16sampler2D tex, vec2 coords, - float16_t x_tile_mode, - float16_t y_tile_mode) { - if (x_tile_mode == kTileModeDecalHf && (coords.x < 0.0 || coords.x >= 1.0) || - y_tile_mode == kTileModeDecalHf && (coords.y < 0.0 || coords.y >= 1.0)) { + float x_tile_mode, + float y_tile_mode) { + if (x_tile_mode == kTileModeDecal && (coords.x < 0.0 || coords.x >= 1.0) || + y_tile_mode == kTileModeDecal && (coords.y < 0.0 || coords.y >= 1.0)) { return f16vec4(0.0hf); } - return texture(tex, coords, kDefaultMipBiasHalf); + return texture(tex, coords, float16_t(kDefaultMipBias)); } /// Sample a texture, emulating a specific tile mode. @@ -137,7 +135,7 @@ f16vec4 IPHalfSampleDecal(f16sampler2D texture_sampler, vec2 coords) { any(greaterThanEqual(coords, vec2(1)))) { return f16vec4(0.0); } - return texture(texture_sampler, coords, kDefaultMipBiasHalf); + return texture(texture_sampler, coords, float16_t(kDefaultMipBias)); } /// Sample a texture, emulating a specific tile mode. diff --git a/engine/src/flutter/impeller/entity/shaders/filters/morphology_filter.frag b/engine/src/flutter/impeller/entity/shaders/filters/morphology_filter.frag index 54d151e98b..5cd4781136 100644 --- a/engine/src/flutter/impeller/entity/shaders/filters/morphology_filter.frag +++ b/engine/src/flutter/impeller/entity/shaders/filters/morphology_filter.frag @@ -12,15 +12,15 @@ layout(constant_id = 0) const float supports_decal = 1.0; // These values must correspond to the order of the items in the // 'FilterContents::MorphType' enum class. -const float16_t kMorphTypeDilate = 0.0hf; -const float16_t kMorphTypeErode = 1.0hf; +// const float kMorphTypeDilate = 0.0; +// const float kMorphTypeErode = 1.0; uniform f16sampler2D texture_sampler; uniform FragInfo { f16vec2 uv_offset; float16_t radius; - float16_t morph_type; + float morph_type; float supports_decal_sampler_address_mode; } frag_info; @@ -30,8 +30,9 @@ in highp vec2 v_texture_coords; out f16vec4 frag_color; void main() { - f16vec4 result = - frag_info.morph_type == kMorphTypeDilate ? f16vec4(0.0) : f16vec4(1.0); + f16vec4 result = frag_info.morph_type == /*kMorphTypeDilate*/ 0.0 + ? f16vec4(0.0) + : f16vec4(1.0); for (float16_t i = -frag_info.radius; i <= frag_info.radius; i++) { vec2 texture_coords = v_texture_coords + frag_info.uv_offset * i; @@ -42,7 +43,7 @@ void main() { color = IPHalfSampleDecal(texture_sampler, texture_coords); } - if (frag_info.morph_type == kMorphTypeDilate) { + if (frag_info.morph_type == /*kMorphTypeDilate*/ 0.0) { result = max(color, result); } else { result = min(color, result); diff --git a/engine/src/flutter/impeller/entity/shaders/filters/yuv_to_rgb_filter.frag b/engine/src/flutter/impeller/entity/shaders/filters/yuv_to_rgb_filter.frag index 6d8db224a5..b2f9416e18 100644 --- a/engine/src/flutter/impeller/entity/shaders/filters/yuv_to_rgb_filter.frag +++ b/engine/src/flutter/impeller/entity/shaders/filters/yuv_to_rgb_filter.frag @@ -13,12 +13,12 @@ uniform f16sampler2D uv_texture; // These values must correspond to the order of the items in the // 'YUVColorSpace' enum class. -const float16_t kBT601LimitedRange = 0.0hf; -const float16_t kBT601FullRange = 1.0hf; +// const float kBT601LimitedRange = 0.0; +// const float kBT601FullRange = 1.0; uniform FragInfo { mat4 matrix; - float16_t yuv_color_space; + float yuv_color_space; } frag_info; @@ -29,7 +29,7 @@ out f16vec4 frag_color; void main() { f16vec3 yuv; f16vec3 yuv_offset = f16vec3(0.0hf, 0.5hf, 0.5hf); - if (frag_info.yuv_color_space == kBT601LimitedRange) { + if (frag_info.yuv_color_space == /*kBT601LimitedRange*/ 0.0) { yuv_offset.x = 16.0hf / 255.0hf; } diff --git a/engine/src/flutter/impeller/entity/shaders/texture_fill.frag b/engine/src/flutter/impeller/entity/shaders/texture_fill.frag index c520b4701c..9bebdeb539 100644 --- a/engine/src/flutter/impeller/entity/shaders/texture_fill.frag +++ b/engine/src/flutter/impeller/entity/shaders/texture_fill.frag @@ -16,6 +16,6 @@ out f16vec4 frag_color; void main() { f16vec4 sampled = - texture(texture_sampler, v_texture_coords, kDefaultMipBiasHalf); + texture(texture_sampler, v_texture_coords, float16_t(kDefaultMipBias)); frag_color = sampled * v_alpha; } diff --git a/engine/src/flutter/impeller/entity/shaders/texture_fill_strict_src.frag b/engine/src/flutter/impeller/entity/shaders/texture_fill_strict_src.frag index 04f4029844..6381598be8 100644 --- a/engine/src/flutter/impeller/entity/shaders/texture_fill_strict_src.frag +++ b/engine/src/flutter/impeller/entity/shaders/texture_fill_strict_src.frag @@ -25,6 +25,6 @@ void main() { clamp(v_texture_coords.y, frag_info.source_rect.y, frag_info.source_rect.w)); f16vec4 sampled = - texture(texture_sampler, texture_coords, kDefaultMipBiasHalf); + texture(texture_sampler, texture_coords, float16_t(kDefaultMipBias)); frag_color = sampled * v_alpha; }