Skip to content
This repository has been archived by the owner. It is now read-only.

8251033: Background texture is not visible when Alpha Composite is enabled #126

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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 {
@@ -289,7 +289,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]],
@@ -325,7 +325,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]],
@@ -365,7 +365,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;
}


@@ -517,7 +517,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
@@ -544,7 +544,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]],
@@ -574,7 +574,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;