Moved XbConvert.h outside the XTL namespace.
Fixed up all XTL-hell that resulted from this.
This commit is contained in:
parent
32e155e1ba
commit
98c89ec656
|
@ -48,6 +48,7 @@ namespace xboxkrnl
|
|||
#include "core\hle\D3D8\XbPushBuffer.h"
|
||||
#include "core\kernel\memory-manager\VMManager.h" // for g_VMManager
|
||||
#include "core\kernel\support\EmuXTL.h"
|
||||
#include "core\hle\D3D8\XbConvert.h"
|
||||
#include "Logging.h"
|
||||
#include "..\XbD3D8Logging.h"
|
||||
#include "core\hle\Intercept.hpp" // for bLLE_GPU
|
||||
|
@ -1231,7 +1232,7 @@ void GetSurfaceFaceAndLevelWithinTexture(XTL::X_D3DSurface* pSurface, XTL::X_D3D
|
|||
CxbxGetPixelContainerMeasures(pSurface, 0, &surfaceWidth, &surfaceHeight, &surfaceDepth, &surfaceRowPitch, &surfaceSlicePitch);
|
||||
|
||||
// Iterate through all faces and levels, until we find a matching pointer
|
||||
bool isCompressed = XTL::EmuXBFormatIsCompressed(GetXboxPixelContainerFormat(pTexture));
|
||||
bool isCompressed = EmuXBFormatIsCompressed(GetXboxPixelContainerFormat(pTexture));
|
||||
int minSize = (isCompressed) ? 4 : 1;
|
||||
int cubeFaceOffset = 0; int cubeFaceSize = 0;
|
||||
auto pData = pTextureData;
|
||||
|
@ -1303,15 +1304,15 @@ bool ConvertD3DTextureToARGBBuffer(
|
|||
int iTextureStage = 0
|
||||
)
|
||||
{
|
||||
const XTL::FormatToARGBRow ConvertRowToARGB = EmuXBFormatComponentConverter(X_Format);
|
||||
const FormatToARGBRow ConvertRowToARGB = EmuXBFormatComponentConverter(X_Format);
|
||||
if (ConvertRowToARGB == nullptr)
|
||||
return false; // Unhandled conversion
|
||||
|
||||
uint8_t *unswizleBuffer = nullptr;
|
||||
if (XTL::EmuXBFormatIsSwizzled(X_Format)) {
|
||||
if (EmuXBFormatIsSwizzled(X_Format)) {
|
||||
unswizleBuffer = (uint8_t*)malloc(SrcSlicePitch * uiDepth); // TODO : Reuse buffer when performance is important
|
||||
// First we need to unswizzle the texture data
|
||||
XTL::EmuUnswizzleBox(
|
||||
EmuUnswizzleBox(
|
||||
pSrc, SrcWidth, SrcHeight, uiDepth,
|
||||
EmuXBFormatBytesPerPixel(X_Format),
|
||||
// Note : use src pitch on dest, because this is an intermediate step :
|
||||
|
@ -1365,7 +1366,7 @@ uint8_t *XTL::ConvertD3DTextureToARGB(
|
|||
{
|
||||
// Avoid allocating pDest when ConvertD3DTextureToARGBBuffer will fail anyway
|
||||
XTL::X_D3DFORMAT X_Format = GetXboxPixelContainerFormat(pXboxPixelContainer);
|
||||
const XTL::FormatToARGBRow ConvertRowToARGB = EmuXBFormatComponentConverter(X_Format);
|
||||
const FormatToARGBRow ConvertRowToARGB = EmuXBFormatComponentConverter(X_Format);
|
||||
if (ConvertRowToARGB == nullptr)
|
||||
return nullptr; // Unhandled conversion
|
||||
|
||||
|
@ -2009,8 +2010,8 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
|
|||
// TODO: Investigate the best option for this
|
||||
g_EmuCDPD.HostPresentationParameters.SwapEffect = XTL::D3DSWAPEFFECT_COPY;
|
||||
|
||||
g_EmuCDPD.HostPresentationParameters.BackBufferFormat = XTL::EmuXB2PC_D3DFormat(g_EmuCDPD.XboxPresentationParameters.BackBufferFormat);
|
||||
g_EmuCDPD.HostPresentationParameters.AutoDepthStencilFormat = XTL::EmuXB2PC_D3DFormat(g_EmuCDPD.XboxPresentationParameters.AutoDepthStencilFormat);
|
||||
g_EmuCDPD.HostPresentationParameters.BackBufferFormat = EmuXB2PC_D3DFormat(g_EmuCDPD.XboxPresentationParameters.BackBufferFormat);
|
||||
g_EmuCDPD.HostPresentationParameters.AutoDepthStencilFormat = EmuXB2PC_D3DFormat(g_EmuCDPD.XboxPresentationParameters.AutoDepthStencilFormat);
|
||||
|
||||
g_EmuCDPD.HostPresentationParameters.PresentationInterval = g_XBVideo.bVSync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
g_DefaultPresentationInterval = g_EmuCDPD.XboxPresentationParameters.PresentationInterval;
|
||||
|
@ -2169,9 +2170,9 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
|
|||
memset(g_bSupportsFormatCubeTexture, false, sizeof(g_bSupportsFormatCubeTexture));
|
||||
for (int X_Format = XTL::X_D3DFMT_L8; X_Format <= XTL::X_D3DFMT_LIN_R8G8B8A8; X_Format++) {
|
||||
// Only process Xbox formats that are directly mappable to host
|
||||
if (!XTL::EmuXBFormatRequiresConversionToARGB((XTL::X_D3DFORMAT)X_Format)) {
|
||||
if (!EmuXBFormatRequiresConversionToARGB((XTL::X_D3DFORMAT)X_Format)) {
|
||||
// Convert the Xbox format into host format (without warning, thanks to the above restriction)
|
||||
XTL::D3DFORMAT PCFormat = XTL::EmuXB2PC_D3DFormat((XTL::X_D3DFORMAT)X_Format);
|
||||
XTL::D3DFORMAT PCFormat = EmuXB2PC_D3DFormat((XTL::X_D3DFORMAT)X_Format);
|
||||
if (PCFormat != XTL::D3DFMT_UNKNOWN) {
|
||||
// Index with Xbox D3DFormat, because host FourCC codes are too big to be used as indices
|
||||
if (D3D_OK == g_pDirect3D->CheckDeviceFormat(
|
||||
|
@ -2374,7 +2375,7 @@ static void EmuVerifyResourceIsRegistered(XTL::X_D3DResource *pResource, DWORD D
|
|||
auto key = GetHostResourceKey(pResource);
|
||||
auto it = g_XboxDirect3DResources.find(key);
|
||||
if (it != g_XboxDirect3DResources.end()) {
|
||||
if (D3DUsage == D3DUSAGE_RENDERTARGET && IsResourceAPixelContainer(pResource) && XTL::EmuXBFormatIsRenderTarget(GetXboxPixelContainerFormat((XTL::X_D3DPixelContainer*)pResource))) {
|
||||
if (D3DUsage == D3DUSAGE_RENDERTARGET && IsResourceAPixelContainer(pResource) && EmuXBFormatIsRenderTarget(GetXboxPixelContainerFormat((XTL::X_D3DPixelContainer*)pResource))) {
|
||||
// Render targets have special behavior: We can't trash them on guest modification
|
||||
// this fixes an issue where CubeMaps were broken because the surface Set in GetCubeMapSurface
|
||||
// would be overwritten by the surface created in SetRenderTarget
|
||||
|
@ -5730,7 +5731,7 @@ void CreateHostResource(XTL::X_D3DResource *pResource, DWORD D3DUsage, int iText
|
|||
}
|
||||
else if (bSwizzled) {
|
||||
// First we need to unswizzle the texture data
|
||||
XTL::EmuUnswizzleBox(
|
||||
EmuUnswizzleBox(
|
||||
pSrc, dwMipWidth, dwMipHeight, dwMipDepth,
|
||||
dwBPP,
|
||||
pDst, dwDstRowPitch, dwDstSlicePitch
|
||||
|
|
|
@ -807,7 +807,7 @@ void ____UYVYToARGBRow_C(const uint8_t* src_uyvy,
|
|||
}
|
||||
}
|
||||
|
||||
static const XTL::FormatToARGBRow ComponentConverters[] = {
|
||||
static const FormatToARGBRow ComponentConverters[] = {
|
||||
nullptr, // NoCmpnts,
|
||||
ARGB1555ToARGBRow_C, // A1R5G5B5,
|
||||
X1R5G5B5ToARGBRow_C, // X1R5G5B5, // Test : Convert X into 255
|
||||
|
@ -942,9 +942,9 @@ static const FormatInfo FormatInfos[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
const XTL::FormatToARGBRow XTL::EmuXBFormatComponentConverter(X_D3DFORMAT Format)
|
||||
const FormatToARGBRow EmuXBFormatComponentConverter(XTL::X_D3DFORMAT Format)
|
||||
{
|
||||
if (Format <= X_D3DFMT_LIN_R8G8B8A8)
|
||||
if (Format <= XTL::X_D3DFMT_LIN_R8G8B8A8)
|
||||
if (FormatInfos[Format].components != NoCmpnts)
|
||||
return ComponentConverters[FormatInfos[Format].components];
|
||||
|
||||
|
@ -952,7 +952,7 @@ const XTL::FormatToARGBRow XTL::EmuXBFormatComponentConverter(X_D3DFORMAT Format
|
|||
}
|
||||
|
||||
// Is there a converter available from the supplied format to ARGB?
|
||||
bool XTL::EmuXBFormatCanBeConvertedToARGB(X_D3DFORMAT Format)
|
||||
bool EmuXBFormatCanBeConvertedToARGB(XTL::X_D3DFORMAT Format)
|
||||
{
|
||||
const FormatToARGBRow info = EmuXBFormatComponentConverter(Format);
|
||||
return (info != nullptr);
|
||||
|
@ -960,7 +960,7 @@ bool XTL::EmuXBFormatCanBeConvertedToARGB(X_D3DFORMAT Format)
|
|||
|
||||
// Returns if convertion to ARGB is required. This is the case when
|
||||
// the format has a warning message and there's a converter present.
|
||||
bool XTL::EmuXBFormatRequiresConversionToARGB(X_D3DFORMAT Format)
|
||||
bool EmuXBFormatRequiresConversionToARGB(XTL::X_D3DFORMAT Format)
|
||||
{
|
||||
if (FormatInfos[Format].warning != nullptr)
|
||||
if (EmuXBFormatCanBeConvertedToARGB(Format))
|
||||
|
@ -969,62 +969,64 @@ bool XTL::EmuXBFormatRequiresConversionToARGB(X_D3DFORMAT Format)
|
|||
return false;
|
||||
}
|
||||
|
||||
DWORD XTL::EmuXBFormatBitsPerPixel(X_D3DFORMAT Format)
|
||||
DWORD EmuXBFormatBitsPerPixel(XTL::X_D3DFORMAT Format)
|
||||
{
|
||||
if (Format <= X_D3DFMT_LIN_R8G8B8A8)
|
||||
if (Format <= XTL::X_D3DFMT_LIN_R8G8B8A8)
|
||||
if (FormatInfos[Format].bits_per_pixel > 0) // TODO : Remove this
|
||||
return FormatInfos[Format].bits_per_pixel;
|
||||
|
||||
return 16; // TODO : 8
|
||||
}
|
||||
|
||||
DWORD XTL::EmuXBFormatBytesPerPixel(X_D3DFORMAT Format)
|
||||
DWORD EmuXBFormatBytesPerPixel(XTL::X_D3DFORMAT Format)
|
||||
{
|
||||
return ((EmuXBFormatBitsPerPixel(Format) + 4) / 8);
|
||||
}
|
||||
|
||||
BOOL XTL::EmuXBFormatIsCompressed(X_D3DFORMAT Format)
|
||||
BOOL EmuXBFormatIsCompressed(XTL::X_D3DFORMAT Format)
|
||||
{
|
||||
if (Format <= X_D3DFMT_LIN_R8G8B8A8)
|
||||
if (Format <= XTL::X_D3DFMT_LIN_R8G8B8A8)
|
||||
return (FormatInfos[Format].stored == Cmprsd);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL XTL::EmuXBFormatIsLinear(X_D3DFORMAT Format)
|
||||
BOOL EmuXBFormatIsLinear(XTL::X_D3DFORMAT Format)
|
||||
{
|
||||
if (Format <= X_D3DFMT_LIN_R8G8B8A8)
|
||||
if (Format <= XTL::X_D3DFMT_LIN_R8G8B8A8)
|
||||
return (FormatInfos[Format].stored == Linear);
|
||||
|
||||
return (Format == X_D3DFMT_VERTEXDATA); // TODO : false;
|
||||
return (Format == XTL::X_D3DFMT_VERTEXDATA); // TODO : false;
|
||||
}
|
||||
|
||||
BOOL XTL::EmuXBFormatIsSwizzled(X_D3DFORMAT Format)
|
||||
BOOL EmuXBFormatIsSwizzled(XTL::X_D3DFORMAT Format)
|
||||
{
|
||||
if (Format <= X_D3DFMT_LIN_R8G8B8A8)
|
||||
if (Format <= XTL::X_D3DFMT_LIN_R8G8B8A8)
|
||||
return (FormatInfos[Format].stored == Swzzld);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL XTL::EmuXBFormatIsRenderTarget(X_D3DFORMAT Format)
|
||||
BOOL EmuXBFormatIsRenderTarget(XTL::X_D3DFORMAT Format)
|
||||
{
|
||||
if (Format <= X_D3DFMT_LIN_R8G8B8A8)
|
||||
if (Format <= XTL::X_D3DFMT_LIN_R8G8B8A8)
|
||||
return (FormatInfos[Format].usage == RenderTarget);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL XTL::EmuXBFormatIsDepthBuffer(X_D3DFORMAT Format)
|
||||
BOOL EmuXBFormatIsDepthBuffer(XTL::X_D3DFORMAT Format)
|
||||
{
|
||||
if (Format <= X_D3DFMT_LIN_R8G8B8A8)
|
||||
if (Format <= XTL::X_D3DFMT_LIN_R8G8B8A8)
|
||||
return (FormatInfos[Format].usage == DepthBuffer);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
XTL::D3DFORMAT XTL::EmuXB2PC_D3DFormat(X_D3DFORMAT Format)
|
||||
XTL::D3DFORMAT EmuXB2PC_D3DFormat(XTL::X_D3DFORMAT Format)
|
||||
{
|
||||
using namespace XTL;
|
||||
|
||||
if (Format <= X_D3DFMT_LIN_R8G8B8A8 && Format != -1 /*X_D3DFMT_UNKNOWN*/) // The last bit prevents crashing (Metal Slug 3)
|
||||
{
|
||||
const FormatInfo *info = &FormatInfos[Format];
|
||||
|
@ -1047,8 +1049,10 @@ XTL::D3DFORMAT XTL::EmuXB2PC_D3DFormat(X_D3DFORMAT Format)
|
|||
return D3DFMT_UNKNOWN;
|
||||
}
|
||||
|
||||
XTL::X_D3DFORMAT XTL::EmuPC2XB_D3DFormat(D3DFORMAT Format, bool bPreferLinear)
|
||||
{
|
||||
XTL::X_D3DFORMAT EmuPC2XB_D3DFormat(XTL::D3DFORMAT Format, bool bPreferLinear)
|
||||
{
|
||||
using namespace XTL;
|
||||
|
||||
X_D3DFORMAT result;
|
||||
switch(Format)
|
||||
{
|
||||
|
@ -1129,8 +1133,10 @@ XTL::X_D3DFORMAT XTL::EmuPC2XB_D3DFormat(D3DFORMAT Format, bool bPreferLinear)
|
|||
return result;
|
||||
}
|
||||
|
||||
DWORD XTL::EmuXB2PC_D3DLock(DWORD Flags)
|
||||
{
|
||||
DWORD EmuXB2PC_D3DLock(DWORD Flags)
|
||||
{
|
||||
using namespace XTL;
|
||||
|
||||
DWORD NewFlags = 0;
|
||||
|
||||
// Need to convert the flags, TODO: fix the xbox extensions
|
||||
|
@ -1150,8 +1156,10 @@ DWORD XTL::EmuXB2PC_D3DLock(DWORD Flags)
|
|||
}
|
||||
|
||||
// convert from xbox to pc multisample formats
|
||||
XTL::D3DMULTISAMPLE_TYPE XTL::EmuXB2PC_D3DMultiSampleFormat(DWORD Type)
|
||||
XTL::D3DMULTISAMPLE_TYPE EmuXB2PC_D3DMultiSampleFormat(DWORD Type)
|
||||
{
|
||||
using namespace XTL;
|
||||
|
||||
D3DMULTISAMPLE_TYPE result;
|
||||
switch (Type & 0xFFFF)
|
||||
{
|
||||
|
@ -1182,7 +1190,7 @@ XTL::D3DMULTISAMPLE_TYPE XTL::EmuXB2PC_D3DMultiSampleFormat(DWORD Type)
|
|||
}
|
||||
|
||||
// lookup table for converting vertex count to primitive count
|
||||
UINT XTL::EmuD3DVertexToPrimitive[11][2] =
|
||||
UINT EmuD3DVertexToPrimitive[11][2] =
|
||||
{
|
||||
{0, 0}, // NULL
|
||||
{1, 0}, // X_D3DPT_POINTLIST
|
||||
|
@ -1198,7 +1206,7 @@ UINT XTL::EmuD3DVertexToPrimitive[11][2] =
|
|||
};
|
||||
|
||||
// conversion table for xbox->pc primitive types
|
||||
XTL::D3DPRIMITIVETYPE XTL::EmuPrimitiveTypeLookup[] =
|
||||
XTL::D3DPRIMITIVETYPE EmuPrimitiveTypeLookup[] =
|
||||
{
|
||||
/* NULL = 0 */ (XTL::D3DPRIMITIVETYPE)0,
|
||||
/* D3DPT_POINTLIST = 1, */ XTL::D3DPT_POINTLIST,
|
||||
|
@ -1214,7 +1222,7 @@ XTL::D3DPRIMITIVETYPE XTL::EmuPrimitiveTypeLookup[] =
|
|||
/* D3DPT_MAX = 11, */ (XTL::D3DPRIMITIVETYPE)11
|
||||
};
|
||||
|
||||
void XTL::EmuUnswizzleBox
|
||||
void EmuUnswizzleBox
|
||||
(
|
||||
CONST PVOID pSrcBuff,
|
||||
CONST DWORD dwWidth,
|
||||
|
@ -1328,9 +1336,6 @@ void XTL::EmuUnswizzleBox
|
|||
}
|
||||
} // EmuUnswizzleBox NOPATCH
|
||||
|
||||
namespace XTL
|
||||
{
|
||||
|
||||
const RenderStateInfo DxbxRenderStateInfo[] = {
|
||||
|
||||
// String Ord Version Type Method Native
|
||||
|
@ -1392,25 +1397,25 @@ const RenderStateInfo DxbxRenderStateInfo[] = {
|
|||
{ "D3DRS_PSDOTMAPPING" /*= 55*/, 3424, xtDWORD, NV2A_TX_SHADER_DOTMAPPING },
|
||||
{ "D3DRS_PSINPUTTEXTURE" /*= 56*/, 3424, xtDWORD, NV2A_TX_SHADER_PREVIOUS },
|
||||
// End of "pixel-shader" render states, continuing with "simple" render states :
|
||||
{ "D3DRS_ZFUNC" /*= 57*/, 3424, xtD3DCMPFUNC, NV2A_DEPTH_FUNC, D3DRS_ZFUNC },
|
||||
{ "D3DRS_ALPHAFUNC" /*= 58*/, 3424, xtD3DCMPFUNC, NV2A_ALPHA_FUNC_FUNC, D3DRS_ALPHAFUNC },
|
||||
{ "D3DRS_ALPHABLENDENABLE" /*= 59*/, 3424, xtBOOL, NV2A_BLEND_FUNC_ENABLE, D3DRS_ALPHABLENDENABLE, "TRUE to enable alpha blending" },
|
||||
{ "D3DRS_ALPHATESTENABLE" /*= 60*/, 3424, xtBOOL, NV2A_ALPHA_FUNC_ENABLE, D3DRS_ALPHATESTENABLE, "TRUE to enable alpha tests" },
|
||||
{ "D3DRS_ALPHAREF" /*= 61*/, 3424, xtBYTE, NV2A_ALPHA_FUNC_REF, D3DRS_ALPHAREF },
|
||||
{ "D3DRS_SRCBLEND" /*= 62*/, 3424, xtD3DBLEND, NV2A_BLEND_FUNC_SRC, D3DRS_SRCBLEND },
|
||||
{ "D3DRS_DESTBLEND" /*= 63*/, 3424, xtD3DBLEND, NV2A_BLEND_FUNC_DST, D3DRS_DESTBLEND },
|
||||
{ "D3DRS_ZWRITEENABLE" /*= 64*/, 3424, xtBOOL, NV2A_DEPTH_WRITE_ENABLE, D3DRS_ZWRITEENABLE, "TRUE to enable Z writes" },
|
||||
{ "D3DRS_DITHERENABLE" /*= 65*/, 3424, xtBOOL, NV2A_DITHER_ENABLE, D3DRS_DITHERENABLE, "TRUE to enable dithering" },
|
||||
{ "D3DRS_SHADEMODE" /*= 66*/, 3424, xtD3DSHADEMODE, NV2A_SHADE_MODEL, D3DRS_SHADEMODE },
|
||||
{ "D3DRS_COLORWRITEENABLE" /*= 67*/, 3424, xtD3DCOLORWRITEENABLE, NV2A_COLOR_MASK, D3DRS_COLORWRITEENABLE }, // *_ALPHA, etc. per-channel write enable
|
||||
{ "D3DRS_STENCILZFAIL" /*= 68*/, 3424, xtD3DSTENCILOP, NV2A_STENCIL_OP_ZFAIL, D3DRS_STENCILZFAIL, "Operation to do if stencil test passes and Z test fails" },
|
||||
{ "D3DRS_STENCILPASS" /*= 69*/, 3424, xtD3DSTENCILOP, NV2A_STENCIL_OP_ZPASS, D3DRS_STENCILPASS, "Operation to do if both stencil and Z tests pass" },
|
||||
{ "D3DRS_STENCILFUNC" /*= 70*/, 3424, xtD3DCMPFUNC, NV2A_STENCIL_FUNC_FUNC, D3DRS_STENCILFUNC },
|
||||
{ "D3DRS_STENCILREF" /*= 71*/, 3424, xtBYTE, NV2A_STENCIL_FUNC_REF, D3DRS_STENCILREF, "BYTE reference value used in stencil test" },
|
||||
{ "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 },
|
||||
{ "D3DRS_BLENDCOLOR" /*= 75*/, 3424, xtD3DCOLOR, NV2A_BLEND_COLOR, D3DRS_BLENDFACTOR, "D3DCOLOR for D3DBLEND_CONSTANTCOLOR" },
|
||||
{ "D3DRS_ZFUNC" /*= 57*/, 3424, xtD3DCMPFUNC, NV2A_DEPTH_FUNC, XTL::D3DRS_ZFUNC },
|
||||
{ "D3DRS_ALPHAFUNC" /*= 58*/, 3424, xtD3DCMPFUNC, NV2A_ALPHA_FUNC_FUNC, XTL::D3DRS_ALPHAFUNC },
|
||||
{ "D3DRS_ALPHABLENDENABLE" /*= 59*/, 3424, xtBOOL, NV2A_BLEND_FUNC_ENABLE, XTL::D3DRS_ALPHABLENDENABLE, "TRUE to enable alpha blending" },
|
||||
{ "D3DRS_ALPHATESTENABLE" /*= 60*/, 3424, xtBOOL, NV2A_ALPHA_FUNC_ENABLE, XTL::D3DRS_ALPHATESTENABLE, "TRUE to enable alpha tests" },
|
||||
{ "D3DRS_ALPHAREF" /*= 61*/, 3424, xtBYTE, NV2A_ALPHA_FUNC_REF, XTL::D3DRS_ALPHAREF },
|
||||
{ "D3DRS_SRCBLEND" /*= 62*/, 3424, xtD3DBLEND, NV2A_BLEND_FUNC_SRC, XTL::D3DRS_SRCBLEND },
|
||||
{ "D3DRS_DESTBLEND" /*= 63*/, 3424, xtD3DBLEND, NV2A_BLEND_FUNC_DST, XTL::D3DRS_DESTBLEND },
|
||||
{ "D3DRS_ZWRITEENABLE" /*= 64*/, 3424, xtBOOL, NV2A_DEPTH_WRITE_ENABLE, XTL::D3DRS_ZWRITEENABLE, "TRUE to enable Z writes" },
|
||||
{ "D3DRS_DITHERENABLE" /*= 65*/, 3424, xtBOOL, NV2A_DITHER_ENABLE, XTL::D3DRS_DITHERENABLE, "TRUE to enable dithering" },
|
||||
{ "D3DRS_SHADEMODE" /*= 66*/, 3424, xtD3DSHADEMODE, NV2A_SHADE_MODEL, XTL::D3DRS_SHADEMODE },
|
||||
{ "D3DRS_COLORWRITEENABLE" /*= 67*/, 3424, xtD3DCOLORWRITEENABLE, NV2A_COLOR_MASK, XTL::D3DRS_COLORWRITEENABLE }, // *_ALPHA, etc. per-channel write enable
|
||||
{ "D3DRS_STENCILZFAIL" /*= 68*/, 3424, xtD3DSTENCILOP, NV2A_STENCIL_OP_ZFAIL, XTL::D3DRS_STENCILZFAIL, "Operation to do if stencil test passes and Z test fails" },
|
||||
{ "D3DRS_STENCILPASS" /*= 69*/, 3424, xtD3DSTENCILOP, NV2A_STENCIL_OP_ZPASS, XTL::D3DRS_STENCILPASS, "Operation to do if both stencil and Z tests pass" },
|
||||
{ "D3DRS_STENCILFUNC" /*= 70*/, 3424, xtD3DCMPFUNC, NV2A_STENCIL_FUNC_FUNC, XTL::D3DRS_STENCILFUNC },
|
||||
{ "D3DRS_STENCILREF" /*= 71*/, 3424, xtBYTE, NV2A_STENCIL_FUNC_REF, XTL::D3DRS_STENCILREF, "BYTE reference value used in stencil test" },
|
||||
{ "D3DRS_STENCILMASK" /*= 72*/, 3424, xtBYTE, NV2A_STENCIL_FUNC_MASK, XTL::D3DRS_STENCILMASK, "BYTE mask value used in stencil test" },
|
||||
{ "D3DRS_STENCILWRITEMASK" /*= 73*/, 3424, xtBYTE, NV2A_STENCIL_MASK, XTL::D3DRS_STENCILWRITEMASK, "BYTE write mask applied to values written to stencil buffer" },
|
||||
{ "D3DRS_BLENDOP" /*= 74*/, 3424, xtD3DBLENDOP, NV2A_BLEND_EQUATION, XTL::D3DRS_BLENDOP },
|
||||
{ "D3DRS_BLENDCOLOR" /*= 75*/, 3424, xtD3DCOLOR, NV2A_BLEND_COLOR, XTL::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
|
||||
{ "D3DRS_SWATHWIDTH" /*= 76*/, 3424, xtD3DSWATH, NV2A_SWATH_WIDTH },
|
||||
{ "D3DRS_POLYGONOFFSETZSLOPESCALE" /*= 77*/, 3424, xtFloat, NV2A_POLYGON_OFFSET_FACTOR, D3DRS_NONE, "float Z factor for shadow maps" },
|
||||
|
@ -1429,39 +1434,39 @@ const RenderStateInfo DxbxRenderStateInfo[] = {
|
|||
{ "D3DRS_SIMPLE_UNUSED2" /*= 90*/, 4627, xtDWORD, 0 },
|
||||
{ "D3DRS_SIMPLE_UNUSED1" /*= 91*/, 4627, xtDWORD, 0 },
|
||||
// End of "simple" render states, continuing with "deferred" render states :
|
||||
{ "D3DRS_FOGENABLE" /*= 92*/, 3424, xtBOOL, NV2A_FOG_ENABLE, D3DRS_FOGENABLE },
|
||||
{ "D3DRS_FOGTABLEMODE" /*= 93*/, 3424, xtD3DFOGMODE, NV2A_FOG_MODE, D3DRS_FOGTABLEMODE },
|
||||
{ "D3DRS_FOGSTART" /*= 94*/, 3424, xtFloat, NV2A_FOG_COORD_DIST, D3DRS_FOGSTART },
|
||||
{ "D3DRS_FOGEND" /*= 95*/, 3424, xtFloat, NV2A_FOG_MODE, D3DRS_FOGEND },
|
||||
{ "D3DRS_FOGDENSITY" /*= 96*/, 3424, xtFloat, NV2A_FOG_EQUATION_CONSTANT, D3DRS_FOGDENSITY }, // + NV2A_FOG_EQUATION_LINEAR + NV2A_FOG_EQUATION_QUADRATIC
|
||||
{ "D3DRS_RANGEFOGENABLE" /*= 97*/, 3424, xtBOOL, NV2A_FOG_COORD_DIST, D3DRS_RANGEFOGENABLE },
|
||||
{ "D3DRS_WRAP0" /*= 98*/, 3424, xtD3DWRAP, NV2A_TX_WRAP(0), D3DRS_WRAP0 },
|
||||
{ "D3DRS_WRAP1" /*= 99*/, 3424, xtD3DWRAP, NV2A_TX_WRAP(1), D3DRS_WRAP1 },
|
||||
{ "D3DRS_WRAP2" /*= 100*/, 3424, xtD3DWRAP, NV2A_TX_WRAP(2), D3DRS_WRAP2 },
|
||||
{ "D3DRS_WRAP3" /*= 101*/, 3424, xtD3DWRAP, NV2A_TX_WRAP(3), D3DRS_WRAP3 },
|
||||
{ "D3DRS_LIGHTING" /*= 102*/, 3424, xtBOOL, NV2A_LIGHT_MODEL, D3DRS_LIGHTING }, // TODO : Needs push-buffer data conversion
|
||||
{ "D3DRS_SPECULARENABLE" /*= 103*/, 3424, xtBOOL, NV2A_RC_FINAL0, D3DRS_SPECULARENABLE },
|
||||
{ "D3DRS_LOCALVIEWER" /*= 104*/, 3424, xtBOOL, 0, D3DRS_LOCALVIEWER },
|
||||
{ "D3DRS_COLORVERTEX" /*= 105*/, 3424, xtBOOL, 0, D3DRS_COLORVERTEX },
|
||||
{ "D3DRS_FOGENABLE" /*= 92*/, 3424, xtBOOL, NV2A_FOG_ENABLE, XTL::D3DRS_FOGENABLE },
|
||||
{ "D3DRS_FOGTABLEMODE" /*= 93*/, 3424, xtD3DFOGMODE, NV2A_FOG_MODE, XTL::D3DRS_FOGTABLEMODE },
|
||||
{ "D3DRS_FOGSTART" /*= 94*/, 3424, xtFloat, NV2A_FOG_COORD_DIST, XTL::D3DRS_FOGSTART },
|
||||
{ "D3DRS_FOGEND" /*= 95*/, 3424, xtFloat, NV2A_FOG_MODE, XTL::D3DRS_FOGEND },
|
||||
{ "D3DRS_FOGDENSITY" /*= 96*/, 3424, xtFloat, NV2A_FOG_EQUATION_CONSTANT, XTL::D3DRS_FOGDENSITY }, // + NV2A_FOG_EQUATION_LINEAR + NV2A_FOG_EQUATION_QUADRATIC
|
||||
{ "D3DRS_RANGEFOGENABLE" /*= 97*/, 3424, xtBOOL, NV2A_FOG_COORD_DIST, XTL::D3DRS_RANGEFOGENABLE },
|
||||
{ "D3DRS_WRAP0" /*= 98*/, 3424, xtD3DWRAP, NV2A_TX_WRAP(0), XTL::D3DRS_WRAP0 },
|
||||
{ "D3DRS_WRAP1" /*= 99*/, 3424, xtD3DWRAP, NV2A_TX_WRAP(1), XTL::D3DRS_WRAP1 },
|
||||
{ "D3DRS_WRAP2" /*= 100*/, 3424, xtD3DWRAP, NV2A_TX_WRAP(2), XTL::D3DRS_WRAP2 },
|
||||
{ "D3DRS_WRAP3" /*= 101*/, 3424, xtD3DWRAP, NV2A_TX_WRAP(3), XTL::D3DRS_WRAP3 },
|
||||
{ "D3DRS_LIGHTING" /*= 102*/, 3424, xtBOOL, NV2A_LIGHT_MODEL, XTL::D3DRS_LIGHTING }, // TODO : Needs push-buffer data conversion
|
||||
{ "D3DRS_SPECULARENABLE" /*= 103*/, 3424, xtBOOL, NV2A_RC_FINAL0, XTL::D3DRS_SPECULARENABLE },
|
||||
{ "D3DRS_LOCALVIEWER" /*= 104*/, 3424, xtBOOL, 0, XTL::D3DRS_LOCALVIEWER },
|
||||
{ "D3DRS_COLORVERTEX" /*= 105*/, 3424, xtBOOL, 0, XTL::D3DRS_COLORVERTEX },
|
||||
{ "D3DRS_BACKSPECULARMATERIALSOURCE" /*= 106*/, 3424, xtD3DMCS, 0 }, // nsp.
|
||||
{ "D3DRS_BACKDIFFUSEMATERIALSOURCE" /*= 107*/, 3424, xtD3DMCS, 0 }, // nsp.
|
||||
{ "D3DRS_BACKAMBIENTMATERIALSOURCE" /*= 108*/, 3424, xtD3DMCS, 0 }, // nsp.
|
||||
{ "D3DRS_BACKEMISSIVEMATERIALSOURCE" /*= 109*/, 3424, xtD3DMCS, 0 }, // nsp.
|
||||
{ "D3DRS_SPECULARMATERIALSOURCE" /*= 110*/, 3424, xtD3DMCS, NV2A_COLOR_MATERIAL, D3DRS_SPECULARMATERIALSOURCE },
|
||||
{ "D3DRS_DIFFUSEMATERIALSOURCE" /*= 111*/, 3424, xtD3DMCS, 0, D3DRS_DIFFUSEMATERIALSOURCE },
|
||||
{ "D3DRS_AMBIENTMATERIALSOURCE" /*= 112*/, 3424, xtD3DMCS, 0, D3DRS_AMBIENTMATERIALSOURCE },
|
||||
{ "D3DRS_EMISSIVEMATERIALSOURCE" /*= 113*/, 3424, xtD3DMCS, 0, D3DRS_EMISSIVEMATERIALSOURCE },
|
||||
{ "D3DRS_SPECULARMATERIALSOURCE" /*= 110*/, 3424, xtD3DMCS, NV2A_COLOR_MATERIAL, XTL::D3DRS_SPECULARMATERIALSOURCE },
|
||||
{ "D3DRS_DIFFUSEMATERIALSOURCE" /*= 111*/, 3424, xtD3DMCS, 0, XTL::D3DRS_DIFFUSEMATERIALSOURCE },
|
||||
{ "D3DRS_AMBIENTMATERIALSOURCE" /*= 112*/, 3424, xtD3DMCS, 0, XTL::D3DRS_AMBIENTMATERIALSOURCE },
|
||||
{ "D3DRS_EMISSIVEMATERIALSOURCE" /*= 113*/, 3424, xtD3DMCS, 0, XTL::D3DRS_EMISSIVEMATERIALSOURCE },
|
||||
{ "D3DRS_BACKAMBIENT" /*= 114*/, 3424, xtD3DCOLOR, NV2A_LIGHT_MODEL_BACK_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_R }, // ..NV2A_MATERIAL_FACTOR_BACK_B nsp. Was NV2A_LIGHT_MODEL_BACK_AMBIENT_R
|
||||
{ "D3DRS_AMBIENT" /*= 115*/, 3424, xtD3DCOLOR, NV2A_LIGHT_MODEL_FRONT_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_R, D3DRS_AMBIENT }, // ..NV2A_LIGHT_MODEL_FRONT_AMBIENT_B + NV2A_MATERIAL_FACTOR_FRONT_R..NV2A_MATERIAL_FACTOR_FRONT_A Was NV2A_LIGHT_MODEL_FRONT_AMBIENT_R
|
||||
{ "D3DRS_POINTSIZE" /*= 116*/, 3424, xtFloat, NV2A_POINT_PARAMETER(0), D3DRS_POINTSIZE },
|
||||
{ "D3DRS_POINTSIZE_MIN" /*= 117*/, 3424, xtFloat, 0, D3DRS_POINTSIZE_MIN },
|
||||
{ "D3DRS_POINTSPRITEENABLE" /*= 118*/, 3424, xtBOOL, NV2A_POINT_SMOOTH_ENABLE, D3DRS_POINTSPRITEENABLE },
|
||||
{ "D3DRS_POINTSCALEENABLE" /*= 119*/, 3424, xtBOOL, NV2A_POINT_PARAMETERS_ENABLE, D3DRS_POINTSCALEENABLE },
|
||||
{ "D3DRS_POINTSCALE_A" /*= 120*/, 3424, xtFloat, 0, D3DRS_POINTSCALE_A },
|
||||
{ "D3DRS_POINTSCALE_B" /*= 121*/, 3424, xtFloat, 0, D3DRS_POINTSCALE_B },
|
||||
{ "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?
|
||||
{ "D3DRS_AMBIENT" /*= 115*/, 3424, xtD3DCOLOR, NV2A_LIGHT_MODEL_FRONT_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_R, XTL::D3DRS_AMBIENT }, // ..NV2A_LIGHT_MODEL_FRONT_AMBIENT_B + NV2A_MATERIAL_FACTOR_FRONT_R..NV2A_MATERIAL_FACTOR_FRONT_A Was NV2A_LIGHT_MODEL_FRONT_AMBIENT_R
|
||||
{ "D3DRS_POINTSIZE" /*= 116*/, 3424, xtFloat, NV2A_POINT_PARAMETER(0), XTL::D3DRS_POINTSIZE },
|
||||
{ "D3DRS_POINTSIZE_MIN" /*= 117*/, 3424, xtFloat, 0, XTL::D3DRS_POINTSIZE_MIN },
|
||||
{ "D3DRS_POINTSPRITEENABLE" /*= 118*/, 3424, xtBOOL, NV2A_POINT_SMOOTH_ENABLE, XTL::D3DRS_POINTSPRITEENABLE },
|
||||
{ "D3DRS_POINTSCALEENABLE" /*= 119*/, 3424, xtBOOL, NV2A_POINT_PARAMETERS_ENABLE, XTL::D3DRS_POINTSCALEENABLE },
|
||||
{ "D3DRS_POINTSCALE_A" /*= 120*/, 3424, xtFloat, 0, XTL::D3DRS_POINTSCALE_A },
|
||||
{ "D3DRS_POINTSCALE_B" /*= 121*/, 3424, xtFloat, 0, XTL::D3DRS_POINTSCALE_B },
|
||||
{ "D3DRS_POINTSCALE_C" /*= 122*/, 3424, xtFloat, 0, XTL::D3DRS_POINTSCALE_C },
|
||||
{ "D3DRS_POINTSIZE_MAX" /*= 123*/, 3424, xtFloat, 0, XTL::D3DRS_POINTSIZE_MAX },
|
||||
{ "D3DRS_PATCHEDGESTYLE" /*= 124*/, 3424, xtDWORD, 0, XTL::D3DRS_PATCHEDGESTYLE }, // D3DPATCHEDGESTYLE?
|
||||
{ "D3DRS_PATCHSEGMENTS" /*= 125*/, 3424, xtDWORD, 0 }, // nsp. // D3DRS_PATCHSEGMENTS exists in Direct3D 8, but not in 9 !?
|
||||
// TODO -oDxbx : Is X_D3DRS_SWAPFILTER really a xtD3DMULTISAMPLE_TYPE?
|
||||
{ "D3DRS_SWAPFILTER" /*= 126*/, 4039, xtD3DMULTISAMPLE_TYPE, 0, D3DRS_NONE, "D3DTEXF_LINEAR etc. filter to use for Swap" }, // nsp.
|
||||
|
@ -1476,23 +1481,23 @@ const RenderStateInfo DxbxRenderStateInfo[] = {
|
|||
{ "D3DRS_DEFERRED_UNUSED1" /*= 135*/, 4627, xtDWORD, 0 },
|
||||
// End of "deferred" render states, continuing with "complex" render states :
|
||||
{ "D3DRS_PSTEXTUREMODES" /*= 136*/, 3424, xtDWORD, 0 },
|
||||
{ "D3DRS_VERTEXBLEND" /*= 137*/, 3424, xtD3DVERTEXBLENDFLAGS, NV2A_SKIN_MODE, D3DRS_VERTEXBLEND },
|
||||
{ "D3DRS_FOGCOLOR" /*= 138*/, 3424, xtD3DCOLOR, NV2A_FOG_COLOR, D3DRS_FOGCOLOR }, // SwapRgb
|
||||
{ "D3DRS_FILLMODE" /*= 139*/, 3424, xtD3DFILLMODE, NV2A_POLYGON_MODE_FRONT, D3DRS_FILLMODE },
|
||||
{ "D3DRS_VERTEXBLEND" /*= 137*/, 3424, xtD3DVERTEXBLENDFLAGS, NV2A_SKIN_MODE, XTL::D3DRS_VERTEXBLEND },
|
||||
{ "D3DRS_FOGCOLOR" /*= 138*/, 3424, xtD3DCOLOR, NV2A_FOG_COLOR, XTL::D3DRS_FOGCOLOR }, // SwapRgb
|
||||
{ "D3DRS_FILLMODE" /*= 139*/, 3424, xtD3DFILLMODE, NV2A_POLYGON_MODE_FRONT, XTL::D3DRS_FILLMODE },
|
||||
{ "D3DRS_BACKFILLMODE" /*= 140*/, 3424, xtD3DFILLMODE, 0 }, // nsp.
|
||||
{ "D3DRS_TWOSIDEDLIGHTING" /*= 141*/, 3424, xtBOOL, NV2A_POLYGON_MODE_BACK }, // nsp.
|
||||
{ "D3DRS_NORMALIZENORMALS" /*= 142*/, 3424, xtBOOL, NV2A_NORMALIZE_ENABLE, D3DRS_NORMALIZENORMALS },
|
||||
{ "D3DRS_ZENABLE" /*= 143*/, 3424, xtBOOL, NV2A_DEPTH_TEST_ENABLE, D3DRS_ZENABLE }, // D3DZBUFFERTYPE?
|
||||
{ "D3DRS_STENCILENABLE" /*= 144*/, 3424, xtBOOL, NV2A_STENCIL_ENABLE, D3DRS_STENCILENABLE },
|
||||
{ "D3DRS_STENCILFAIL" /*= 145*/, 3424, xtD3DSTENCILOP, NV2A_STENCIL_OP_FAIL, D3DRS_STENCILFAIL },
|
||||
{ "D3DRS_NORMALIZENORMALS" /*= 142*/, 3424, xtBOOL, NV2A_NORMALIZE_ENABLE, XTL::D3DRS_NORMALIZENORMALS },
|
||||
{ "D3DRS_ZENABLE" /*= 143*/, 3424, xtBOOL, NV2A_DEPTH_TEST_ENABLE, XTL::D3DRS_ZENABLE }, // D3DZBUFFERTYPE?
|
||||
{ "D3DRS_STENCILENABLE" /*= 144*/, 3424, xtBOOL, NV2A_STENCIL_ENABLE, XTL::D3DRS_STENCILENABLE },
|
||||
{ "D3DRS_STENCILFAIL" /*= 145*/, 3424, xtD3DSTENCILOP, NV2A_STENCIL_OP_FAIL, XTL::D3DRS_STENCILFAIL },
|
||||
{ "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 },
|
||||
{ "D3DRS_ZBIAS" /*= 149*/, 3424, xtLONG, 0, D3DRS_DEPTHBIAS }, // Was D3DRS_ZBIAS
|
||||
{ "D3DRS_CULLMODE" /*= 147*/, 3424, xtD3DCULL, NV2A_CULL_FACE, XTL::D3DRS_CULLMODE },
|
||||
{ "D3DRS_TEXTUREFACTOR" /*= 148*/, 3424, xtD3DCOLOR, NV2A_RC_CONSTANT_COLOR0(0), XTL::D3DRS_TEXTUREFACTOR },
|
||||
{ "D3DRS_ZBIAS" /*= 149*/, 3424, xtLONG, 0, XTL::D3DRS_DEPTHBIAS }, // Was D3DRS_ZBIAS
|
||||
{ "D3DRS_LOGICOP" /*= 150*/, 3424, xtD3DLOGICOP, NV2A_COLOR_LOGIC_OP_OP }, // nsp.
|
||||
{ "D3DRS_EDGEANTIALIAS" /*= 151*/, 3424, xtBOOL, NV2A_LINE_SMOOTH_ENABLE, D3DRS_ANTIALIASEDLINEENABLE }, // Was D3DRS_EDGEANTIALIAS. Dxbx note : No Xbox ext. (according to Direct3D8) !
|
||||
{ "D3DRS_MULTISAMPLEANTIALIAS" /*= 152*/, 3424, xtBOOL, NV2A_MULTISAMPLE_CONTROL, D3DRS_MULTISAMPLEANTIALIAS },
|
||||
{ "D3DRS_MULTISAMPLEMASK" /*= 153*/, 3424, xtDWORD, NV2A_MULTISAMPLE_CONTROL, D3DRS_MULTISAMPLEMASK },
|
||||
{ "D3DRS_EDGEANTIALIAS" /*= 151*/, 3424, xtBOOL, NV2A_LINE_SMOOTH_ENABLE, XTL::D3DRS_ANTIALIASEDLINEENABLE }, // Was D3DRS_EDGEANTIALIAS. Dxbx note : No Xbox ext. (according to Direct3D8) !
|
||||
{ "D3DRS_MULTISAMPLEANTIALIAS" /*= 152*/, 3424, xtBOOL, NV2A_MULTISAMPLE_CONTROL, XTL::D3DRS_MULTISAMPLEANTIALIAS },
|
||||
{ "D3DRS_MULTISAMPLEMASK" /*= 153*/, 3424, xtDWORD, NV2A_MULTISAMPLE_CONTROL, XTL::D3DRS_MULTISAMPLEMASK },
|
||||
// { "D3DRS_MULTISAMPLETYPE" /*= 154*/, 3424, xtD3DMULTISAMPLE_TYPE, 0 }, // [-3911] \_ aliasses D3DMULTISAMPLE_TYPE
|
||||
{ "D3DRS_MULTISAMPLEMODE" /*= 154*/, 4361, xtD3DMULTISAMPLEMODE, 0 }, // [4361+] / D3DMULTISAMPLEMODE for the backbuffer
|
||||
{ "D3DRS_MULTISAMPLERENDERTARGETMODE" /*= 155*/, 4242, xtD3DMULTISAMPLEMODE, NV2A_RT_FORMAT },
|
||||
|
@ -1561,8 +1566,6 @@ Direct3D9 states unused :
|
|||
D3DRS_BLENDOPALPHA = 209 // Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE
|
||||
*/
|
||||
|
||||
}; // end of namespace XTL
|
||||
|
||||
#if 0
|
||||
/* Generic swizzle function, usable for both x and y dimensions.
|
||||
When passing x, Max should be 2*height, and Shift should be 0
|
||||
|
|
|
@ -38,44 +38,44 @@
|
|||
|
||||
typedef void(*FormatToARGBRow)(const uint8_t* src, uint8_t* dst_argb, int width);
|
||||
|
||||
extern const FormatToARGBRow EmuXBFormatComponentConverter(X_D3DFORMAT Format);
|
||||
extern const FormatToARGBRow EmuXBFormatComponentConverter(XTL::X_D3DFORMAT Format);
|
||||
|
||||
bool EmuXBFormatCanBeConvertedToARGB(X_D3DFORMAT Format);
|
||||
bool EmuXBFormatCanBeConvertedToARGB(XTL::X_D3DFORMAT Format);
|
||||
|
||||
bool EmuXBFormatRequiresConversionToARGB(X_D3DFORMAT Format);
|
||||
bool EmuXBFormatRequiresConversionToARGB(XTL::X_D3DFORMAT Format);
|
||||
|
||||
// how many bits does this format use per pixel?
|
||||
extern DWORD EmuXBFormatBitsPerPixel(X_D3DFORMAT Format);
|
||||
extern DWORD EmuXBFormatBitsPerPixel(XTL::X_D3DFORMAT Format);
|
||||
|
||||
// how many bytes does this format use per pixel?
|
||||
extern DWORD EmuXBFormatBytesPerPixel(X_D3DFORMAT Format);
|
||||
extern DWORD EmuXBFormatBytesPerPixel(XTL::X_D3DFORMAT Format);
|
||||
|
||||
// is this format compressed?
|
||||
extern BOOL EmuXBFormatIsCompressed(X_D3DFORMAT Format);
|
||||
extern BOOL EmuXBFormatIsCompressed(XTL::X_D3DFORMAT Format);
|
||||
|
||||
// is this format linear?
|
||||
extern BOOL EmuXBFormatIsLinear(X_D3DFORMAT Format);
|
||||
extern BOOL EmuXBFormatIsLinear(XTL::X_D3DFORMAT Format);
|
||||
|
||||
// is this format swizzled?
|
||||
extern BOOL EmuXBFormatIsSwizzled(X_D3DFORMAT Format);
|
||||
extern BOOL EmuXBFormatIsSwizzled(XTL::X_D3DFORMAT Format);
|
||||
|
||||
// is this format a valid render target?
|
||||
extern BOOL EmuXBFormatIsRenderTarget(X_D3DFORMAT Format);
|
||||
extern BOOL EmuXBFormatIsRenderTarget(XTL::X_D3DFORMAT Format);
|
||||
|
||||
// is this format a valid depth buffer?
|
||||
extern BOOL EmuXBFormatIsDepthBuffer(X_D3DFORMAT Format);
|
||||
extern BOOL EmuXBFormatIsDepthBuffer(XTL::X_D3DFORMAT Format);
|
||||
|
||||
// convert from xbox to pc color formats
|
||||
extern D3DFORMAT EmuXB2PC_D3DFormat(X_D3DFORMAT Format);
|
||||
extern XTL::D3DFORMAT EmuXB2PC_D3DFormat(XTL::X_D3DFORMAT Format);
|
||||
|
||||
// convert from pc to xbox color formats
|
||||
extern X_D3DFORMAT EmuPC2XB_D3DFormat(D3DFORMAT Format, bool bPreferLinear = true);
|
||||
extern XTL::X_D3DFORMAT EmuPC2XB_D3DFormat(XTL::D3DFORMAT Format, bool bPreferLinear = true);
|
||||
|
||||
// convert from xbox to pc d3d lock flags
|
||||
extern DWORD EmuXB2PC_D3DLock(DWORD Flags);
|
||||
|
||||
// convert from xbox to pc multisample formats
|
||||
extern D3DMULTISAMPLE_TYPE EmuXB2PC_D3DMultiSampleFormat(DWORD Type);
|
||||
extern XTL::D3DMULTISAMPLE_TYPE EmuXB2PC_D3DMultiSampleFormat(DWORD Type);
|
||||
|
||||
/**
|
||||
// convert from pc to xbox texture transform state types (unnecessary so far)
|
||||
|
@ -90,8 +90,10 @@ else
|
|||
//*/
|
||||
|
||||
// convert from xbox to pc texture transform state types
|
||||
inline D3DTRANSFORMSTATETYPE EmuXB2PC_D3DTS(D3DTRANSFORMSTATETYPE State)
|
||||
{
|
||||
inline XTL::D3DTRANSFORMSTATETYPE EmuXB2PC_D3DTS(XTL::D3DTRANSFORMSTATETYPE State)
|
||||
{
|
||||
using namespace XTL;
|
||||
|
||||
// Handle Xbox -> D3D State mapping
|
||||
switch (State) {
|
||||
case 0: return (D3DTRANSFORMSTATETYPE)D3DTS_VIEW;
|
||||
|
@ -116,9 +118,11 @@ inline D3DTRANSFORMSTATETYPE EmuXB2PC_D3DTS(D3DTRANSFORMSTATETYPE State)
|
|||
}
|
||||
|
||||
// convert from xbox to pc blend ops
|
||||
inline D3DBLENDOP EmuXB2PC_D3DBLENDOP(X_D3DBLENDOP Value)
|
||||
inline XTL::D3DBLENDOP EmuXB2PC_D3DBLENDOP(XTL::X_D3DBLENDOP Value)
|
||||
{
|
||||
switch(Value)
|
||||
using namespace XTL;
|
||||
|
||||
switch(Value)
|
||||
{
|
||||
case 0x8006: return D3DBLENDOP_ADD;
|
||||
case 0x800a: return D3DBLENDOP_SUBTRACT;
|
||||
|
@ -141,9 +145,11 @@ inline D3DBLENDOP EmuXB2PC_D3DBLENDOP(X_D3DBLENDOP Value)
|
|||
}
|
||||
|
||||
// convert from xbox to pc blend types
|
||||
inline D3DBLEND EmuXB2PC_D3DBLEND(X_D3DBLEND Value)
|
||||
inline XTL::D3DBLEND EmuXB2PC_D3DBLEND(XTL::X_D3DBLEND Value)
|
||||
{
|
||||
switch (Value) {
|
||||
using namespace XTL;
|
||||
|
||||
switch (Value) {
|
||||
case 0x000: return D3DBLEND_ZERO;
|
||||
case 0x001: return D3DBLEND_ONE;
|
||||
case 0x300: return D3DBLEND_SRCCOLOR;
|
||||
|
@ -166,9 +172,11 @@ inline D3DBLEND EmuXB2PC_D3DBLEND(X_D3DBLEND Value)
|
|||
}
|
||||
|
||||
// convert from xbox to pc comparison functions
|
||||
inline D3DCMPFUNC EmuXB2PC_D3DCMPFUNC(X_D3DCMPFUNC Value)
|
||||
inline XTL::D3DCMPFUNC EmuXB2PC_D3DCMPFUNC(XTL::X_D3DCMPFUNC Value)
|
||||
{
|
||||
switch (Value) {
|
||||
using namespace XTL;
|
||||
|
||||
switch (Value) {
|
||||
case 0x200: return D3DCMP_NEVER;
|
||||
case 0x201: return D3DCMP_LESS;
|
||||
case 0x202: return D3DCMP_EQUAL;
|
||||
|
@ -184,9 +192,11 @@ inline D3DCMPFUNC EmuXB2PC_D3DCMPFUNC(X_D3DCMPFUNC Value)
|
|||
}
|
||||
|
||||
// convert from xbox to pc fill modes
|
||||
inline D3DFILLMODE EmuXB2PC_D3DFILLMODE(X_D3DFILLMODE Value)
|
||||
inline XTL::D3DFILLMODE EmuXB2PC_D3DFILLMODE(XTL::X_D3DFILLMODE Value)
|
||||
{
|
||||
switch (Value) {
|
||||
using namespace XTL;
|
||||
|
||||
switch (Value) {
|
||||
case 0x1B00: return D3DFILL_POINT;
|
||||
case 0x1B01: return D3DFILL_WIREFRAME;
|
||||
case 0x1B02: return D3DFILL_SOLID;
|
||||
|
@ -197,9 +207,11 @@ inline D3DFILLMODE EmuXB2PC_D3DFILLMODE(X_D3DFILLMODE Value)
|
|||
}
|
||||
|
||||
// convert from xbox to pc shade modes
|
||||
inline D3DSHADEMODE EmuXB2PC_D3DSHADEMODE(X_D3DSHADEMODE Value)
|
||||
inline XTL::D3DSHADEMODE EmuXB2PC_D3DSHADEMODE(XTL::X_D3DSHADEMODE Value)
|
||||
{
|
||||
switch (Value) {
|
||||
using namespace XTL;
|
||||
|
||||
switch (Value) {
|
||||
case 0x1D00: return D3DSHADE_FLAT;
|
||||
case 0x1D01: return D3DSHADE_GOURAUD;
|
||||
}
|
||||
|
@ -209,8 +221,10 @@ inline D3DSHADEMODE EmuXB2PC_D3DSHADEMODE(X_D3DSHADEMODE Value)
|
|||
}
|
||||
|
||||
// convert from xbox to pc stencilop modes
|
||||
inline D3DSTENCILOP EmuXB2PC_D3DSTENCILOP(X_D3DSTENCILOP Value)
|
||||
{
|
||||
inline XTL::D3DSTENCILOP EmuXB2PC_D3DSTENCILOP(XTL::X_D3DSTENCILOP Value)
|
||||
{
|
||||
using namespace XTL;
|
||||
|
||||
switch(Value)
|
||||
{
|
||||
case 0x1e00: return D3DSTENCILOP_KEEP;
|
||||
|
@ -229,9 +243,9 @@ inline D3DSTENCILOP EmuXB2PC_D3DSTENCILOP(X_D3DSTENCILOP Value)
|
|||
}
|
||||
|
||||
// table used for vertex->primitive count conversion
|
||||
extern UINT EmuD3DVertexToPrimitive[X_D3DPT_POLYGON + 1][2];
|
||||
extern UINT EmuD3DVertexToPrimitive[XTL::X_D3DPT_POLYGON + 1][2];
|
||||
|
||||
inline bool EmuD3DValidVertexCount(X_D3DPRIMITIVETYPE XboxPrimitiveType, UINT VertexCount)
|
||||
inline bool EmuD3DValidVertexCount(XTL::X_D3DPRIMITIVETYPE XboxPrimitiveType, UINT VertexCount)
|
||||
{
|
||||
// Are there more vertices than required for setup?
|
||||
if (VertexCount > EmuD3DVertexToPrimitive[XboxPrimitiveType][1])
|
||||
|
@ -243,30 +257,30 @@ inline bool EmuD3DValidVertexCount(X_D3DPRIMITIVETYPE XboxPrimitiveType, UINT Ve
|
|||
}
|
||||
|
||||
// convert from vertex count to primitive count (Xbox)
|
||||
inline int EmuD3DVertex2PrimitiveCount(X_D3DPRIMITIVETYPE PrimitiveType, int VertexCount)
|
||||
inline int EmuD3DVertex2PrimitiveCount(XTL::X_D3DPRIMITIVETYPE PrimitiveType, int VertexCount)
|
||||
{
|
||||
return (VertexCount - EmuD3DVertexToPrimitive[PrimitiveType][1]) / EmuD3DVertexToPrimitive[PrimitiveType][0];
|
||||
}
|
||||
|
||||
// convert from primitive count to vertex count (Xbox)
|
||||
inline int EmuD3DPrimitive2VertexCount(X_D3DPRIMITIVETYPE PrimitiveType, int PrimitiveCount)
|
||||
inline int EmuD3DPrimitive2VertexCount(XTL::X_D3DPRIMITIVETYPE PrimitiveType, int PrimitiveCount)
|
||||
{
|
||||
return (PrimitiveCount * EmuD3DVertexToPrimitive[PrimitiveType][0]) + EmuD3DVertexToPrimitive[PrimitiveType][1];
|
||||
}
|
||||
|
||||
// conversion table for xbox->pc primitive types
|
||||
extern D3DPRIMITIVETYPE EmuPrimitiveTypeLookup[];
|
||||
extern XTL::D3DPRIMITIVETYPE EmuPrimitiveTypeLookup[];
|
||||
|
||||
// convert xbox->pc primitive type
|
||||
inline D3DPRIMITIVETYPE EmuXB2PC_D3DPrimitiveType(X_D3DPRIMITIVETYPE PrimitiveType)
|
||||
inline XTL::D3DPRIMITIVETYPE EmuXB2PC_D3DPrimitiveType(XTL::X_D3DPRIMITIVETYPE PrimitiveType)
|
||||
{
|
||||
if((DWORD)PrimitiveType == 0x7FFFFFFF)
|
||||
return D3DPT_FORCE_DWORD;
|
||||
return XTL::D3DPT_FORCE_DWORD;
|
||||
|
||||
return EmuPrimitiveTypeLookup[PrimitiveType];
|
||||
}
|
||||
|
||||
inline int EmuD3DIndexCountToVertexCount(X_D3DPRIMITIVETYPE XboxPrimitiveType, int IndexCount)
|
||||
inline int EmuD3DIndexCountToVertexCount(XTL::X_D3DPRIMITIVETYPE XboxPrimitiveType, int IndexCount)
|
||||
{
|
||||
return IndexCount;
|
||||
}
|
||||
|
@ -1809,13 +1823,13 @@ typedef struct _RenderStateInfo {
|
|||
char *S; // String representation.
|
||||
WORD V; // The XDK version since which a render state was introduced (using the 5911 declarations as a base).
|
||||
TXBType T = xt_Unknown; // The Xbox data type. Defaults to xt_Unknown.
|
||||
NV2AMETHOD M; // The related push buffer method. Not always a 1-to-1 mapping. Needs push-buffer interpretation & conversion code.
|
||||
D3DRENDERSTATETYPE PC = (D3DRENDERSTATETYPE)0; // Map XBox to PC render state
|
||||
XTL::NV2AMETHOD M; // The related push buffer method. Not always a 1-to-1 mapping. Needs push-buffer interpretation & conversion code.
|
||||
XTL::D3DRENDERSTATETYPE PC = (XTL::D3DRENDERSTATETYPE)0; // Map XBox to PC render state
|
||||
char *N; // XDK notes. Defaults to ''.
|
||||
}
|
||||
RenderStateInfo;
|
||||
|
||||
#define D3DRS_NONE ((D3DRENDERSTATETYPE)0)
|
||||
#define D3DRS_NONE ((XTL::D3DRENDERSTATETYPE)0)
|
||||
|
||||
extern const RenderStateInfo DxbxRenderStateInfo[];
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ namespace XTL {
|
|||
#include "core\hle\D3D8\XbD3D8Types.h" // For X_D3DFORMAT
|
||||
}
|
||||
#include "core\hle\D3D8\ResourceTracker.h"
|
||||
#include "core\hle\D3D8\XbPushBuffer.h"
|
||||
#include "core\hle\D3D8\XbPushBuffer.h"
|
||||
#include "core\hle\D3D8\XbConvert.h"
|
||||
#include "devices/video/nv2a.h" // For g_NV2A, PGRAPHState
|
||||
#include "devices/video/nv2a_int.h" // For NV** defines
|
||||
#include "Logging.h"
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
|
||||
#include "core\kernel\init\CxbxKrnl.h"
|
||||
#include "core\kernel\support\Emu.h"
|
||||
#include "core\kernel\support\EmuXTL.h"
|
||||
#include "core\kernel\support\EmuXTL.h"
|
||||
#include "core\hle\D3D8\XbConvert.h" // For DxbxRenderStateInfo
|
||||
|
||||
// deferred state lookup tables
|
||||
DWORD *XTL::EmuD3DDeferredRenderState = nullptr;
|
||||
|
@ -60,7 +61,7 @@ void VerifyAndFixEmuDeferredRenderStateOffset()
|
|||
// Calculate index of D3DRS_CULLMODE for this XDK. We start counting from the first deferred state (D3DRS_FOGENABLE)
|
||||
DWORD CullModeIndex = 0;
|
||||
for (int i = XTL::X_D3DRS_FOGENABLE; i < XTL::X_D3DRS_CULLMODE; i++) {
|
||||
if (XTL::DxbxRenderStateInfo[i].V <= g_LibVersion_D3D8) {
|
||||
if (DxbxRenderStateInfo[i].V <= g_LibVersion_D3D8) {
|
||||
CullModeIndex++;
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +81,7 @@ void UpdateDeferredRenderStates()
|
|||
// Loop through all deferred render states
|
||||
for (unsigned int RenderState = XTL::X_D3DRS_FOGENABLE; RenderState <= XTL::X_D3DRS_PRESENTATIONINTERVAL; RenderState++) {
|
||||
// If the current state is not present within our desired XDK, skip it
|
||||
if (XTL::DxbxRenderStateInfo[RenderState].V >= g_LibVersion_D3D8) {
|
||||
if (DxbxRenderStateInfo[RenderState].V >= g_LibVersion_D3D8) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -165,15 +166,15 @@ void UpdateDeferredRenderStates()
|
|||
Value |= (OldValue & 0x01000000) ? D3DWRAPCOORD_3 : 0;
|
||||
} break;
|
||||
default:
|
||||
EmuLog(LOG_LEVEL::WARNING, "Unimplemented Deferred Render State: %s", XTL::DxbxRenderStateInfo[RenderState].S);
|
||||
EmuLog(LOG_LEVEL::WARNING, "Unimplemented Deferred Render State: %s", DxbxRenderStateInfo[RenderState].S);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (XTL::DxbxRenderStateInfo[RenderState].PC == 0) {
|
||||
if (DxbxRenderStateInfo[RenderState].PC == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
g_pD3DDevice->SetRenderState(XTL::DxbxRenderStateInfo[RenderState].PC, Value);
|
||||
g_pD3DDevice->SetRenderState(DxbxRenderStateInfo[RenderState].PC, Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@
|
|||
#include "core\kernel\support\EmuXTL.h"
|
||||
#include "core\hle\D3D8\ResourceTracker.h"
|
||||
#include "core\hle\D3D8\XbPushBuffer.h" // for DxbxFVF_GetNumberOfTextureCoordinates
|
||||
#include "core\hle\D3D8\XbVertexBuffer.h"
|
||||
#include "core\hle\D3D8\XbVertexBuffer.h"
|
||||
#include "core\hle\D3D8\XbConvert.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <chrono>
|
||||
|
|
|
@ -32,7 +32,6 @@ namespace XTL
|
|||
{
|
||||
#include "core\hle\XAPI\Xapi.h"
|
||||
#include "core\hle\D3D8\Direct3D9/Direct3D9.h"
|
||||
#include "core\hle\D3D8\XbConvert.h"
|
||||
#include "core\hle\D3D8\XbPixelShader.h"
|
||||
#include "core\hle\D3D8\XbState.h"
|
||||
#include "core\hle\DSOUND\DirectSound\DirectSound.hpp"
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "common\xbe\XbePrinter.h" // For DumpInformation
|
||||
#include "EmuShared.h"
|
||||
#include "core\kernel\support\EmuXTL.h"
|
||||
#include "core\hle\D3D8\XbConvert.h" // For EmuPC2XB_D3DFormat
|
||||
#include "common\Settings.hpp"
|
||||
|
||||
#include "core\kernel\init\CxbxKrnl.h" // For CxbxConvertArgToString and CxbxExec
|
||||
|
@ -1513,7 +1514,7 @@ void WndMain::LoadGameLogo()
|
|||
(XTL::UINT)pDDSHeader->dwWidth,
|
||||
(XTL::UINT)pDDSHeader->dwHeight,
|
||||
1,
|
||||
XTL::EmuPC2XB_D3DFormat(Format),
|
||||
EmuPC2XB_D3DFormat(Format),
|
||||
2,
|
||||
(XTL::UINT)pDDSHeader->dwPitchOrLinearSize);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue