2021-10-06 00:05:46 +00:00
|
|
|
#include "shared.effect"
|
|
|
|
|
2021-10-22 00:57:03 +00:00
|
|
|
uniform texture2D InputA<
|
|
|
|
bool automatic = true;
|
|
|
|
>;
|
|
|
|
uniform texture2D InputB<
|
|
|
|
bool automatic = true;
|
|
|
|
>;
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Technique: Draw
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Parameters:
|
|
|
|
// - InputA: RGBA Texture
|
|
|
|
|
|
|
|
float4 PSDraw(VertexData vtx) : TARGET {
|
|
|
|
return InputA.Sample(BlankSampler, vtx.uv);
|
|
|
|
};
|
|
|
|
|
|
|
|
technique Draw
|
|
|
|
{
|
|
|
|
pass
|
|
|
|
{
|
|
|
|
vertex_shader = DefaultVertexShader(vtx);
|
|
|
|
pixel_shader = PSDraw(vtx);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Technique: Draw
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Parameters:
|
|
|
|
// - InputA: RGBA Texture
|
|
|
|
|
|
|
|
float4 PSDrawPremultiplied(VertexData vtx) : TARGET {
|
|
|
|
float4 rgba = InputA.Sample(BlankSampler, vtx.uv);
|
|
|
|
rgba.rgb /= rgba.a > (1. / 1024.) ? rgba.a : 1.0;
|
|
|
|
return rgba;
|
|
|
|
};
|
|
|
|
|
|
|
|
technique DrawPremultiplied
|
|
|
|
{
|
|
|
|
pass
|
|
|
|
{
|
|
|
|
vertex_shader = DefaultVertexShader(vtx);
|
|
|
|
pixel_shader = PSDrawPremultiplied(vtx);
|
|
|
|
};
|
|
|
|
};
|
2021-10-06 00:05:46 +00:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Technique: Restore Alpha
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Parameters:
|
2021-10-22 00:57:03 +00:00
|
|
|
// - InputA: RGBX Texture
|
|
|
|
// - InputB: XXXA Texture
|
2021-10-06 00:05:46 +00:00
|
|
|
|
|
|
|
float4 PSRestoreAlpha(VertexData vtx) : TARGET {
|
2021-10-22 00:57:03 +00:00
|
|
|
float4 rgbx = InputA.Sample(BlankSampler, vtx.uv);
|
|
|
|
float4 xxxa = InputB.Sample(BlankSampler, vtx.uv);
|
2021-10-06 00:05:46 +00:00
|
|
|
rgbx.a = xxxa.a;
|
|
|
|
return rgbx;
|
|
|
|
};
|
|
|
|
|
|
|
|
technique RestoreAlpha
|
|
|
|
{
|
|
|
|
pass
|
|
|
|
{
|
|
|
|
vertex_shader = DefaultVertexShader(vtx);
|
|
|
|
pixel_shader = PSRestoreAlpha(vtx);
|
|
|
|
};
|
|
|
|
};
|