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: 89813297e6adb95d253a98674465c2823eaca2ef (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
/*
 * (C) 2003-2006 Gabest
 * (C) 2006-2014 see Authors.txt
 *
 * This file is part of MPC-HC.
 *
 * MPC-HC 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.
 *
 * MPC-HC 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 "../../../mpc-hc/AppSettings.h"
#include "../../../mpc-hc/mplayerc.h"
#include "../../../DSUtil/SysVersion.h"
#include "version.h"
#include <d3dx9.h>

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

void CRenderersSettings::CAdvRendererSettings::SetDefault()
{
    bVMR9AlterativeVSync              = false;
    iVMR9VSyncOffset                  = 0;
    bVMR9VSyncAccurate                = false;
    bVMR9FullscreenGUISupport         = false;
    bVMR9VSync                        = !SysVersion::IsVistaOrLater();
    bVMR9FullFloatingPointProcessing  = false;
    bVMR9HalfFloatingPointProcessing  = false;
    bVMR9ColorManagementEnable        = false;
    iVMR9ColorManagementInput         = VIDEO_SYSTEM_UNKNOWN;
    iVMR9ColorManagementAmbientLight  = AMBIENT_LIGHT_BRIGHT;
    iVMR9ColorManagementIntent        = COLOR_RENDERING_INTENT_PERCEPTUAL;
    bVMRDisableDesktopComposition     = false;
    bVMRFlushGPUBeforeVSync           = true;
    bVMRFlushGPUAfterPresent          = true;
    bVMRFlushGPUWait                  = false;
    bEVRHighColorResolution           = false;
    bEVRForceInputHighColorResolution = false;
    bEVREnableFrameTimeCorrection     = false;
    iEVROutputRange                   = 0;
    bSynchronizeVideo                 = false;
    bSynchronizeDisplay               = false;
    bSynchronizeNearest               = true;
    iLineDelta                        = 0;
    iColumnDelta                      = 0;
    fCycleDelta                       = 0.0012;
    fTargetSyncOffset                 = 12.0;
    fControlLimit                     = 2.0;
}

void CRenderersSettings::CAdvRendererSettings::SetOptimal()
{
    bVMR9AlterativeVSync              = true;
    iVMR9VSyncOffset                  = 0;
    bVMR9VSyncAccurate                = true;
    bVMR9FullscreenGUISupport         = false;
    bVMR9VSync                        = true;
    bVMR9FullFloatingPointProcessing  = true;
    bVMR9HalfFloatingPointProcessing  = false;
    bVMR9ColorManagementEnable        = false;
    iVMR9ColorManagementInput         = VIDEO_SYSTEM_UNKNOWN;
    iVMR9ColorManagementAmbientLight  = AMBIENT_LIGHT_BRIGHT;
    iVMR9ColorManagementIntent        = COLOR_RENDERING_INTENT_PERCEPTUAL;
    bVMRDisableDesktopComposition     = true;
    bVMRFlushGPUBeforeVSync           = true;
    bVMRFlushGPUAfterPresent          = true;
    bVMRFlushGPUWait                  = false;
    bEVRHighColorResolution           = false;
    bEVRForceInputHighColorResolution = false;
    bEVREnableFrameTimeCorrection     = false;
    iEVROutputRange                   = 0;
    bSynchronizeVideo                 = false;
    bSynchronizeDisplay               = false;
    bSynchronizeNearest               = true;
    iLineDelta                        = 0;
    iColumnDelta                      = 0;
    fCycleDelta                       = 0.0012;
    fTargetSyncOffset                 = 12.0;
    fControlLimit                     = 2.0;
}

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

CRenderersData::CRenderersData()
{
    m_bTearingTest  = false;
    m_iDisplayStats = 0;
    m_bResetStats   = false;
    m_hD3DX9Dll     = nullptr;
    m_nDXSdkRelease = 0;

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

LONGLONG CRenderersData::GetPerfCounter() const
{
    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 LONGLONG(timeGetTime()) * 10000;
    }
}

HINSTANCE CRenderersData::GetD3X9Dll()
{
#if D3DX_SDK_VERSION < MPC_DX_SDK_NUMBER
#pragma message("ERROR: DirectX SDK " MPC_DX_SDK_MONTH " " MAKE_STR(MPC_DX_SDK_YEAR) " (v" MAKE_STR(MPC_DX_SDK_NUMBER) ") or newer is required to build MPC-HC")
#endif

    if (m_hD3DX9Dll == nullptr) {
        m_nDXSdkRelease = 0;

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

    return m_hD3DX9Dll;
}