From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/GfxDevice/d3d/D3D9Enumeration.h | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Runtime/GfxDevice/d3d/D3D9Enumeration.h (limited to 'Runtime/GfxDevice/d3d/D3D9Enumeration.h') diff --git a/Runtime/GfxDevice/d3d/D3D9Enumeration.h b/Runtime/GfxDevice/d3d/D3D9Enumeration.h new file mode 100644 index 0000000..240bb89 --- /dev/null +++ b/Runtime/GfxDevice/d3d/D3D9Enumeration.h @@ -0,0 +1,64 @@ +#pragma once + +#include "D3D9Includes.h" + + +struct D3DDeviceCombo; + +typedef std::vector DwordVector; +typedef std::vector D3DDeviceComboVector; + + +enum D3DVertexProcessing { + kVPPureHardware, + kVPHardware, + kVPMixed, + kVPSoftware, +}; + + +//--------------------------------------------------------------------------- + +// A combo of adapter format, back buffer format, and windowed/fulscreen that +// is compatible with a D3D device. +struct D3DDeviceCombo { +public: + // A depth/stencil buffer format that is incompatible with a multisample type. + struct MultiSampleConflict { + D3DFORMAT format; + D3DMULTISAMPLE_TYPE type; + }; + typedef std::vector MultiSampleConflictVector; +public: + D3DFORMAT adapterFormat; + D3DFORMAT backBufferFormat; + bool isWindowed; + DWORD presentationIntervals; + + DwordVector depthStencilFormats; + DwordVector multiSampleTypes; + MultiSampleConflictVector conflicts; +}; + + +//--------------------------------------------------------------------------- + +class D3D9FormatCaps { +public: + D3D9FormatCaps() : m_VertexProcessings(0) { } + + bool Enumerate( IDirect3D9& d3d ); + + // Fills in BackBufferFormat, AutoDepthStencilFormat, PresentationInterval, + // MultiSampleType, MultiSampleQuality. + void FindBestPresentationParams( int width, int height, D3DFORMAT desktopMode, bool windowed, int vBlankCount, int multiSample, D3DPRESENT_PARAMETERS& outParams ) const; + + // Gets adapter format for doing CheckDeviceFormat checks. + // Usually D3DFMT_X8R8G8B8, except for really old cards that can't do 32 bpp. + D3DFORMAT GetAdapterFormatForChecks() const { return m_AdapterFormatForChecks; } + +public: + D3DDeviceComboVector m_Combos; + UInt32 m_VertexProcessings; // bitmask + D3DFORMAT m_AdapterFormatForChecks; +}; -- cgit v1.1-26-g67d0