diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /gfx/layers/d3d11/mlgshaders/blend-ps-generated.hlslh | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/d3d11/mlgshaders/blend-ps-generated.hlslh')
-rw-r--r-- | gfx/layers/d3d11/mlgshaders/blend-ps-generated.hlslh | 540 |
1 files changed, 540 insertions, 0 deletions
diff --git a/gfx/layers/d3d11/mlgshaders/blend-ps-generated.hlslh b/gfx/layers/d3d11/mlgshaders/blend-ps-generated.hlslh new file mode 100644 index 0000000000..655f3e0cb4 --- /dev/null +++ b/gfx/layers/d3d11/mlgshaders/blend-ps-generated.hlslh @@ -0,0 +1,540 @@ +float4 BlendMultiplyPS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendMultiply(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendScreenPS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendScreen(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendOverlayPS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendOverlay(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendDarkenPS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendDarken(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendLightenPS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendLighten(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendColorDodgePS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendColorDodge(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendColorBurnPS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendColorBurn(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendHardLightPS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= sOpacity;
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendHardLight(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendSoftLightPS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendSoftLight(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendDifferencePS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendDifference(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendExclusionPS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendExclusion(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendHuePS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendHue(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendSaturationPS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendSaturation(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendColorPS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendColor(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
+float4 BlendLuminosityPS(const VS_BLEND_OUTPUT aInput) : SV_Target
+{
+ if (!RectContainsPoint(aInput.vClipRect, aInput.vPosition.xy)) {
+ discard;
+ }
+
+ float4 backdrop = tBackdrop.Sample(sSampler, aInput.vBackdropCoords);
+ float4 source = simpleTex.Sample(sSampler, aInput.vTexCoords);
+
+ source *= ReadMask(aInput.vMaskCoords);
+
+ // Shortcut when the backdrop or source alpha is 0, otherwise we may leak
+ // infinity into the blend function and return incorrect results.
+ if (backdrop.a == 0.0) {
+ return source;
+ }
+ if (source.a == 0.0) {
+ return float4(0, 0, 0, 0);
+ }
+
+ // The spec assumes there is no premultiplied alpha. The backdrop and
+ // source are both render targets and always premultiplied, so we undo
+ // that here.
+ backdrop.rgb /= backdrop.a;
+ source.rgb /= source.a;
+
+ float4 result;
+ result.rgb = BlendLuminosity(backdrop.rgb, source.rgb);
+ result.a = source.a;
+
+ // Factor backdrop alpha, then premultiply for the final OP_OVER.
+ result.rgb = (1.0 - backdrop.a) * source.rgb + backdrop.a * result.rgb;
+ result.rgb *= result.a;
+ return result;
+}
+
|