- Separate vsync option for exclusive full screen because it tends to work better, so you may want to enable it while leaving non-exclusive vsync off.
- Add some tool tips. git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@260 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24
This commit is contained in:
parent
bdbb19c1ee
commit
71a555532b
@ -66,6 +66,7 @@ Direct3DBlitter::Direct3DBlitter(VideoBufferLocker vbl, QWidget *parent) :
|
|||||||
adapterSelector(new QComboBox),
|
adapterSelector(new QComboBox),
|
||||||
vblankblit_(new QCheckBox("Wait for vertical blank"), "direct3dblitter/vblankblit", false),
|
vblankblit_(new QCheckBox("Wait for vertical blank"), "direct3dblitter/vblankblit", false),
|
||||||
flipping_(new QCheckBox("Exclusive full screen"), "direct3dblitter/flipping", false),
|
flipping_(new QCheckBox("Exclusive full screen"), "direct3dblitter/flipping", false),
|
||||||
|
vblankflip_(new QCheckBox("Flip during vertical blank"), "direct3dblitter/vblankflip", true),
|
||||||
triplebuf_(new QCheckBox("Triple buffering"), "direct3dblitter/triplebuf", false),
|
triplebuf_(new QCheckBox("Triple buffering"), "direct3dblitter/triplebuf", false),
|
||||||
bf_(new QCheckBox("Bilinear filtering"), "direct3dblitter/bf", true),
|
bf_(new QCheckBox("Bilinear filtering"), "direct3dblitter/bf", true),
|
||||||
d3d9handle(NULL),
|
d3d9handle(NULL),
|
||||||
@ -128,12 +129,27 @@ Direct3DBlitter::Direct3DBlitter(VideoBufferLocker vbl, QWidget *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
mainLayout->addWidget(vblankblit_.checkBox());
|
mainLayout->addWidget(vblankblit_.checkBox());
|
||||||
|
vblankblit_.checkBox()->setToolTip(tr("Prevents tearing. Does not work well on all systems.\n"
|
||||||
|
"Ignored when exclusive full screen or DWM composition is active."));
|
||||||
mainLayout->addWidget(flipping_.checkBox());
|
mainLayout->addWidget(flipping_.checkBox());
|
||||||
|
flipping_.checkBox()->setToolTip(tr("Grabs device for better performance when full screen."));
|
||||||
|
|
||||||
|
{
|
||||||
|
QHBoxLayout *const l = new QHBoxLayout;
|
||||||
|
l->addSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin));
|
||||||
|
l->addWidget(vblankflip_.checkBox());
|
||||||
|
vblankflip_.checkBox()->setToolTip(tr("Prevents tearing. Recommended."));
|
||||||
|
mainLayout->addLayout(l);
|
||||||
|
}
|
||||||
|
|
||||||
mainLayout->addWidget(triplebuf_.checkBox());
|
mainLayout->addWidget(triplebuf_.checkBox());
|
||||||
|
triplebuf_.checkBox()->setToolTip(tr("Attempts to improve video flow at the cost of increased latency."));
|
||||||
mainLayout->addWidget(bf_.checkBox());
|
mainLayout->addWidget(bf_.checkBox());
|
||||||
confWidget->setLayout(mainLayout);
|
confWidget->setLayout(mainLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vblankflip_.checkBox()->setEnabled(flipping_.checkBox()->isChecked());
|
||||||
|
connect(flipping_.checkBox(), SIGNAL(toggled(bool)), vblankflip_.checkBox(), SLOT(setEnabled(bool)));
|
||||||
rejectSettings();
|
rejectSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +196,7 @@ void Direct3DBlitter::getPresentParams(D3DPRESENT_PARAMETERS *const presentParam
|
|||||||
presentParams->Flags = 0;
|
presentParams->Flags = 0;
|
||||||
presentParams->FullScreen_RefreshRateInHz = excl ? displayMode.RefreshRate : 0;
|
presentParams->FullScreen_RefreshRateInHz = excl ? displayMode.RefreshRate : 0;
|
||||||
presentParams->PresentationInterval = swapInterval == 2 ? D3DPRESENT_INTERVAL_TWO :
|
presentParams->PresentationInterval = swapInterval == 2 ? D3DPRESENT_INTERVAL_TWO :
|
||||||
(swapInterval == 1 || (vblankblit_.value() && (excl || !DwmControl::isCompositingEnabled()))
|
(swapInterval == 1 || (excl ? vblankflip_.value() : vblankblit_.value() && !DwmControl::isCompositingEnabled())
|
||||||
? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE);
|
? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +394,9 @@ void Direct3DBlitter::present() {
|
|||||||
|
|
||||||
if (swapChain) {
|
if (swapChain) {
|
||||||
enum { DONOTWAIT = 1 };
|
enum { DONOTWAIT = 1 };
|
||||||
swapChain->Present(NULL, NULL, 0, NULL, vblankblit_.value() ? DONOTWAIT : 0);
|
|
||||||
|
const DWORD flags = (windowed ? vblankblit_.value() : vblankflip_.value()) ? DONOTWAIT : 0;
|
||||||
|
swapChain->Present(NULL, NULL, 0, NULL, flags);
|
||||||
swapChain->Release();
|
swapChain->Release();
|
||||||
} else
|
} else
|
||||||
device->Present(NULL, NULL, 0, NULL);
|
device->Present(NULL, NULL, 0, NULL);
|
||||||
@ -567,6 +585,7 @@ void Direct3DBlitter::acceptSettings() {
|
|||||||
exclusiveChange();
|
exclusiveChange();
|
||||||
|
|
||||||
vblankblit_.accept();
|
vblankblit_.accept();
|
||||||
|
vblankflip_.accept();
|
||||||
triplebuf_.accept();
|
triplebuf_.accept();
|
||||||
bf_.accept();
|
bf_.accept();
|
||||||
resetDevice();
|
resetDevice();
|
||||||
@ -576,6 +595,7 @@ void Direct3DBlitter::rejectSettings() const {
|
|||||||
adapterSelector->setCurrentIndex(adapterIndex);
|
adapterSelector->setCurrentIndex(adapterIndex);
|
||||||
flipping_.reject();
|
flipping_.reject();
|
||||||
vblankblit_.reject();
|
vblankblit_.reject();
|
||||||
|
vblankflip_.reject();
|
||||||
triplebuf_.reject();
|
triplebuf_.reject();
|
||||||
bf_.reject();
|
bf_.reject();
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ class Direct3DBlitter : public BlitterWidget {
|
|||||||
QComboBox *const adapterSelector;
|
QComboBox *const adapterSelector;
|
||||||
PersistCheckBox vblankblit_;
|
PersistCheckBox vblankblit_;
|
||||||
PersistCheckBox flipping_;
|
PersistCheckBox flipping_;
|
||||||
|
PersistCheckBox vblankflip_;
|
||||||
PersistCheckBox triplebuf_;
|
PersistCheckBox triplebuf_;
|
||||||
PersistCheckBox bf_;
|
PersistCheckBox bf_;
|
||||||
HMODULE d3d9handle;
|
HMODULE d3d9handle;
|
||||||
|
@ -49,6 +49,7 @@ DirectDrawBlitter::DirectDrawBlitter(VideoBufferLocker vbl, QWidget *parent) :
|
|||||||
confWidget(new QWidget),
|
confWidget(new QWidget),
|
||||||
vblank_(new QCheckBox(QString("Wait for vertical blank")), "directdrawblitter/vblank", false),
|
vblank_(new QCheckBox(QString("Wait for vertical blank")), "directdrawblitter/vblank", false),
|
||||||
flipping_(new QCheckBox(QString("Exclusive full screen")), "directdrawblitter/flipping", false),
|
flipping_(new QCheckBox(QString("Exclusive full screen")), "directdrawblitter/flipping", false),
|
||||||
|
vblankflip_(new QCheckBox(QString("Flip during vertical blank")), "directdrawblitter/vblankflip", true),
|
||||||
triplebuf_(new QCheckBox("Triple buffering"), "directdrawblitter/triplebuf", false),
|
triplebuf_(new QCheckBox("Triple buffering"), "directdrawblitter/triplebuf", false),
|
||||||
videoSurface_(new QCheckBox(QString("Use video memory surface")), "directdrawblitter/videoSurface", true),
|
videoSurface_(new QCheckBox(QString("Use video memory surface")), "directdrawblitter/videoSurface", true),
|
||||||
deviceSelector(new QComboBox),
|
deviceSelector(new QComboBox),
|
||||||
@ -95,11 +96,19 @@ DirectDrawBlitter::DirectDrawBlitter(VideoBufferLocker vbl, QWidget *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
mainLayout->addWidget(vblank_.checkBox());
|
mainLayout->addWidget(vblank_.checkBox());
|
||||||
|
vblank_.checkBox()->setToolTip(tr("Prevents tearing. Does not work well on all systems.\n"
|
||||||
|
"Ignored when exclusive full screen or DWM composition is active."));
|
||||||
mainLayout->addWidget(flipping_.checkBox());
|
mainLayout->addWidget(flipping_.checkBox());
|
||||||
|
flipping_.checkBox()->setToolTip(tr("Grabs device for better performance when full screen."));
|
||||||
|
|
||||||
{
|
{
|
||||||
QHBoxLayout *l = new QHBoxLayout;
|
QHBoxLayout *l = new QHBoxLayout;
|
||||||
l->addSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin));
|
l->addSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin));
|
||||||
|
l->addWidget(vblankflip_.checkBox());
|
||||||
|
vblankflip_.checkBox()->setToolTip(tr("Prevents tearing. Recommended."));
|
||||||
|
mainLayout->addLayout(l);
|
||||||
|
l = new QHBoxLayout;
|
||||||
|
l->addSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin));
|
||||||
l->addWidget(triplebuf_.checkBox());
|
l->addWidget(triplebuf_.checkBox());
|
||||||
mainLayout->addLayout(l);
|
mainLayout->addLayout(l);
|
||||||
}
|
}
|
||||||
@ -107,7 +116,9 @@ DirectDrawBlitter::DirectDrawBlitter(VideoBufferLocker vbl, QWidget *parent) :
|
|||||||
mainLayout->addWidget(videoSurface_.checkBox());
|
mainLayout->addWidget(videoSurface_.checkBox());
|
||||||
confWidget->setLayout(mainLayout);
|
confWidget->setLayout(mainLayout);
|
||||||
|
|
||||||
|
vblankflip_.checkBox()->setEnabled(flipping_.checkBox()->isChecked());
|
||||||
triplebuf_.checkBox()->setEnabled(flipping_.checkBox()->isChecked());
|
triplebuf_.checkBox()->setEnabled(flipping_.checkBox()->isChecked());
|
||||||
|
connect(flipping_.checkBox(), SIGNAL(toggled(bool)), vblankflip_.checkBox(), SLOT(setEnabled(bool)));
|
||||||
connect(flipping_.checkBox(), SIGNAL(toggled(bool)), triplebuf_.checkBox(), SLOT(setEnabled(bool)));
|
connect(flipping_.checkBox(), SIGNAL(toggled(bool)), triplebuf_.checkBox(), SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
rejectSettings();
|
rejectSettings();
|
||||||
@ -561,12 +572,12 @@ long DirectDrawBlitter::sync() {
|
|||||||
lastblank = now;
|
lastblank = now;
|
||||||
} else {
|
} else {
|
||||||
if (!blitted)
|
if (!blitted)
|
||||||
finalBlit(vblank_.value() ? DDBLT_DONOTWAIT : DDBLT_WAIT);
|
finalBlit(vblankflip_.value() ? DDBLT_DONOTWAIT : DDBLT_WAIT);
|
||||||
|
|
||||||
if (lpDDSPrimary && blitted)
|
if (lpDDSPrimary && blitted)
|
||||||
ddrval = lpDDSPrimary->Flip(NULL,
|
ddrval = lpDDSPrimary->Flip(NULL,
|
||||||
(vblank_.value() ? DDFLIP_DONOTWAIT : DDFLIP_WAIT) |
|
(vblankflip_.value() ? DDFLIP_DONOTWAIT : DDFLIP_WAIT) |
|
||||||
(vblank_.value() ? 0 : DDFLIP_NOVSYNC));
|
(vblankflip_.value() ? 0 : DDFLIP_NOVSYNC));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (const unsigned si = swapInterval ? swapInterval : vblank_.value() && !DwmControl::isCompositingEnabled()) {
|
if (const unsigned si = swapInterval ? swapInterval : vblank_.value() && !DwmControl::isCompositingEnabled()) {
|
||||||
@ -606,6 +617,7 @@ void DirectDrawBlitter::acceptSettings() {
|
|||||||
|
|
||||||
vblank_.accept();
|
vblank_.accept();
|
||||||
flipping_.accept();
|
flipping_.accept();
|
||||||
|
vblankflip_.accept();
|
||||||
triplebuf_.accept();
|
triplebuf_.accept();
|
||||||
videoSurface_.accept();
|
videoSurface_.accept();
|
||||||
|
|
||||||
@ -629,6 +641,7 @@ void DirectDrawBlitter::acceptSettings() {
|
|||||||
void DirectDrawBlitter::rejectSettings() const {
|
void DirectDrawBlitter::rejectSettings() const {
|
||||||
vblank_.reject();
|
vblank_.reject();
|
||||||
flipping_.reject();
|
flipping_.reject();
|
||||||
|
vblankflip_.reject();
|
||||||
triplebuf_.reject();
|
triplebuf_.reject();
|
||||||
videoSurface_.reject();
|
videoSurface_.reject();
|
||||||
deviceSelector->setCurrentIndex(deviceIndex);
|
deviceSelector->setCurrentIndex(deviceIndex);
|
||||||
|
@ -33,6 +33,7 @@ class DirectDrawBlitter : public BlitterWidget {
|
|||||||
const std::auto_ptr<QWidget> confWidget;
|
const std::auto_ptr<QWidget> confWidget;
|
||||||
PersistCheckBox vblank_;
|
PersistCheckBox vblank_;
|
||||||
PersistCheckBox flipping_;
|
PersistCheckBox flipping_;
|
||||||
|
PersistCheckBox vblankflip_;
|
||||||
PersistCheckBox triplebuf_;
|
PersistCheckBox triplebuf_;
|
||||||
PersistCheckBox videoSurface_;
|
PersistCheckBox videoSurface_;
|
||||||
QComboBox *const deviceSelector;
|
QComboBox *const deviceSelector;
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2011 by Sindre Aamås *
|
||||||
|
* aamas@stud.ntnu.no *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License version 2 as *
|
||||||
|
* published by the Free Software Foundation. *
|
||||||
|
* *
|
||||||
|
* This program 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 version 2 for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* version 2 along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
#include "dwmcontrol.h"
|
#include "dwmcontrol.h"
|
||||||
|
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2011 by Sindre Aamås *
|
||||||
|
* aamas@stud.ntnu.no *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License version 2 as *
|
||||||
|
* published by the Free Software Foundation. *
|
||||||
|
* *
|
||||||
|
* This program 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 version 2 for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* version 2 along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
#ifndef DWMCONTROL_H_
|
#ifndef DWMCONTROL_H_
|
||||||
#define DWMCONTROL_H_
|
#define DWMCONTROL_H_
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user