Backdrop Path + Cybersteel (#23)
Co-authored-by: Zachary Levy <zachary@sunforge.is> Reviewed-on: #23
This commit was merged in pull request #23.
This commit is contained in:
@@ -24,8 +24,8 @@ struct main0_in
|
||||
float4 f_params [[user(locn2)]];
|
||||
float4 f_params2 [[user(locn3)]];
|
||||
uint f_flags [[user(locn4)]];
|
||||
uint f_rotation_sc [[user(locn5)]];
|
||||
uint4 f_uv_or_effects [[user(locn6)]];
|
||||
float4 f_uv_rect [[user(locn6), flat]];
|
||||
uint4 f_effects [[user(locn7)]];
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
@@ -109,11 +109,6 @@ fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> tex [[textur
|
||||
float h = 0.5;
|
||||
float2 half_size = in.f_params.xy;
|
||||
float2 p_local = in.f_local_or_uv;
|
||||
if ((flags & 16u) != 0u)
|
||||
{
|
||||
float2 sc = float2(as_type<half2>(in.f_rotation_sc));
|
||||
p_local = float2((sc.y * p_local.x) + (sc.x * p_local.y), ((-sc.x) * p_local.x) + (sc.y * p_local.y));
|
||||
}
|
||||
if (kind == 1u)
|
||||
{
|
||||
float4 corner_radii = float4(in.f_params.zw, in.f_params2.xy);
|
||||
@@ -163,16 +158,16 @@ fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> tex [[textur
|
||||
{
|
||||
float d_start = dot(p_local, n_start);
|
||||
float d_end = dot(p_local, n_end);
|
||||
float _372;
|
||||
float _338;
|
||||
if (arc_bits == 1u)
|
||||
{
|
||||
_372 = fast::max(d_start, d_end);
|
||||
_338 = fast::max(d_start, d_end);
|
||||
}
|
||||
else
|
||||
{
|
||||
_372 = fast::min(d_start, d_end);
|
||||
_338 = fast::min(d_start, d_end);
|
||||
}
|
||||
float d_wedge = _372;
|
||||
float d_wedge = _338;
|
||||
d = fast::max(d, d_wedge);
|
||||
}
|
||||
half_size = float2(outer);
|
||||
@@ -187,7 +182,7 @@ fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> tex [[textur
|
||||
if ((flags & 2u) != 0u)
|
||||
{
|
||||
float4 gradient_start = in.f_color;
|
||||
float4 gradient_end = unpack_unorm4x8_to_float(in.f_uv_or_effects.x);
|
||||
float4 gradient_end = unpack_unorm4x8_to_float(in.f_effects.x);
|
||||
if ((flags & 4u) != 0u)
|
||||
{
|
||||
float t_1 = length(p_local / half_size);
|
||||
@@ -198,7 +193,7 @@ fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> tex [[textur
|
||||
}
|
||||
else
|
||||
{
|
||||
float2 direction = float2(as_type<half2>(in.f_uv_or_effects.z));
|
||||
float2 direction = float2(as_type<half2>(in.f_effects.z));
|
||||
float t_2 = (dot(p_local / half_size, direction) * 0.5) + 0.5;
|
||||
float4 param_11 = gradient_start;
|
||||
float4 param_12 = gradient_end;
|
||||
@@ -210,7 +205,7 @@ fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> tex [[textur
|
||||
{
|
||||
if ((flags & 1u) != 0u)
|
||||
{
|
||||
float4 uv_rect = as_type<float4>(in.f_uv_or_effects);
|
||||
float4 uv_rect = in.f_uv_rect;
|
||||
float2 local_uv = ((p_local / half_size) * 0.5) + float2(0.5);
|
||||
float2 uv = mix(uv_rect.xy, uv_rect.zw, local_uv);
|
||||
shape_color = in.f_color * tex.sample(texSmplr, uv);
|
||||
@@ -222,8 +217,8 @@ fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> tex [[textur
|
||||
}
|
||||
if ((flags & 8u) != 0u)
|
||||
{
|
||||
float4 ol_color = unpack_unorm4x8_to_float(in.f_uv_or_effects.y);
|
||||
float ol_width = float2(as_type<half2>(in.f_uv_or_effects.w)).x / grad_magnitude;
|
||||
float4 ol_color = unpack_unorm4x8_to_float(in.f_effects.y);
|
||||
float ol_width = float2(as_type<half2>(in.f_effects.w)).x / grad_magnitude;
|
||||
float param_14 = d;
|
||||
float param_15 = h;
|
||||
float fill_cov = sdf_alpha(param_14, param_15);
|
||||
|
||||
Reference in New Issue
Block a user