1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Added P8 format support for D3D9On12

This commit is contained in:
narzoul 2023-01-12 22:23:13 +01:00
parent 0b7f4589f2
commit a0d7cffc07
3 changed files with 20 additions and 3 deletions

View File

@ -129,15 +129,27 @@ namespace D3dDdi
for (auto& formatOp : info.formatOps)
{
if (D3DDDIFMT_P8 == formatOp.first)
{
continue;
}
auto fixedFormatOp = formatOp.second;
if (isEmulatedRenderTargetFormat(formatOp.first, info.formatOps))
{
fixedFormatOp.Operations |= FORMATOP_OFFSCREEN_RENDERTARGET;
}
if (D3DDDIFMT_P8 == formatOp.first && Config::palettizedTextures.get())
if (D3DDDIFMT_L8 == formatOp.first)
{
fixedFormatOp.Operations |= FORMATOP_TEXTURE | FORMATOP_CUBETEXTURE;
auto p8FormatOp = formatOp.second;
p8FormatOp.Format = D3DDDIFMT_P8;
p8FormatOp.Operations |= FORMATOP_OFFSCREENPLAIN;
if (!Config::palettizedTextures.get())
{
p8FormatOp.Operations &= ~(FORMATOP_TEXTURE | FORMATOP_VOLUMETEXTURE | FORMATOP_CUBETEXTURE);
}
fixedFormatOps[D3DDDIFMT_P8] = p8FormatOp;
}
if (D3DDDIFMT_D24X4S4 == formatOp.first || D3DDDIFMT_X4S4D24 == formatOp.first)

View File

@ -513,7 +513,7 @@ namespace D3dDdi
if (D3DDDIFMT_P8 == m_fixedData.Format)
{
data.Color <<= 16;
data.Color |= data.Color << 16;
}
prepareForBltDst(data.hResource, data.SubResourceIndex, data.DstRect);

View File

@ -41,6 +41,11 @@ namespace D3dDdi
m_releasedSurfaces.clear();
CompatPtr<IDirectDrawSurface7> surface;
if (D3DDDIFMT_P8 == format)
{
format = D3DDDIFMT_L8;
}
DDSURFACEDESC2 desc = {};
desc.dwSize = sizeof(desc);
desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_CAPS;