Declare CXBXFMT_* mappings once, using _9_11 macro
Replace D3DFORMAT by CXBXFORMAT in a few more places (including in disabled code in Direct3D9.cpp.unused-patches, just to conform it to most current X_ prefixed type declarations, similar to other types.
This commit is contained in:
parent
b132ede78b
commit
81b5380206
|
@ -2080,25 +2080,25 @@ void UpdateDepthStencilFlags(IDirect3DSurface *pDepthStencilSurface)
|
|||
pDepthStencilSurface->GetDesc(&Desc);
|
||||
|
||||
switch (Desc.Format) {
|
||||
case D3DFMT_D16:
|
||||
case CXBXFMT_D16:
|
||||
g_bHasDepth = true;
|
||||
break;
|
||||
case D3DFMT_D15S1:
|
||||
case CXBXFMT_D15S1:
|
||||
g_bHasDepth = true;
|
||||
g_bHasStencil = true;
|
||||
break;
|
||||
case D3DFMT_D24X8:
|
||||
case CXBXFMT_D24X8:
|
||||
g_bHasDepth = true;
|
||||
break;
|
||||
case D3DFMT_D24S8:
|
||||
case CXBXFMT_D24S8:
|
||||
g_bHasDepth = true;
|
||||
g_bHasStencil = true;
|
||||
break;
|
||||
case D3DFMT_D24X4S4:
|
||||
case CXBXFMT_D24X4S4:
|
||||
g_bHasDepth = true;
|
||||
g_bHasStencil = true;
|
||||
break;
|
||||
case D3DFMT_D32:
|
||||
case CXBXFMT_D32:
|
||||
g_bHasDepth = true;
|
||||
break;
|
||||
}
|
||||
|
@ -2176,7 +2176,7 @@ static void DetermineSupportedD3DFormats
|
|||
if (!EmuXBFormatRequiresConversionToARGB((xbox::X_D3DFORMAT)X_Format)) {
|
||||
// Convert the Xbox format into host format (without warning, thanks to the above restriction)
|
||||
const CXBXFORMAT PCFormat = EmuXB2PC_D3DFormat((xbox::X_D3DFORMAT)X_Format);
|
||||
if (PCFormat != _9_11(D3DFMT_UNKNOWN, DXGI_FORMAT_UNKNOWN)) {
|
||||
if (PCFormat != CXBXFMT_UNKNOWN) {
|
||||
// Index with Xbox D3DFormat, because host FourCC codes are too big to be used as indices
|
||||
#ifdef CBXB_USE_D3D11
|
||||
UINT FormatSupport = 0;
|
||||
|
@ -2752,7 +2752,7 @@ IDirect3DIndexBuffer* CxbxCreateIndexBuffer(unsigned IndexCount)
|
|||
HRESULT hRet = g_pD3DDevice->CreateIndexBuffer(
|
||||
uiIndexBufferSize, // Size of the index buffer, in bytes.
|
||||
D3DUsage,
|
||||
/*Format=*/D3DFMT_INDEX16,
|
||||
/*Format=*/CXBXFMT_INDEX16,
|
||||
D3DPool,
|
||||
&Result,
|
||||
nullptr // pSharedHandle
|
||||
|
@ -2833,10 +2833,10 @@ ConvertedIndexBuffer& CxbxUpdateActiveIndexBuffer
|
|||
if (bConvertQuadListToTriangleList) {
|
||||
// Note, that LowIndex and HighIndex won't change due to any quad-to-triangle conversion,
|
||||
// so it's less work to WalkIndexBuffer over the input instead of the converted index buffer.
|
||||
EmuLog(LOG_LEVEL::DEBUG, "CxbxUpdateActiveIndexBuffer: Converting quads to %d triangle indices (D3DFMT_INDEX16)", RequiredIndexCount);
|
||||
EmuLog(LOG_LEVEL::DEBUG, "CxbxUpdateActiveIndexBuffer: Converting quads to %d triangle indices (CXBXFMT_INDEX16)", RequiredIndexCount);
|
||||
CxbxConvertQuadListToTriangleListIndices(pXboxIndexData, RequiredIndexCount, pHostIndexBufferData);
|
||||
} else {
|
||||
EmuLog(LOG_LEVEL::DEBUG, "CxbxUpdateActiveIndexBuffer: Copying %d indices (D3DFMT_INDEX16)", XboxIndexCount);
|
||||
EmuLog(LOG_LEVEL::DEBUG, "CxbxUpdateActiveIndexBuffer: Copying %d indices (CXBXFMT_INDEX16)", XboxIndexCount);
|
||||
memcpy(pHostIndexBufferData, pXboxIndexData, XboxIndexCount * sizeof(INDEX16));
|
||||
}
|
||||
|
||||
|
@ -4108,7 +4108,7 @@ xbox::X_D3DSurface* CxbxrImpl_GetBackBuffer2
|
|||
if(pCachedPrimarySurface == nullptr) {
|
||||
// create a buffer to return
|
||||
// TODO: Verify the surface is always 640x480
|
||||
hRet = g_pD3DDevice->CreateOffscreenPlainSurface(640, 480, D3DFMT_A8R8G8B8, /*D3DPool=* /0, &pCachedPrimarySurface, nullptr);
|
||||
hRet = g_pD3DDevice->CreateOffscreenPlainSurface(640, 480, CXBXFMT_A8R8G8B8, /*D3DPool=* /0, &pCachedPrimarySurface, nullptr);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateOffscreenPlainSurface");
|
||||
}
|
||||
|
||||
|
@ -5467,18 +5467,18 @@ xbox::dword_xt WINAPI xbox::EMUPATCH(D3DDevice_Swap)
|
|||
// TODO : Before reading from pgraph, flush all pending push-buffer commands
|
||||
switch (GET_MASK(HLE_read_NV2A_pgraph_register(NV_PGRAPH_CONTROL_0), NV_PGRAPH_CONTROL_0_CSCONVERT)) {
|
||||
case 0: // = pass-through
|
||||
PCFormat = D3DFMT_YUY2;
|
||||
PCFormat = CXBXFMT_YUY2;
|
||||
break;
|
||||
case 1: // = CRYCB_TO_RGB
|
||||
PCFormat = D3DFMT_YUY2; // Test-case : Turok (intro movie)
|
||||
PCFormat = CXBXFMT_YUY2; // Test-case : Turok (intro movie)
|
||||
break;
|
||||
case 2: // = SCRYSCB_TO_RGB
|
||||
LOG_TEST_CASE("SCRYSCB_TO_RGB");
|
||||
PCFormat = D3DFMT_YUY2;
|
||||
PCFormat = CXBXFMT_YUY2;
|
||||
break;
|
||||
default:
|
||||
LOG_TEST_CASE("Unrecognized NV_PGRAPH_CONTROL_0_CSCONVERT");
|
||||
PCFormat = D3DFMT_YUY2;
|
||||
PCFormat = CXBXFMT_YUY2;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5559,7 +5559,7 @@ xbox::dword_xt WINAPI xbox::EMUPATCH(D3DDevice_Swap)
|
|||
HRESULT hRet = g_pD3DDevice->CreateOffscreenPlainSurface(
|
||||
OverlayWidth,
|
||||
OverlayHeight,
|
||||
D3DFMT_A8R8G8B8,
|
||||
CXBXFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT,
|
||||
&pTemporaryOverlaySurface,
|
||||
nullptr
|
||||
|
@ -5907,7 +5907,7 @@ void CreateHostResource(xbox::X_D3DResource *pResource, DWORD D3DUsage, int iTex
|
|||
|
||||
if (EmuXBFormatRequiresConversionToARGB(X_Format)) {
|
||||
bConvertToARGB = true;
|
||||
PCFormat = _9_11(D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM);
|
||||
PCFormat = CXBXFMT_A8R8G8B8;
|
||||
|
||||
// Unset D3DUSAGE_DEPTHSTENCIL: It's not possible for ARGB textures to be depth stencils
|
||||
// Fixes CreateTexture error in Virtua Cop 3 (Chihiro)
|
||||
|
@ -5922,12 +5922,12 @@ void CreateHostResource(xbox::X_D3DResource *pResource, DWORD D3DUsage, int iTex
|
|||
else {
|
||||
if (D3DUsage & D3DUSAGE_DEPTHSTENCIL) {
|
||||
// If it was a depth stencil, fall back to a known supported depth format
|
||||
EmuLog(LOG_LEVEL::WARNING, "Xbox %s Format %x will be converted to D3DFMT_D24S8", ResourceTypeName, X_Format);
|
||||
PCFormat = _9_11(D3DFMT_D24S8, DXGI_FORMAT_D24_UNORM_S8_UINT);
|
||||
EmuLog(LOG_LEVEL::WARNING, "Xbox %s Format %x will be converted to CXBXFMT_D24S8", ResourceTypeName, X_Format);
|
||||
PCFormat = CXBXFMT_D24S8;
|
||||
} else if (EmuXBFormatCanBeConvertedToARGB(X_Format)) {
|
||||
EmuLog(LOG_LEVEL::WARNING, "Xbox %s Format %x will be converted to ARGB", ResourceTypeName, X_Format);
|
||||
bConvertToARGB = true;
|
||||
PCFormat = _9_11(D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM);
|
||||
PCFormat = CXBXFMT_A8R8G8B8;
|
||||
} else {
|
||||
// Otherwise, use a best matching format
|
||||
/*CxbxrAbort*/EmuLog(LOG_LEVEL::WARNING, "Encountered a completely incompatible %s format!", ResourceTypeName);
|
||||
|
@ -6133,22 +6133,22 @@ void CreateHostResource(xbox::X_D3DResource *pResource, DWORD D3DUsage, int iTex
|
|||
#endif
|
||||
|
||||
// If the above failed, we might be able to use an ARGB texture instead
|
||||
if ((hRet != D3D_OK) && (PCFormat != _9_11(D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM)) && EmuXBFormatCanBeConvertedToARGB(X_Format)) {
|
||||
if ((hRet != D3D_OK) && (PCFormat != CXBXFMT_A8R8G8B8) && EmuXBFormatCanBeConvertedToARGB(X_Format)) {
|
||||
#ifdef CXBX_USE_D3D11
|
||||
desc.Format = _9_11(D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM);
|
||||
desc.Format = CXBXFMT_A8R8G8B8;
|
||||
hRet = g_pD3DDevice->CreateTexture2D(&desc, NULL, pNewHostResource.GetAddressOf()); // TODO : pNewHostResource.Get() ?
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateTexture2D");
|
||||
#else
|
||||
hRet = g_pD3DDevice->CreateTexture(hostWidth, hostHeight, dwMipMapLevels,
|
||||
D3DUsage, _9_11(D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM), D3DPool, pNewHostTexture.GetAddressOf(),
|
||||
D3DUsage, CXBXFMT_A8R8G8B8, D3DPool, pNewHostTexture.GetAddressOf(),
|
||||
nullptr
|
||||
);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateTexture(D3DFMT_A8R8G8B8)");
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateTexture(CXBXFMT_A8R8G8B8)");
|
||||
#endif
|
||||
if (hRet == D3D_OK) {
|
||||
// Okay, now this works, make sure the texture gets converted
|
||||
bConvertToARGB = true;
|
||||
PCFormat = _9_11(D3DFMT_A8R8G8B8, desc.Format);
|
||||
PCFormat = _9_11(CXBXFMT_A8R8G8B8, desc.Format);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6383,7 +6383,7 @@ void CreateHostResource(xbox::X_D3DResource *pResource, DWORD D3DUsage, int iTex
|
|||
|
||||
// Copy texture data to the host resource
|
||||
if (bConvertToARGB) {
|
||||
EmuLog(LOG_LEVEL::DEBUG, "Unsupported texture format, expanding to D3DFMT_A8R8G8B8");
|
||||
EmuLog(LOG_LEVEL::DEBUG, "Unsupported texture format, expanding to CXBXFMT_A8R8G8B8");
|
||||
|
||||
// In case where there is a palettized texture without a palette attached,
|
||||
// fill it with zeroes for now. This might not be correct, but it prevents a crash.
|
||||
|
@ -7487,7 +7487,7 @@ void CxbxDrawIndexedClosingLineUP(INDEX16 LowIndex, INDEX16 HighIndex, void *pHo
|
|||
/*NumVertices=*/(HighIndex - LowIndex) + 1,
|
||||
/*PrimitiveCount=*/1,
|
||||
/*pIndexData=*/CxbxClosingLineIndices,
|
||||
/*IndexDataFormat=*/D3DFMT_INDEX16,
|
||||
/*IndexDataFormat=*/CXBXFMT_INDEX16,
|
||||
pHostVertexStreamZeroData,
|
||||
uiHostVertexStreamZeroStride
|
||||
);
|
||||
|
@ -7612,7 +7612,7 @@ void CxbxDrawPrimitiveUP(CxbxDrawContext &DrawContext)
|
|||
/*NumVertices=*/DrawContext.dwVertexCount,
|
||||
PrimitiveCount,
|
||||
pIndexData,
|
||||
/*IndexDataFormat=*/D3DFMT_INDEX16,
|
||||
/*IndexDataFormat=*/CXBXFMT_INDEX16,
|
||||
DrawContext.pHostVertexStreamZeroData,
|
||||
DrawContext.uiHostVertexStreamZeroStride
|
||||
);
|
||||
|
@ -8529,7 +8529,7 @@ xbox::void_xt WINAPI xbox::EMUPATCH(D3DDevice_DrawIndexedVerticesUP)
|
|||
/*NumVertexIndices=*/(DrawContext.HighIndex - DrawContext.LowIndex) + 1,
|
||||
PrimitiveCount,
|
||||
pHostIndexData,
|
||||
/*IndexDataFormat=*/D3DFMT_INDEX16,
|
||||
/*IndexDataFormat=*/CXBXFMT_INDEX16,
|
||||
DrawContext.pHostVertexStreamZeroData,
|
||||
DrawContext.uiHostVertexStreamZeroStride
|
||||
);
|
||||
|
|
|
@ -245,15 +245,15 @@ HRESULT WINAPI XTL::EMUPATCH(D3DDevice_CreateImageSurface)
|
|||
*ppSurface = EmuNewD3DSurface();
|
||||
XTL::IDirect3DSurface8 *pNewHostSurface = nullptr;
|
||||
|
||||
D3DFORMAT PCFormat = EmuXB2PC_D3DFormat(Format);
|
||||
CXBXFORMAT PCFormat = EmuXB2PC_D3DFormat(Format);
|
||||
HRESULT hRet = g_pD3DDevice8->CreateImageSurface(Width, Height, PCFormat, &pNewHostSurface);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice8->CreateImageSurface");
|
||||
|
||||
if(FAILED(hRet))
|
||||
if(Format == X_D3DFMT_LIN_D24S8)
|
||||
{
|
||||
EmuWarning("CreateImageSurface: D3DFMT_LIN_D24S8 -> D3DFMT_A8R8G8B8");
|
||||
hRet = g_pD3DDevice8->CreateImageSurface(Width, Height, D3DFMT_A8R8G8B8, &pNewHostSurface);
|
||||
EmuWarning("CreateImageSurface: CXBXFMT_LIN_D24S8 -> CXBXFMT_A8R8G8B8");
|
||||
hRet = g_pD3DDevice8->CreateImageSurface(Width, Height, CXBXFMT_A8R8G8B8, &pNewHostSurface);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice8->CreateImageSurface(ARGB)");
|
||||
}
|
||||
|
||||
|
@ -424,33 +424,33 @@ HRESULT WINAPI XTL::EMUPATCH(D3DDevice_CreateTexture)
|
|||
else
|
||||
{
|
||||
// Convert Format (Xbox->PC)
|
||||
D3DFORMAT PCFormat = EmuXB2PC_D3DFormat(Format);
|
||||
CXBXFORMAT PCFormat = EmuXB2PC_D3DFormat(Format);
|
||||
|
||||
// TODO: HACK: Devices that don't support this should somehow emulate it!
|
||||
//* This is OK on my GeForce FX 5600
|
||||
if(PCFormat == D3DFMT_D16)
|
||||
if(PCFormat == CXBXFMT_D16)
|
||||
{
|
||||
EmuWarning("D3DFMT_D16 is an unsupported texture format!");
|
||||
PCFormat = D3DFMT_R5G6B5;
|
||||
EmuWarning("CXBXFMT_D16 is an unsupported texture format!");
|
||||
PCFormat = CXBXFMT_R5G6B5;
|
||||
}
|
||||
//*
|
||||
else if(PCFormat == D3DFMT_P8 && !g_bSupportsTextureFormat[X_D3DFMT_P8])
|
||||
else if(PCFormat == CXBXFMT_P8 && !g_bSupportsTextureFormat[X_D3DFMT_P8])
|
||||
{
|
||||
EmuWarning("D3DFMT_P8 is an unsupported texture format!");
|
||||
PCFormat = D3DFMT_L8;
|
||||
EmuWarning("CXBXFMT_P8 is an unsupported texture format!");
|
||||
PCFormat = CXBXFMT_L8;
|
||||
}
|
||||
//*/
|
||||
//* This is OK on my GeForce FX 5600
|
||||
else if(PCFormat == D3DFMT_D24S8)
|
||||
else if(PCFormat == CXBXFMT_D24S8)
|
||||
{
|
||||
EmuWarning("D3DFMT_D24S8 is an unsupported texture format!");
|
||||
PCFormat = D3DFMT_X8R8G8B8; // TODO : Use D3DFMT_A8R8G8B8?
|
||||
EmuWarning("CXBXFMT_D24S8 is an unsupported texture format!");
|
||||
PCFormat = CXBXFMT_X8R8G8B8; // TODO : Use CXBXFMT_A8R8G8B8?
|
||||
}//*/
|
||||
// TODO: HACK: This texture format fails on some newer hardware
|
||||
else if(PCFormat == D3DFMT_X1R5G5B5)
|
||||
else if(PCFormat == CXBXFMT_X1R5G5B5)
|
||||
{
|
||||
EmuWarning("D3DFMT_X1R5G5B5 -> D3DFMT_R5G6B5");
|
||||
PCFormat = D3DFMT_R5G6B5;
|
||||
EmuWarning("CXBXFMT_X1R5G5B5 -> CXBXFMT_R5G6B5");
|
||||
PCFormat = CXBXFMT_R5G6B5;
|
||||
}
|
||||
|
||||
DWORD PCUsage = Usage & (D3DUSAGE_RENDERTARGET);
|
||||
|
@ -577,23 +577,23 @@ HRESULT WINAPI XTL::EMUPATCH(D3DDevice_CreateVolumeTexture)
|
|||
else
|
||||
{
|
||||
// Convert Format (Xbox->PC)
|
||||
D3DFORMAT PCFormat = EmuXB2PC_D3DFormat(Format);
|
||||
CXBXFORMAT PCFormat = EmuXB2PC_D3DFormat(Format);
|
||||
|
||||
// TODO: HACK: Devices that don't support this should somehow emulate it!
|
||||
if (PCFormat == D3DFMT_D16)
|
||||
if (PCFormat == CXBXFMT_D16)
|
||||
{
|
||||
EmuWarning("D3DFMT_D16 is an unsupported texture format!");
|
||||
PCFormat = D3DFMT_X8R8G8B8; // TODO : Use D3DFMT_R5G6B5 ?
|
||||
EmuWarning("CXBXFMT_D16 is an unsupported texture format!");
|
||||
PCFormat = CXBXFMT_X8R8G8B8; // TODO : Use CXBXFMT_R5G6B5 ?
|
||||
}
|
||||
else if (PCFormat == D3DFMT_P8 && !g_bSupportsTextureFormat[X_D3DFMT_P8])
|
||||
else if (PCFormat == CXBXFMT_P8 && !g_bSupportsTextureFormat[X_D3DFMT_P8])
|
||||
{
|
||||
EmuWarning("D3DFMT_P8 is an unsupported texture format!");
|
||||
PCFormat = D3DFMT_L8;
|
||||
EmuWarning("CXBXFMT_P8 is an unsupported texture format!");
|
||||
PCFormat = CXBXFMT_L8;
|
||||
}
|
||||
else if (PCFormat == D3DFMT_D24S8)
|
||||
else if (PCFormat == CXBXFMT_D24S8)
|
||||
{
|
||||
EmuWarning("D3DFMT_D24S8 is an unsupported texture format!");
|
||||
PCFormat = D3DFMT_X8R8G8B8; // TODO : Use D3DFMT_A8R8G8B8?
|
||||
EmuWarning("CXBXFMT_D24S8 is an unsupported texture format!");
|
||||
PCFormat = CXBXFMT_X8R8G8B8; // TODO : Use CXBXFMT_A8R8G8B8?
|
||||
}
|
||||
|
||||
EmuAdjustPower2(&Width, &Height);
|
||||
|
@ -648,23 +648,23 @@ HRESULT WINAPI XTL::EMUPATCH(D3DDevice_CreateCubeTexture)
|
|||
}
|
||||
|
||||
// Convert Format (Xbox->PC)
|
||||
D3DFORMAT PCFormat = EmuXB2PC_D3DFormat(Format);
|
||||
CXBXFORMAT PCFormat = EmuXB2PC_D3DFormat(Format);
|
||||
|
||||
// TODO: HACK: Devices that don't support this should somehow emulate it!
|
||||
if(PCFormat == D3DFMT_D16)
|
||||
if(PCFormat == CXBXFMT_D16)
|
||||
{
|
||||
EmuWarning("D3DFMT_D16 is an unsupported texture format!");
|
||||
PCFormat = D3DFMT_X8R8G8B8; // TODO : Use D3DFMT_R5G6B5?
|
||||
EmuWarning("CXBXFMT_D16 is an unsupported texture format!");
|
||||
PCFormat = CXBXFMT_X8R8G8B8; // TODO : Use CXBXFMT_R5G6B5?
|
||||
}
|
||||
else if(PCFormat == D3DFMT_P8 && !g_bSupportsTextureFormat[X_D3DFMT_P8])
|
||||
else if(PCFormat == CXBXFMT_P8 && !g_bSupportsTextureFormat[X_D3DFMT_P8])
|
||||
{
|
||||
EmuWarning("D3DFMT_P8 is an unsupported texture format!");
|
||||
PCFormat = D3DFMT_L8;
|
||||
EmuWarning("CXBXFMT_P8 is an unsupported texture format!");
|
||||
PCFormat = CXBXFMT_L8;
|
||||
}
|
||||
else if(PCFormat == D3DFMT_D24S8)
|
||||
else if(PCFormat == CXBXFMT_D24S8)
|
||||
{
|
||||
EmuWarning("D3DFMT_D24S8 is an unsupported texture format!");
|
||||
PCFormat = D3DFMT_X8R8G8B8; // TODO : Use D3DFMT_A8R8G8B8?
|
||||
EmuWarning("CXBXFMT_D24S8 is an unsupported texture format!");
|
||||
PCFormat = CXBXFMT_X8R8G8B8; // TODO : Use CXBXFMT_A8R8G8B8?
|
||||
}
|
||||
|
||||
*ppCubeTexture = EmuNewD3DCubeTexture();
|
||||
|
@ -719,7 +719,7 @@ HRESULT WINAPI XTL::EMUPATCH(D3DDevice_CreateIndexBuffer)
|
|||
|
||||
HRESULT hRet = g_pD3DDevice8->CreateIndexBuffer
|
||||
(
|
||||
Length/*InBytes*/, /*Usage=*/0, D3DFMT_INDEX16, D3DPOOL_MANAGED, &pNewHostIndexBuffer
|
||||
Length/*InBytes*/, /*Usage=*/0, CXBXFMT_INDEX16, D3DPOOL_MANAGED, &pNewHostIndexBuffer
|
||||
);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice8->CreateIndexBuffer");
|
||||
if(SUCCEEDED(hRet))
|
||||
|
@ -1708,7 +1708,7 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_GetPersistedSurface)(X_D3DSurface **ppSurfac
|
|||
*ppSurface = EmuNewD3DSurface();
|
||||
IDirect3DSurface8 *pNewHostSurface = nullptr;
|
||||
|
||||
HRESULT hr = g_pD3DDevice8->CreateImageSurface( 640, 480, D3DFMT_X8R8G8B8, &pNewHostSurface);
|
||||
HRESULT hr = g_pD3DDevice8->CreateImageSurface( 640, 480, CXBXFMT_X8R8G8B8, &pNewHostSurface);
|
||||
DEBUG_D3DRESULT(hr, "g_pD3DDevice8->CreateImageSurface - Could not create temporary surface!");
|
||||
|
||||
if( SUCCEEDED( hr ) )
|
||||
|
@ -1862,23 +1862,23 @@ HRESULT WINAPI XTL::EMUPATCH(Direct3D_CheckDeviceMultiSampleType)
|
|||
EmuWarning("DeviceType == D3DDEVTYPE_FORCE_DWORD");
|
||||
|
||||
// Convert SurfaceFormat (Xbox->PC)
|
||||
D3DFORMAT PCSurfaceFormat = EmuXB2PC_D3DFormat(SurfaceFormat);
|
||||
CXBXFORMAT PCSurfaceFormat = EmuXB2PC_D3DFormat(SurfaceFormat);
|
||||
|
||||
// TODO: HACK: Devices that don't support this should somehow emulate it!
|
||||
if(PCSurfaceFormat == D3DFMT_D16)
|
||||
if(PCSurfaceFormat == CXBXFMT_D16)
|
||||
{
|
||||
EmuWarning("D3DFMT_D16 is an unsupported texture format!");
|
||||
PCSurfaceFormat = D3DFMT_X8R8G8B8;
|
||||
EmuWarning("CXBXFMT_D16 is an unsupported texture format!");
|
||||
PCSurfaceFormat = CXBXFMT_X8R8G8B8;
|
||||
}
|
||||
else if(PCSurfaceFormat == D3DFMT_P8 && !g_bSupportsTextureFormat[X_D3DFMT_P8])
|
||||
else if(PCSurfaceFormat == CXBXFMT_P8 && !g_bSupportsTextureFormat[X_D3DFMT_P8])
|
||||
{
|
||||
EmuWarning("D3DFMT_P8 is an unsupported texture format!");
|
||||
PCSurfaceFormat = D3DFMT_X8R8G8B8;
|
||||
EmuWarning("CXBXFMT_P8 is an unsupported texture format!");
|
||||
PCSurfaceFormat = CXBXFMT_X8R8G8B8;
|
||||
}
|
||||
else if(PCSurfaceFormat == D3DFMT_D24S8)
|
||||
else if(PCSurfaceFormat == CXBXFMT_D24S8)
|
||||
{
|
||||
EmuWarning("D3DFMT_D24S8 is an unsupported texture format!");
|
||||
PCSurfaceFormat = D3DFMT_X8R8G8B8;
|
||||
EmuWarning("CXBXFMT_D24S8 is an unsupported texture format!");
|
||||
PCSurfaceFormat = CXBXFMT_X8R8G8B8;
|
||||
}
|
||||
|
||||
if(Windowed != FALSE)
|
||||
|
|
|
@ -875,79 +875,76 @@ static const FormatInfo FormatInfos[] = {
|
|||
// in the warning field, so EmuXBFormatRequiresConversionToARGB can return a conversion
|
||||
// to ARGB is needed (which is implemented in EMUPATCH(D3DResource_Register).
|
||||
|
||||
// D3D9 D3FFORMAT to D3D11 DXGI_FORMAT mapping : https://docs.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-legacy-formats
|
||||
#define DXGI_FORMAT_NOT_AVAILABLE DXGI_FORMAT_UNKNOWN // TODO : Replace below occurences with a suitable format and corresponding conversion
|
||||
|
||||
/* 0x00 X_D3DFMT_L8 */ { 8, Swzzld, ______L8, _9_11(D3DFMT_L8, DXGI_FORMAT_R8_UNORM) },
|
||||
/* 0x01 X_D3DFMT_AL8 */ { 8, Swzzld, _____AL8, _9_11(D3DFMT_L8, DXGI_FORMAT_R8_UNORM) , Texture, "X_D3DFMT_AL8 -> D3DFMT_L8" },
|
||||
/* 0x02 X_D3DFMT_A1R5G5B5 */ { 16, Swzzld, A1R5G5B5, _9_11(D3DFMT_A1R5G5B5, DXGI_FORMAT_B5G5R5A1_UNORM) },
|
||||
/* 0x03 X_D3DFMT_X1R5G5B5 */ { 16, Swzzld, X1R5G5B5, _9_11(D3DFMT_X1R5G5B5, DXGI_FORMAT_B5G5R5A1_UNORM) , RenderTarget }, // D3D11 TODO : Default A in shader
|
||||
/* 0x04 X_D3DFMT_A4R4G4B4 */ { 16, Swzzld, A4R4G4B4, _9_11(D3DFMT_A4R4G4B4, DXGI_FORMAT_B4G4R4A4_UNORM) },
|
||||
/* 0x05 X_D3DFMT_R5G6B5 */ { 16, Swzzld, __R5G6B5, _9_11(D3DFMT_R5G6B5, DXGI_FORMAT_B5G6R5_UNORM) , RenderTarget },
|
||||
/* 0x06 X_D3DFMT_A8R8G8B8 */ { 32, Swzzld, A8R8G8B8, _9_11(D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM) , RenderTarget },
|
||||
/* 0x07 X_D3DFMT_X8R8G8B8 */ { 32, Swzzld, X8R8G8B8, _9_11(D3DFMT_X8R8G8B8, DXGI_FORMAT_B8G8R8X8_UNORM) , RenderTarget }, // Alias : X_D3DFMT_X8L8V8U8
|
||||
/* 0x00 X_D3DFMT_L8 */ { 8, Swzzld, ______L8, CXBXFMT_L8 },
|
||||
/* 0x01 X_D3DFMT_AL8 */ { 8, Swzzld, _____AL8, CXBXFMT_L8 , Texture, "X_D3DFMT_AL8 -> CXBXFMT_L8" },
|
||||
/* 0x02 X_D3DFMT_A1R5G5B5 */ { 16, Swzzld, A1R5G5B5, CXBXFMT_A1R5G5B5 },
|
||||
/* 0x03 X_D3DFMT_X1R5G5B5 */ { 16, Swzzld, X1R5G5B5, CXBXFMT_X1R5G5B5 , RenderTarget }, // D3D11 TODO : Default A in shader
|
||||
/* 0x04 X_D3DFMT_A4R4G4B4 */ { 16, Swzzld, A4R4G4B4, CXBXFMT_A4R4G4B4 },
|
||||
/* 0x05 X_D3DFMT_R5G6B5 */ { 16, Swzzld, __R5G6B5, CXBXFMT_R5G6B5 , RenderTarget },
|
||||
/* 0x06 X_D3DFMT_A8R8G8B8 */ { 32, Swzzld, A8R8G8B8, CXBXFMT_A8R8G8B8 , RenderTarget },
|
||||
/* 0x07 X_D3DFMT_X8R8G8B8 */ { 32, Swzzld, X8R8G8B8, CXBXFMT_X8R8G8B8 , RenderTarget }, // Alias : X_D3DFMT_X8L8V8U8
|
||||
/* 0x08 undefined */ {},
|
||||
/* 0x09 undefined */ {},
|
||||
/* 0x0A undefined */ {},
|
||||
/* 0x0B X_D3DFMT_P8 */ { 8, Swzzld, ______P8, _9_11(D3DFMT_P8, DXGI_FORMAT_R8_UINT) , Texture, "X_D3DFMT_P8 -> D3DFMT_L8" }, // 8-bit palletized
|
||||
/* 0x0C X_D3DFMT_DXT1 */ { 4, Cmprsd, ____DXT1, _9_11(D3DFMT_DXT1, DXGI_FORMAT_BC1_UNORM) }, // opaque/one-bit alpha // NOTE : DXT1 is half byte per pixel, so divide Size and Pitch calculations by two!
|
||||
/* 0x0B X_D3DFMT_P8 */ { 8, Swzzld, ______P8, CXBXFMT_P8 , Texture, "X_D3DFMT_P8 -> CXBXFMT_L8" }, // 8-bit palletized
|
||||
/* 0x0C X_D3DFMT_DXT1 */ { 4, Cmprsd, ____DXT1, CXBXFMT_DXT1 }, // opaque/one-bit alpha // NOTE : DXT1 is half byte per pixel, so divide Size and Pitch calculations by two!
|
||||
/* 0x0D undefined */ {},
|
||||
/* 0x0E X_D3DFMT_DXT3 */ { 8, Cmprsd, ____DXT3, _9_11(D3DFMT_DXT3, DXGI_FORMAT_BC2_UNORM) }, // Alias : X_D3DFMT_DXT2 // linear alpha
|
||||
/* 0x0F X_D3DFMT_DXT5 */ { 8, Cmprsd, ____DXT5, _9_11(D3DFMT_DXT5, DXGI_FORMAT_BC3_UNORM) }, // Alias : X_D3DFMT_DXT4 // interpolated alpha
|
||||
/* 0x10 X_D3DFMT_LIN_A1R5G5B5 */ { 16, Linear, A1R5G5B5, _9_11(D3DFMT_A1R5G5B5, DXGI_FORMAT_B5G5R5A1_UNORM) },
|
||||
/* 0x11 X_D3DFMT_LIN_R5G6B5 */ { 16, Linear, __R5G6B5, _9_11(D3DFMT_R5G6B5, DXGI_FORMAT_B5G6R5_UNORM) , RenderTarget },
|
||||
/* 0x12 X_D3DFMT_LIN_A8R8G8B8 */ { 32, Linear, A8R8G8B8, _9_11(D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM) , RenderTarget },
|
||||
/* 0x13 X_D3DFMT_LIN_L8 */ { 8, Linear, ______L8, _9_11(D3DFMT_L8, DXGI_FORMAT_R8_UNORM) , RenderTarget },
|
||||
/* 0x0E X_D3DFMT_DXT3 */ { 8, Cmprsd, ____DXT3, CXBXFMT_DXT3 }, // Alias : X_D3DFMT_DXT2 // linear alpha
|
||||
/* 0x0F X_D3DFMT_DXT5 */ { 8, Cmprsd, ____DXT5, CXBXFMT_DXT5 }, // Alias : X_D3DFMT_DXT4 // interpolated alpha
|
||||
/* 0x10 X_D3DFMT_LIN_A1R5G5B5 */ { 16, Linear, A1R5G5B5, CXBXFMT_A1R5G5B5 },
|
||||
/* 0x11 X_D3DFMT_LIN_R5G6B5 */ { 16, Linear, __R5G6B5, CXBXFMT_R5G6B5 , RenderTarget },
|
||||
/* 0x12 X_D3DFMT_LIN_A8R8G8B8 */ { 32, Linear, A8R8G8B8, CXBXFMT_A8R8G8B8 , RenderTarget },
|
||||
/* 0x13 X_D3DFMT_LIN_L8 */ { 8, Linear, ______L8, CXBXFMT_L8 , RenderTarget },
|
||||
/* 0x14 undefined */ {},
|
||||
/* 0x15 undefined */ {},
|
||||
/* 0x16 X_D3DFMT_LIN_R8B8 */ { 16, Linear, ____R8B8, _9_11(D3DFMT_A8L8, DXGI_FORMAT_R8G8_UNORM) , Texture, "X_D3DFMT_LIN_R8B8 -> D3DFMT_R5G6B5" },
|
||||
/* 0x17 X_D3DFMT_LIN_G8B8 */ { 16, Linear, ____G8B8, _9_11(D3DFMT_A8L8, DXGI_FORMAT_R8G8_UNORM) , RenderTarget, "X_D3DFMT_LIN_G8B8 -> D3DFMT_R5G6B5" }, // Alias : X_D3DFMT_LIN_V8U8
|
||||
/* 0x16 X_D3DFMT_LIN_R8B8 */ { 16, Linear, ____R8B8, CXBXFMT_A8L8 , Texture, "X_D3DFMT_LIN_R8B8 -> CXBXFMT_R5G6B5" },
|
||||
/* 0x17 X_D3DFMT_LIN_G8B8 */ { 16, Linear, ____G8B8, CXBXFMT_A8L8 , RenderTarget, "X_D3DFMT_LIN_G8B8 -> CXBXFMT_R5G6B5" }, // Alias : X_D3DFMT_LIN_V8U8
|
||||
/* 0x18 undefined */ {},
|
||||
/* 0x19 X_D3DFMT_A8 */ { 8, Swzzld, ______A8, _9_11(D3DFMT_A8, DXGI_FORMAT_A8_UNORM) , Texture, "X_D3DFMT_A8 -> D3DFMT_A8R8G8B8" }, // D3D9 sets RGB = 0 instead of 1
|
||||
/* 0x1A X_D3DFMT_A8L8 */ { 16, Swzzld, ____A8L8, _9_11(D3DFMT_A8L8, DXGI_FORMAT_R8G8_UNORM) },
|
||||
/* 0x1B X_D3DFMT_LIN_AL8 */ { 8, Linear, _____AL8, _9_11(D3DFMT_L8, DXGI_FORMAT_R8_UNORM) , Texture, "X_D3DFMT_LIN_AL8 -> D3DFMT_L8" },
|
||||
/* 0x1C X_D3DFMT_LIN_X1R5G5B5 */ { 16, Linear, X1R5G5B5, _9_11(D3DFMT_X1R5G5B5, DXGI_FORMAT_B5G5R5A1_UNORM) , RenderTarget }, // D3D11 TODO : Default A in shader
|
||||
/* 0x1D X_D3DFMT_LIN_A4R4G4B4 */ { 16, Linear, A4R4G4B4, _9_11(D3DFMT_A4R4G4B4, DXGI_FORMAT_B4G4R4A4_UNORM) },
|
||||
/* 0x1E X_D3DFMT_LIN_X8R8G8B8 */ { 32, Linear, X8R8G8B8, _9_11(D3DFMT_X8R8G8B8, DXGI_FORMAT_B8G8R8X8_UNORM) , RenderTarget }, // Alias : X_D3DFMT_LIN_X8L8V8U8
|
||||
/* 0x1F X_D3DFMT_LIN_A8 */ { 8, Linear, ______A8, _9_11(D3DFMT_A8, DXGI_FORMAT_A8_UNORM) , Texture, "X_D3DFMT_LIN_A8 -> D3DFMT_A8R8G8B8" }, // D3D9 sets RGB = 0 instead of 1
|
||||
/* 0x20 X_D3DFMT_LIN_A8L8 */ { 16, Linear, ____A8L8, _9_11(D3DFMT_A8L8, DXGI_FORMAT_R8G8_UNORM) },
|
||||
/* 0x19 X_D3DFMT_A8 */ { 8, Swzzld, ______A8, CXBXFMT_A8 , Texture, "X_D3DFMT_A8 -> CXBXFMT_A8R8G8B8" }, // D3D9 sets RGB = 0 instead of 1
|
||||
/* 0x1A X_D3DFMT_A8L8 */ { 16, Swzzld, ____A8L8, CXBXFMT_A8L8 },
|
||||
/* 0x1B X_D3DFMT_LIN_AL8 */ { 8, Linear, _____AL8, CXBXFMT_L8 , Texture, "X_D3DFMT_LIN_AL8 -> CXBXFMT_L8" },
|
||||
/* 0x1C X_D3DFMT_LIN_X1R5G5B5 */ { 16, Linear, X1R5G5B5, CXBXFMT_X1R5G5B5 , RenderTarget }, // D3D11 TODO : Default A in shader
|
||||
/* 0x1D X_D3DFMT_LIN_A4R4G4B4 */ { 16, Linear, A4R4G4B4, CXBXFMT_A4R4G4B4 },
|
||||
/* 0x1E X_D3DFMT_LIN_X8R8G8B8 */ { 32, Linear, X8R8G8B8, CXBXFMT_X8R8G8B8 , RenderTarget }, // Alias : X_D3DFMT_LIN_X8L8V8U8
|
||||
/* 0x1F X_D3DFMT_LIN_A8 */ { 8, Linear, ______A8, CXBXFMT_A8 , Texture, "X_D3DFMT_LIN_A8 -> CXBXFMT_A8R8G8B8" }, // D3D9 sets RGB = 0 instead of 1
|
||||
/* 0x20 X_D3DFMT_LIN_A8L8 */ { 16, Linear, ____A8L8, CXBXFMT_A8L8 },
|
||||
/* 0x21 undefined */ {},
|
||||
/* 0x22 undefined */ {},
|
||||
/* 0x23 undefined */ {},
|
||||
/* 0x24 X_D3DFMT_YUY2 */ { 16, Linear, ____YUY2, _9_11(D3DFMT_YUY2, DXGI_FORMAT_YUY2) }, // DXGI_FORMAT_NOT_AVAILABLE ?
|
||||
/* 0x25 X_D3DFMT_UYVY */ { 16, Linear, ____UYVY, _9_11(D3DFMT_UYVY, DXGI_FORMAT_NOT_AVAILABLE) },
|
||||
/* 0x24 X_D3DFMT_YUY2 */ { 16, Linear, ____YUY2, CXBXFMT_YUY2 }, // DXGI_FORMAT_NOT_AVAILABLE ?
|
||||
/* 0x25 X_D3DFMT_UYVY */ { 16, Linear, ____UYVY, CXBXFMT_UYVY },
|
||||
/* 0x26 undefined */ {},
|
||||
/* 0x27 X_D3DFMT_L6V5U5 */ { 16, Swzzld, __R6G5B5, _9_11(D3DFMT_L6V5U5, DXGI_FORMAT_NOT_AVAILABLE) }, // Alias : X_D3DFMT_R6G5B5 // XQEMU NOTE : This might be signed
|
||||
/* 0x28 X_D3DFMT_V8U8 */ { 16, Swzzld, ____G8B8, _9_11(D3DFMT_V8U8, DXGI_FORMAT_R8G8_SNORM) }, // Alias : X_D3DFMT_G8B8 // XQEMU NOTE : This might be signed
|
||||
/* 0x29 X_D3DFMT_R8B8 */ { 16, Swzzld, ____R8B8, _9_11(D3DFMT_A8L8, DXGI_FORMAT_R8G8_UNORM) , Texture, "X_D3DFMT_R8B8 -> D3DFMT_R5G6B5" }, // XQEMU NOTE : This might be signed
|
||||
/* 0x2A X_D3DFMT_D24S8 */ { 32, Swzzld, NoCmpnts, _9_11(D3DFMT_D24S8, DXGI_FORMAT_D24_UNORM_S8_UINT), DepthBuffer },
|
||||
/* 0x2B X_D3DFMT_F24S8 */ { 32, Swzzld, NoCmpnts, _9_11(D3DFMT_D24FS8, DXGI_FORMAT_R24G8_TYPELESS) , DepthBuffer },
|
||||
/* 0x2C X_D3DFMT_D16 */ { 16, Swzzld, NoCmpnts, _9_11(D3DFMT_D16, DXGI_FORMAT_D16_UNORM) , DepthBuffer }, // Note : X_D3DFMT_D16 is always lockable on Xbox, D3DFMT_D16 on host is not, but D3DFMT_D16_LOCKABLE often fails SetRenderTarget.
|
||||
/* 0x2D X_D3DFMT_F16 */ { 16, Swzzld, NoCmpnts, _9_11(D3DFMT_R16F, DXGI_FORMAT_R16_FLOAT) , DepthBuffer, "X_D3DFMT_F16 -> D3DFMT_R16F" }, // HACK : PC doesn't have D3DFMT_F16 (Float vs Int) // TODO : Use D3DFMT_R16F?
|
||||
/* 0x2E X_D3DFMT_LIN_D24S8 */ { 32, Linear, NoCmpnts, _9_11(D3DFMT_D24S8, DXGI_FORMAT_D24_UNORM_S8_UINT), DepthBuffer },
|
||||
/* 0x2F X_D3DFMT_LIN_F24S8 */ { 32, Linear, NoCmpnts, _9_11(D3DFMT_D24FS8, DXGI_FORMAT_R24G8_TYPELESS) , DepthBuffer },
|
||||
/* 0x30 X_D3DFMT_LIN_D16 */ { 16, Linear, NoCmpnts, _9_11(D3DFMT_D16, DXGI_FORMAT_D16_UNORM) , DepthBuffer }, // Note : X_D3DFMT_D16 is always lockable on Xbox, D3DFMT_D16 on host is not, but D3DFMT_D16_LOCKABLE often fails SetRenderTarget.
|
||||
/* 0x31 X_D3DFMT_LIN_F16 */ { 16, Linear, NoCmpnts, _9_11(D3DFMT_R16F, DXGI_FORMAT_R16_FLOAT) , DepthBuffer, "X_D3DFMT_LIN_F16 -> D3DFMT_R16F" }, // HACK : PC doesn't have D3DFMT_F16 (Float vs Int) // TODO : Use D3DFMT_R16F?
|
||||
/* 0x32 X_D3DFMT_L16 */ { 16, Swzzld, _____L16, _9_11(D3DFMT_L16, DXGI_FORMAT_R16_UNORM) },
|
||||
/* 0x33 X_D3DFMT_V16U16 */ { 32, Swzzld, NoCmpnts, _9_11(D3DFMT_V16U16, DXGI_FORMAT_R16G16_SNORM) },
|
||||
/* 0x27 X_D3DFMT_L6V5U5 */ { 16, Swzzld, __R6G5B5, CXBXFMT_L6V5U5 }, // Alias : X_D3DFMT_R6G5B5 // XQEMU NOTE : This might be signed
|
||||
/* 0x28 X_D3DFMT_V8U8 */ { 16, Swzzld, ____G8B8, CXBXFMT_V8U8 }, // Alias : X_D3DFMT_G8B8 // XQEMU NOTE : This might be signed
|
||||
/* 0x29 X_D3DFMT_R8B8 */ { 16, Swzzld, ____R8B8, CXBXFMT_A8L8 , Texture, "X_D3DFMT_R8B8 -> CXBXFMT_R5G6B5" }, // XQEMU NOTE : This might be signed
|
||||
/* 0x2A X_D3DFMT_D24S8 */ { 32, Swzzld, NoCmpnts, CXBXFMT_D24S8 , DepthBuffer },
|
||||
/* 0x2B X_D3DFMT_F24S8 */ { 32, Swzzld, NoCmpnts, CXBXFMT_D24FS8 , DepthBuffer },
|
||||
/* 0x2C X_D3DFMT_D16 */ { 16, Swzzld, NoCmpnts, CXBXFMT_D16 , DepthBuffer }, // Note : X_D3DFMT_D16 is always lockable on Xbox, CXBXFMT_D16 on host is not, but CXBXFMT_D16_LOCKABLE often fails SetRenderTarget.
|
||||
/* 0x2D X_D3DFMT_F16 */ { 16, Swzzld, NoCmpnts, CXBXFMT_R16F , DepthBuffer, "X_D3DFMT_F16 -> CXBXFMT_R16F" }, // HACK : PC doesn't have CXBXFMT_F16 (Float vs Int) // TODO : Use CXBXFMT_R16F?
|
||||
/* 0x2E X_D3DFMT_LIN_D24S8 */ { 32, Linear, NoCmpnts, CXBXFMT_D24S8 , DepthBuffer },
|
||||
/* 0x2F X_D3DFMT_LIN_F24S8 */ { 32, Linear, NoCmpnts, CXBXFMT_D24FS8 , DepthBuffer },
|
||||
/* 0x30 X_D3DFMT_LIN_D16 */ { 16, Linear, NoCmpnts, CXBXFMT_D16 , DepthBuffer }, // Note : X_D3DFMT_D16 is always lockable on Xbox, CXBXFMT_D16 on host is not, but CXBXFMT_D16_LOCKABLE often fails SetRenderTarget.
|
||||
/* 0x31 X_D3DFMT_LIN_F16 */ { 16, Linear, NoCmpnts, CXBXFMT_R16F , DepthBuffer, "X_D3DFMT_LIN_F16 -> CXBXFMT_R16F" }, // HACK : PC doesn't have CXBXFMT_F16 (Float vs Int) // TODO : Use CXBXFMT_R16F?
|
||||
/* 0x32 X_D3DFMT_L16 */ { 16, Swzzld, _____L16, CXBXFMT_L16 },
|
||||
/* 0x33 X_D3DFMT_V16U16 */ { 32, Swzzld, NoCmpnts, CXBXFMT_V16U16 },
|
||||
/* 0x34 undefined */ {},
|
||||
/* 0x35 X_D3DFMT_LIN_L16 */ { 16, Linear, _____L16, _9_11(D3DFMT_L16, DXGI_FORMAT_R16_UNORM) },
|
||||
/* 0x36 X_D3DFMT_LIN_V16U16 */ { 32, Linear, NoCmpnts, _9_11(D3DFMT_V16U16, DXGI_FORMAT_R16G16_SNORM) }, // Note : Seems unused on Xbox
|
||||
/* 0x37 X_D3DFMT_LIN_L6V5U5 */ { 16, Linear, __R6G5B5, _9_11(D3DFMT_L6V5U5, DXGI_FORMAT_NOT_AVAILABLE) }, // Alias : X_D3DFMT_LIN_R6G5B5
|
||||
/* 0x38 X_D3DFMT_R5G5B5A1 */ { 16, Swzzld, R5G5B5A1, _9_11(D3DFMT_A1R5G5B5, DXGI_FORMAT_B5G5R5A1_UNORM) , Texture, "X_D3DFMT_R5G5B5A1 -> D3DFMT_A1R5G5B5" },
|
||||
/* 0x39 X_D3DFMT_R4G4B4A4 */ { 16, Swzzld, R4G4B4A4, _9_11(D3DFMT_A4R4G4B4, DXGI_FORMAT_B4G4R4A4_UNORM) , Texture, "X_D3DFMT_R4G4B4A4 -> D3DFMT_A4R4G4B4" },
|
||||
/* 0x3A X_D3DFMT_Q8W8V8U8 */ { 32, Swzzld, A8B8G8R8, _9_11(D3DFMT_Q8W8V8U8, DXGI_FORMAT_R8G8B8A8_SNORM) }, // Alias : X_D3DFMT_A8B8G8R8 // Note : D3DFMT_A8B8G8R8=32 D3DFMT_Q8W8V8U8=63 // TODO : Needs testcase.
|
||||
/* 0x3B X_D3DFMT_B8G8R8A8 */ { 32, Swzzld, B8G8R8A8, _9_11(D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM) , Texture, "X_D3DFMT_B8G8R8A8 -> D3DFMT_A8R8G8B8" },
|
||||
/* 0x3C X_D3DFMT_R8G8B8A8 */ { 32, Swzzld, R8G8B8A8, _9_11(D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM) , Texture, "X_D3DFMT_R8G8B8A8 -> D3DFMT_A8R8G8B8" },
|
||||
/* 0x3D X_D3DFMT_LIN_R5G5B5A1 */ { 16, Linear, R5G5B5A1, _9_11(D3DFMT_A1R5G5B5, DXGI_FORMAT_B5G5R5A1_UNORM) , Texture, "X_D3DFMT_LIN_R5G5B5A1 -> D3DFMT_A1R5G5B5" },
|
||||
/* 0x3E X_D3DFMT_LIN_R4G4B4A4 */ { 16, Linear, R4G4B4A4, _9_11(D3DFMT_A4R4G4B4, DXGI_FORMAT_B4G4R4A4_UNORM) , Texture, "X_D3DFMT_LIN_R4G4B4A4 -> D3DFMT_A4R4G4B4" },
|
||||
/* 0x3F X_D3DFMT_LIN_A8B8G8R8 */ { 32, Linear, A8B8G8R8, _9_11(D3DFMT_A8B8G8R8, DXGI_FORMAT_R8G8B8A8_UNORM) }, // Note : D3DFMT_A8B8G8R8=32 D3DFMT_Q8W8V8U8=63 // TODO : Needs testcase.
|
||||
/* 0x40 X_D3DFMT_LIN_B8G8R8A8 */ { 32, Linear, B8G8R8A8, _9_11(D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM) , Texture, "X_D3DFMT_LIN_B8G8R8A8 -> D3DFMT_A8R8G8B8" },
|
||||
/* 0x41 X_D3DFMT_LIN_R8G8B8A8 */ { 32, Linear, R8G8B8A8, _9_11(D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM) , Texture, "X_D3DFMT_LIN_R8G8B8A8 -> D3DFMT_A8R8G8B8" },
|
||||
/* 0x35 X_D3DFMT_LIN_L16 */ { 16, Linear, _____L16, CXBXFMT_L16 },
|
||||
/* 0x36 X_D3DFMT_LIN_V16U16 */ { 32, Linear, NoCmpnts, CXBXFMT_V16U16 }, // Note : Seems unused on Xbox
|
||||
/* 0x37 X_D3DFMT_LIN_L6V5U5 */ { 16, Linear, __R6G5B5, CXBXFMT_L6V5U5 }, // Alias : X_D3DFMT_LIN_R6G5B5
|
||||
/* 0x38 X_D3DFMT_R5G5B5A1 */ { 16, Swzzld, R5G5B5A1, CXBXFMT_A1R5G5B5 , Texture, "X_D3DFMT_R5G5B5A1 -> CXBXFMT_A1R5G5B5" },
|
||||
/* 0x39 X_D3DFMT_R4G4B4A4 */ { 16, Swzzld, R4G4B4A4, CXBXFMT_A4R4G4B4 , Texture, "X_D3DFMT_R4G4B4A4 -> CXBXFMT_A4R4G4B4" },
|
||||
/* 0x3A X_D3DFMT_Q8W8V8U8 */ { 32, Swzzld, A8B8G8R8, CXBXFMT_Q8W8V8U8 }, // Alias : X_D3DFMT_A8B8G8R8 // Note : CXBXFMT_A8B8G8R8=32 CXBXFMT_Q8W8V8U8=63 // TODO : Needs testcase.
|
||||
/* 0x3B X_D3DFMT_B8G8R8A8 */ { 32, Swzzld, B8G8R8A8, CXBXFMT_A8R8G8B8 , Texture, "X_D3DFMT_B8G8R8A8 -> CXBXFMT_A8R8G8B8" },
|
||||
/* 0x3C X_D3DFMT_R8G8B8A8 */ { 32, Swzzld, R8G8B8A8, CXBXFMT_A8R8G8B8 , Texture, "X_D3DFMT_R8G8B8A8 -> CXBXFMT_A8R8G8B8" },
|
||||
/* 0x3D X_D3DFMT_LIN_R5G5B5A1 */ { 16, Linear, R5G5B5A1, CXBXFMT_A1R5G5B5 , Texture, "X_D3DFMT_LIN_R5G5B5A1 -> CXBXFMT_A1R5G5B5" },
|
||||
/* 0x3E X_D3DFMT_LIN_R4G4B4A4 */ { 16, Linear, R4G4B4A4, CXBXFMT_A4R4G4B4 , Texture, "X_D3DFMT_LIN_R4G4B4A4 -> CXBXFMT_A4R4G4B4" },
|
||||
/* 0x3F X_D3DFMT_LIN_A8B8G8R8 */ { 32, Linear, A8B8G8R8, CXBXFMT_A8B8G8R8 }, // Note : CXBXFMT_A8B8G8R8=32 CXBXFMT_Q8W8V8U8=63 // TODO : Needs testcase.
|
||||
/* 0x40 X_D3DFMT_LIN_B8G8R8A8 */ { 32, Linear, B8G8R8A8, CXBXFMT_A8R8G8B8 , Texture, "X_D3DFMT_LIN_B8G8R8A8 -> CXBXFMT_A8R8G8B8" },
|
||||
/* 0x41 X_D3DFMT_LIN_R8G8B8A8 */ { 32, Linear, R8G8B8A8, CXBXFMT_A8R8G8B8 , Texture, "X_D3DFMT_LIN_R8G8B8A8 -> CXBXFMT_A8R8G8B8" },
|
||||
#if 0
|
||||
/* 0x42 to 0x63 undefined */ {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},
|
||||
/* 0x64 X_D3DFMT_VERTEXDATA */ { 8, Linear, NoCmpnts, D3DFMT_VERTEXDATA },
|
||||
/* 0x65 X_D3DFMT_INDEX16 */ { 16, Linear, NoCmpnts, D3DFMT_INDEX16 }, // Dxbx addition : X_D3DFMT_INDEX16 is not an Xbox format, but used internally
|
||||
/* 0x64 X_D3DFMT_VERTEXDATA */ { 8, Linear, NoCmpnts, CXBXFMT_VERTEXDATA },
|
||||
/* 0x65 X_D3DFMT_INDEX16 */ { 16, Linear, NoCmpnts, CXBXFMT_INDEX16 }, // Dxbx addition : X_D3DFMT_INDEX16 is not an Xbox format, but used internally
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -1049,93 +1046,107 @@ CXBXFORMAT EmuXB2PC_D3DFormat(xbox::X_D3DFORMAT Format)
|
|||
#ifdef CXBX_USE_D3D11
|
||||
[[fallthrough]]; // This case is unlikely to ever get passed in here anyway
|
||||
#else
|
||||
return D3DFMT_VERTEXDATA;
|
||||
return CXBXFMT_VERTEXDATA;
|
||||
#endif
|
||||
case xbox::X_D3DFMT_UNKNOWN: [[fallthrough]]; // Test-case : Metal Slug 3?
|
||||
case ((xbox::X_D3DFORMAT)0xffffffff):
|
||||
return _9_11(D3DFMT_UNKNOWN, DXGI_FORMAT_UNKNOWN); // TODO -oCXBX: Not sure if this counts as swizzled or not...
|
||||
return CXBXFMT_UNKNOWN; // TODO -oCXBX: Not sure if this counts as swizzled or not...
|
||||
default:
|
||||
CxbxrAbort("EmuXB2PC_D3DFormat: Unknown Format (0x%.08X)", Format);
|
||||
}
|
||||
|
||||
return _9_11(D3DFMT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
|
||||
return CXBXFMT_UNKNOWN;
|
||||
}
|
||||
|
||||
xbox::X_D3DFORMAT EmuPC2XB_D3DFormat(D3DFORMAT Format, bool bPreferLinear)
|
||||
xbox::X_D3DFORMAT EmuPC2XB_D3DFormat(CXBXFORMAT Format, bool bPreferLinear)
|
||||
{
|
||||
xbox::X_D3DFORMAT result;
|
||||
switch(Format)
|
||||
{
|
||||
case D3DFMT_YUY2:
|
||||
case CXBXFMT_YUY2:
|
||||
result = xbox::X_D3DFMT_YUY2;
|
||||
break;
|
||||
case D3DFMT_UYVY:
|
||||
#ifndef CXBX_USE_D3D11 // Mapped to DXGI_FORMAT_NOT_AVAILABLE
|
||||
case CXBXFMT_UYVY:
|
||||
result = xbox::X_D3DFMT_UYVY;
|
||||
break;
|
||||
case D3DFMT_R5G6B5:
|
||||
#endif
|
||||
case CXBXFMT_R5G6B5:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_R5G6B5 : xbox::X_D3DFMT_R5G6B5;
|
||||
break;
|
||||
case D3DFMT_D24S8:
|
||||
case CXBXFMT_D24S8:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_D24S8 : xbox::X_D3DFMT_D24S8;
|
||||
break;
|
||||
case D3DFMT_DXT5:
|
||||
case CXBXFMT_DXT5:
|
||||
result = xbox::X_D3DFMT_DXT5; // Compressed
|
||||
break;
|
||||
case D3DFMT_DXT4:
|
||||
#ifndef CXBX_USE_D3D11 // Mapped to DXGI_FORMAT_NOT_AVAILABLE
|
||||
case CXBXFMT_DXT4:
|
||||
result = xbox::X_D3DFMT_DXT4; // Compressed // Same as xbox::X_D3DFMT_DXT5
|
||||
break;
|
||||
case D3DFMT_DXT3:
|
||||
#endif
|
||||
case CXBXFMT_DXT3:
|
||||
result = xbox::X_D3DFMT_DXT3; // Compressed
|
||||
break;
|
||||
case D3DFMT_DXT2:
|
||||
#ifndef CXBX_USE_D3D11 // Mapped to DXGI_FORMAT_NOT_AVAILABLE
|
||||
case CXBXFMT_DXT2:
|
||||
result = xbox::X_D3DFMT_DXT2; // Compressed // Same as xbox::X_D3DFMT_DXT3
|
||||
break;
|
||||
case D3DFMT_DXT1:
|
||||
#endif
|
||||
case CXBXFMT_DXT1:
|
||||
result = xbox::X_D3DFMT_DXT1; // Compressed
|
||||
break;
|
||||
case D3DFMT_A1R5G5B5:
|
||||
case CXBXFMT_A1R5G5B5:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_A1R5G5B5 : xbox::X_D3DFMT_A1R5G5B5;
|
||||
break;
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case CXBXFMT_X8R8G8B8:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_X8R8G8B8 : xbox::X_D3DFMT_X8R8G8B8;
|
||||
break;
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case CXBXFMT_A8R8G8B8:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_A8R8G8B8 : xbox::X_D3DFMT_A8R8G8B8;
|
||||
break;
|
||||
case D3DFMT_A4R4G4B4:
|
||||
case CXBXFMT_A4R4G4B4:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_A4R4G4B4 : xbox::X_D3DFMT_A4R4G4B4;
|
||||
break;
|
||||
case D3DFMT_X1R5G5B5:
|
||||
#ifndef CXBX_USE_D3D11 // Note : CXBXFMT_A1R5G5B5 maps to same DXGI_FORMAT_B5G5R5A1_UNORM
|
||||
case CXBXFMT_X1R5G5B5:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_X1R5G5B5 : xbox::X_D3DFMT_X1R5G5B5;
|
||||
break;
|
||||
case D3DFMT_A8:
|
||||
#endif
|
||||
case CXBXFMT_A8:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_A8 : xbox::X_D3DFMT_A8;
|
||||
break;
|
||||
case D3DFMT_L8:
|
||||
case CXBXFMT_L8:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_L8 : xbox::X_D3DFMT_L8;
|
||||
break;
|
||||
case D3DFMT_D16:
|
||||
case CXBXFMT_D16:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_D16 : xbox::X_D3DFMT_D16;
|
||||
break;
|
||||
case D3DFMT_D16_LOCKABLE:
|
||||
#ifndef CXBX_USE_D3D11 // Mapped to DXGI_FORMAT_NOT_AVAILABLE
|
||||
case CXBXFMT_D16_LOCKABLE:
|
||||
result = xbox::X_D3DFMT_D16_LOCKABLE;
|
||||
break;
|
||||
case D3DFMT_UNKNOWN:
|
||||
#endif
|
||||
case CXBXFMT_UNKNOWN:
|
||||
result = ((xbox::X_D3DFORMAT)0xffffffff); // TODO : return xbox::X_D3DFMT_UNKNOWN ?
|
||||
break;
|
||||
// Dxbx additions :
|
||||
case D3DFMT_L6V5U5:
|
||||
#ifndef CXBX_USE_D3D11 // Mapped to DXGI_FORMAT_NOT_AVAILABLE
|
||||
case CXBXFMT_L6V5U5:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_L6V5U5 : xbox::X_D3DFMT_L6V5U5;
|
||||
break;
|
||||
case D3DFMT_V8U8:
|
||||
#endif
|
||||
case CXBXFMT_V8U8:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_V8U8 : xbox::X_D3DFMT_V8U8;
|
||||
break;
|
||||
case D3DFMT_V16U16:
|
||||
case CXBXFMT_V16U16:
|
||||
result = bPreferLinear ? xbox::X_D3DFMT_LIN_V16U16 : xbox::X_D3DFMT_V16U16;
|
||||
break;
|
||||
case D3DFMT_VERTEXDATA:
|
||||
#ifndef CXBX_USE_D3D11 // Mapped to DXGI_FORMAT_NOT_AVAILABLE
|
||||
case CXBXFMT_VERTEXDATA:
|
||||
result = xbox::X_D3DFMT_VERTEXDATA;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
CxbxrAbort("EmuPC2XB_D3DFormat: Unknown Format (%d)", Format);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ extern BOOL EmuXBFormatIsDepthBuffer(xbox::X_D3DFORMAT Format);
|
|||
extern CXBXFORMAT EmuXB2PC_D3DFormat(xbox::X_D3DFORMAT Format);
|
||||
|
||||
// convert from pc to xbox color formats
|
||||
extern xbox::X_D3DFORMAT EmuPC2XB_D3DFormat(D3DFORMAT Format, bool bPreferLinear = true);
|
||||
extern xbox::X_D3DFORMAT EmuPC2XB_D3DFormat(CXBXFORMAT Format, bool bPreferLinear = true);
|
||||
|
||||
// convert from xbox to pc d3d lock flags
|
||||
extern DWORD EmuXB2PC_D3DLock(DWORD Flags);
|
||||
|
|
|
@ -100,6 +100,42 @@ typedef D3D11_RECT D3DRECT;
|
|||
#define IDirect3DVolume IDirect3DVolume9
|
||||
#define IDirect3DQuery _9_11(IDirect3DQuery9, ID3D11Query)
|
||||
|
||||
|
||||
// D3D9 D3FFORMAT to D3D11 DXGI_FORMAT mapping : https://docs.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-legacy-formats
|
||||
#define CXBXFMT_A1R5G5B5 _9_11(D3DFMT_A1R5G5B5, DXGI_FORMAT_B5G5R5A1_UNORM) // Note : CXBXFMT_X1R5G5B5 maps to same DXGI_FORMAT_B5G5R5A1_UNORM
|
||||
#define CXBXFMT_A4R4G4B4 _9_11(D3DFMT_A4R4G4B4, DXGI_FORMAT_B4G4R4A4_UNORM)
|
||||
#define CXBXFMT_A8 _9_11(D3DFMT_A8, DXGI_FORMAT_A8_UNORM)
|
||||
#define CXBXFMT_A8B8G8R8 _9_11(D3DFMT_A8B8G8R8, DXGI_FORMAT_R8G8B8A8_UNORM)
|
||||
#define CXBXFMT_A8L8 _9_11(D3DFMT_A8L8, DXGI_FORMAT_R8G8_UNORM)
|
||||
#define CXBXFMT_A8R8G8B8 _9_11(D3DFMT_A8R8G8B8, DXGI_FORMAT_B8G8R8A8_UNORM)
|
||||
#define CXBXFMT_D16 _9_11(D3DFMT_D16, DXGI_FORMAT_D16_UNORM)
|
||||
#define CXBXFMT_D24FS8 _9_11(D3DFMT_D24FS8, DXGI_FORMAT_R24G8_TYPELESS)
|
||||
#define CXBXFMT_D24S8 _9_11(D3DFMT_D24S8, DXGI_FORMAT_D24_UNORM_S8_UINT)
|
||||
#define CXBXFMT_DXT1 _9_11(D3DFMT_DXT1, DXGI_FORMAT_BC1_UNORM)
|
||||
#define CXBXFMT_DXT3 _9_11(D3DFMT_DXT3, DXGI_FORMAT_BC2_UNORM)
|
||||
#define CXBXFMT_DXT5 _9_11(D3DFMT_DXT5, DXGI_FORMAT_BC3_UNORM)
|
||||
#define CXBXFMT_L16 _9_11(D3DFMT_L16, DXGI_FORMAT_R16_UNORM)
|
||||
#define CXBXFMT_L8 _9_11(D3DFMT_L8, DXGI_FORMAT_R8_UNORM)
|
||||
#define CXBXFMT_P8 _9_11(D3DFMT_P8, DXGI_FORMAT_R8_UINT)
|
||||
#define CXBXFMT_Q8W8V8U8 _9_11(D3DFMT_Q8W8V8U8, DXGI_FORMAT_R8G8B8A8_SNORM)
|
||||
#define CXBXFMT_R16F _9_11(D3DFMT_R16F, DXGI_FORMAT_R16_FLOAT)
|
||||
#define CXBXFMT_R5G6B5 _9_11(D3DFMT_R5G6B5, DXGI_FORMAT_B5G6R5_UNORM)
|
||||
#define CXBXFMT_UNKNOWN _9_11(D3DFMT_UNKNOWN, DXGI_FORMAT_UNKNOWN) // Note : Used when format is unknown (duh)
|
||||
#define CXBXFMT_V16U16 _9_11(D3DFMT_V16U16, DXGI_FORMAT_R16G16_SNORM)
|
||||
#define CXBXFMT_V8U8 _9_11(D3DFMT_V8U8, DXGI_FORMAT_R8G8_SNORM)
|
||||
#define CXBXFMT_X1R5G5B5 _9_11(D3DFMT_X1R5G5B5, DXGI_FORMAT_B5G5R5A1_UNORM) // Note : CXBXFMT_A1R5G5B5 maps to same DXGI_FORMAT_B5G5R5A1_UNORM
|
||||
#define CXBXFMT_X8R8G8B8 _9_11(D3DFMT_X8R8G8B8, DXGI_FORMAT_B8G8R8X8_UNORM)
|
||||
#define CXBXFMT_YUY2 _9_11(D3DFMT_YUY2, DXGI_FORMAT_YUY2)
|
||||
|
||||
#define DXGI_FORMAT_NOT_AVAILABLE DXGI_FORMAT_UNKNOWN // TODO : Replace below occurences with a suitable format and corresponding conversion
|
||||
// Unmappable to Direct3D 11 :
|
||||
#define CXBXFMT_D16_LOCKABLE _9_11(D3DFMT_D16_LOCKABLE, DXGI_FORMAT_NOT_AVAILABLE) // TODO : (CXBXFORMAT)200 ? How to handle in our code?
|
||||
#define CXBXFMT_DXT2 _9_11(D3DFMT_DXT2, DXGI_FORMAT_NOT_AVAILABLE) // TODO : (CXBXFORMAT)201 ? How to handle in our code?
|
||||
#define CXBXFMT_DXT4 _9_11(D3DFMT_DXT4, DXGI_FORMAT_NOT_AVAILABLE) // TODO : (CXBXFORMAT)202 ? How to handle in our code?
|
||||
#define CXBXFMT_L6V5U5 _9_11(D3DFMT_L6V5U5, DXGI_FORMAT_NOT_AVAILABLE) // TODO : (CXBXFORMAT)203 ? How to handle in our code?
|
||||
#define CXBXFMT_UYVY _9_11(D3DFMT_UYVY, DXGI_FORMAT_NOT_AVAILABLE) // TODO : (CXBXFORMAT)204 ? How to handle in our code?
|
||||
#define CXBXFMT_VERTEXDATA _9_11(D3DFMT_VERTEXDATA, DXGI_FORMAT_NOT_AVAILABLE) // TODO : (CXBXFORMAT)205 ? How to handle in our code?
|
||||
|
||||
typedef xbox::word_xt INDEX16; // TODO: Move INDEX16 into xbox namespace
|
||||
|
||||
namespace xbox {
|
||||
|
|
|
@ -348,7 +348,7 @@ void RefreshDirect3DDevice()
|
|||
{
|
||||
uint32_t dwAdapterModeCount = g_pDirect3D->GetAdapterModeCount(
|
||||
g_XBVideo.adapter
|
||||
, D3DFMT_X8R8G8B8
|
||||
, CXBXFMT_X8R8G8B8
|
||||
);
|
||||
|
||||
SendMessage(g_hVideoResolution, CB_ADDSTRING, 0, (LPARAM)"Automatic (Xbox Default)");
|
||||
|
@ -362,23 +362,23 @@ void RefreshDirect3DDevice()
|
|||
|
||||
g_pDirect3D->EnumAdapterModes(
|
||||
g_XBVideo.adapter,
|
||||
D3DFMT_X8R8G8B8,
|
||||
CXBXFMT_X8R8G8B8,
|
||||
v,
|
||||
&displayMode
|
||||
);
|
||||
|
||||
switch(displayMode.Format)
|
||||
{
|
||||
case D3DFMT_X1R5G5B5:
|
||||
case CXBXFMT_X1R5G5B5:
|
||||
szFormat = "16bit x1r5g5b5";
|
||||
break;
|
||||
case D3DFMT_R5G6B5:
|
||||
case CXBXFMT_R5G6B5:
|
||||
szFormat = "16bit r5g6r5";
|
||||
break;
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case CXBXFMT_X8R8G8B8:
|
||||
szFormat = "32bit x8r8g8b8";
|
||||
break;
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case CXBXFMT_A8R8G8B8:
|
||||
szFormat = "32bit a8r8g8b8";
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1502,19 +1502,19 @@ void WndMain::LoadGameLogo()
|
|||
switch (*(DWORD*)pSection) {
|
||||
case MAKEFOURCC('D', 'D', 'S', ' '): {
|
||||
DDS_HEADER *pDDSHeader = (DDS_HEADER *)(pSection + sizeof(DWORD));
|
||||
D3DFORMAT Format = D3DFMT_UNKNOWN;
|
||||
CXBXFORMAT Format = CXBXFMT_UNKNOWN;
|
||||
if (pDDSHeader->ddspf.dwFlags & DDPF_FOURCC) {
|
||||
switch (pDDSHeader->ddspf.dwFourCC) {
|
||||
case MAKEFOURCC('D', 'X', 'T', '1'): Format = D3DFMT_DXT1; break;
|
||||
case MAKEFOURCC('D', 'X', 'T', '3'): Format = D3DFMT_DXT3; break;
|
||||
case MAKEFOURCC('D', 'X', 'T', '5'): Format = D3DFMT_DXT5; break;
|
||||
case MAKEFOURCC('D', 'X', 'T', '1'): Format = CXBXFMT_DXT1; break;
|
||||
case MAKEFOURCC('D', 'X', 'T', '3'): Format = CXBXFMT_DXT3; break;
|
||||
case MAKEFOURCC('D', 'X', 'T', '5'): Format = CXBXFMT_DXT5; break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// TODO : Determine D3D format based on pDDSHeader->ddspf.dwABitMask, .dwRBitMask, .dwGBitMask and .dwBBitMask
|
||||
}
|
||||
|
||||
if (Format == D3DFMT_UNKNOWN)
|
||||
if (Format == CXBXFMT_UNKNOWN)
|
||||
return;
|
||||
|
||||
ImageData = (uint8_t *)(pSection + sizeof(DWORD) + pDDSHeader->dwSize);
|
||||
|
|
Loading…
Reference in New Issue