Converted X_D3DFORMAT into an enum type
This commit is contained in:
parent
8c87e21d6e
commit
b7c3c5591d
|
@ -274,10 +274,10 @@ VOID XTL::EmuD3DInit(Xbe::Header *XbeHeader, uint32 XbeHeaderSize)
|
|||
|
||||
PresParam.BackBufferWidth = 640;
|
||||
PresParam.BackBufferHeight = 480;
|
||||
PresParam.BackBufferFormat = 6; /* X_D3DFMT_A8R8G8B8 */
|
||||
PresParam.BackBufferFormat = X_D3DFMT_A8R8G8B8;
|
||||
PresParam.BackBufferCount = 1;
|
||||
PresParam.EnableAutoDepthStencil = TRUE;
|
||||
PresParam.AutoDepthStencilFormat = 0x2A; /* X_D3DFMT_D24S8 */
|
||||
PresParam.AutoDepthStencilFormat = X_D3DFMT_D24S8;
|
||||
PresParam.SwapEffect = XTL::D3DSWAPEFFECT_DISCARD;
|
||||
|
||||
|
||||
|
@ -745,7 +745,7 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
|
|||
{
|
||||
// only one device should be created at once
|
||||
// TODO: ensure all surfaces are somehow cleaned up?
|
||||
if(g_pD3DDevice8 != 0)
|
||||
if(g_pD3DDevice8 != nullptr)
|
||||
{
|
||||
DbgPrintf("EmuD3D8: CreateDevice proxy thread releasing old Device.\n");
|
||||
|
||||
|
@ -757,7 +757,7 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
|
|||
while(g_pD3DDevice8->Release() != 0);
|
||||
#endif
|
||||
|
||||
g_pD3DDevice8 = 0;
|
||||
g_pD3DDevice8 = nullptr;
|
||||
}
|
||||
|
||||
if(g_EmuCDPD.pPresentationParameters->BufferSurfaces[0] != NULL)
|
||||
|
@ -768,8 +768,8 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
|
|||
|
||||
// make adjustments to parameters to make sense with windows Direct3D
|
||||
{
|
||||
g_EmuCDPD.DeviceType =(g_XBVideo.GetDirect3DDevice() == 0) ? XTL::D3DDEVTYPE_HAL : XTL::D3DDEVTYPE_REF;
|
||||
g_EmuCDPD.Adapter = g_XBVideo.GetDisplayAdapter();
|
||||
g_EmuCDPD.DeviceType = (g_XBVideo.GetDirect3DDevice() == 0) ? XTL::D3DDEVTYPE_HAL : XTL::D3DDEVTYPE_REF;
|
||||
g_EmuCDPD.Adapter = g_XBVideo.GetDisplayAdapter();
|
||||
|
||||
g_EmuCDPD.pPresentationParameters->Windowed = !g_XBVideo.GetFullscreen();
|
||||
|
||||
|
@ -778,8 +778,8 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
|
|||
|
||||
g_EmuCDPD.hFocusWindow = g_hEmuWindow;
|
||||
|
||||
g_EmuCDPD.pPresentationParameters->BackBufferFormat = XTL::EmuXB2PC_D3DFormat(g_EmuCDPD.pPresentationParameters->BackBufferFormat);
|
||||
g_EmuCDPD.pPresentationParameters->AutoDepthStencilFormat = XTL::EmuXB2PC_D3DFormat(g_EmuCDPD.pPresentationParameters->AutoDepthStencilFormat);
|
||||
g_EmuCDPD.pPresentationParameters->BackBufferFormat = (XTL::X_D3DFORMAT)XTL::EmuXB2PC_D3DFormat(g_EmuCDPD.pPresentationParameters->BackBufferFormat);
|
||||
g_EmuCDPD.pPresentationParameters->AutoDepthStencilFormat = (XTL::X_D3DFORMAT)XTL::EmuXB2PC_D3DFormat(g_EmuCDPD.pPresentationParameters->AutoDepthStencilFormat);
|
||||
|
||||
if(!g_XBVideo.GetVSync() && (g_D3DCaps.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE) && g_XBVideo.GetFullscreen())
|
||||
g_EmuCDPD.pPresentationParameters->FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
|
@ -824,7 +824,7 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
|
|||
|
||||
g_pD3D8->GetAdapterDisplayMode(g_XBVideo.GetDisplayAdapter(), &D3DDisplayMode);
|
||||
|
||||
g_EmuCDPD.pPresentationParameters->BackBufferFormat = D3DDisplayMode.Format;
|
||||
g_EmuCDPD.pPresentationParameters->BackBufferFormat = (XTL::X_D3DFORMAT)D3DDisplayMode.Format;
|
||||
g_EmuCDPD.pPresentationParameters->FullScreen_RefreshRateInHz = 0;
|
||||
}
|
||||
else
|
||||
|
@ -838,13 +838,13 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
|
|||
&g_EmuCDPD.pPresentationParameters->FullScreen_RefreshRateInHz);
|
||||
|
||||
if(strcmp(szBackBufferFormat, "x1r5g5b5") == 0)
|
||||
g_EmuCDPD.pPresentationParameters->BackBufferFormat = XTL::D3DFMT_X1R5G5B5;
|
||||
g_EmuCDPD.pPresentationParameters->BackBufferFormat = (XTL::X_D3DFORMAT)XTL::D3DFMT_X1R5G5B5;
|
||||
else if(strcmp(szBackBufferFormat, "r5g6r5") == 0)
|
||||
g_EmuCDPD.pPresentationParameters->BackBufferFormat = XTL::D3DFMT_R5G6B5;
|
||||
g_EmuCDPD.pPresentationParameters->BackBufferFormat = (XTL::X_D3DFORMAT)XTL::D3DFMT_R5G6B5;
|
||||
else if(strcmp(szBackBufferFormat, "x8r8g8b8") == 0)
|
||||
g_EmuCDPD.pPresentationParameters->BackBufferFormat = XTL::D3DFMT_X8R8G8B8;
|
||||
g_EmuCDPD.pPresentationParameters->BackBufferFormat = (XTL::X_D3DFORMAT)XTL::D3DFMT_X8R8G8B8;
|
||||
else if(strcmp(szBackBufferFormat, "a8r8g8b8") == 0)
|
||||
g_EmuCDPD.pPresentationParameters->BackBufferFormat = XTL::D3DFMT_A8R8G8B8;
|
||||
g_EmuCDPD.pPresentationParameters->BackBufferFormat = (XTL::X_D3DFORMAT)XTL::D3DFMT_A8R8G8B8;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1154,7 +1154,7 @@ static void EmuUnswizzleTextureStages()
|
|||
if(pPixelContainer == NULL || !(pPixelContainer->Common & X_D3DCOMMON_ISLOCKED))
|
||||
return;
|
||||
|
||||
DWORD XBFormat = (pPixelContainer->Format & X_D3DFORMAT_FORMAT_MASK) >> X_D3DFORMAT_FORMAT_SHIFT;
|
||||
XTL::X_D3DFORMAT XBFormat = (XTL::X_D3DFORMAT)((pPixelContainer->Format & X_D3DFORMAT_FORMAT_MASK) >> X_D3DFORMAT_FORMAT_SHIFT);
|
||||
DWORD dwBPP = 0;
|
||||
|
||||
if(!XTL::EmuXBFormatIsSwizzled(XBFormat, &dwBPP))
|
||||
|
@ -1339,7 +1339,7 @@ HRESULT WINAPI XTL::EmuIDirect3D8_CheckDeviceFormat
|
|||
(
|
||||
UINT Adapter,
|
||||
D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT AdapterFormat,
|
||||
X_D3DFORMAT AdapterFormat,
|
||||
DWORD Usage,
|
||||
X_D3DRESOURCETYPE RType,
|
||||
X_D3DFORMAT CheckFormat
|
||||
|
@ -2953,7 +2953,7 @@ XTL::X_D3DResource * WINAPI XTL::EmuIDirect3DDevice8_CreateTexture2
|
|||
UINT Depth,
|
||||
UINT Levels,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
X_D3DFORMAT Format,
|
||||
D3DRESOURCETYPE D3DResource
|
||||
)
|
||||
{
|
||||
|
@ -2988,7 +2988,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateTexture
|
|||
UINT Height,
|
||||
UINT Levels,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
X_D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
X_D3DTexture **ppTexture
|
||||
)
|
||||
|
@ -3146,7 +3146,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateVolumeTexture
|
|||
UINT Depth,
|
||||
UINT Levels,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
X_D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
X_D3DVolumeTexture **ppVolumeTexture
|
||||
)
|
||||
|
@ -3248,7 +3248,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateCubeTexture
|
|||
UINT EdgeLength,
|
||||
UINT Levels,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
X_D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
X_D3DCubeTexture **ppCubeTexture
|
||||
)
|
||||
|
@ -3316,7 +3316,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_CreateIndexBuffer
|
|||
(
|
||||
UINT Length,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
X_D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
X_D3DIndexBuffer **ppIndexBuffer
|
||||
)
|
||||
|
@ -3373,7 +3373,7 @@ XTL::X_D3DIndexBuffer * WINAPI XTL::EmuIDirect3DDevice8_CreateIndexBuffer2(UINT
|
|||
(
|
||||
Length,
|
||||
NULL,
|
||||
D3DFMT_INDEX16,
|
||||
X_D3DFMT_INDEX16,
|
||||
D3DPOOL_MANAGED,
|
||||
&pIndexBuffer
|
||||
);
|
||||
|
@ -4496,14 +4496,14 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
|
|||
if(X_Format == 0x2E)
|
||||
{
|
||||
/*CxbxKrnlCleanup*/EmuWarning("D3DFMT_LIN_D24S8 not yet supported!");
|
||||
X_Format = 0x12;
|
||||
X_Format = X_D3DFMT_LIN_A8R8G8B8;
|
||||
Format = D3DFMT_A8R8G8B8;
|
||||
}
|
||||
|
||||
if(X_Format == 0x30)
|
||||
{
|
||||
/*CxbxKrnlCleanup*/EmuWarning("D3DFMT_LIN_D16 not yet supported!");
|
||||
X_Format = 0x11;
|
||||
X_Format = X_D3DFMT_LIN_R5G6B5;
|
||||
Format = D3DFMT_R5G6B5;
|
||||
}
|
||||
|
||||
|
@ -4512,8 +4512,8 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
|
|||
BOOL bCubemap = pPixelContainer->Format & X_D3DFORMAT_CUBEMAP;
|
||||
|
||||
// Interpret Width/Height/BPP
|
||||
if(X_Format == 0x07 /* X_D3DFMT_X8R8G8B8 */ || X_Format == 0x06 /* X_D3DFMT_A8R8G8B8 */
|
||||
|| X_Format == 0x3A /* X_D3DFMT_A8B8G8R8 */)
|
||||
if(X_Format == X_D3DFMT_X8R8G8B8 || X_Format == X_D3DFMT_A8R8G8B8
|
||||
|| X_Format == X_D3DFMT_A8B8G8R8)
|
||||
{
|
||||
bSwizzled = TRUE;
|
||||
|
||||
|
@ -4525,9 +4525,9 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
|
|||
dwPitch = dwWidth*4;
|
||||
dwBPP = 4;
|
||||
}
|
||||
else if(X_Format == 0x05 /* X_D3DFMT_R5G6B5 */ || X_Format == 0x04 /* X_D3DFMT_A4R4G4B4 */
|
||||
|| X_Format == 0x02 /* X_D3DFMT_A1R5G5B5 */ || X_Format == 0x03 /* X_D3DFMT_X1R5G5B5 */
|
||||
|| X_Format == 0x28 /* X_D3DFMT_G8B8 */ )
|
||||
else if(X_Format == X_D3DFMT_R5G6B5 || X_Format == X_D3DFMT_A4R4G4B4
|
||||
|| X_Format == X_D3DFMT_A1R5G5B5 || X_Format == X_D3DFMT_X1R5G5B5
|
||||
|| X_Format == X_D3DFMT_G8B8 )
|
||||
{
|
||||
bSwizzled = TRUE;
|
||||
|
||||
|
@ -4539,9 +4539,9 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
|
|||
dwPitch = dwWidth*2;
|
||||
dwBPP = 2;
|
||||
}
|
||||
else if(X_Format == 0x00 /* X_D3DFMT_L8 */ || X_Format == 0x0B /* X_D3DFMT_P8 */
|
||||
|| X_Format == 0x01 /* X_D3DFMT_AL8 */ || X_Format == 0x1A /* X_D3DFMT_A8L8 */
|
||||
|| X_Format == 0x19 /* X_D3DFMT_A8 */)
|
||||
else if(X_Format == X_D3DFMT_L8 || X_Format == X_D3DFMT_P8
|
||||
|| X_Format == X_D3DFMT_AL8 || X_Format == X_D3DFMT_A8L8
|
||||
|| X_Format == X_D3DFMT_A8)
|
||||
{
|
||||
bSwizzled = TRUE;
|
||||
|
||||
|
@ -4553,8 +4553,8 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
|
|||
dwPitch = dwWidth;
|
||||
dwBPP = 1;
|
||||
}
|
||||
else if(X_Format == 0x1E /* X_D3DFMT_LIN_X8R8G8B8 */ || X_Format == 0x12 /* X_D3DFMT_LIN_A8R8G8B8 */
|
||||
|| X_Format == 0x2E /* D3DFMT_LIN_D24S8 */ || X_Format == 0x3F /* X_D3DFMT_LIN_A8B8G8R8 */)
|
||||
else if(X_Format == X_D3DFMT_LIN_X8R8G8B8 || X_Format == X_D3DFMT_LIN_A8R8G8B8
|
||||
|| X_Format == X_D3DFMT_LIN_D24S8 || X_Format == X_D3DFMT_LIN_A8B8G8R8)
|
||||
{
|
||||
// Linear 32 Bit
|
||||
dwWidth = (pPixelContainer->Size & X_D3DSIZE_WIDTH_MASK) + 1;
|
||||
|
@ -4562,9 +4562,9 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
|
|||
dwPitch = (((pPixelContainer->Size & X_D3DSIZE_PITCH_MASK) >> X_D3DSIZE_PITCH_SHIFT)+1)*64;
|
||||
dwBPP = 4;
|
||||
}
|
||||
else if(X_Format == 0x11 /* D3DFMT_LIN_R5G6B5 */ || X_Format == 0x30 /* D3DFMT_LIN_D16 */
|
||||
|| X_Format == 0x1D /* X_D3DFMT_LIN_A4R4G4B4 */ || X_Format == 0x10 /* X_D3DFMT_LIN_A1R5G5B5 */
|
||||
|| X_Format == 0x1C /* X_D3DFMT_LIN_X1R5G5B5 */ )
|
||||
else if(X_Format == X_D3DFMT_LIN_R5G6B5 || X_Format == X_D3DFMT_LIN_D16
|
||||
|| X_Format == X_D3DFMT_LIN_A4R4G4B4 || X_Format == X_D3DFMT_LIN_A1R5G5B5
|
||||
|| X_Format == X_D3DFMT_LIN_X1R5G5B5 )
|
||||
{
|
||||
// Linear 16 Bit
|
||||
dwWidth = (pPixelContainer->Size & X_D3DSIZE_WIDTH_MASK) + 1;
|
||||
|
@ -4572,7 +4572,7 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
|
|||
dwPitch = (((pPixelContainer->Size & X_D3DSIZE_PITCH_MASK) >> X_D3DSIZE_PITCH_SHIFT)+1)*64;
|
||||
dwBPP = 2;
|
||||
}
|
||||
else if(X_Format == 0x0C /* D3DFMT_DXT1 */ || X_Format == 0x0E /* D3DFMT_DXT2 */ || X_Format == 0x0F /* D3DFMT_DXT3 */)
|
||||
else if(X_Format == X_D3DFMT_DXT1 || X_Format == X_D3DFMT_DXT2 || X_Format == X_D3DFMT_DXT3)
|
||||
{
|
||||
bCompressed = TRUE;
|
||||
|
||||
|
@ -4590,7 +4590,7 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
|
|||
|
||||
dwBPP = 1;
|
||||
}
|
||||
else if(X_Format == 0x24 /* D3DFMT_YUY2 */)
|
||||
else if(X_Format == X_D3DFMT_YUY2)
|
||||
{
|
||||
// Linear 32 Bit
|
||||
dwWidth = (pPixelContainer->Size & X_D3DSIZE_WIDTH_MASK) + 1;
|
||||
|
@ -4602,7 +4602,7 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
|
|||
CxbxKrnlCleanup("0x%.08X is not a supported format!\n", X_Format);
|
||||
}
|
||||
|
||||
if(X_Format == 0x24 /* X_D3DFMT_YUY2 */)
|
||||
if(X_Format == X_D3DFMT_YUY2)
|
||||
{
|
||||
//
|
||||
// cache the overlay size
|
||||
|
@ -8939,7 +8939,7 @@ HRESULT WINAPI XTL::EmuIDirect3D8_CheckDeviceMultiSampleType
|
|||
(
|
||||
UINT Adapter,
|
||||
D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT SurfaceFormat,
|
||||
X_D3DFORMAT SurfaceFormat,
|
||||
BOOL Windowed,
|
||||
D3DMULTISAMPLE_TYPE MultiSampleType
|
||||
)
|
||||
|
|
|
@ -87,7 +87,7 @@ HRESULT WINAPI EmuIDirect3D8_CheckDeviceFormat
|
|||
(
|
||||
UINT Adapter,
|
||||
D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT AdapterFormat,
|
||||
X_D3DFORMAT AdapterFormat,
|
||||
DWORD Usage,
|
||||
X_D3DRESOURCETYPE RType,
|
||||
X_D3DFORMAT CheckFormat
|
||||
|
@ -434,7 +434,7 @@ X_D3DResource * WINAPI EmuIDirect3DDevice8_CreateTexture2
|
|||
UINT Depth,
|
||||
UINT Levels,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
X_D3DFORMAT Format,
|
||||
D3DRESOURCETYPE D3DResource
|
||||
);
|
||||
|
||||
|
@ -447,7 +447,7 @@ HRESULT WINAPI EmuIDirect3DDevice8_CreateTexture
|
|||
UINT Height,
|
||||
UINT Levels,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
X_D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
X_D3DTexture **ppTexture
|
||||
);
|
||||
|
@ -462,7 +462,7 @@ HRESULT WINAPI EmuIDirect3DDevice8_CreateVolumeTexture
|
|||
UINT Depth,
|
||||
UINT Levels,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
X_D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
X_D3DVolumeTexture **ppVolumeTexture
|
||||
);
|
||||
|
@ -475,7 +475,7 @@ HRESULT WINAPI EmuIDirect3DDevice8_CreateCubeTexture
|
|||
UINT EdgeLength,
|
||||
UINT Levels,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
X_D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
X_D3DCubeTexture **ppCubeTexture
|
||||
);
|
||||
|
@ -487,7 +487,7 @@ HRESULT WINAPI EmuIDirect3DDevice8_CreateIndexBuffer
|
|||
(
|
||||
UINT Length,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
X_D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
X_D3DIndexBuffer **ppIndexBuffer
|
||||
);
|
||||
|
@ -1531,7 +1531,7 @@ HRESULT WINAPI EmuIDirect3D8_CheckDeviceMultiSampleType
|
|||
(
|
||||
UINT Adapter,
|
||||
D3DDEVTYPE DeviceType,
|
||||
D3DFORMAT SurfaceFormat,
|
||||
X_D3DFORMAT SurfaceFormat,
|
||||
BOOL Windowed,
|
||||
D3DMULTISAMPLE_TYPE MultiSampleType
|
||||
);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "CxbxKrnl/Emu.h"
|
||||
#include "CxbxKrnl/EmuXTL.h"
|
||||
#include "CxbxKrnl/EmuD3D8Types.h" // For X_D3DFORMAT
|
||||
#include "CxbxKrnl/ResourceTracker.h"
|
||||
|
||||
uint32 XTL::g_dwPrimaryPBCount = 0;
|
||||
|
@ -77,7 +78,7 @@ static void EmuUnswizzleActiveTexture()
|
|||
if(pPixelContainer == NULL || !(pPixelContainer->Common & X_D3DCOMMON_ISLOCKED))
|
||||
return;
|
||||
|
||||
DWORD XBFormat = (pPixelContainer->Format & X_D3DFORMAT_FORMAT_MASK) >> X_D3DFORMAT_FORMAT_SHIFT;
|
||||
XTL::X_D3DFORMAT XBFormat = (XTL::X_D3DFORMAT)((pPixelContainer->Format & X_D3DFORMAT_FORMAT_MASK) >> X_D3DFORMAT_FORMAT_SHIFT);
|
||||
DWORD dwBPP = 0;
|
||||
|
||||
if(!XTL::EmuXBFormatIsSwizzled(XBFormat, &dwBPP))
|
||||
|
|
|
@ -713,20 +713,20 @@ bool XTL::VertexPatcher::PatchStream(VertexPatchDesc *pPatchDesc,
|
|||
bool XTL::VertexPatcher::NormalizeTexCoords(VertexPatchDesc *pPatchDesc, UINT uiStream)
|
||||
{
|
||||
// Check for active linear textures.
|
||||
bool bHasLinearTex = false, bTexIsLinear[4];
|
||||
bool bHasLinearTex = false, bTexIsLinear[4] = { false };
|
||||
X_D3DPixelContainer *pLinearPixelContainer[4];
|
||||
|
||||
for(uint08 i = 0; i < 4; i++)
|
||||
{
|
||||
X_D3DPixelContainer *pPixelContainer = (X_D3DPixelContainer*)EmuD3DActiveTexture[i];
|
||||
if(pPixelContainer && EmuXBFormatIsLinear(((X_D3DFORMAT)pPixelContainer->Format & X_D3DFORMAT_FORMAT_MASK) >> X_D3DFORMAT_FORMAT_SHIFT))
|
||||
{
|
||||
bHasLinearTex = bTexIsLinear[i] = true;
|
||||
pLinearPixelContainer[i] = pPixelContainer;
|
||||
}
|
||||
else
|
||||
{
|
||||
bTexIsLinear[i] = false;
|
||||
if (pPixelContainer)
|
||||
{
|
||||
XTL::X_D3DFORMAT XBFormat = (XTL::X_D3DFORMAT)((pPixelContainer->Format & X_D3DFORMAT_FORMAT_MASK) >> X_D3DFORMAT_FORMAT_SHIFT);
|
||||
if (EmuXBFormatIsLinear(XBFormat))
|
||||
{
|
||||
bHasLinearTex = bTexIsLinear[i] = true;
|
||||
pLinearPixelContainer[i] = pPixelContainer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include <d3d8types.h>
|
||||
|
||||
// TODO: fill out these enumeration tables for convienance
|
||||
typedef DWORD X_D3DFORMAT;
|
||||
typedef DWORD X_D3DBLENDOP;
|
||||
typedef DWORD X_D3DBLEND;
|
||||
typedef DWORD X_D3DCMPFUNC;
|
||||
|
@ -51,91 +50,131 @@ typedef DWORD X_D3DSTENCILOP;
|
|||
typedef DWORD X_D3DTEXTURESTAGESTATETYPE;
|
||||
typedef PVOID X_D3DCALLBACK;
|
||||
|
||||
const int X_D3DFMT_L8 = 0x00;
|
||||
const int X_D3DFMT_AL8 = 0x01;
|
||||
const int X_D3DFMT_A1R5G5B5 = 0x02;
|
||||
const int X_D3DFMT_X1R5G5B5 = 0x03;
|
||||
const int X_D3DFMT_A4R4G4B4 = 0x04;
|
||||
const int X_D3DFMT_R5G6B5 = 0x05;
|
||||
const int X_D3DFMT_A8R8G8B8 = 0x06;
|
||||
const int X_D3DFMT_X8R8G8B8 = 0x07;
|
||||
const int X_D3DFMT_X8L8V8U8 = 0x07; // Alias
|
||||
typedef enum _X_D3DFORMAT
|
||||
{
|
||||
/*
|
||||
Xbox1 D3DFORMAT notes
|
||||
---------------------
|
||||
|
||||
const int X_D3DFMT_P8 = 0x0b; // 8-bit Palletized
|
||||
The Xbox1 D3DFORMAT type consists of 4 different format categories :
|
||||
1. Swizzled (improves data locality, incompatible with native Direct3D)
|
||||
2. Compressed (DXT compression, giving 4:1 reduction on 4x4 pixel blocks)
|
||||
3. Linear (compatible with native Direct3D)
|
||||
4. Depth (Fixed or Floating point, stored Linear or Swizzled)
|
||||
|
||||
const int X_D3DFMT_A8 = 0x19;
|
||||
const int X_D3DFMT_A8L8 = 0x1a;
|
||||
const int X_D3DFMT_R6G5B5 = 0x27;
|
||||
const int X_D3DFMT_L6V5U5 = 0x27; // Alias
|
||||
Requirements\Format Swizzled Compressed Linear Depth Notes
|
||||
|
||||
const int X_D3DFMT_G8B8 = 0x28;
|
||||
const int X_D3DFMT_V8U8 = 0x28; // Alias
|
||||
Power-of-two required ? YES YES NO NO
|
||||
Mipmap supported ? YES YES NO YES Linear has MipmapLevels = 1
|
||||
CubeMaps supported ? YES YES NO NO Cubemaps have 6 faces
|
||||
Supports volumes ? YES YES NO NO Volumes have 3 dimensions, Textures have 2
|
||||
Can be a rendertarget ? YES YES YES LINEAR Depth buffers can only be rendered to if stored Linear
|
||||
|
||||
const int X_D3DFMT_R8B8 = 0x29;
|
||||
const int X_D3DFMT_D24S8 = 0x2a;
|
||||
const int X_D3DFMT_F24S8 = 0x2b;
|
||||
const int X_D3DFMT_D16 = 0x2c;
|
||||
const int X_D3DFMT_D16_LOCKABLE = 0x2c; // Alias
|
||||
Implications :
|
||||
- CubeMaps must be square
|
||||
- Volumes cannot be cube mapped and vice versa
|
||||
|
||||
const int X_D3DFMT_F16 = 0x2d;
|
||||
const int X_D3DFMT_L16 = 0x32;
|
||||
const int X_D3DFMT_V16U16 = 0x33;
|
||||
const int X_D3DFMT_R5G5B5A1 = 0x38;
|
||||
const int X_D3DFMT_R4G4B4A4 = 0x39;
|
||||
const int X_D3DFMT_A8B8G8R8 = 0x3A;
|
||||
const int X_D3DFMT_Q8W8V8U8 = 0x3A; // Alias
|
||||
Maximum dimensions :
|
||||
2D : 4096 x 4096 (12 mipmap levels)
|
||||
3D : 512 x 512 x 512 (9 mipmap levels)
|
||||
|
||||
const int X_D3DFMT_B8G8R8A8 = 0x3B;
|
||||
const int X_D3DFMT_R8G8B8A8 = 0x3C;
|
||||
*/
|
||||
|
||||
// YUV Formats
|
||||
// Xbox D3DFORMAT types :
|
||||
// See http://wiki.beyondunreal.com/Legacy:Texture_Format
|
||||
|
||||
const int X_D3DFMT_YUY2 = 0x24;
|
||||
const int X_D3DFMT_UYVY = 0x25;
|
||||
// Swizzled Formats
|
||||
|
||||
// Compressed Formats
|
||||
X_D3DFMT_L8 = 0x00,
|
||||
X_D3DFMT_AL8 = 0x01,
|
||||
X_D3DFMT_A1R5G5B5 = 0x02,
|
||||
X_D3DFMT_X1R5G5B5 = 0x03,
|
||||
X_D3DFMT_A4R4G4B4 = 0x04,
|
||||
X_D3DFMT_R5G6B5 = 0x05,
|
||||
X_D3DFMT_A8R8G8B8 = 0x06,
|
||||
X_D3DFMT_X8R8G8B8 = 0x07,
|
||||
X_D3DFMT_X8L8V8U8 = 0x07, // Alias
|
||||
|
||||
const int X_D3DFMT_DXT1 = 0x0C; // opaque/one-bit alpha
|
||||
X_D3DFMT_P8 = 0x0b, // 8-bit Palletized
|
||||
|
||||
const int X_D3DFMT_DXT2 = 0x0E;
|
||||
const int X_D3DFMT_DXT3 = 0x0E; // linear alpha
|
||||
X_D3DFMT_A8 = 0x19,
|
||||
X_D3DFMT_A8L8 = 0x1a,
|
||||
X_D3DFMT_R6G5B5 = 0x27,
|
||||
X_D3DFMT_L6V5U5 = 0x27, // Alias
|
||||
|
||||
const int X_D3DFMT_DXT4 = 0x0F;
|
||||
const int X_D3DFMT_DXT5 = 0x0F; // interpolated alpha
|
||||
X_D3DFMT_G8B8 = 0x28,
|
||||
X_D3DFMT_V8U8 = 0x28, // Alias
|
||||
|
||||
// Linear Formats
|
||||
X_D3DFMT_R8B8 = 0x29,
|
||||
X_D3DFMT_D24S8 = 0x2a,
|
||||
X_D3DFMT_F24S8 = 0x2b,
|
||||
X_D3DFMT_D16 = 0x2c,
|
||||
X_D3DFMT_D16_LOCKABLE = 0x2c, // Alias
|
||||
|
||||
const int X_D3DFMT_LIN_A1R5G5B5 = 0x10;
|
||||
const int X_D3DFMT_LIN_R5G6B5 = 0x11;
|
||||
const int X_D3DFMT_LIN_A8R8G8B8 = 0x12;
|
||||
const int X_D3DFMT_LIN_L8 = 0x13;
|
||||
const int X_D3DFMT_LIN_R8B8 = 0x16;
|
||||
const int X_D3DFMT_LIN_G8B8 = 0x17;
|
||||
const int X_D3DFMT_LIN_V8U8 = 0x17; // Alias
|
||||
X_D3DFMT_F16 = 0x2d,
|
||||
X_D3DFMT_L16 = 0x32,
|
||||
X_D3DFMT_V16U16 = 0x33,
|
||||
X_D3DFMT_R5G5B5A1 = 0x38,
|
||||
X_D3DFMT_R4G4B4A4 = 0x39,
|
||||
X_D3DFMT_A8B8G8R8 = 0x3A,
|
||||
X_D3DFMT_Q8W8V8U8 = 0x3A, // Alias
|
||||
|
||||
const int X_D3DFMT_LIN_AL8 = 0x1b;
|
||||
const int X_D3DFMT_LIN_X1R5G5B5 = 0x1c;
|
||||
const int X_D3DFMT_LIN_A4R4G4B4 = 0x1d;
|
||||
const int X_D3DFMT_LIN_X8R8G8B8 = 0x1e;
|
||||
const int X_D3DFMT_LIN_X8L8V8U8 = 0x1e; // Alias
|
||||
X_D3DFMT_B8G8R8A8 = 0x3B,
|
||||
X_D3DFMT_R8G8B8A8 = 0x3C,
|
||||
|
||||
const int X_D3DFMT_LIN_A8 = 0x1f;
|
||||
const int X_D3DFMT_LIN_A8L8 = 0x20;
|
||||
const int X_D3DFMT_LIN_D24S8 = 0x2E;
|
||||
const int X_D3DFMT_LIN_F24S8 = 0x2f;
|
||||
const int X_D3DFMT_LIN_D16 = 0x30;
|
||||
const int X_D3DFMT_LIN_F16 = 0x31;
|
||||
const int X_D3DFMT_LIN_L16 = 0x35;
|
||||
const int X_D3DFMT_LIN_V16U16 = 0x36;
|
||||
const int X_D3DFMT_LIN_R6G5B5 = 0x37;
|
||||
const int X_D3DFMT_LIN_L6V5U5 = 0x37; // Alias
|
||||
// YUV Formats
|
||||
|
||||
const int X_D3DFMT_LIN_R5G5B5A1 = 0x3D;
|
||||
const int X_D3DFMT_LIN_R4G4B4A4 = 0x3e;
|
||||
const int X_D3DFMT_LIN_A8B8G8R8 = 0x3f;
|
||||
const int X_D3DFMT_LIN_B8G8R8A8 = 0x40;
|
||||
const int X_D3DFMT_LIN_R8G8B8A8 = 0x41;
|
||||
const int X_D3DFMT_VERTEXDATA = 0x64;
|
||||
X_D3DFMT_YUY2 = 0x24,
|
||||
X_D3DFMT_UYVY = 0x25,
|
||||
|
||||
// Compressed Formats
|
||||
|
||||
X_D3DFMT_DXT1 = 0x0C, // opaque/one-bit alpha
|
||||
X_D3DFMT_DXT2 = 0x0E, // linear alpha
|
||||
X_D3DFMT_DXT3 = 0x0E, // Alias
|
||||
X_D3DFMT_DXT4 = 0x0F, // interpolated alpha
|
||||
X_D3DFMT_DXT5 = 0x0F, // Alias
|
||||
|
||||
// Linear Formats
|
||||
|
||||
X_D3DFMT_LIN_A1R5G5B5 = 0x10,
|
||||
X_D3DFMT_LIN_R5G6B5 = 0x11,
|
||||
X_D3DFMT_LIN_A8R8G8B8 = 0x12,
|
||||
X_D3DFMT_LIN_L8 = 0x13,
|
||||
X_D3DFMT_LIN_R8B8 = 0x16,
|
||||
X_D3DFMT_LIN_G8B8 = 0x17,
|
||||
X_D3DFMT_LIN_V8U8 = 0x17, // Alias
|
||||
|
||||
X_D3DFMT_LIN_AL8 = 0x1b,
|
||||
X_D3DFMT_LIN_X1R5G5B5 = 0x1c,
|
||||
X_D3DFMT_LIN_A4R4G4B4 = 0x1d,
|
||||
X_D3DFMT_LIN_X8R8G8B8 = 0x1e,
|
||||
X_D3DFMT_LIN_X8L8V8U8 = 0x1e, // Alias
|
||||
|
||||
X_D3DFMT_LIN_A8 = 0x1f,
|
||||
X_D3DFMT_LIN_A8L8 = 0x20,
|
||||
X_D3DFMT_LIN_D24S8 = 0x2E,
|
||||
X_D3DFMT_LIN_F24S8 = 0x2f,
|
||||
X_D3DFMT_LIN_D16 = 0x30,
|
||||
X_D3DFMT_LIN_F16 = 0x31,
|
||||
X_D3DFMT_LIN_L16 = 0x35,
|
||||
X_D3DFMT_LIN_V16U16 = 0x36,
|
||||
X_D3DFMT_LIN_R6G5B5 = 0x37,
|
||||
X_D3DFMT_LIN_L6V5U5 = 0x37, // Alias
|
||||
|
||||
X_D3DFMT_LIN_R5G5B5A1 = 0x3D,
|
||||
X_D3DFMT_LIN_R4G4B4A4 = 0x3e,
|
||||
X_D3DFMT_LIN_A8B8G8R8 = 0x3f,
|
||||
X_D3DFMT_LIN_B8G8R8A8 = 0x40,
|
||||
X_D3DFMT_LIN_R8G8B8A8 = 0x41,
|
||||
|
||||
X_D3DFMT_VERTEXDATA = 0x64,
|
||||
|
||||
X_D3DFMT_INDEX16 = 101/*=D3DFMT_INDEX16*/, // Dxbx addition : Not an Xbox format, used internally
|
||||
|
||||
X_D3DFMT_UNKNOWN = 0xFFFFFFFF - 3, // Unique declaration to make overloads possible
|
||||
}
|
||||
X_D3DFORMAT, *PX_D3DFORMAT;
|
||||
|
||||
// Primitives supported by draw-primitive API
|
||||
typedef enum _X_D3DPRIMITIVETYPE
|
||||
|
@ -441,7 +480,7 @@ X_D3DPALETTESIZE;
|
|||
|
||||
struct X_D3DPixelContainer : public X_D3DResource
|
||||
{
|
||||
X_D3DFORMAT Format;
|
||||
DWORD Format;
|
||||
DWORD Size;
|
||||
};
|
||||
|
||||
|
@ -556,7 +595,8 @@ typedef void (__cdecl * D3DSWAPCALLBACK)(D3DSWAPDATA *pData);
|
|||
// D3DCALLBACK
|
||||
typedef void (__cdecl * D3DCALLBACK)(DWORD Context);
|
||||
|
||||
// X_D3DTEXTUREOP values :
|
||||
// X_D3DTEXTUREOP values :
|
||||
|
||||
#define X_D3DTOP_DISABLE 1
|
||||
#define X_D3DTOP_SELECTARG1 2
|
||||
#define X_D3DTOP_SELECTARG2 3
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace NtDll
|
|||
// ******************************************************************
|
||||
PVOID WINAPI XTL::EmuXGIsSwizzledFormat
|
||||
(
|
||||
XTL::D3DFORMAT Format
|
||||
X_D3DFORMAT Format
|
||||
)
|
||||
{
|
||||
LOG_FUNC_ONE_ARG(Format);
|
||||
|
@ -333,7 +333,7 @@ VOID WINAPI XTL::EmuXGSetTextureHeader
|
|||
UINT Height,
|
||||
UINT Levels,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
X_D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
X_D3DTexture* pTexture,
|
||||
UINT Data,
|
||||
|
|
|
@ -47,7 +47,6 @@ XGPOINT3D;
|
|||
// ******************************************************************
|
||||
PVOID WINAPI EmuXGIsSwizzledFormat
|
||||
(
|
||||
D3DFORMAT Format
|
||||
);
|
||||
|
||||
// ******************************************************************
|
||||
|
@ -117,7 +116,7 @@ VOID WINAPI EmuXGSetTextureHeader
|
|||
UINT Height,
|
||||
UINT Levels,
|
||||
DWORD Usage,
|
||||
D3DFORMAT Format,
|
||||
X_D3DFORMAT Format,
|
||||
D3DPOOL Pool,
|
||||
X_D3DTexture* pTexture,
|
||||
UINT Data,
|
||||
|
|
Loading…
Reference in New Issue