зеркало из https://github.com/mozilla/pjs.git
Bug 590367 - Render RGB d2d layers with a RGBA surface and shader r=Bas, a=blocking2.0
This commit is contained in:
Родитель
d892767b19
Коммит
b11ef202f4
|
@ -239,7 +239,7 @@ CanvasLayerD3D9::RenderLayer()
|
|||
opacity[0] = GetOpacity();
|
||||
device()->SetPixelShaderConstantF(0, opacity, 1);
|
||||
|
||||
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBLAYER);
|
||||
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER);
|
||||
|
||||
if (!mDataIsPremultiplied) {
|
||||
device()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||
|
|
|
@ -257,7 +257,7 @@ ContainerLayerD3D9::RenderLayer()
|
|||
opacityVector[0] = opacity;
|
||||
device()->SetPixelShaderConstantF(0, opacityVector, 1);
|
||||
|
||||
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBLAYER);
|
||||
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER);
|
||||
|
||||
device()->SetTexture(0, renderTexture);
|
||||
device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
|
|
|
@ -338,6 +338,13 @@ DeviceManagerD3D9::Init()
|
|||
return false;
|
||||
}
|
||||
|
||||
hr = mDevice->CreatePixelShader((DWORD*)RGBAShaderPS,
|
||||
getter_AddRefs(mRGBAPS));
|
||||
|
||||
if (FAILED(hr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = mDevice->CreatePixelShader((DWORD*)YCbCrShaderPS,
|
||||
getter_AddRefs(mYCbCrPS));
|
||||
|
||||
|
@ -459,6 +466,10 @@ DeviceManagerD3D9::SetShaderMode(ShaderMode aMode)
|
|||
mDevice->SetVertexShader(mLayerVS);
|
||||
mDevice->SetPixelShader(mRGBPS);
|
||||
break;
|
||||
case RGBALAYER:
|
||||
mDevice->SetVertexShader(mLayerVS);
|
||||
mDevice->SetPixelShader(mRGBAPS);
|
||||
break;
|
||||
case YCBCRLAYER:
|
||||
mDevice->SetVertexShader(mLayerVS);
|
||||
mDevice->SetPixelShader(mYCbCrPS);
|
||||
|
|
|
@ -129,6 +129,7 @@ public:
|
|||
|
||||
enum ShaderMode {
|
||||
RGBLAYER,
|
||||
RGBALAYER,
|
||||
YCBCRLAYER,
|
||||
SOLIDCOLORLAYER
|
||||
};
|
||||
|
@ -178,6 +179,9 @@ private:
|
|||
/* Pixel shader used for RGB textures */
|
||||
nsRefPtr<IDirect3DPixelShader9> mRGBPS;
|
||||
|
||||
/* Pixel shader used for RGBA textures */
|
||||
nsRefPtr<IDirect3DPixelShader9> mRGBAPS;
|
||||
|
||||
/* Pixel shader used for RGB textures */
|
||||
nsRefPtr<IDirect3DPixelShader9> mYCbCrPS;
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ ImageLayerD3D9::RenderLayer()
|
|||
opacity[0] = GetOpacity();
|
||||
device()->SetPixelShaderConstantF(0, opacity, 1);
|
||||
|
||||
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBLAYER);
|
||||
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER);
|
||||
|
||||
device()->SetTexture(0, cairoImage->mTexture);
|
||||
device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
|
||||
//
|
||||
// fxc LayerManagerD3D9Shaders.hlsl -ELayerQuadVS -nologo -FhtmpShaderHeader
|
||||
// -VnLayerQuadVS
|
||||
|
@ -92,8 +92,8 @@ const BYTE LayerQuadVS[] =
|
|||
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,
|
||||
50, 55, 46, 57, 53, 50,
|
||||
46, 51, 48, 50, 50, 0,
|
||||
81, 0, 0, 5, 13, 0,
|
||||
15, 160, 0, 0, 0, 191,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
|
@ -149,10 +149,10 @@ const BYTE LayerQuadVS[] =
|
|||
};
|
||||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
|
||||
//
|
||||
// fxc LayerManagerD3D9Shaders.hlsl -ERGBShader -nologo -Tps_2_0
|
||||
// -FhtmpShaderHeader -VnRGBShaderPS
|
||||
// fxc LayerManagerD3D9Shaders.hlsl -ERGBAShader -nologo -Tps_2_0
|
||||
// -FhtmpShaderHeader -VnRGBAShaderPS
|
||||
//
|
||||
//
|
||||
// Parameters:
|
||||
|
@ -179,6 +179,87 @@ const BYTE LayerQuadVS[] =
|
|||
// approximately 3 instruction slots used (1 texture, 2 arithmetic)
|
||||
#endif
|
||||
|
||||
const BYTE RGBAShaderPS[] =
|
||||
{
|
||||
0, 2, 255, 255, 254, 255,
|
||||
45, 0, 67, 84, 65, 66,
|
||||
28, 0, 0, 0, 127, 0,
|
||||
0, 0, 0, 2, 255, 255,
|
||||
2, 0, 0, 0, 28, 0,
|
||||
0, 0, 0, 1, 0, 0,
|
||||
120, 0, 0, 0, 68, 0,
|
||||
0, 0, 2, 0, 0, 0,
|
||||
1, 0, 0, 0, 84, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
100, 0, 0, 0, 3, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
104, 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,
|
||||
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, 55, 46, 57,
|
||||
53, 50, 46, 51, 48, 50,
|
||||
50, 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, 66, 0, 0, 3,
|
||||
0, 0, 15, 128, 0, 0,
|
||||
228, 176, 0, 8, 228, 160,
|
||||
5, 0, 0, 3, 0, 0,
|
||||
15, 128, 0, 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.27.952.3022
|
||||
//
|
||||
// fxc LayerManagerD3D9Shaders.hlsl -ERGBShader -nologo -Tps_2_0
|
||||
// -FhtmpShaderHeader -VnRGBShaderPS
|
||||
//
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// float fLayerOpacity;
|
||||
// sampler2D s2D;
|
||||
//
|
||||
//
|
||||
// Registers:
|
||||
//
|
||||
// Name Reg Size
|
||||
// ------------- ----- ----
|
||||
// fLayerOpacity c0 1
|
||||
// s2D s0 1
|
||||
//
|
||||
|
||||
ps_2_0
|
||||
def c1, 1, 0, 0, 0
|
||||
dcl t0.xy
|
||||
dcl_2d s0
|
||||
texld r0, t0, s0
|
||||
mul r0.xyz, r0, c0.x
|
||||
mov r0.w, c1.x
|
||||
mov oC0, r0
|
||||
|
||||
// approximately 4 instruction slots used (1 texture, 3 arithmetic)
|
||||
#endif
|
||||
|
||||
const BYTE RGBShaderPS[] =
|
||||
{
|
||||
0, 2, 255, 255, 254, 255,
|
||||
|
@ -210,9 +291,13 @@ const BYTE RGBShaderPS[] =
|
|||
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, 31, 0, 0, 2,
|
||||
57, 46, 50, 55, 46, 57,
|
||||
53, 50, 46, 51, 48, 50,
|
||||
50, 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,
|
||||
|
@ -220,15 +305,17 @@ const BYTE RGBShaderPS[] =
|
|||
0, 0, 15, 128, 0, 0,
|
||||
228, 176, 0, 8, 228, 160,
|
||||
5, 0, 0, 3, 0, 0,
|
||||
15, 128, 0, 0, 228, 128,
|
||||
7, 128, 0, 0, 228, 128,
|
||||
0, 0, 0, 160, 1, 0,
|
||||
0, 2, 0, 0, 8, 128,
|
||||
1, 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
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
|
||||
//
|
||||
// fxc LayerManagerD3D9Shaders.hlsl -EYCbCrShader -nologo -Tps_2_0
|
||||
// -FhtmpShaderHeader -VnYCbCrShaderPS
|
||||
|
@ -323,9 +410,9 @@ const BYTE YCbCrShaderPS[] =
|
|||
76, 83, 76, 32, 83, 104,
|
||||
97, 100, 101, 114, 32, 67,
|
||||
111, 109, 112, 105, 108, 101,
|
||||
114, 32, 57, 46, 50, 57,
|
||||
114, 32, 57, 46, 50, 55,
|
||||
46, 57, 53, 50, 46, 51,
|
||||
49, 49, 49, 0, 81, 0,
|
||||
48, 50, 50, 0, 81, 0,
|
||||
0, 5, 1, 0, 15, 160,
|
||||
0, 0, 0, 191, 0, 0,
|
||||
128, 189, 244, 253, 148, 63,
|
||||
|
@ -384,7 +471,7 @@ const BYTE YCbCrShaderPS[] =
|
|||
};
|
||||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
|
||||
//
|
||||
// fxc LayerManagerD3D9Shaders.hlsl -ESolidColorShader -nologo -Tps_2_0
|
||||
// -FhtmpShaderHeader -VnSolidColorShaderPS
|
||||
|
@ -432,8 +519,8 @@ const BYTE SolidColorShaderPS[] =
|
|||
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,
|
||||
50, 55, 46, 57, 53, 50,
|
||||
46, 51, 48, 50, 50, 0,
|
||||
1, 0, 0, 2, 0, 8,
|
||||
15, 128, 0, 0, 228, 160,
|
||||
255, 255, 0, 0
|
||||
|
|
|
@ -39,11 +39,19 @@ VS_OUTPUT LayerQuadVS(const VS_INPUT aVertex)
|
|||
return outp;
|
||||
}
|
||||
|
||||
float4 RGBShader(const VS_OUTPUT aVertex) : COLOR
|
||||
float4 RGBAShader(const VS_OUTPUT aVertex) : COLOR
|
||||
{
|
||||
return tex2D(s2D, aVertex.vTexCoords) * fLayerOpacity;
|
||||
}
|
||||
|
||||
float4 RGBShader(const VS_OUTPUT aVertex) : COLOR
|
||||
{
|
||||
float4 result;
|
||||
result = tex2D(s2D, aVertex.vTexCoords) * fLayerOpacity;
|
||||
result.a = 1.0;
|
||||
return result;
|
||||
}
|
||||
|
||||
float4 YCbCrShader(const VS_OUTPUT aVertex) : COLOR
|
||||
{
|
||||
float4 yuv;
|
||||
|
|
|
@ -234,7 +234,12 @@ ThebesLayerD3D9::RenderLayer()
|
|||
opacity[0] = GetOpacity();
|
||||
device()->SetPixelShaderConstantF(0, opacity, 1);
|
||||
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
if (mD2DSurface && UseOpaqueSurface(this)) {
|
||||
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBLAYER);
|
||||
} else
|
||||
#endif
|
||||
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER);
|
||||
|
||||
device()->SetTexture(0, mTexture);
|
||||
device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
|
|
|
@ -2,6 +2,8 @@ tempfile=tmpShaderHeader
|
|||
rm LayerManagerD3D9Shaders.h
|
||||
fxc LayerManagerD3D9Shaders.hlsl -ELayerQuadVS -nologo -Fh$tempfile -VnLayerQuadVS
|
||||
cat $tempfile >> LayerManagerD3D9Shaders.h
|
||||
fxc LayerManagerD3D9Shaders.hlsl -ERGBAShader -nologo -Tps_2_0 -Fh$tempfile -VnRGBAShaderPS
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче