diff options
-rw-r--r-- | dispatch/d3d9imports.hpp | 15 | ||||
-rw-r--r-- | retrace/d3d9state.hpp | 7 | ||||
-rw-r--r-- | retrace/d3d9state_formats.cpp | 113 |
3 files changed, 114 insertions, 21 deletions
diff --git a/dispatch/d3d9imports.hpp b/dispatch/d3d9imports.hpp index 07eeb91c..7aee055f 100644 --- a/dispatch/d3d9imports.hpp +++ b/dispatch/d3d9imports.hpp @@ -80,6 +80,21 @@ #define D3DFMT_RAWZ ((D3DFORMAT)MAKEFOURCC('R','A','W','Z')) #endif +#ifndef D3DFMT_RESZ +#define D3DFMT_RESZ ((D3DFORMAT)MAKEFOURCC('R','E','S','Z')) +#endif + +#ifndef RESZ_CODE +#define RESZ_CODE 0x7fa05000 +#endif + +#ifndef D3DFMT_ATI1 +#define D3DFMT_ATI1 ((D3DFORMAT)MAKEFOURCC('A','T','I','1')) +#endif + +#ifndef D3DFMT_ATI2 +#define D3DFMT_ATI2 ((D3DFORMAT)MAKEFOURCC('A','T','I','2')) +#endif #ifndef D3DUSAGE_TEXTAPI #define D3DUSAGE_TEXTAPI 0x10000000L diff --git a/retrace/d3d9state.hpp b/retrace/d3d9state.hpp index affb1221..31b626f7 100644 --- a/retrace/d3d9state.hpp +++ b/retrace/d3d9state.hpp @@ -36,10 +36,6 @@ namespace image { class Image; } -std::ostream & -operator << (std::ostream &os, D3DFORMAT Format); - - namespace d3dstate { @@ -49,7 +45,8 @@ ConvertImage(D3DFORMAT SrcFormat, INT SrcPitch, UINT Width, UINT Height); - +const char * +formatToString(D3DFORMAT fmt); } /* namespace d3dstate */ diff --git a/retrace/d3d9state_formats.cpp b/retrace/d3d9state_formats.cpp index c3157a33..1681011b 100644 --- a/retrace/d3d9state_formats.cpp +++ b/retrace/d3d9state_formats.cpp @@ -28,6 +28,7 @@ #include <assert.h> #include <stdint.h> +#include <sstream> #include "image.hpp" #include "halffloat.hpp" @@ -36,24 +37,104 @@ #include "dxgistate.hpp" #endif +namespace d3dstate { -std::ostream & -operator << (std::ostream &os, D3DFORMAT Format) { - if (Format >= 0 && Format < 256) { - return os << (unsigned)Format; - } else { - char ch0 = Format; - char ch1 = Format >> 8; - char ch2 = Format >> 16; - char ch3 = Format >> 24; - return os << "'" << ch0 << ch1 << ch2 << ch3 << "'"; - } - return os; -} - +const char * +formatToString(D3DFORMAT fmt) +{ + switch ((UINT)fmt) { + case D3DFMT_UNKNOWN: return "D3DFMT_UNKNOWN"; + case D3DFMT_R8G8B8: return "D3DFMT_R8G8B8"; + case D3DFMT_A8R8G8B8: return "D3DFMT_A8R8G8B8"; + case D3DFMT_X8R8G8B8: return "D3DFMT_X8R8G8B8"; + case D3DFMT_R5G6B5: return "D3DFMT_R5G6B5"; + case D3DFMT_X1R5G5B5: return "D3DFMT_X1R5G5B5"; + case D3DFMT_A1R5G5B5: return "D3DFMT_A1R5G5B5"; + case D3DFMT_A4R4G4B4: return "D3DFMT_A4R4G4B4"; + case D3DFMT_R3G3B2: return "D3DFMT_R3G3B2"; + case D3DFMT_A8: return "D3DFMT_A8"; + case D3DFMT_A8R3G3B2: return "D3DFMT_A8R3G3B2"; + case D3DFMT_X4R4G4B4: return "D3DFMT_X4R4G4B4"; + case D3DFMT_A2B10G10R10: return "D3DFMT_A2B10G10R10"; + case D3DFMT_A8B8G8R8: return "D3DFMT_A8B8G8R8"; + case D3DFMT_X8B8G8R8: return "D3DFMT_X8B8G8R8"; + case D3DFMT_G16R16: return "D3DFMT_G16R16"; + case D3DFMT_A2R10G10B10: return "D3DFMT_A2R10G10B10"; + case D3DFMT_A16B16G16R16: return "D3DFMT_A16B16G16R16"; + case D3DFMT_A8P8: return "D3DFMT_A8P8"; + case D3DFMT_P8: return "D3DFMT_P8"; + case D3DFMT_L8: return "D3DFMT_L8"; + case D3DFMT_A8L8: return "D3DFMT_A8L8"; + case D3DFMT_A4L4: return "D3DFMT_A4L4"; + case D3DFMT_V8U8: return "D3DFMT_V8U8"; + case D3DFMT_L6V5U5: return "D3DFMT_L6V5U5"; + case D3DFMT_X8L8V8U8: return "D3DFMT_X8L8V8U8"; + case D3DFMT_Q8W8V8U8: return "D3DFMT_Q8W8V8U8"; + case D3DFMT_V16U16: return "D3DFMT_V16U16"; + case D3DFMT_A2W10V10U10: return "D3DFMT_A2W10V10U10"; + case D3DFMT_UYVY: return "D3DFMT_UYVY"; + case D3DFMT_R8G8_B8G8: return "D3DFMT_R8G8_B8G8"; + case D3DFMT_YUY2: return "D3DFMT_YUY2"; + case D3DFMT_G8R8_G8B8: return "D3DFMT_G8R8_G8B8"; + case D3DFMT_DXT1: return "D3DFMT_DXT1"; + case D3DFMT_DXT2: return "D3DFMT_DXT2"; + case D3DFMT_DXT3: return "D3DFMT_DXT3"; + case D3DFMT_DXT4: return "D3DFMT_DXT4"; + case D3DFMT_DXT5: return "D3DFMT_DXT5"; + case D3DFMT_D16_LOCKABLE: return "D3DFMT_D16_LOCKABLE"; + case D3DFMT_D32: return "D3DFMT_D32"; + case D3DFMT_D15S1: return "D3DFMT_D15S1"; + case D3DFMT_D24S8: return "D3DFMT_D24S8"; + case D3DFMT_D24X8: return "D3DFMT_D24X8"; + case D3DFMT_D24X4S4: return "D3DFMT_D24X4S4"; + case D3DFMT_D16: return "D3DFMT_D16"; + case D3DFMT_D32F_LOCKABLE: return "D3DFMT_D32F_LOCKABLE"; + case D3DFMT_D24FS8: return "D3DFMT_D24FS8"; + case D3DFMT_D32_LOCKABLE: return "D3DFMT_D32_LOCKABLE"; + case D3DFMT_S8_LOCKABLE: return "D3DFMT_S8_LOCKABLE"; + case D3DFMT_L16: return "D3DFMT_L16"; + case D3DFMT_VERTEXDATA: return "D3DFMT_VERTEXDATA"; + case D3DFMT_INDEX16: return "D3DFMT_INDEX16"; + case D3DFMT_INDEX32: return "D3DFMT_INDEX32"; + case D3DFMT_Q16W16V16U16: return "D3DFMT_Q16W16V16U16"; + case D3DFMT_MULTI2_ARGB8: return "D3DFMT_MULTI2_ARGB8"; + case D3DFMT_R16F: return "D3DFMT_R16F"; + case D3DFMT_G16R16F: return "D3DFMT_G16R16F"; + case D3DFMT_A16B16G16R16F: return "D3DFMT_A16B16G16R16F"; + case D3DFMT_R32F: return "D3DFMT_R32F"; + case D3DFMT_G32R32F: return "D3DFMT_G32R32F"; + case D3DFMT_A32B32G32R32F: return "D3DFMT_A32B32G32R32F"; + case D3DFMT_CxV8U8: return "D3DFMT_CxV8U8"; + case D3DFMT_A1: return "D3DFMT_A1"; + case D3DFMT_A2B10G10R10_XR_BIAS: return "D3DFMT_A2B10G10R10_XR_BIAS"; + case D3DFMT_BINARYBUFFER: return "D3DFMT_BINARYBUFFER"; + case D3DFMT_ATI1: return "D3DFMT_ATI1"; + case D3DFMT_ATI2: return "D3DFMT_ATI2"; + case D3DFMT_DF16: return "D3DFMT_DF16"; + case D3DFMT_DF24: return "D3DFMT_DF24"; + case D3DFMT_INTZ: return "D3DFMT_INTZ"; + case D3DFMT_RESZ: return "D3DFMT_RESZ"; + case D3DFMT_NULL: return "D3DFMT_NULL"; + case D3DFMT_AYUV: return "D3DFMT_AYUV"; + case D3DFMT_RAWZ: return "D3DFMT_RAWZ"; + default: + std::ostringstream oss; -namespace d3dstate { + if (fmt > 255) { + char ch0 = fmt; + char ch1 = fmt >> 8; + char ch2 = fmt >> 16; + char ch3 = fmt >> 24; + oss << "D3DFMT_" << ch0 << ch1 << ch2 << ch3; + } else { + oss << (unsigned)fmt; + } + return oss.str().c_str(); + break; + } + return "Unknown"; +} #ifdef HAVE_DXGI @@ -217,7 +298,7 @@ ConvertImage(D3DFORMAT SrcFormat, } #endif - std::cerr << "warning: unsupported D3DFORMAT " << SrcFormat << "\n"; + std::cerr << "warning: unsupported D3DFORMAT " << formatToString(SrcFormat) << "\n"; return NULL; } |