More D3D9 conversion:
* add additional arguments to functions that need them * use newly available types where possible * enable D3D9 porting preparations inherited from Dxbx
This commit is contained in:
parent
4ca78e947d
commit
b22d681559
|
@ -955,7 +955,7 @@ XTL::IDirect3DBaseTexture *GetHostBaseTexture(XTL::X_D3DResource *pXboxResource,
|
|||
// Burnout hits this case (retreiving a surface instead of a texture)
|
||||
}
|
||||
|
||||
return (XTL::IDirect3DBaseTexture8*)GetHostResource(pXboxResource, iTextureStage);
|
||||
return (XTL::IDirect3DBaseTexture*)GetHostResource(pXboxResource, iTextureStage);
|
||||
}
|
||||
|
||||
XTL::IDirect3DTexture *GetHostTexture(XTL::X_D3DResource *pXboxResource, int iTextureStage = 0)
|
||||
|
@ -1276,7 +1276,11 @@ VOID CxbxReleaseBackBufferLock()
|
|||
{
|
||||
XTL::IDirect3DSurface *pBackBuffer = nullptr;
|
||||
|
||||
if (D3D_OK == g_pD3DDevice->GetBackBuffer(0, XTL::D3DBACKBUFFER_TYPE_MONO, &pBackBuffer))
|
||||
if (D3D_OK == g_pD3DDevice->GetBackBuffer(
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // iSwapChain
|
||||
#endif
|
||||
0, XTL::D3DBACKBUFFER_TYPE_MONO, &pBackBuffer))
|
||||
{
|
||||
assert(pBackBuffer != nullptr);
|
||||
|
||||
|
@ -2120,7 +2124,11 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
|
|||
|
||||
// update render target cache
|
||||
XTL::IDirect3DSurface *pNewHostSurface = nullptr;
|
||||
hRet = g_pD3DDevice->GetRenderTarget(&pNewHostSurface);
|
||||
hRet = g_pD3DDevice->GetRenderTarget(
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // RenderTargetIndex
|
||||
#endif
|
||||
&pNewHostSurface);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->GetRenderTarget");
|
||||
|
||||
// update z-stencil surface cache
|
||||
|
@ -2134,12 +2142,19 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
|
|||
(
|
||||
1, 0, 0, XTL::D3DPOOL_MANAGED,
|
||||
&g_pDummyBuffer
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateVertexBuffer");
|
||||
|
||||
for(int Streams = 0; Streams < 16; Streams++)
|
||||
{
|
||||
hRet = g_pD3DDevice->SetStreamSource(Streams, g_pDummyBuffer, 1);
|
||||
hRet = g_pD3DDevice->SetStreamSource(Streams, g_pDummyBuffer,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // OffsetInBytes
|
||||
#endif
|
||||
1);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->SetStreamSource");
|
||||
}
|
||||
|
||||
|
@ -2284,7 +2299,11 @@ void CxbxUpdateActiveIndexBuffer
|
|||
D3DUSAGE_WRITEONLY,
|
||||
XTL::D3DFMT_INDEX16,
|
||||
XTL::D3DPOOL_MANAGED,
|
||||
&indexBuffer.pHostIndexBuffer);
|
||||
&indexBuffer.pHostIndexBuffer
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateIndexBuffer");
|
||||
|
||||
if (FAILED(hRet))
|
||||
|
@ -2315,7 +2334,12 @@ void CxbxUpdateActiveIndexBuffer
|
|||
*pIndexBase = g_CachedIndexBase;
|
||||
|
||||
// Activate the new native index buffer :
|
||||
#ifdef CXBX_USE_D3D9
|
||||
HRESULT hRet = g_pD3DDevice->SetIndices(indexBuffer.pHostIndexBuffer);
|
||||
// Note : *pIndexBase is moved to DrawIndexedPrimitive
|
||||
#else
|
||||
HRESULT hRet = g_pD3DDevice->SetIndices(indexBuffer.pHostIndexBuffer, *pIndexBase);
|
||||
#endif
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->SetIndices");
|
||||
|
||||
if (FAILED(hRet))
|
||||
|
@ -2677,7 +2701,13 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetGammaRamp)
|
|||
PCRamp.blue[v] = pRamp->blue[v];
|
||||
}
|
||||
|
||||
// g_pD3DDevice->SetGammaRamp(dwPCFlags, &PCRamp);
|
||||
#if 0 // TODO : Why is this disabled?
|
||||
g_pD3DDevice->SetGammaRamp(
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // iSwapChain
|
||||
#endif
|
||||
dwPCFlags, &PCRamp);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
|
@ -2694,7 +2724,11 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_GetGammaRamp)
|
|||
|
||||
D3DGAMMARAMP *pGammaRamp = (D3DGAMMARAMP *)malloc(sizeof(D3DGAMMARAMP));
|
||||
|
||||
g_pD3DDevice->GetGammaRamp(pGammaRamp);
|
||||
g_pD3DDevice->GetGammaRamp(
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // iSwapChain
|
||||
#endif
|
||||
pGammaRamp);
|
||||
|
||||
for(int v=0;v<256;v++)
|
||||
{
|
||||
|
@ -2736,8 +2770,13 @@ XTL::X_D3DSurface* WINAPI XTL::EMUPATCH(D3DDevice_GetBackBuffer2)
|
|||
{
|
||||
// create a buffer to return
|
||||
// TODO: Verify the surface is always 640x480
|
||||
#ifdef CXBX_USE_D3D9
|
||||
hRet = g_pD3DDevice->CreateOffscreenPlainSurface(640, 480, D3DFMT_A8R8G8B8, /*D3DPool=* /0, &pCachedPrimarySurface, nullptr);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateOffscreenPlainSurface");
|
||||
#else
|
||||
hRet = g_pD3DDevice->CreateImageSurface(640, 480, D3DFMT_A8R8G8B8, &pCachedPrimarySurface);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateImageSurface");
|
||||
#endif
|
||||
}
|
||||
|
||||
SetHostSurface(pBackBuffer, pCachedPrimarySurface);
|
||||
|
@ -2759,7 +2798,11 @@ XTL::X_D3DSurface* WINAPI XTL::EMUPATCH(D3DDevice_GetBackBuffer2)
|
|||
}
|
||||
|
||||
if(BackBuffer != -1) {
|
||||
hRet = g_pD3DDevice->GetBackBuffer(BackBuffer, D3DBACKBUFFER_TYPE_MONO, &pCachedPrimarySurface);
|
||||
hRet = g_pD3DDevice->GetBackBuffer(
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // iSwapChain
|
||||
#endif
|
||||
BackBuffer, D3DBACKBUFFER_TYPE_MONO, &pCachedPrimarySurface);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->GetBackBuffer");
|
||||
}
|
||||
//*/
|
||||
|
@ -2773,7 +2816,11 @@ XTL::X_D3DSurface* WINAPI XTL::EMUPATCH(D3DDevice_GetBackBuffer2)
|
|||
BackBuffer = 0;
|
||||
}
|
||||
|
||||
HRESULT hRet = g_pD3DDevice->GetBackBuffer(BackBuffer, D3DBACKBUFFER_TYPE_MONO, &pNewHostSurface);
|
||||
HRESULT hRet = g_pD3DDevice->GetBackBuffer(
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // iSwapChain
|
||||
#endif
|
||||
BackBuffer, D3DBACKBUFFER_TYPE_MONO, &pNewHostSurface);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->GetBackBuffer");
|
||||
|
||||
if (FAILED(hRet))
|
||||
|
@ -2817,7 +2864,11 @@ XTL::X_D3DSurface* WINAPI XTL::EMUPATCH(D3DDevice_GetBackBuffer2)
|
|||
BackBuffer = 0;
|
||||
}
|
||||
|
||||
hRet = g_pD3DDevice->GetBackBuffer(BackBuffer, D3DBACKBUFFER_TYPE_MONO, &pNewHostSurface);
|
||||
hRet = g_pD3DDevice->GetBackBuffer(
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // iSwapChain
|
||||
#endif
|
||||
BackBuffer, D3DBACKBUFFER_TYPE_MONO, &pNewHostSurface);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->GetBackBuffer");
|
||||
|
||||
if (FAILED(hRet)) {
|
||||
|
@ -4338,12 +4389,26 @@ void CreateHostResource(XTL::X_D3DResource *pResource, int iTextureStage, DWORD
|
|||
case X_D3DRTYPE_SURFACE: {
|
||||
if (D3DUsage & D3DUSAGE_DEPTHSTENCIL) {
|
||||
hRet = g_pD3DDevice->CreateDepthStencilSurface(dwWidth, dwHeight, PCFormat,
|
||||
g_EmuCDPD.HostPresentationParameters.MultiSampleType, &pNewHostSurface);
|
||||
g_EmuCDPD.HostPresentationParameters.MultiSampleType,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // MultisampleQuality
|
||||
false, // Discard
|
||||
#endif
|
||||
&pNewHostSurface
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateDepthStencilSurface");
|
||||
}
|
||||
else {
|
||||
#ifdef CXBX_USE_D3D9
|
||||
hRet = g_pD3DDevice->CreateOffscreenPlainSurface(dwWidth, dwHeight, PCFormat, D3DPool, &pNewHostSurface, nullptr);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateOffscreenPlainSurface");
|
||||
#else
|
||||
hRet = g_pD3DDevice->CreateImageSurface(dwWidth, dwHeight, PCFormat, &pNewHostSurface);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateImageSurface");
|
||||
#endif
|
||||
}
|
||||
|
||||
// First fail, retry with a fallback format
|
||||
|
@ -4359,7 +4424,11 @@ void CreateHostResource(XTL::X_D3DResource *pResource, int iTextureStage, DWORD
|
|||
}
|
||||
|
||||
EmuWarning("Trying Fallback");
|
||||
#ifdef CXBX_USE_D3D9
|
||||
hRet = g_pD3DDevice->CreateOffscreenPlainSurface(dwWidth, dwHeight, PCFormat, D3DPool, &pNewHostSurface, nullptr);
|
||||
#else
|
||||
hRet = g_pD3DDevice->CreateImageSurface(dwWidth, dwHeight, D3DFMT_A8R8G8B8, &pNewHostSurface);
|
||||
#endif
|
||||
}
|
||||
|
||||
// If the fallback failed, show an error and exit execution.
|
||||
|
@ -4391,14 +4460,33 @@ void CreateHostResource(XTL::X_D3DResource *pResource, int iTextureStage, DWORD
|
|||
}
|
||||
|
||||
case X_D3DRTYPE_TEXTURE: {
|
||||
/* TODO : Enabled this if D3DPool is ever anything else but D3DPOOL_MANAGED :
|
||||
#ifdef CXBX_USE_D3D9
|
||||
if (D3DPool == D3DPOOL_DEFAULT) {
|
||||
if ((D3DUsage & D3DUSAGE_DYNAMIC) == 0) {
|
||||
if ((D3DUsage & D3DUSAGE_RENDERTARGET) == 0) {
|
||||
D3DUsage |= D3DUSAGE_DYNAMIC;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
hRet = g_pD3DDevice->CreateTexture(dwWidth, dwHeight, dwMipMapLevels,
|
||||
D3DUsage, PCFormat, D3DPool, &pNewHostTexture);
|
||||
D3DUsage, PCFormat, D3DPool, &pNewHostTexture
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateTexture");
|
||||
|
||||
// If the above failed, we might be able to use an ARGB texture instead
|
||||
if ((hRet != D3D_OK) && (PCFormat != D3DFMT_A8R8G8B8) && EmuXBFormatCanBeConvertedToARGB(X_Format)) {
|
||||
hRet = g_pD3DDevice->CreateTexture(dwWidth, dwHeight, dwMipMapLevels,
|
||||
D3DUsage, D3DFMT_A8R8G8B8, D3DPool, &pNewHostTexture);
|
||||
D3DUsage, D3DFMT_A8R8G8B8, D3DPool, &pNewHostTexture
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateTexture(D3DFMT_A8R8G8B8)");
|
||||
|
||||
if (hRet == D3D_OK) {
|
||||
|
@ -4414,7 +4502,10 @@ void CreateHostResource(XTL::X_D3DResource *pResource, int iTextureStage, DWORD
|
|||
(
|
||||
dwWidth, dwHeight, dwMipMapLevels, D3DUsage, PCFormat,
|
||||
D3DPOOL_SYSTEMMEM, &pNewHostTexture
|
||||
);
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateTexture(D3DPOOL_SYSTEMMEM)");
|
||||
}*/
|
||||
|
||||
|
@ -4432,7 +4523,11 @@ void CreateHostResource(XTL::X_D3DResource *pResource, int iTextureStage, DWORD
|
|||
|
||||
case X_D3DRTYPE_VOLUMETEXTURE: {
|
||||
hRet = g_pD3DDevice->CreateVolumeTexture(dwWidth, dwHeight, dwDepth,
|
||||
dwMipMapLevels, D3DUsage, PCFormat, D3DPool, &pNewHostVolumeTexture);
|
||||
dwMipMapLevels, D3DUsage, PCFormat, D3DPool, &pNewHostVolumeTexture
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateVolumeTexture");
|
||||
|
||||
if (hRet != D3D_OK) {
|
||||
|
@ -4451,7 +4546,11 @@ void CreateHostResource(XTL::X_D3DResource *pResource, int iTextureStage, DWORD
|
|||
dwMipMapLevels, PCFormat);
|
||||
|
||||
hRet = g_pD3DDevice->CreateCubeTexture(dwWidth, dwMipMapLevels, D3DUsage,
|
||||
PCFormat, D3DPool, &pNewHostCubeTexture);
|
||||
PCFormat, D3DPool, &pNewHostCubeTexture
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->CreateCubeTexture");
|
||||
|
||||
if (hRet != D3D_OK) {
|
||||
|
@ -4853,7 +4952,11 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_UpdateOverlay)
|
|||
}
|
||||
|
||||
IDirect3DSurface *pBackBufferSurface = nullptr;
|
||||
HRESULT hRet = g_pD3DDevice->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &pBackBufferSurface);
|
||||
HRESULT hRet = g_pD3DDevice->GetBackBuffer(
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // iSwapChain
|
||||
#endif
|
||||
0, D3DBACKBUFFER_TYPE_MONO, &pBackBufferSurface);
|
||||
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->GetBackBuffer - Unable to get backbuffer surface!");
|
||||
|
||||
// if we obtained the backbuffer, load the YUY2 into the backbuffer
|
||||
|
@ -6271,7 +6374,9 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_DrawIndexedVertices)
|
|||
HRESULT hRet = g_pD3DDevice->DrawIndexedPrimitive
|
||||
(
|
||||
D3DPT_TRIANGLEFAN, // Draw a triangle-fan instead of a quad
|
||||
//{ $IFDEF DXBX_USE_D3D9 } {BaseVertexIndex = }0, { $ENDIF }
|
||||
#ifdef CXBX_USE_D3D9
|
||||
/* BaseVertexIndex = */0, // TODO : Use g_CachedIndexBase here too? Or transformed somehow?
|
||||
#endif
|
||||
/* MinVertexIndex = */0,
|
||||
/* NumVertices = */VERTICES_PER_QUAD, // Use all 4 vertices of 1 quad
|
||||
uiStartIndex,
|
||||
|
@ -6289,6 +6394,9 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_DrawIndexedVertices)
|
|||
// Other primitives than X_D3DPT_QUADLIST can be drawn normally :
|
||||
hRet = g_pD3DDevice->DrawIndexedPrimitive(
|
||||
EmuXB2PC_D3DPrimitiveType(VPDesc.XboxPrimitiveType),
|
||||
#ifdef CXBX_USE_D3D9
|
||||
g_CachedIndexBase,
|
||||
#endif
|
||||
/* MinVertexIndex = */0,
|
||||
/* NumVertices = */uiNumVertices, // TODO : g_EmuD3DActiveStreamSizes[0], // Note : ATI drivers are especially picky about this -
|
||||
// NumVertices should be the span of covered vertices in the active vertex buffer (TODO : Is stream 0 correct?)
|
||||
|
@ -6307,7 +6415,11 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_DrawIndexedVertices)
|
|||
g_dwPrimPerFrame += VPDesc.dwHostPrimitiveCount;
|
||||
}
|
||||
|
||||
#ifdef CXBX_USE_D3D9
|
||||
g_pD3DDevice->SetIndices(nullptr);
|
||||
#else
|
||||
g_pD3DDevice->SetIndices(NULL, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Execute callback procedure
|
||||
|
|
|
@ -930,7 +930,11 @@ static const FormatInfo FormatInfos[] = {
|
|||
/* 0x32 X_D3DFMT_L16 */ { 16, Swzzld, _____L16, XTL::D3DFMT_A8L8 , Texture, "X_D3DFMT_L16 -> D3DFMT_A8L8" },
|
||||
/* 0x33 X_D3DFMT_V16U16 */ { 32, Swzzld, NoCmpnts, XTL::D3DFMT_V16U16 },
|
||||
/* 0x34 undefined */ {},
|
||||
#ifdef CXBX_USE_D3D9
|
||||
/* 0x35 X_D3DFMT_LIN_L16 */ { 16, Linear, _____L16, XTL::D3DFMT_L16 },
|
||||
#else
|
||||
/* 0x35 X_D3DFMT_LIN_L16 */ { 16, Linear, _____L16, XTL::D3DFMT_A8L8 , Texture, "X_D3DFMT_LIN_L16 -> D3DFMT_A8L8" },
|
||||
#endif
|
||||
/* 0x36 X_D3DFMT_LIN_V16U16 */ { 32, Linear, NoCmpnts, XTL::D3DFMT_V16U16 }, // Note : Seems ununsed on Xbox
|
||||
/* 0x37 X_D3DFMT_LIN_L6V5U5 */ { 16, Linear, __R6G5B5, XTL::D3DFMT_L6V5U5 }, // Alias : X_D3DFMT_LIN_R6G5B5
|
||||
/* 0x38 X_D3DFMT_R5G5B5A1 */ { 16, Swzzld, R5G5B5A1, XTL::D3DFMT_A1R5G5B5 , Texture, "X_D3DFMT_R5G5B5A1 -> D3DFMT_A1R5G5B5" },
|
||||
|
@ -1532,7 +1536,7 @@ const RenderStateInfo DxbxRenderStateInfo[] = {
|
|||
{ "D3DRS_STENCILMASK" /*= 72*/, 3424, xtBYTE, NV2A_STENCIL_FUNC_MASK, D3DRS_STENCILMASK, "BYTE mask value used in stencil test" },
|
||||
{ "D3DRS_STENCILWRITEMASK" /*= 73*/, 3424, xtBYTE, NV2A_STENCIL_MASK, D3DRS_STENCILWRITEMASK, "BYTE write mask applied to values written to stencil buffer" },
|
||||
{ "D3DRS_BLENDOP" /*= 74*/, 3424, xtD3DBLENDOP, NV2A_BLEND_EQUATION, D3DRS_BLENDOP },
|
||||
#ifdef DXBX_USE_D3D9
|
||||
#ifdef CXBX_USE_D3D9
|
||||
{ "D3DRS_BLENDCOLOR" /*= 75*/, 3424, xtD3DCOLOR, NV2A_BLEND_COLOR, D3DRS_BLENDFACTOR, "D3DCOLOR for D3DBLEND_CONSTANTCOLOR" },
|
||||
// D3D9 D3DRS_BLENDFACTOR : D3DCOLOR used for a constant blend factor during alpha blending for devices that support D3DPBLENDCAPS_BLENDFACTOR
|
||||
#else
|
||||
|
@ -1588,7 +1592,11 @@ const RenderStateInfo DxbxRenderStateInfo[] = {
|
|||
{ "D3DRS_POINTSCALE_C" /*= 122*/, 3424, xtFloat, 0, D3DRS_POINTSCALE_C },
|
||||
{ "D3DRS_POINTSIZE_MAX" /*= 123*/, 3424, xtFloat, 0, D3DRS_POINTSIZE_MAX },
|
||||
{ "D3DRS_PATCHEDGESTYLE" /*= 124*/, 3424, xtDWORD, 0, D3DRS_PATCHEDGESTYLE }, // D3DPATCHEDGESTYLE?
|
||||
#ifdef CXBX_USE_D3D9 // D3DRS_PATCHSEGMENTS exists in Direct3D 8, but not in 9 !?
|
||||
{ "D3DRS_PATCHSEGMENTS" /*= 125*/, 3424, xtDWORD, 0 }, // nsp.
|
||||
#else
|
||||
{ "D3DRS_PATCHSEGMENTS" /*= 125*/, 3424, xtDWORD, 0, D3DRS_PATCHSEGMENTS },
|
||||
#endif
|
||||
// TODO -oDxbx : Is X_D3DRS_SWAPFILTER really a xtD3DMULTISAMPLE_TYPE?
|
||||
{ "D3DRS_SWAPFILTER" /*= 126*/, 4361, xtD3DMULTISAMPLE_TYPE, 0, D3DRS_NONE, "D3DTEXF_LINEAR etc. filter to use for Swap" }, // nsp.
|
||||
{ "D3DRS_PRESENTATIONINTERVAL" /*= 127*/, 4627, xtDWORD, 0 }, // nsp.
|
||||
|
@ -1614,13 +1622,13 @@ const RenderStateInfo DxbxRenderStateInfo[] = {
|
|||
{ "D3DRS_FRONTFACE" /*= 146*/, 3424, xtD3DFRONT, NV2A_FRONT_FACE }, // nsp.
|
||||
{ "D3DRS_CULLMODE" /*= 147*/, 3424, xtD3DCULL, NV2A_CULL_FACE, D3DRS_CULLMODE },
|
||||
{ "D3DRS_TEXTUREFACTOR" /*= 148*/, 3424, xtD3DCOLOR, NV2A_RC_CONSTANT_COLOR0(0), D3DRS_TEXTUREFACTOR },
|
||||
#ifdef DXBX_USE_D3D9
|
||||
#ifdef CXBX_USE_D3D9
|
||||
{ "D3DRS_ZBIAS" /*= 149*/, 3424, xtLONG, 0, D3DRS_DEPTHBIAS },
|
||||
#else
|
||||
{ "D3DRS_ZBIAS" /*= 149*/, 3424, xtLONG, 0, D3DRS_ZBIAS },
|
||||
#endif
|
||||
{ "D3DRS_LOGICOP" /*= 150*/, 3424, xtD3DLOGICOP, NV2A_COLOR_LOGIC_OP_OP }, // nsp.
|
||||
#ifdef DXBX_USE_D3D9
|
||||
#ifdef CXBX_USE_D3D9
|
||||
{ "D3DRS_EDGEANTIALIAS" /*= 151*/, 3424, xtBOOL, NV2A_LINE_SMOOTH_ENABLE, D3DRS_ANTIALIASEDLINEENABLE }, // Dxbx note : No Xbox ext. (according to Direct3D8) !
|
||||
#else
|
||||
{ "D3DRS_EDGEANTIALIAS" /*= 151*/, 3424, xtBOOL, NV2A_LINE_SMOOTH_ENABLE, D3DRS_EDGEANTIALIAS }, // Dxbx note : No Xbox ext. (according to Direct3D8) !
|
||||
|
|
|
@ -43,6 +43,9 @@
|
|||
|
||||
// TODO: Find somewhere to put this that doesn't conflict with XTL::
|
||||
extern void EmuUpdateActiveTextureStages();
|
||||
#ifdef CXBX_USE_D3D9
|
||||
extern DWORD g_CachedIndexBase;
|
||||
#endif
|
||||
|
||||
uint32 XTL::g_dwPrimaryPBCount = 0;
|
||||
uint32 *XTL::g_pPrimaryPB = 0;
|
||||
|
@ -267,7 +270,16 @@ extern void XTL::EmuExecutePushBufferRaw
|
|||
// create cached vertex buffer only once, with maxed out size
|
||||
if(pVertexBuffer == 0)
|
||||
{
|
||||
HRESULT hRet = g_pD3DDevice->CreateVertexBuffer(2047*sizeof(DWORD), D3DUSAGE_WRITEONLY, dwVertexShader, D3DPOOL_MANAGED, &pVertexBuffer);
|
||||
HRESULT hRet = g_pD3DDevice->CreateVertexBuffer(
|
||||
2047*sizeof(DWORD),
|
||||
D3DUSAGE_WRITEONLY,
|
||||
dwVertexShader,
|
||||
D3DPOOL_MANAGED,
|
||||
&pVertexBuffer
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
|
||||
if(FAILED(hRet))
|
||||
CxbxKrnlCleanup("Unable to create vertex buffer cache for PushBuffer emulation (0x1818, dwCount : %d)", dwCount);
|
||||
|
@ -376,7 +388,11 @@ extern void XTL::EmuExecutePushBufferRaw
|
|||
pIndexBuffer->Release();
|
||||
}
|
||||
|
||||
hRet = g_pD3DDevice->CreateIndexBuffer(dwCount*2 + 2*2, 0, D3DFMT_INDEX16, D3DPOOL_MANAGED, &pIndexBuffer);
|
||||
hRet = g_pD3DDevice->CreateIndexBuffer(dwCount*2 + 2*2, 0, D3DFMT_INDEX16, D3DPOOL_MANAGED, &pIndexBuffer
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
|
||||
maxIBSize = dwCount*2 + 2*2;
|
||||
}
|
||||
|
@ -417,7 +433,11 @@ extern void XTL::EmuExecutePushBufferRaw
|
|||
|
||||
bool bPatched = VertPatch.Apply(&VPDesc, NULL);
|
||||
|
||||
g_pD3DDevice->SetIndices(pIndexBuffer, 0);
|
||||
#ifdef CXBX_USE_D3D9
|
||||
g_pD3DDevice->SetIndices(pIndexBuffer);
|
||||
#else
|
||||
g_pD3DDevice->SetIndices(pIndexBuffer, 0);
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG_TRACK_PB
|
||||
if(!g_PBTrackDisable.exists(pdwOrigPushData))
|
||||
|
@ -430,8 +450,14 @@ extern void XTL::EmuExecutePushBufferRaw
|
|||
{
|
||||
g_pD3DDevice->DrawIndexedPrimitive
|
||||
(
|
||||
PCPrimitiveType, 0, 8*1024*1024, 0, PrimitiveCount
|
||||
// PCPrimitiveType, 0, dwCount*2, 0, PrimitiveCount
|
||||
PCPrimitiveType,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
g_CachedIndexBase,
|
||||
#endif
|
||||
0,
|
||||
8*1024*1024, // dwCount*2
|
||||
0,
|
||||
PrimitiveCount
|
||||
);
|
||||
|
||||
g_dwPrimPerFrame += PrimitiveCount;
|
||||
|
@ -442,7 +468,11 @@ extern void XTL::EmuExecutePushBufferRaw
|
|||
}
|
||||
#endif
|
||||
|
||||
g_pD3DDevice->SetIndices(0, 0);
|
||||
#ifdef CXBX_USE_D3D9
|
||||
g_pD3DDevice->SetIndices(nullptr);
|
||||
#else
|
||||
g_pD3DDevice->SetIndices(0, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -485,7 +515,11 @@ extern void XTL::EmuExecutePushBufferRaw
|
|||
UINT uiStride;
|
||||
|
||||
// retrieve stream data
|
||||
g_pD3DDevice->GetStreamSource(0, &pActiveVB, &uiStride);
|
||||
g_pD3DDevice->GetStreamSource(0, &pActiveVB,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
nullptr, // pOffsetInBytes
|
||||
#endif
|
||||
&uiStride);
|
||||
|
||||
// retrieve stream desc
|
||||
pActiveVB->GetDesc(&VBDesc);
|
||||
|
@ -528,7 +562,11 @@ extern void XTL::EmuExecutePushBufferRaw
|
|||
pIndexBuffer->Release();
|
||||
}
|
||||
|
||||
hRet = g_pD3DDevice->CreateIndexBuffer(dwCount*2, 0, D3DFMT_INDEX16, D3DPOOL_MANAGED, &pIndexBuffer);
|
||||
hRet = g_pD3DDevice->CreateIndexBuffer(dwCount*2, 0, D3DFMT_INDEX16, D3DPOOL_MANAGED, &pIndexBuffer
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
|
||||
maxIBSize = dwCount*2;
|
||||
}
|
||||
|
@ -580,7 +618,11 @@ extern void XTL::EmuExecutePushBufferRaw
|
|||
|
||||
bool bPatched = VertPatch.Apply(&VPDesc, NULL);
|
||||
|
||||
g_pD3DDevice->SetIndices(pIndexBuffer, 0);
|
||||
#ifdef CXBX_USE_D3D9
|
||||
g_pD3DDevice->SetIndices(pIndexBuffer);
|
||||
#else
|
||||
g_pD3DDevice->SetIndices(pIndexBuffer, 0);
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG_TRACK_PB
|
||||
if(!g_PBTrackDisable.exists(pdwOrigPushData))
|
||||
|
@ -591,7 +633,14 @@ extern void XTL::EmuExecutePushBufferRaw
|
|||
{
|
||||
g_pD3DDevice->DrawIndexedPrimitive
|
||||
(
|
||||
PCPrimitiveType, 0, /*dwCount*2*/8*1024*1024, 0, PrimitiveCount
|
||||
PCPrimitiveType,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
g_CachedIndexBase,
|
||||
#endif
|
||||
0,
|
||||
/*dwCount*2*/8*1024*1024,
|
||||
0,
|
||||
PrimitiveCount
|
||||
);
|
||||
|
||||
g_dwPrimPerFrame += PrimitiveCount;
|
||||
|
@ -601,8 +650,12 @@ extern void XTL::EmuExecutePushBufferRaw
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef CXBX_USE_D3D9
|
||||
g_pD3DDevice->SetIndices(nullptr);
|
||||
#else
|
||||
g_pD3DDevice->SetIndices(0, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
pdwPushData--;
|
||||
|
@ -646,7 +699,11 @@ void DbgDumpMesh(WORD *pIndexData, DWORD dwCount)
|
|||
UINT uiStride;
|
||||
|
||||
// retrieve stream data
|
||||
g_pD3DDevice->GetStreamSource(0, &pActiveVB, &uiStride);
|
||||
g_pD3DDevice->GetStreamSource(0, &pActiveVB,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
nullptr, // pOffsetInBytes
|
||||
#endif
|
||||
&uiStride);
|
||||
|
||||
char szFileName[128];
|
||||
sprintf(szFileName, "D:\\_cxbx\\mesh\\CxbxMesh-0x%.08X.x", pIndexData);
|
||||
|
|
|
@ -139,8 +139,10 @@ void XTL::EmuUpdateDeferredStates()
|
|||
if(XTL::EmuD3DDeferredRenderState[31] != X_D3DRS_UNK)
|
||||
g_pD3DDevice->SetRenderState(D3DRS_POINTSIZE_MAX, XTL::EmuD3DDeferredRenderState[31]);
|
||||
|
||||
#ifndef CXBX_USE_D3D9 // D3DRS_PATCHSEGMENTS exists in Direct3D 8, but not in 9 !?
|
||||
if(XTL::EmuD3DDeferredRenderState[33] != X_D3DRS_UNK)
|
||||
g_pD3DDevice->SetRenderState(D3DRS_PATCHSEGMENTS, XTL::EmuD3DDeferredRenderState[33]);
|
||||
#endif
|
||||
|
||||
/** To check for unhandled RenderStates
|
||||
for(int v=0;v<117-82;v++)
|
||||
|
|
|
@ -95,7 +95,16 @@ bool GetCachedVertexBufferObject(DWORD pXboxDataPtr, DWORD size, XTL::IDirect3DV
|
|||
newBuffer.uiSize = size;
|
||||
newBuffer.lastUsed = std::chrono::high_resolution_clock::now();
|
||||
|
||||
HRESULT hRet = g_pD3DDevice->CreateVertexBuffer(size, D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, 0, XTL::D3DPOOL_DEFAULT, &newBuffer.pHostVertexBuffer);
|
||||
HRESULT hRet = g_pD3DDevice->CreateVertexBuffer(
|
||||
size,
|
||||
D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC,
|
||||
0,
|
||||
XTL::D3DPOOL_DEFAULT,
|
||||
&newBuffer.pHostVertexBuffer
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
if (FAILED(hRet)) {
|
||||
CxbxKrnlCleanup("Failed to create vertex buffer");
|
||||
}
|
||||
|
@ -118,7 +127,16 @@ bool GetCachedVertexBufferObject(DWORD pXboxDataPtr, DWORD size, XTL::IDirect3DV
|
|||
// If execution reached here, we need to release and re-create the vertex buffer..
|
||||
buffer->pHostVertexBuffer->Release();
|
||||
buffer->uiSize = size;
|
||||
HRESULT hRet = g_pD3DDevice->CreateVertexBuffer(size, D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, 0, XTL::D3DPOOL_DEFAULT, &buffer->pHostVertexBuffer);
|
||||
HRESULT hRet = g_pD3DDevice->CreateVertexBuffer(
|
||||
size,
|
||||
D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC,
|
||||
0,
|
||||
XTL::D3DPOOL_DEFAULT,
|
||||
&buffer->pHostVertexBuffer
|
||||
#ifdef CXBX_USE_D3D9
|
||||
, nullptr
|
||||
#endif
|
||||
);
|
||||
if (FAILED(hRet)) {
|
||||
CxbxKrnlCleanup("Failed to create vertex buffer");
|
||||
}
|
||||
|
@ -351,7 +369,7 @@ bool XTL::VertexPatcher::PatchStream(VertexPatchDesc *pPatchDesc,
|
|||
pOrigVertex += 1 * sizeof(SHORT);
|
||||
break;
|
||||
}
|
||||
#if !DXBX_USE_D3D9 // No need for patching in D3D9
|
||||
#if !CXBX_USE_D3D9 // No need for patching in D3D9
|
||||
case X_D3DVSDT_NORMSHORT2: { // 0x21: // Make it FLOAT2
|
||||
// UNTESTED - Need test-case!
|
||||
((FLOAT *)pNewDataPos)[0] = ((FLOAT)((SHORT*)pOrigVertex)[0]) / 32767.0f;
|
||||
|
@ -368,7 +386,7 @@ bool XTL::VertexPatcher::PatchStream(VertexPatchDesc *pPatchDesc,
|
|||
pOrigVertex += 3 * sizeof(SHORT);
|
||||
break;
|
||||
}
|
||||
#if !DXBX_USE_D3D9 // No need for patching in D3D9
|
||||
#if !CXBX_USE_D3D9 // No need for patching in D3D9
|
||||
case X_D3DVSDT_NORMSHORT4: { // 0x41: // Make it FLOAT4
|
||||
// UNTESTED - Need test-case!
|
||||
((FLOAT *)pNewDataPos)[0] = ((FLOAT)((SHORT*)pOrigVertex)[0]) / 32767.0f;
|
||||
|
@ -412,7 +430,14 @@ bool XTL::VertexPatcher::PatchStream(VertexPatchDesc *pPatchDesc,
|
|||
//if(pNewVertexBuffer != nullptr) // Dxbx addition
|
||||
pNewVertexBuffer->Unlock();
|
||||
|
||||
if(FAILED(g_pD3DDevice->SetStreamSource(uiStream, pNewVertexBuffer, pStreamPatch->ConvertedStride)))
|
||||
HRESULT hr = g_pD3DDevice->SetStreamSource(
|
||||
uiStream,
|
||||
pNewVertexBuffer,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // OffsetInBytes
|
||||
#endif
|
||||
pStreamPatch->ConvertedStride);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
CxbxKrnlCleanup("Failed to set the type patched buffer as the new stream source!\n");
|
||||
}
|
||||
|
@ -575,7 +600,14 @@ bool XTL::VertexPatcher::NormalizeTexCoords(VertexPatchDesc *pPatchDesc, UINT ui
|
|||
{
|
||||
pNewVertexBuffer->Unlock();
|
||||
|
||||
if(FAILED(g_pD3DDevice->SetStreamSource(uiStream, pNewVertexBuffer, uiStride)))
|
||||
HRESULT hr = g_pD3DDevice->SetStreamSource(
|
||||
uiStream,
|
||||
pNewVertexBuffer,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // OffsetInBytes
|
||||
#endif
|
||||
uiStride);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
CxbxKrnlCleanup("Failed to set the texcoord patched FVF buffer as the new stream source.");
|
||||
}
|
||||
|
@ -769,7 +801,13 @@ bool XTL::VertexPatcher::PatchPrimitive(VertexPatchDesc *pPatchDesc,
|
|||
{
|
||||
pStream->pPatchedStream->Unlock();
|
||||
|
||||
g_pD3DDevice->SetStreamSource(uiStream, pStream->pPatchedStream, pStream->uiOrigStride);
|
||||
g_pD3DDevice->SetStreamSource(
|
||||
uiStream,
|
||||
pStream->pPatchedStream,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // OffsetInBytes
|
||||
#endif
|
||||
pStream->uiOrigStride);
|
||||
}
|
||||
|
||||
m_bPatched = true;
|
||||
|
@ -820,7 +858,13 @@ bool XTL::VertexPatcher::Apply(VertexPatchDesc *pPatchDesc, bool *pbFatalError)
|
|||
pHostVertexBuffer->Unlock();
|
||||
|
||||
// Set the buffer as a stream source
|
||||
g_pD3DDevice->SetStreamSource(uiStream, pHostVertexBuffer, g_D3DStreamStrides[uiStream]);
|
||||
g_pD3DDevice->SetStreamSource(
|
||||
uiStream,
|
||||
pHostVertexBuffer,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
0, // OffsetInBytes
|
||||
#endif
|
||||
g_D3DStreamStrides[uiStream]);
|
||||
}
|
||||
|
||||
// TODO: Cache Vertex Buffer Data
|
||||
|
|
|
@ -2068,7 +2068,7 @@ static void VshConvertToken_STREAMDATA_REG(DWORD *pToken,
|
|||
break;
|
||||
case X_D3DVSDT_NONE: // 0x02:
|
||||
DbgVshPrintf("D3DVSDT_NONE /* xbox ext. nsp */");
|
||||
#if DXBX_USE_D3D9
|
||||
#if CXBX_USE_D3D9
|
||||
NewDataType = D3DVSDT_NONE;
|
||||
#endif
|
||||
// TODO -oDxbx: Use D3DVSD_NOP ?
|
||||
|
|
|
@ -58,46 +58,91 @@ ENUM2STR_START(D3DCUBEMAP_FACES)
|
|||
ENUM2STR_END_and_LOGRENDER(D3DCUBEMAP_FACES)
|
||||
|
||||
ENUM2STR_START(D3DFORMAT)
|
||||
ENUM2STR_CASE(D3DFMT_UNKNOWN)
|
||||
ENUM2STR_CASE(D3DFMT_R8G8B8)
|
||||
ENUM2STR_CASE(D3DFMT_A8R8G8B8)
|
||||
ENUM2STR_CASE(D3DFMT_X8R8G8B8)
|
||||
ENUM2STR_CASE(D3DFMT_R5G6B5)
|
||||
ENUM2STR_CASE(D3DFMT_X1R5G5B5)
|
||||
ENUM2STR_CASE(D3DFMT_A1R5G5B5)
|
||||
ENUM2STR_CASE(D3DFMT_A4R4G4B4)
|
||||
ENUM2STR_CASE(D3DFMT_R3G3B2)
|
||||
ENUM2STR_CASE(D3DFMT_A8)
|
||||
ENUM2STR_CASE(D3DFMT_A8R3G3B2)
|
||||
ENUM2STR_CASE(D3DFMT_X4R4G4B4)
|
||||
ENUM2STR_CASE(D3DFMT_A8P8)
|
||||
ENUM2STR_CASE(D3DFMT_P8)
|
||||
ENUM2STR_CASE(D3DFMT_L8)
|
||||
ENUM2STR_CASE(D3DFMT_A8L8)
|
||||
ENUM2STR_CASE(D3DFMT_A4L4)
|
||||
ENUM2STR_CASE(D3DFMT_V8U8)
|
||||
ENUM2STR_CASE(D3DFMT_L6V5U5)
|
||||
ENUM2STR_CASE(D3DFMT_X8L8V8U8)
|
||||
ENUM2STR_CASE(D3DFMT_Q8W8V8U8)
|
||||
ENUM2STR_CASE(D3DFMT_V16U16)
|
||||
ENUM2STR_CASE(D3DFMT_W11V11U10)
|
||||
ENUM2STR_CASE(D3DFMT_UYVY)
|
||||
ENUM2STR_CASE(D3DFMT_YUY2)
|
||||
ENUM2STR_CASE(D3DFMT_DXT1)
|
||||
ENUM2STR_CASE(D3DFMT_DXT2)
|
||||
ENUM2STR_CASE(D3DFMT_DXT3)
|
||||
ENUM2STR_CASE(D3DFMT_DXT4)
|
||||
ENUM2STR_CASE(D3DFMT_DXT5)
|
||||
ENUM2STR_CASE(D3DFMT_D16_LOCKABLE)
|
||||
ENUM2STR_CASE(D3DFMT_D32)
|
||||
ENUM2STR_CASE(D3DFMT_D15S1)
|
||||
ENUM2STR_CASE(D3DFMT_D24S8)
|
||||
ENUM2STR_CASE(D3DFMT_D16)
|
||||
ENUM2STR_CASE(D3DFMT_D24X8)
|
||||
ENUM2STR_CASE(D3DFMT_D24X4S4)
|
||||
ENUM2STR_CASE(D3DFMT_VERTEXDATA)
|
||||
ENUM2STR_CASE(D3DFMT_INDEX16)
|
||||
ENUM2STR_CASE(D3DFMT_INDEX32)
|
||||
ENUM2STR_CASE(D3DFMT_UNKNOWN) // = 0,
|
||||
ENUM2STR_CASE(D3DFMT_R8G8B8) // = 20,
|
||||
ENUM2STR_CASE(D3DFMT_A8R8G8B8) // = 21,
|
||||
ENUM2STR_CASE(D3DFMT_X8R8G8B8) // = 22,
|
||||
ENUM2STR_CASE(D3DFMT_R5G6B5) // = 23,
|
||||
ENUM2STR_CASE(D3DFMT_X1R5G5B5) // = 24,
|
||||
ENUM2STR_CASE(D3DFMT_A1R5G5B5) // = 25,
|
||||
ENUM2STR_CASE(D3DFMT_A4R4G4B4) // = 26,
|
||||
ENUM2STR_CASE(D3DFMT_R3G3B2) // = 27,
|
||||
ENUM2STR_CASE(D3DFMT_A8) // = 28,
|
||||
ENUM2STR_CASE(D3DFMT_A8R3G3B2) // = 29,
|
||||
ENUM2STR_CASE(D3DFMT_X4R4G4B4) // = 30,
|
||||
ENUM2STR_CASE(D3DFMT_A2B10G10R10) // = 31,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_A8B8G8R8) // = 32,
|
||||
ENUM2STR_CASE(D3DFMT_X8B8G8R8) // = 33,
|
||||
#endif // CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_G16R16) // = 34,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_A2R10G10B10) // = 35,
|
||||
ENUM2STR_CASE(D3DFMT_A16B16G16R16) // = 36,
|
||||
#endif // CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_A8P8) // = 40,
|
||||
ENUM2STR_CASE(D3DFMT_P8) // = 41,
|
||||
ENUM2STR_CASE(D3DFMT_L8) // = 50,
|
||||
ENUM2STR_CASE(D3DFMT_A8L8) // = 51,
|
||||
ENUM2STR_CASE(D3DFMT_A4L4) // = 52,
|
||||
ENUM2STR_CASE(D3DFMT_V8U8) // = 60,
|
||||
ENUM2STR_CASE(D3DFMT_L6V5U5) // = 61,
|
||||
ENUM2STR_CASE(D3DFMT_X8L8V8U8) // = 62,
|
||||
ENUM2STR_CASE(D3DFMT_Q8W8V8U8) // = 63,
|
||||
ENUM2STR_CASE(D3DFMT_V16U16) // = 64,
|
||||
#ifndef CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_W11V11U10) // = 65,
|
||||
#else // !CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_A2W10V10U10) // = 67,
|
||||
#endif // CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_UYVY) // = MAKEFOURCC('U', 'Y', 'V', 'Y'),
|
||||
#ifdef CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_R8G8_B8G8) // = MAKEFOURCC('R', 'G', 'B', 'G'),
|
||||
#endif // CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_YUY2) // = MAKEFOURCC('Y', 'U', 'Y', '2'),
|
||||
#ifdef CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_G8R8_G8B8) // = MAKEFOURCC('G', 'R', 'G', 'B'),
|
||||
#endif // CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_DXT1) // = MAKEFOURCC('D', 'X', 'T', '1'),
|
||||
ENUM2STR_CASE(D3DFMT_DXT2) // = MAKEFOURCC('D', 'X', 'T', '2'),
|
||||
ENUM2STR_CASE(D3DFMT_DXT3) // = MAKEFOURCC('D', 'X', 'T', '3'),
|
||||
ENUM2STR_CASE(D3DFMT_DXT4) // = MAKEFOURCC('D', 'X', 'T', '4'),
|
||||
ENUM2STR_CASE(D3DFMT_DXT5) // = MAKEFOURCC('D', 'X', 'T', '5'),
|
||||
ENUM2STR_CASE(D3DFMT_D16_LOCKABLE) // = 70,
|
||||
ENUM2STR_CASE(D3DFMT_D32) // = 71,
|
||||
ENUM2STR_CASE(D3DFMT_D15S1) // = 73,
|
||||
ENUM2STR_CASE(D3DFMT_D24S8) // = 75,
|
||||
ENUM2STR_CASE(D3DFMT_D24X8) // = 77,
|
||||
ENUM2STR_CASE(D3DFMT_D24X4S4) // = 79,
|
||||
ENUM2STR_CASE(D3DFMT_D16) // = 80,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_D32F_LOCKABLE) // = 82,
|
||||
ENUM2STR_CASE(D3DFMT_D24FS8) // = 83,
|
||||
#if !defined(D3D_DISABLE_9EX)
|
||||
ENUM2STR_CASE(D3DFMT_D32_LOCKABLE) // = 84,
|
||||
ENUM2STR_CASE(D3DFMT_S8_LOCKABLE) // = 85,
|
||||
#endif // !D3D_DISABLE_9EX
|
||||
ENUM2STR_CASE(D3DFMT_L16) // = 81,
|
||||
#endif // CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_VERTEXDATA) // = 100,
|
||||
ENUM2STR_CASE(D3DFMT_INDEX16) // = 101,
|
||||
ENUM2STR_CASE(D3DFMT_INDEX32) // = 102,
|
||||
#ifdef CXBX_USE_D3D9
|
||||
ENUM2STR_CASE(D3DFMT_Q16W16V16U16) // = 110,
|
||||
ENUM2STR_CASE(D3DFMT_MULTI2_ARGB8) // = MAKEFOURCC('M', 'E', 'T', '1'),
|
||||
ENUM2STR_CASE(D3DFMT_R16F) // = 111,
|
||||
ENUM2STR_CASE(D3DFMT_G16R16F) // = 112,
|
||||
ENUM2STR_CASE(D3DFMT_A16B16G16R16F) // = 113,
|
||||
ENUM2STR_CASE(D3DFMT_R32F) // = 114,
|
||||
ENUM2STR_CASE(D3DFMT_G32R32F) // = 115,
|
||||
ENUM2STR_CASE(D3DFMT_A32B32G32R32F) // = 116,
|
||||
ENUM2STR_CASE(D3DFMT_CxV8U8) // = 117,
|
||||
#if !defined(D3D_DISABLE_9EX)
|
||||
ENUM2STR_CASE(D3DFMT_A1) // = 118,
|
||||
ENUM2STR_CASE(D3DFMT_A2B10G10R10_XR_BIAS) // = 119,
|
||||
ENUM2STR_CASE(D3DFMT_BINARYBUFFER) // = 199,
|
||||
#endif // !D3D_DISABLE_9EX
|
||||
#endif // CXBX_USE_D3D9
|
||||
ENUM2STR_END_and_LOGRENDER(D3DFORMAT)
|
||||
|
||||
ENUM2STR_START(D3DPOOL)
|
||||
|
|
|
@ -34,10 +34,12 @@
|
|||
#ifndef EMUD3D8TYPES_H
|
||||
#define EMUD3D8TYPES_H
|
||||
|
||||
//#define CXBX_USE_D3D9
|
||||
//#define CXBX_USE_D3D9 // Declared in the Debug_Direct3D9 build configuration
|
||||
|
||||
#ifdef CXBX_USE_D3D9
|
||||
|
||||
#undef UNICODE // make sure dxerr.h DXGetErrorString is aliassed to *A, not *W
|
||||
|
||||
// include direct3d 9x headers
|
||||
#define DIRECT3D_VERSION 0x0900
|
||||
#include <d3d9.h>
|
||||
|
@ -45,6 +47,7 @@
|
|||
//implies #include <d3d9caps.h>
|
||||
#include <d3dx9math.h> // for D3DXVECTOR4, etc
|
||||
#include <d3dx9tex.h>
|
||||
|
||||
#include <dxerr.h>
|
||||
#pragma comment(lib, "dxerr.lib") // See https://blogs.msdn.microsoft.com/chuckw/2012/04/24/wheres-dxerr-lib/
|
||||
|
||||
|
@ -52,6 +55,10 @@
|
|||
// from https://www.microsoft.com/en-us/download/details.aspx?id=6812
|
||||
// and select the Direct3D 9 include & library path (TODO : how?)
|
||||
|
||||
// We're going to use the approach detailed in :
|
||||
// https://blogs.msdn.microsoft.com/chuckw/2015/03/23/the-zombie-directx-sdk/
|
||||
|
||||
|
||||
// For transforming code that's written for Direct3D 8 into Direct3D 9,
|
||||
// See "Converting to Direct3D 9" https://msdn.microsoft.com/en-us/library/windows/desktop/bb204851(v=vs.85).aspx
|
||||
|
||||
|
@ -61,8 +68,7 @@
|
|||
// Alias all host Direct3D 9 symbols to generic symbols
|
||||
#define Direct3DCreate Direct3DCreate9
|
||||
#define D3DXAssembleShader D3DXCompileShader
|
||||
#define DXGetErrorString DXGetErrorString9
|
||||
#define DXGetErrorDescription DXGetErrorDescription9
|
||||
#define FullScreen_PresentationInterval PresentationInterval // a field in D3DPRESENT_PARAMETERS
|
||||
|
||||
#define D3DADAPTER_IDENTIFIER D3DADAPTER_IDENTIFIER9
|
||||
#define D3DCAPS D3DCAPS9
|
||||
|
@ -425,8 +431,6 @@ typedef struct _X_D3DGAMMARAMP
|
|||
}
|
||||
X_D3DGAMMARAMP;
|
||||
|
||||
#define X_PIXELSHADER_FAKE_HANDLE 0xDEADBEEF
|
||||
|
||||
struct X_D3DVertexShader
|
||||
{
|
||||
union
|
||||
|
|
Loading…
Reference in New Issue