Hash :
4f0e003e
Author :
Date :
2017-05-01T16:04:35
Implement the new formats/features of the ES3 CHROMIUM_copy_texture. Some non-renderable texture formats remain unimplemented. BUG=angleproject:1932 Change-Id: Id206432d6e26a70fc0e84478a4e43e9eefadcf2f Reviewed-on: https://chromium-review.googlesource.com/491948 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
Texture2D<float4> TextureF : register(t0);
Texture2D<uint4> TextureUI : register(t0);
SamplerState Sampler : register(s0);
// Notation:
// PM: premultiply, UM: unmulitply, PT: passthrough
// F: float, U: uint
// Float to float RGBA
float4 PS_FtoF_PM_RGBA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
{
float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
color.rgb *= color.a;
return color;
}
float4 PS_FtoF_UM_RGBA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
{
float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
if (color.a > 0.0f)
{
color.rgb /= color.a;
}
return color;
}
// Float to float RGB
float4 PS_FtoF_PM_RGB(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
{
float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
color.rgb *= color.a;
color.a = 1.0f;
return color;
}
float4 PS_FtoF_UM_RGB(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
{
float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
if (color.a > 0.0f)
{
color.rgb /= color.a;
}
color.a = 1.0f;
return color;
}
// Float to uint RGBA
uint4 PS_FtoU_PT_RGBA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
{
float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
return uint4(color * 255);
}
uint4 PS_FtoU_PM_RGBA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
{
float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
color.rgb *= color.a;
return uint4(color * 255);
}
uint4 PS_FtoU_UM_RGBA(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
{
float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
if (color.a > 0.0f)
{
color.rgb /= color.a;
}
return uint4(color * 255);
}
// Float to uint RGB
uint4 PS_FtoU_PT_RGB(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
{
float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
return uint4(color.rgb * 255, 1);
}
uint4 PS_FtoU_PM_RGB(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
{
float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
color.rgb *= color.a;
return uint4(color.rgb * 255, 1);
}
uint4 PS_FtoU_UM_RGB(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
{
float4 color = TextureF.Sample(Sampler, inTexCoord).rgba;
if (color.a > 0.0f)
{
color.rgb /= color.a;
}
return uint4(color.rgb * 255, 1);
}