Welcome to mirror list, hosted at ThFree Co, Russian Federation.

RenderersSettings.cpp « VideoRenderers « renderer « filters « src - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 274a60fc1367ed2402156ebe6276edb0872063d8 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
 * $Id$
 *
 * (C) 2003-2006 Gabest
 * (C) 2006-2010 see AUTHORS
 *
 * This file is part of mplayerc.
 *
 * Mplayerc is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Mplayerc is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include "stdafx.h"
#include "RenderersSettings.h"
#include "../../../apps/mplayerc/mplayerc.h"
#include <d3dx9.h>

void CRenderersSettings::UpdateData(bool fSave)
{
	AfxGetAppSettings().UpdateRenderersData(fSave);
}

void CRenderersSettings::CRendererSettingsShared::SetDefault()
{
	fVMR9AlterativeVSync = 0;
	iVMR9VSyncOffset = 0;
	iVMR9VSyncAccurate = 1;
	iVMR9FullscreenGUISupport = 0;
	iVMR9VSync = 1;
	iVMR9FullFloatingPointProcessing = 0;
	iVMR9ColorManagementEnable = 0;
	iVMR9ColorManagementInput = VIDEO_SYSTEM_UNKNOWN;
	iVMR9ColorManagementAmbientLight = AMBIENT_LIGHT_BRIGHT;
	iVMR9ColorManagementIntent = COLOR_RENDERING_INTENT_PERCEPTUAL;
	iVMRDisableDesktopComposition = 0;
	iVMRFlushGPUBeforeVSync = 1;
	iVMRFlushGPUAfterPresent = 1;
	iVMRFlushGPUWait = 0;
	bSynchronizeVideo = 0;
	bSynchronizeDisplay = 0;
	bSynchronizeNearest = 1;
	iLineDelta = 0;
	iColumnDelta = 0;
	fCycleDelta = 0.0012;
	fTargetSyncOffset = 12.0;
	fControlLimit = 2.0;
}

void CRenderersSettings::CRendererSettingsShared::SetOptimal()
{
	fVMR9AlterativeVSync = 1;
	iVMR9VSyncAccurate = 1;
	iVMR9VSync = 1;
	iVMR9FullFloatingPointProcessing = 1;
	iVMR9ColorManagementEnable = 0;
	iVMR9ColorManagementInput = VIDEO_SYSTEM_UNKNOWN;
	iVMR9ColorManagementAmbientLight = AMBIENT_LIGHT_BRIGHT;
	iVMR9ColorManagementIntent = COLOR_RENDERING_INTENT_PERCEPTUAL;
	iVMRDisableDesktopComposition = 1;
	iVMRFlushGPUBeforeVSync = 1;
	iVMRFlushGPUAfterPresent = 1;
	iVMRFlushGPUWait = 0;
	bSynchronizeVideo = 0;
	bSynchronizeDisplay = 0;
	bSynchronizeNearest = 1;
	iLineDelta = 0;
	iColumnDelta = 0;
	fCycleDelta = 0.0012;
	fTargetSyncOffset = 12.0;
	fControlLimit = 2.0;
}

void CRenderersSettings::CRendererSettingsEVR::SetDefault()
{
	CRendererSettingsShared::SetDefault();
	iEVRHighColorResolution = 0;
	iEVRForceInputHighColorResolution = 0;
	iEVREnableFrameTimeCorrection = 0;
	iEVROutputRange = 0;
}

void CRenderersSettings::CRendererSettingsEVR::SetOptimal()
{
	CRendererSettingsShared::SetOptimal();
	iEVRHighColorResolution = 0;
	iEVRForceInputHighColorResolution = 0;
}

/////////////////////////////////////////////////////////////////////////////
// CRenderersData construction

CRenderersData::CRenderersData()
{
	m_fTearingTest	= false;
	m_fDisplayStats	= false;
	m_bResetStats	= false;
	m_hD3DX9Dll		= NULL;
	m_nDXSdkRelease	= 0;

	// Don't disable hardware features before initializing a renderer
	m_bFP16Support  = true;
	m_b10bitSupport = true;
}

LONGLONG CRenderersData::GetPerfCounter()
{
	LARGE_INTEGER		i64Ticks100ns;
	LARGE_INTEGER		llPerfFrequency;

	QueryPerformanceFrequency (&llPerfFrequency);
	if (llPerfFrequency.QuadPart != 0)
	{
		QueryPerformanceCounter (&i64Ticks100ns);
		return llMulDiv (i64Ticks100ns.QuadPart, 10000000, llPerfFrequency.QuadPart, 0);
	}
	else
	{
		// ms to 100ns units
		return timeGetTime() * 10000;
	}
}

HINSTANCE CRenderersData::GetD3X9Dll()
{
	if (m_hD3DX9Dll == NULL)
	{
		int min_ver = D3DX_SDK_VERSION;
		int max_ver = D3DX_SDK_VERSION;

		m_nDXSdkRelease = 0;

		if(D3DX_SDK_VERSION >= 42)
		{
			// August 2009 SDK (v42) is not compatible with older versions
			min_ver = 42;
		}
		else
		{
			if(D3DX_SDK_VERSION > 33)
			{
				// versions between 34 and 41 have no known compatibility issues
				min_ver = 34;
			}
			else
			{
				// The minimum version that supports the functionality required by MPC is 24
				min_ver = 24;

				if(D3DX_SDK_VERSION == 33)
				{
					// The April 2007 SDK (v33) should not be used (crash sometimes during shader compilation)
					max_ver = 32;
				}
			}
		}

		// load latest compatible version of the DLL that is available
		for (int i=max_ver; i>=min_ver; i--)
		{
			m_strD3DX9Version.Format(_T("d3dx9_%d.dll"), i);
			m_hD3DX9Dll = LoadLibrary (m_strD3DX9Version);
			if (m_hD3DX9Dll)
			{
				m_nDXSdkRelease = i;
				break;
			}
		}
	}

	return m_hD3DX9Dll;
}