summaryrefslogtreecommitdiff
path: root/Runtime/GfxDevice/d3d/D3D9Enumeration.h
blob: 240bb89cdd013fc21e85f9e1977e549634aded60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once

#include "D3D9Includes.h"


struct D3DDeviceCombo;

typedef std::vector<DWORD>						DwordVector;
typedef std::vector<D3DDeviceCombo>				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<MultiSampleConflict> 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;
};