mirror of https://github.com/doitsujin/dxvk
Compare commits
4 Commits
efcb34286f
...
e5572545e3
Author | SHA1 | Date |
---|---|---|
Robin Kertels | e5572545e3 | |
Philip Rebohle | 462165da19 | |
Philip Rebohle | 3f27a0ee58 | |
Robin Kertels | d33943f424 |
|
@ -172,8 +172,19 @@ namespace dxvk {
|
|||
|
||||
m_lastDialog = m_dialog;
|
||||
|
||||
if (!SwapWithFrontBuffer()) {
|
||||
// We never actually rotate in the front buffer.
|
||||
// Just blit to it for GetFrontBufferData.
|
||||
|
||||
const auto& backbuffer = m_backBuffers[0];
|
||||
const auto& frontbuffer = GetFrontBuffer();
|
||||
if (FAILED(m_parent->StretchRect(backbuffer.ptr(), nullptr, frontbuffer.ptr(), nullptr, D3DTEXF_NONE))) {
|
||||
Logger::err("Failed to blit to front buffer");
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
const bool useGDIFallback = m_partialCopy && !HasFrontBuffer();
|
||||
const bool useGDIFallback = m_partialCopy && !SwapWithFrontBuffer();
|
||||
if (useGDIFallback)
|
||||
return PresentImageGDI(m_window);
|
||||
#endif
|
||||
|
@ -832,7 +843,13 @@ namespace dxvk {
|
|||
|
||||
// Rotate swap chain buffers so that the back
|
||||
// buffer at index 0 becomes the front buffer.
|
||||
for (uint32_t i = 1; i < m_backBuffers.size(); i++)
|
||||
uint32_t rotatingBufferCount = m_backBuffers.size();
|
||||
if (!SwapWithFrontBuffer()) {
|
||||
// The front buffer only exists for GetFrontBufferData
|
||||
// and the application cannot obserse buffer swapping in GetBackBuffer()
|
||||
rotatingBufferCount -= 1;
|
||||
}
|
||||
for (uint32_t i = 1; i < rotatingBufferCount; i++)
|
||||
m_backBuffers[i]->Swap(m_backBuffers[i - 1].ptr());
|
||||
|
||||
m_parent->m_flags.set(D3D9DeviceFlag::DirtyFramebuffer);
|
||||
|
@ -1012,8 +1029,7 @@ namespace dxvk {
|
|||
// creating a new one to free up resources
|
||||
DestroyBackBuffers();
|
||||
|
||||
int NumFrontBuffer = HasFrontBuffer() ? 1 : 0;
|
||||
const uint32_t NumBuffers = NumBackBuffers + NumFrontBuffer;
|
||||
const uint32_t NumBuffers = NumBackBuffers + 1; // 1 additional front buffer
|
||||
|
||||
m_backBuffers.reserve(NumBuffers);
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ namespace dxvk {
|
|||
return m_backBuffers.back();
|
||||
}
|
||||
|
||||
bool HasFrontBuffer() const {
|
||||
bool SwapWithFrontBuffer() const {
|
||||
if (m_presentParams.SwapEffect == D3DSWAPEFFECT_COPY)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -13,7 +13,10 @@
|
|||
|
||||
namespace dxvk {
|
||||
|
||||
const static std::vector<std::pair<const char*, Config>> g_appDefaults = {{
|
||||
using ProfileList = std::vector<std::pair<const char*, Config>>;
|
||||
|
||||
|
||||
const static ProfileList g_profiles = {{
|
||||
/* Assassin's Creed Syndicate: amdags issues */
|
||||
{ R"(\\ACS\.exe$)", {{
|
||||
{ "dxgi.customVendorId", "10de" },
|
||||
|
@ -909,6 +912,28 @@ namespace dxvk {
|
|||
}};
|
||||
|
||||
|
||||
const static ProfileList g_deckProfiles = {{
|
||||
/* Fallout 4: Defaults to 45 FPS on OLED, but also breaks above 60 FPS */
|
||||
{ R"(\\Fallout4\.exe$)", {{
|
||||
{ "dxgi.syncInterval", "1" },
|
||||
{ "dxgi.maxFrameRate", "60" },
|
||||
}} },
|
||||
}};
|
||||
|
||||
|
||||
const Config* findProfile(const ProfileList& profiles, const std::string& appName) {
|
||||
auto appConfig = std::find_if(profiles.begin(), profiles.end(),
|
||||
[&appName] (const std::pair<const char*, Config>& pair) {
|
||||
std::regex expr(pair.first, std::regex::extended | std::regex::icase);
|
||||
return std::regex_search(appName, expr);
|
||||
});
|
||||
|
||||
return appConfig != profiles.end()
|
||||
? &appConfig->second
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
|
||||
static bool isWhitespace(char ch) {
|
||||
return ch == ' ' || ch == '\x9' || ch == '\r';
|
||||
}
|
||||
|
@ -1158,20 +1183,22 @@ namespace dxvk {
|
|||
|
||||
|
||||
Config Config::getAppConfig(const std::string& appName) {
|
||||
auto appConfig = std::find_if(g_appDefaults.begin(), g_appDefaults.end(),
|
||||
[&appName] (const std::pair<const char*, Config>& pair) {
|
||||
std::regex expr(pair.first, std::regex::extended | std::regex::icase);
|
||||
return std::regex_search(appName, expr);
|
||||
});
|
||||
const Config* config = nullptr;
|
||||
|
||||
if (appConfig != g_appDefaults.end()) {
|
||||
if (env::getEnvVar("SteamDeck") == "1")
|
||||
config = findProfile(g_deckProfiles, appName);
|
||||
|
||||
if (!config)
|
||||
config = findProfile(g_profiles, appName);
|
||||
|
||||
if (config) {
|
||||
// Inform the user that we loaded a default config
|
||||
Logger::info(str::format("Found built-in config:"));
|
||||
|
||||
for (auto& pair : appConfig->second.m_options)
|
||||
for (auto& pair : config->m_options)
|
||||
Logger::info(str::format(" ", pair.first, " = ", pair.second));
|
||||
|
||||
return appConfig->second;
|
||||
return *config;
|
||||
}
|
||||
|
||||
return Config();
|
||||
|
|
Loading…
Reference in New Issue