2018-05-24 12:31:04 +02:00
|
|
|
#include "dxgi_options.h"
|
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
namespace dxvk {
|
2018-08-07 17:33:19 +02:00
|
|
|
|
|
|
|
static int32_t parsePciId(const std::string& str) {
|
|
|
|
if (str.size() != 4)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
int32_t id = 0;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < str.size(); i++) {
|
|
|
|
id *= 16;
|
|
|
|
|
|
|
|
if (str[i] >= '0' && str[i] <= '9')
|
|
|
|
id += str[i] - '0';
|
|
|
|
else if (str[i] >= 'A' && str[i] <= 'F')
|
|
|
|
id += str[i] - 'A' + 10;
|
|
|
|
else if (str[i] >= 'a' && str[i] <= 'f')
|
|
|
|
id += str[i] - 'a' + 10;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
2018-05-24 12:31:04 +02:00
|
|
|
|
2018-08-07 14:47:06 +02:00
|
|
|
DxgiOptions::DxgiOptions(const Config& config) {
|
|
|
|
this->deferSurfaceCreation = config.getOption<bool> ("dxgi.deferSurfaceCreation", false);
|
|
|
|
this->maxFrameLatency = config.getOption<int32_t> ("dxgi.maxFrameLatency", 0);
|
2018-08-25 01:22:19 +02:00
|
|
|
|
|
|
|
// Fetch these as a string representing a hexadecimal number and parse it.
|
|
|
|
this->customVendorId = parsePciId(config.getOption<std::string>("dxgi.customVendorId"));
|
|
|
|
this->customDeviceId = parsePciId(config.getOption<std::string>("dxgi.customDeviceId"));
|
|
|
|
|
|
|
|
// Interpret the memory limits as Megabytes
|
|
|
|
this->maxDeviceMemory = VkDeviceSize(config.getOption<int32_t>("dxgi.maxDeviceMemory", 0)) << 20;
|
|
|
|
this->maxSharedMemory = VkDeviceSize(config.getOption<int32_t>("dxgi.maxSharedMemory", 0)) << 20;
|
2018-09-09 19:12:07 +02:00
|
|
|
|
|
|
|
this->numBackBuffers = config.getOption<int32_t>("dxgi.numBackBuffers", 0);
|
2018-05-24 12:31:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|