mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 593604. Part 8.6: Add component-alpha shaders. r=bas,a=blocking
This commit is contained in:
parent
b61c7009d7
commit
7e985e9c2e
@ -363,6 +363,20 @@ DeviceManagerD3D9::Init()
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = mDevice->CreatePixelShader((DWORD*)ComponentPass1ShaderPS,
|
||||
getter_AddRefs(mComponentPass1PS));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = mDevice->CreatePixelShader((DWORD*)ComponentPass2ShaderPS,
|
||||
getter_AddRefs(mComponentPass2PS));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = mDevice->CreatePixelShader((DWORD*)YCbCrShaderPS,
|
||||
getter_AddRefs(mYCbCrPS));
|
||||
|
||||
@ -483,6 +497,14 @@ DeviceManagerD3D9::SetShaderMode(ShaderMode aMode)
|
||||
mDevice->SetVertexShader(mLayerVS);
|
||||
mDevice->SetPixelShader(mRGBAPS);
|
||||
break;
|
||||
case COMPONENTLAYERPASS1:
|
||||
mDevice->SetVertexShader(mLayerVS);
|
||||
mDevice->SetPixelShader(mComponentPass1PS);
|
||||
break;
|
||||
case COMPONENTLAYERPASS2:
|
||||
mDevice->SetVertexShader(mLayerVS);
|
||||
mDevice->SetPixelShader(mComponentPass2PS);
|
||||
break;
|
||||
case YCBCRLAYER:
|
||||
mDevice->SetVertexShader(mLayerVS);
|
||||
mDevice->SetPixelShader(mYCbCrPS);
|
||||
|
@ -142,6 +142,8 @@ public:
|
||||
enum ShaderMode {
|
||||
RGBLAYER,
|
||||
RGBALAYER,
|
||||
COMPONENTLAYERPASS1,
|
||||
COMPONENTLAYERPASS2,
|
||||
YCBCRLAYER,
|
||||
SOLIDCOLORLAYER
|
||||
};
|
||||
@ -205,6 +207,12 @@ private:
|
||||
/* Pixel shader used for RGBA textures */
|
||||
nsRefPtr<IDirect3DPixelShader9> mRGBAPS;
|
||||
|
||||
/* Pixel shader used for component alpha textures (pass 1) */
|
||||
nsRefPtr<IDirect3DPixelShader9> mComponentPass1PS;
|
||||
|
||||
/* Pixel shader used for component alpha textures (pass 2) */
|
||||
nsRefPtr<IDirect3DPixelShader9> mComponentPass2PS;
|
||||
|
||||
/* Pixel shader used for RGB textures */
|
||||
nsRefPtr<IDirect3DPixelShader9> mYCbCrPS;
|
||||
|
||||
|
@ -229,6 +229,228 @@ const BYTE RGBAShaderPS[] =
|
||||
//
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||
//
|
||||
// fxc LayerManagerD3D9Shaders.hlsl -EComponentPass1Shader -nologo -Tps_2_0
|
||||
// -FhtmpShaderHeader -VnComponentPass1ShaderPS
|
||||
//
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// float fLayerOpacity;
|
||||
// sampler2D s2D;
|
||||
// sampler2D s2DWhite;
|
||||
//
|
||||
//
|
||||
// Registers:
|
||||
//
|
||||
// Name Reg Size
|
||||
// ------------- ----- ----
|
||||
// fLayerOpacity c0 1
|
||||
// s2D s0 1
|
||||
// s2DWhite s1 1
|
||||
//
|
||||
|
||||
ps_2_0
|
||||
def c1, 1, 0, 0, 0
|
||||
dcl t0.xy
|
||||
dcl_2d s0
|
||||
dcl_2d s1
|
||||
texld r0, t0, s0
|
||||
texld r1, t0, s1
|
||||
add r0.xyz, r0, -r1
|
||||
add r0.xyz, r0, c1.x
|
||||
mul r0.xyz, r0, c0.x
|
||||
mov r1.xyz, r0
|
||||
mov r1.w, r0.y
|
||||
mov oC0, r1
|
||||
|
||||
// approximately 8 instruction slots used (2 texture, 6 arithmetic)
|
||||
#endif
|
||||
|
||||
const BYTE ComponentPass1ShaderPS[] =
|
||||
{
|
||||
0, 2, 255, 255, 254, 255,
|
||||
57, 0, 67, 84, 65, 66,
|
||||
28, 0, 0, 0, 175, 0,
|
||||
0, 0, 0, 2, 255, 255,
|
||||
3, 0, 0, 0, 28, 0,
|
||||
0, 0, 0, 1, 0, 0,
|
||||
168, 0, 0, 0, 88, 0,
|
||||
0, 0, 2, 0, 0, 0,
|
||||
1, 0, 0, 0, 104, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
120, 0, 0, 0, 3, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
124, 0, 0, 0, 0, 0,
|
||||
0, 0, 140, 0, 0, 0,
|
||||
3, 0, 1, 0, 1, 0,
|
||||
0, 0, 152, 0, 0, 0,
|
||||
0, 0, 0, 0, 102, 76,
|
||||
97, 121, 101, 114, 79, 112,
|
||||
97, 99, 105, 116, 121, 0,
|
||||
171, 171, 0, 0, 3, 0,
|
||||
1, 0, 1, 0, 1, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
115, 50, 68, 0, 4, 0,
|
||||
12, 0, 1, 0, 1, 0,
|
||||
1, 0, 0, 0, 0, 0,
|
||||
0, 0, 115, 50, 68, 87,
|
||||
104, 105, 116, 101, 0, 171,
|
||||
171, 171, 4, 0, 12, 0,
|
||||
1, 0, 1, 0, 1, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
112, 115, 95, 50, 95, 48,
|
||||
0, 77, 105, 99, 114, 111,
|
||||
115, 111, 102, 116, 32, 40,
|
||||
82, 41, 32, 72, 76, 83,
|
||||
76, 32, 83, 104, 97, 100,
|
||||
101, 114, 32, 67, 111, 109,
|
||||
112, 105, 108, 101, 114, 32,
|
||||
57, 46, 50, 57, 46, 57,
|
||||
53, 50, 46, 51, 49, 49,
|
||||
49, 0, 81, 0, 0, 5,
|
||||
1, 0, 15, 160, 0, 0,
|
||||
128, 63, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 31, 0, 0, 2,
|
||||
0, 0, 0, 128, 0, 0,
|
||||
3, 176, 31, 0, 0, 2,
|
||||
0, 0, 0, 144, 0, 8,
|
||||
15, 160, 31, 0, 0, 2,
|
||||
0, 0, 0, 144, 1, 8,
|
||||
15, 160, 66, 0, 0, 3,
|
||||
0, 0, 15, 128, 0, 0,
|
||||
228, 176, 0, 8, 228, 160,
|
||||
66, 0, 0, 3, 1, 0,
|
||||
15, 128, 0, 0, 228, 176,
|
||||
1, 8, 228, 160, 2, 0,
|
||||
0, 3, 0, 0, 7, 128,
|
||||
0, 0, 228, 128, 1, 0,
|
||||
228, 129, 2, 0, 0, 3,
|
||||
0, 0, 7, 128, 0, 0,
|
||||
228, 128, 1, 0, 0, 160,
|
||||
5, 0, 0, 3, 0, 0,
|
||||
7, 128, 0, 0, 228, 128,
|
||||
0, 0, 0, 160, 1, 0,
|
||||
0, 2, 1, 0, 7, 128,
|
||||
0, 0, 228, 128, 1, 0,
|
||||
0, 2, 1, 0, 8, 128,
|
||||
0, 0, 85, 128, 1, 0,
|
||||
0, 2, 0, 8, 15, 128,
|
||||
1, 0, 228, 128, 255, 255,
|
||||
0, 0
|
||||
};
|
||||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||
//
|
||||
// fxc LayerManagerD3D9Shaders.hlsl -EComponentPass2Shader -nologo -Tps_2_0
|
||||
// -FhtmpShaderHeader -VnComponentPass2ShaderPS
|
||||
//
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// float fLayerOpacity;
|
||||
// sampler2D s2D;
|
||||
// sampler2D s2DWhite;
|
||||
//
|
||||
//
|
||||
// Registers:
|
||||
//
|
||||
// Name Reg Size
|
||||
// ------------- ----- ----
|
||||
// fLayerOpacity c0 1
|
||||
// s2D s0 1
|
||||
// s2DWhite s1 1
|
||||
//
|
||||
|
||||
ps_2_0
|
||||
def c1, 1, 0, 0, 0
|
||||
dcl t0.xy
|
||||
dcl_2d s0
|
||||
dcl_2d s1
|
||||
texld r0, t0, s1
|
||||
texld r1, t0, s0
|
||||
add r0.x, -r0.y, r1.y
|
||||
add r1.w, r0.x, c1.x
|
||||
mul r0, r1, c0.x
|
||||
mov oC0, r0
|
||||
|
||||
// approximately 6 instruction slots used (2 texture, 4 arithmetic)
|
||||
#endif
|
||||
|
||||
const BYTE ComponentPass2ShaderPS[] =
|
||||
{
|
||||
0, 2, 255, 255, 254, 255,
|
||||
57, 0, 67, 84, 65, 66,
|
||||
28, 0, 0, 0, 175, 0,
|
||||
0, 0, 0, 2, 255, 255,
|
||||
3, 0, 0, 0, 28, 0,
|
||||
0, 0, 0, 1, 0, 0,
|
||||
168, 0, 0, 0, 88, 0,
|
||||
0, 0, 2, 0, 0, 0,
|
||||
1, 0, 0, 0, 104, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
120, 0, 0, 0, 3, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
124, 0, 0, 0, 0, 0,
|
||||
0, 0, 140, 0, 0, 0,
|
||||
3, 0, 1, 0, 1, 0,
|
||||
0, 0, 152, 0, 0, 0,
|
||||
0, 0, 0, 0, 102, 76,
|
||||
97, 121, 101, 114, 79, 112,
|
||||
97, 99, 105, 116, 121, 0,
|
||||
171, 171, 0, 0, 3, 0,
|
||||
1, 0, 1, 0, 1, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
115, 50, 68, 0, 4, 0,
|
||||
12, 0, 1, 0, 1, 0,
|
||||
1, 0, 0, 0, 0, 0,
|
||||
0, 0, 115, 50, 68, 87,
|
||||
104, 105, 116, 101, 0, 171,
|
||||
171, 171, 4, 0, 12, 0,
|
||||
1, 0, 1, 0, 1, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
112, 115, 95, 50, 95, 48,
|
||||
0, 77, 105, 99, 114, 111,
|
||||
115, 111, 102, 116, 32, 40,
|
||||
82, 41, 32, 72, 76, 83,
|
||||
76, 32, 83, 104, 97, 100,
|
||||
101, 114, 32, 67, 111, 109,
|
||||
112, 105, 108, 101, 114, 32,
|
||||
57, 46, 50, 57, 46, 57,
|
||||
53, 50, 46, 51, 49, 49,
|
||||
49, 0, 81, 0, 0, 5,
|
||||
1, 0, 15, 160, 0, 0,
|
||||
128, 63, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 31, 0, 0, 2,
|
||||
0, 0, 0, 128, 0, 0,
|
||||
3, 176, 31, 0, 0, 2,
|
||||
0, 0, 0, 144, 0, 8,
|
||||
15, 160, 31, 0, 0, 2,
|
||||
0, 0, 0, 144, 1, 8,
|
||||
15, 160, 66, 0, 0, 3,
|
||||
0, 0, 15, 128, 0, 0,
|
||||
228, 176, 1, 8, 228, 160,
|
||||
66, 0, 0, 3, 1, 0,
|
||||
15, 128, 0, 0, 228, 176,
|
||||
0, 8, 228, 160, 2, 0,
|
||||
0, 3, 0, 0, 1, 128,
|
||||
0, 0, 85, 129, 1, 0,
|
||||
85, 128, 2, 0, 0, 3,
|
||||
1, 0, 8, 128, 0, 0,
|
||||
0, 128, 1, 0, 0, 160,
|
||||
5, 0, 0, 3, 0, 0,
|
||||
15, 128, 1, 0, 228, 128,
|
||||
0, 0, 0, 160, 1, 0,
|
||||
0, 2, 0, 8, 15, 128,
|
||||
0, 0, 228, 128, 255, 255,
|
||||
0, 0
|
||||
};
|
||||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||
//
|
||||
// fxc LayerManagerD3D9Shaders.hlsl -ERGBShader -nologo -Tps_2_0
|
||||
// -FhtmpShaderHeader -VnRGBShaderPS
|
||||
//
|
||||
|
@ -8,6 +8,7 @@ rect vLayerQuad;
|
||||
|
||||
texture tex0;
|
||||
sampler s2D;
|
||||
sampler s2DWhite;
|
||||
sampler s2DY;
|
||||
sampler s2DCb;
|
||||
sampler s2DCr;
|
||||
@ -57,6 +58,22 @@ VS_OUTPUT LayerQuadVS(const VS_INPUT aVertex)
|
||||
return outp;
|
||||
}
|
||||
|
||||
float4 ComponentPass1Shader(const VS_OUTPUT aVertex) : COLOR
|
||||
{
|
||||
float4 src = tex2D(s2D, aVertex.vTexCoords);
|
||||
float4 alphas = 1.0 - tex2D(s2DWhite, aVertex.vTexCoords) + src;
|
||||
alphas.a = alphas.g;
|
||||
return alphas * fLayerOpacity;
|
||||
}
|
||||
|
||||
float4 ComponentPass2Shader(const VS_OUTPUT aVertex) : COLOR
|
||||
{
|
||||
float4 src = tex2D(s2D, aVertex.vTexCoords);
|
||||
float4 alphas = 1.0 - tex2D(s2DWhite, aVertex.vTexCoords) + src;
|
||||
src.a = alphas.g;
|
||||
return src * fLayerOpacity;
|
||||
}
|
||||
|
||||
float4 RGBAShader(const VS_OUTPUT aVertex) : COLOR
|
||||
{
|
||||
return tex2D(s2D, aVertex.vTexCoords) * fLayerOpacity;
|
||||
|
@ -4,6 +4,10 @@ fxc LayerManagerD3D9Shaders.hlsl -ELayerQuadVS -nologo -Fh$tempfile -VnLayerQuad
|
||||
cat $tempfile >> LayerManagerD3D9Shaders.h
|
||||
fxc LayerManagerD3D9Shaders.hlsl -ERGBAShader -nologo -Tps_2_0 -Fh$tempfile -VnRGBAShaderPS
|
||||
cat $tempfile >> LayerManagerD3D9Shaders.h
|
||||
fxc LayerManagerD3D9Shaders.hlsl -EComponentPass1Shader -nologo -Tps_2_0 -Fh$tempfile -VnComponentPass1ShaderPS
|
||||
cat $tempfile >> LayerManagerD3D9Shaders.h
|
||||
fxc LayerManagerD3D9Shaders.hlsl -EComponentPass2Shader -nologo -Tps_2_0 -Fh$tempfile -VnComponentPass2ShaderPS
|
||||
cat $tempfile >> LayerManagerD3D9Shaders.h
|
||||
fxc LayerManagerD3D9Shaders.hlsl -ERGBShader -nologo -Tps_2_0 -Fh$tempfile -VnRGBShaderPS
|
||||
cat $tempfile >> LayerManagerD3D9Shaders.h
|
||||
fxc LayerManagerD3D9Shaders.hlsl -EYCbCrShader -nologo -Tps_2_0 -Fh$tempfile -VnYCbCrShaderPS
|
||||
|
Loading…
Reference in New Issue
Block a user