Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8251033: Background texture is not visible when Alpha Composite is en…
…abled
  • Loading branch information
dekonoplyov authored and Alexey Ushakov committed Nov 9, 2020
1 parent 2f883fe commit a66358d388736a857ede100245433959f013c037
@@ -62,6 +62,7 @@ struct GradFrameUniforms {
vector_float4 color1;
vector_float4 color2;
int isCyclic;
float extraAlpha;
};

struct LinGradFrameUniforms {
@@ -70,6 +71,7 @@ struct LinGradFrameUniforms {
vector_float4 color[GRAD_MAX_FRACTIONS];
int numFracts;
int cycleMethod;
float extraAlpha;
};

struct RadGradFrameUniforms {
@@ -80,6 +82,7 @@ struct RadGradFrameUniforms {
vector_float3 m0;
vector_float3 m1;
vector_float3 precalc;
float extraAlpha;
};

struct Vertex {
@@ -291,7 +291,7 @@ fragment half4 frag_txt_grad(GradShaderInOut in [[stage_in]],
return half4(c.r*renderColor.a,
c.g*renderColor.a,
c.b*renderColor.a,
c.a*renderColor.a);
c.a*renderColor.a) * uniforms.extraAlpha;
}

fragment half4 frag_txt_lin_grad(GradShaderInOut in [[stage_in]],
@@ -327,7 +327,7 @@ fragment half4 frag_txt_lin_grad(GradShaderInOut in [[stage_in]],
return half4(c.r*renderColor.a,
c.g*renderColor.a,
c.b*renderColor.a,
c.a*renderColor.a);
c.a*renderColor.a) * uniforms.extraAlpha;
}

fragment half4 frag_txt_rad_grad(GradShaderInOut in [[stage_in]],
@@ -367,7 +367,7 @@ fragment half4 frag_txt_rad_grad(GradShaderInOut in [[stage_in]],
return half4(c.r*renderColor.a,
c.g*renderColor.a,
c.b*renderColor.a,
c.a*renderColor.a);
c.a*renderColor.a) * uniforms.extraAlpha;
}


@@ -519,7 +519,7 @@ fragment half4 frag_grad(GradShaderInOut in [[stage_in]],
}
}
float4 c = mix(uniforms.color1, uniforms.color2, a);
return half4(c);
return half4(c) * uniforms.extraAlpha;
}

// LinGradFrameUniforms
@@ -546,7 +546,7 @@ fragment half4 frag_lin_grad(GradShaderInOut in [[stage_in]],
}
a = (a - n*lf)/lf;
float4 c = mix(uniforms.color[n], uniforms.color[n + 1], a);
return half4(c);
return half4(c) * uniforms.extraAlpha;
}

fragment half4 frag_rad_grad(GradShaderInOut in [[stage_in]],
@@ -576,7 +576,7 @@ fragment half4 frag_rad_grad(GradShaderInOut in [[stage_in]],
}
a = (a - n*lf)/lf;
float4 c = mix(uniforms.color[n], uniforms.color[n + 1], a);
return half4(c);
return half4(c) * uniforms.extraAlpha;
}


@@ -324,7 +324,8 @@ - (void)setPipelineState:(id)encoder
{_p0, _p1, _p3},
RGBA_TO_V4(_pixel1),
RGBA_TO_V4(_pixel2),
_cyclic
_cyclic,
[mtlc.composite getExtraAlpha]
};
[encoder setFragmentBytes:&uf length:sizeof(uf) atIndex:0];

@@ -361,7 +362,8 @@ - (void)setXorModePipelineState:(id)encoder
{_p0, _p1, _p3},
RGBA_TO_V4(_pixel1 ^ xorColor),
RGBA_TO_V4(_pixel2 ^ xorColor),
_cyclic
_cyclic,
[mtlc.composite getExtraAlpha]
};

[encoder setFragmentBytes: &uf length:sizeof(uf) atIndex:0];
@@ -466,7 +468,8 @@ - (void)setPipelineState:(id)encoder
{},
{},
_numFracts,
_cyclic
_cyclic,
[mtlc.composite getExtraAlpha]
};

memcpy(uf.fract, _fract, _numFracts*sizeof(jfloat));
@@ -629,7 +632,8 @@ - (void)setPipelineState:(id)encoder
_cyclic,
{_m00, _m01, _m02},
{_m10, _m11, _m12},
{}
{},
[mtlc.composite getExtraAlpha]
};

uf.precalc[0] = _focusX;

0 comments on commit a66358d

Please sign in to comment.