mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1173983 - Use R8 textures for d3d11 alpha textures since it appears to be better supported. r=Bas
This commit is contained in:
parent
ddad2ed2eb
commit
5925a945d1
@ -127,6 +127,7 @@ static inline SurfaceFormat ToPixelFormat(const D2D1_PIXEL_FORMAT &aFormat)
|
||||
{
|
||||
switch(aFormat.format) {
|
||||
case DXGI_FORMAT_A8_UNORM:
|
||||
case DXGI_FORMAT_R8_UNORM:
|
||||
return SurfaceFormat::A8;
|
||||
case DXGI_FORMAT_B8G8R8A8_UNORM:
|
||||
if (aFormat.alphaMode == D2D1_ALPHA_MODE_IGNORE) {
|
||||
|
@ -237,7 +237,7 @@ IMFYCbCrImage::GetTextureClient(CompositableClient* aClient)
|
||||
RefPtr<ID3D11DeviceContext> ctx;
|
||||
device->GetImmediateContext(byRef(ctx));
|
||||
|
||||
CD3D11_TEXTURE2D_DESC newDesc(DXGI_FORMAT_A8_UNORM,
|
||||
CD3D11_TEXTURE2D_DESC newDesc(DXGI_FORMAT_R8_UNORM,
|
||||
mData.mYSize.width, mData.mYSize.height, 1, 1);
|
||||
|
||||
newDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
|
||||
|
@ -159,14 +159,14 @@ VS_MASK_3D_OUTPUT LayerQuadMask3DVS(const VS_INPUT aVertex)
|
||||
float4 RGBAShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target
|
||||
{
|
||||
float2 maskCoords = aVertex.vMaskCoords;
|
||||
float mask = tMask.Sample(sSampler, maskCoords).a;
|
||||
float mask = tMask.Sample(sSampler, maskCoords).r;
|
||||
return tRGB.Sample(sSampler, aVertex.vTexCoords) * fLayerOpacity * mask;
|
||||
}
|
||||
|
||||
float4 RGBAShaderMask3D(const VS_MASK_3D_OUTPUT aVertex) : SV_Target
|
||||
{
|
||||
float2 maskCoords = aVertex.vMaskCoords.xy / aVertex.vMaskCoords.z;
|
||||
float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a;
|
||||
float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).r;
|
||||
return tRGB.Sample(sSampler, aVertex.vTexCoords) * fLayerOpacity * mask;
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ float4 RGBShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target
|
||||
result.a = fLayerOpacity;
|
||||
|
||||
float2 maskCoords = aVertex.vMaskCoords;
|
||||
float mask = tMask.Sample(sSampler, maskCoords).a;
|
||||
float mask = tMask.Sample(sSampler, maskCoords).r;
|
||||
return result * mask;
|
||||
}
|
||||
|
||||
@ -196,9 +196,9 @@ float4 CalculateYCbCrColor(const float2 aTexCoords)
|
||||
float4 yuv;
|
||||
float4 color;
|
||||
|
||||
yuv.r = tCr.Sample(sSampler, aTexCoords).a - 0.50196;
|
||||
yuv.g = tY.Sample(sSampler, aTexCoords).a - 0.06275;
|
||||
yuv.b = tCb.Sample(sSampler, aTexCoords).a - 0.50196;
|
||||
yuv.r = tCr.Sample(sSampler, aTexCoords).r - 0.50196;
|
||||
yuv.g = tY.Sample(sSampler, aTexCoords).r - 0.06275;
|
||||
yuv.b = tCb.Sample(sSampler, aTexCoords).r - 0.50196;
|
||||
|
||||
color.r = yuv.g * 1.16438 + yuv.r * 1.59603;
|
||||
color.g = yuv.g * 1.16438 - 0.81297 * yuv.r - 0.39176 * yuv.b;
|
||||
@ -211,7 +211,7 @@ float4 CalculateYCbCrColor(const float2 aTexCoords)
|
||||
float4 YCbCrShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target
|
||||
{
|
||||
float2 maskCoords = aVertex.vMaskCoords;
|
||||
float mask = tMask.Sample(sSampler, maskCoords).a;
|
||||
float mask = tMask.Sample(sSampler, maskCoords).r;
|
||||
|
||||
return CalculateYCbCrColor(aVertex.vTexCoords) * fLayerOpacity * mask;
|
||||
}
|
||||
@ -225,7 +225,7 @@ PS_OUTPUT ComponentAlphaShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target
|
||||
result.vSrc.a = result.vAlpha.g;
|
||||
|
||||
float2 maskCoords = aVertex.vMaskCoords;
|
||||
float mask = tMask.Sample(sSampler, maskCoords).a;
|
||||
float mask = tMask.Sample(sSampler, maskCoords).r;
|
||||
result.vSrc *= fLayerOpacity * mask;
|
||||
result.vAlpha *= fLayerOpacity * mask;
|
||||
|
||||
@ -235,7 +235,7 @@ PS_OUTPUT ComponentAlphaShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target
|
||||
float4 SolidColorShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target
|
||||
{
|
||||
float2 maskCoords = aVertex.vMaskCoords;
|
||||
float mask = tMask.Sample(sSampler, maskCoords).a;
|
||||
float mask = tMask.Sample(sSampler, maskCoords).r;
|
||||
return fLayerColor * mask;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,10 @@
|
||||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||
//
|
||||
//
|
||||
// fxc -nologo -Tvs_4_0_level_9_3 CompositorD3D11VR.hlsl
|
||||
// -EOculusVRDistortionVS -VnOculusVRDistortionVS -FhtmpShaderHeader
|
||||
//
|
||||
//
|
||||
// Buffer Definitions:
|
||||
@ -25,7 +29,7 @@
|
||||
// Input signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// -------------------- ----- ------ -------- -------- ------ ------
|
||||
// POSITION 0 xy 0 NONE float xy
|
||||
// TEXCOORD 0 xy 1 NONE float xy
|
||||
// TEXCOORD 1 xy 2 NONE float xy
|
||||
@ -36,7 +40,7 @@
|
||||
// Output signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// -------------------- ----- ------ -------- -------- ------ ------
|
||||
// SV_Position 0 xyzw 0 POS float xyzw
|
||||
// TEXCOORD 0 xyz 1 NONE float xyz
|
||||
// TEXCOORD 1 xyz 2 NONE float xyz
|
||||
@ -106,10 +110,10 @@ ret
|
||||
|
||||
const BYTE OculusVRDistortionVS[] =
|
||||
{
|
||||
68, 88, 66, 67, 3, 61,
|
||||
196, 122, 10, 53, 44, 234,
|
||||
18, 242, 195, 238, 42, 90,
|
||||
72, 193, 1, 0, 0, 0,
|
||||
68, 88, 66, 67, 206, 154,
|
||||
203, 64, 121, 47, 121, 169,
|
||||
222, 206, 108, 175, 167, 227,
|
||||
154, 37, 1, 0, 0, 0,
|
||||
244, 5, 0, 0, 6, 0,
|
||||
0, 0, 56, 0, 0, 0,
|
||||
108, 1, 0, 0, 44, 3,
|
||||
@ -245,7 +249,7 @@ const BYTE OculusVRDistortionVS[] =
|
||||
116, 0, 0, 0, 10, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 10, 0,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
@ -303,9 +307,9 @@ const BYTE OculusVRDistortionVS[] =
|
||||
83, 76, 32, 83, 104, 97,
|
||||
100, 101, 114, 32, 67, 111,
|
||||
109, 112, 105, 108, 101, 114,
|
||||
32, 54, 46, 51, 46, 57,
|
||||
54, 48, 48, 46, 49, 54,
|
||||
51, 56, 52, 0, 171, 171,
|
||||
32, 57, 46, 50, 57, 46,
|
||||
57, 53, 50, 46, 51, 49,
|
||||
49, 49, 0, 171, 171, 171,
|
||||
73, 83, 71, 78, 152, 0,
|
||||
0, 0, 5, 0, 0, 0,
|
||||
8, 0, 0, 0, 128, 0,
|
||||
@ -363,7 +367,11 @@ const BYTE OculusVRDistortionVS[] =
|
||||
};
|
||||
#if 0
|
||||
//
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
|
||||
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
|
||||
//
|
||||
//
|
||||
// fxc -nologo -Tps_4_0_level_9_3 CompositorD3D11VR.hlsl
|
||||
// -EOculusVRDistortionPS -VnOculusVRDistortionPS -FhtmpShaderHeader
|
||||
//
|
||||
//
|
||||
// Resource Bindings:
|
||||
@ -378,7 +386,7 @@ const BYTE OculusVRDistortionVS[] =
|
||||
// Input signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// -------------------- ----- ------ -------- -------- ------ ------
|
||||
// SV_Position 0 xyzw 0 POS float
|
||||
// TEXCOORD 0 xyz 1 NONE float xy
|
||||
// TEXCOORD 1 xyz 2 NONE float xy
|
||||
@ -389,7 +397,7 @@ const BYTE OculusVRDistortionVS[] =
|
||||
// Output signature:
|
||||
//
|
||||
// Name Index Mask Register SysValue Format Used
|
||||
// -------------------- ----- ------ -------- -------- ------- ------
|
||||
// -------------------- ----- ------ -------- -------- ------ ------
|
||||
// SV_Target 0 xyzw 0 TARGET float xyzw
|
||||
//
|
||||
//
|
||||
@ -441,15 +449,15 @@ ret
|
||||
|
||||
const BYTE OculusVRDistortionPS[] =
|
||||
{
|
||||
68, 88, 66, 67, 108, 219,
|
||||
61, 216, 27, 0, 27, 222,
|
||||
242, 132, 183, 21, 166, 141,
|
||||
130, 39, 1, 0, 0, 0,
|
||||
128, 4, 0, 0, 6, 0,
|
||||
68, 88, 66, 67, 48, 161,
|
||||
127, 216, 149, 107, 53, 57,
|
||||
164, 84, 84, 154, 58, 227,
|
||||
125, 61, 1, 0, 0, 0,
|
||||
124, 4, 0, 0, 6, 0,
|
||||
0, 0, 56, 0, 0, 0,
|
||||
60, 1, 0, 0, 132, 2,
|
||||
0, 0, 0, 3, 0, 0,
|
||||
168, 3, 0, 0, 76, 4,
|
||||
164, 3, 0, 0, 72, 4,
|
||||
0, 0, 65, 111, 110, 57,
|
||||
252, 0, 0, 0, 252, 0,
|
||||
0, 0, 0, 2, 255, 255,
|
||||
@ -569,7 +577,7 @@ const BYTE OculusVRDistortionPS[] =
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
82, 68, 69, 70, 160, 0,
|
||||
82, 68, 69, 70, 156, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 2, 0,
|
||||
0, 0, 28, 0, 0, 0,
|
||||
@ -594,43 +602,43 @@ const BYTE OculusVRDistortionPS[] =
|
||||
76, 32, 83, 104, 97, 100,
|
||||
101, 114, 32, 67, 111, 109,
|
||||
112, 105, 108, 101, 114, 32,
|
||||
54, 46, 51, 46, 57, 54,
|
||||
48, 48, 46, 49, 54, 51,
|
||||
56, 52, 0, 171, 171, 171,
|
||||
73, 83, 71, 78, 156, 0,
|
||||
0, 0, 5, 0, 0, 0,
|
||||
8, 0, 0, 0, 128, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
1, 0, 0, 0, 3, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
15, 0, 0, 0, 140, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 3, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
7, 3, 0, 0, 140, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 3, 0,
|
||||
0, 0, 2, 0, 0, 0,
|
||||
7, 3, 0, 0, 140, 0,
|
||||
0, 0, 2, 0, 0, 0,
|
||||
0, 0, 0, 0, 3, 0,
|
||||
0, 0, 3, 0, 0, 0,
|
||||
7, 3, 0, 0, 149, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 3, 0,
|
||||
0, 0, 4, 0, 0, 0,
|
||||
15, 1, 0, 0, 83, 86,
|
||||
95, 80, 111, 115, 105, 116,
|
||||
105, 111, 110, 0, 84, 69,
|
||||
88, 67, 79, 79, 82, 68,
|
||||
0, 67, 79, 76, 79, 82,
|
||||
0, 171, 79, 83, 71, 78,
|
||||
44, 0, 0, 0, 1, 0,
|
||||
57, 46, 50, 57, 46, 57,
|
||||
53, 50, 46, 51, 49, 49,
|
||||
49, 0, 73, 83, 71, 78,
|
||||
156, 0, 0, 0, 5, 0,
|
||||
0, 0, 8, 0, 0, 0,
|
||||
32, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
128, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 0,
|
||||
0, 0, 15, 0, 0, 0,
|
||||
83, 86, 95, 84, 97, 114,
|
||||
103, 101, 116, 0, 171, 171
|
||||
140, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 1, 0,
|
||||
0, 0, 7, 3, 0, 0,
|
||||
140, 0, 0, 0, 1, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 2, 0,
|
||||
0, 0, 7, 3, 0, 0,
|
||||
140, 0, 0, 0, 2, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 3, 0,
|
||||
0, 0, 7, 3, 0, 0,
|
||||
149, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
3, 0, 0, 0, 4, 0,
|
||||
0, 0, 15, 1, 0, 0,
|
||||
83, 86, 95, 80, 111, 115,
|
||||
105, 116, 105, 111, 110, 0,
|
||||
84, 69, 88, 67, 79, 79,
|
||||
82, 68, 0, 67, 79, 76,
|
||||
79, 82, 0, 171, 79, 83,
|
||||
71, 78, 44, 0, 0, 0,
|
||||
1, 0, 0, 0, 8, 0,
|
||||
0, 0, 32, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 3, 0, 0, 0,
|
||||
0, 0, 0, 0, 15, 0,
|
||||
0, 0, 83, 86, 95, 84,
|
||||
97, 114, 103, 101, 116, 0,
|
||||
171, 171
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ SurfaceFormatToDXGIFormat(gfx::SurfaceFormat aFormat)
|
||||
case SurfaceFormat::R8G8B8X8:
|
||||
return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
case SurfaceFormat::A8:
|
||||
return DXGI_FORMAT_A8_UNORM;
|
||||
return DXGI_FORMAT_R8_UNORM;
|
||||
default:
|
||||
MOZ_ASSERT(false, "unsupported format");
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
@ -451,7 +451,7 @@ TextureClientD3D11::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlag
|
||||
|
||||
if (gfxPrefs::Direct2DUse1_1() && d3d11device) {
|
||||
|
||||
CD3D11_TEXTURE2D_DESC newDesc(mFormat == SurfaceFormat::A8 ? DXGI_FORMAT_A8_UNORM : DXGI_FORMAT_B8G8R8A8_UNORM,
|
||||
CD3D11_TEXTURE2D_DESC newDesc(mFormat == SurfaceFormat::A8 ? DXGI_FORMAT_R8_UNORM : DXGI_FORMAT_B8G8R8A8_UNORM,
|
||||
aSize.width, aSize.height, 1, 1,
|
||||
D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE);
|
||||
|
||||
|
@ -1830,23 +1830,7 @@ bool DoesD3D11TextureSharingWork(ID3D11Device *device)
|
||||
|
||||
bool DoesD3D11AlphaTextureSharingWork(ID3D11Device *device)
|
||||
{
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
if (gfxInfo) {
|
||||
// A8 texture sharing crashes on this intel driver version (and no others)
|
||||
// so just avoid using it in that case.
|
||||
nsString adapterVendor;
|
||||
nsString driverVersion;
|
||||
gfxInfo->GetAdapterVendorID(adapterVendor);
|
||||
gfxInfo->GetAdapterDriverVersion(driverVersion);
|
||||
|
||||
nsAString &intelVendorID = (nsAString &)GfxDriverInfo::GetDeviceVendor(VendorIntel);
|
||||
if (adapterVendor.Equals(intelVendorID, nsCaseInsensitiveStringComparator()) &&
|
||||
driverVersion.Equals(NS_LITERAL_STRING("8.15.10.2086"))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return DoesD3D11TextureSharingWorkInternal(device, DXGI_FORMAT_A8_UNORM, D3D11_BIND_SHADER_RESOURCE);
|
||||
return DoesD3D11TextureSharingWorkInternal(device, DXGI_FORMAT_R8_UNORM, D3D11_BIND_SHADER_RESOURCE);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user