Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions impeller/compiler/shader_lib/impeller/types.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
#ifndef TYPES_GLSL_
#define TYPES_GLSL_

#extension GL_AMD_gpu_shader_half_float : enable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Looks like this line can be pulled out of both sides of the ifdef, simplifying to only the #ifndef IMPELLER_TARGET_METAL side?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


#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
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/atlas_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/texture.glsl>
#include <impeller/types.glsl>

uniform sampler2D texture_sampler;

Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/atlas_fill.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform VertInfo {
mat4 mvp;
}
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/blending/advanced_blend.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <impeller/blending.glsl>
#include <impeller/color.glsl>
#include <impeller/texture.glsl>
#include <impeller/types.glsl>

uniform BlendInfo {
float dst_input_alpha;
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/blending/advanced_blend.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform FrameInfo {
mat4 mvp;
}
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/blending/blend.frag
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/texture.glsl>
#include <impeller/types.glsl>

uniform sampler2D texture_sampler_src;

Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/blending/blend.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform FrameInfo {
mat4 mvp;
}
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/border_mask_blur.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <impeller/gaussian.glsl>
#include <impeller/texture.glsl>
#include <impeller/types.glsl>

// Constant time mask blur for image borders.
//
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/border_mask_blur.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform FrameInfo {
mat4 mvp;

Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/color_matrix_color_filter.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <impeller/color.glsl>
#include <impeller/texture.glsl>
#include <impeller/types.glsl>

// A color filter that transforms colors through a 4x5 color matrix.
//
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/color_matrix_color_filter.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform FrameInfo {
mat4 mvp;
}
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/gaussian_blur.frag
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <impeller/constants.glsl>
#include <impeller/gaussian.glsl>
#include <impeller/texture.glsl>
#include <impeller/types.glsl>

uniform sampler2D texture_sampler;
uniform sampler2D alpha_mask_sampler;
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/gaussian_blur.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform FrameInfo {
mat4 mvp;
}
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/glyph_atlas.frag
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform sampler2D glyph_atlas_sampler;

uniform FragInfo {
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/glyph_atlas.vert
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/transform.glsl>
#include <impeller/types.glsl>

uniform FrameInfo {
mat4 mvp;
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/glyph_atlas_sdf.frag
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform sampler2D glyph_atlas_sampler;

uniform FragInfo {
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/glyph_atlas_sdf.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

#include <impeller/transform.glsl>

uniform FrameInfo {
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/gradient_fill.vert
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/transform.glsl>
#include <impeller/types.glsl>

uniform FrameInfo {
mat4 mvp;
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/linear_gradient_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/texture.glsl>
#include <impeller/types.glsl>

uniform sampler2D texture_sampler;

Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/linear_gradient_ssbo_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <impeller/gradient.glsl>
#include <impeller/texture.glsl>
#include <impeller/types.glsl>

readonly buffer ColorData {
vec4 colors[];
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/linear_to_srgb_filter.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <impeller/color.glsl>
#include <impeller/texture.glsl>
#include <impeller/types.glsl>

// A color filter that applies the sRGB gamma curve to the color.
//
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/linear_to_srgb_filter.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform FrameInfo {
mat4 mvp;
}
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/morphology_filter.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <impeller/constants.glsl>
#include <impeller/texture.glsl>
#include <impeller/types.glsl>

// These values must correspond to the order of the items in the
// 'FilterContents::MorphType' enum class.
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/morphology_filter.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform FrameInfo {
mat4 mvp;
}
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/position.vert
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/transform.glsl>
#include <impeller/types.glsl>

uniform VertInfo {
mat4 mvp;
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/position_color.vert
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/transform.glsl>
#include <impeller/types.glsl>

uniform VertInfo {
mat4 mvp;
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/position_uv.vert
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/transform.glsl>
#include <impeller/types.glsl>

uniform VertInfo {
mat4 mvp;
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/radial_gradient_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/texture.glsl>
#include <impeller/types.glsl>

uniform sampler2D texture_sampler;

Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/radial_gradient_ssbo_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <impeller/gradient.glsl>
#include <impeller/texture.glsl>
#include <impeller/types.glsl>

readonly buffer ColorData {
vec4 colors[];
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/rrect_blur.frag
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/gaussian.glsl>
#include <impeller/types.glsl>

uniform FragInfo {
vec4 color;
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/rrect_blur.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform VertInfo {
mat4 mvp;
}
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/runtime_effect.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform VertInfo {
mat4 mvp;
}
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/solid_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform FragInfo {
vec4 color;
}
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/solid_fill.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform VertInfo {
mat4 mvp;
}
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/srgb_to_linear_filter.frag
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// Creates a color filter that applies the inverse of the sRGB gamma curve
// to the RGB channels.

#include <impeller/types.glsl>

uniform sampler2D input_texture;

uniform FragInfo {
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/srgb_to_linear_filter.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform FrameInfo {
mat4 mvp;
}
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/sweep_gradient_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <impeller/constants.glsl>
#include <impeller/texture.glsl>
#include <impeller/types.glsl>

uniform sampler2D texture_sampler;

Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/sweep_gradient_ssbo_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <impeller/constants.glsl>
#include <impeller/gradient.glsl>
#include <impeller/texture.glsl>
#include <impeller/types.glsl>

readonly buffer ColorData {
vec4 colors[];
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/texture_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/texture.glsl>
#include <impeller/types.glsl>

uniform sampler2D texture_sampler;

Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/texture_fill.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform VertInfo {
mat4 mvp;
}
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/tiled_texture_fill.frag
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/texture.glsl>
#include <impeller/types.glsl>

uniform sampler2D texture_sampler;

Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/tiled_texture_fill.vert
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

#include <impeller/transform.glsl>
#include <impeller/types.glsl>

uniform VertInfo {
mat4 mvp;
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/vertices.frag
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

in vec4 v_color;

out vec4 frag_color;
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/shaders/yuv_to_rgb_filter.frag
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <impeller/color.glsl>
#include <impeller/texture.glsl>
#include <impeller/types.glsl>

uniform sampler2D y_texture;
uniform sampler2D uv_texture;
Expand Down
2 changes: 2 additions & 0 deletions impeller/entity/shaders/yuv_to_rgb_filter.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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 <impeller/types.glsl>

uniform FrameInfo {
mat4 mvp;
}
Expand Down