summaryrefslogtreecommitdiffstats
path: root/src/libs/dxvk-native-1.9.2a/src/dxgi/dxgi_options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/dxvk-native-1.9.2a/src/dxgi/dxgi_options.cpp')
-rw-r--r--src/libs/dxvk-native-1.9.2a/src/dxgi/dxgi_options.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/libs/dxvk-native-1.9.2a/src/dxgi/dxgi_options.cpp b/src/libs/dxvk-native-1.9.2a/src/dxgi/dxgi_options.cpp
new file mode 100644
index 00000000..19d4e7a5
--- /dev/null
+++ b/src/libs/dxvk-native-1.9.2a/src/dxgi/dxgi_options.cpp
@@ -0,0 +1,46 @@
+#include "dxgi_options.h"
+
+#include <unordered_map>
+
+namespace dxvk {
+
+ 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;
+ }
+
+
+ DxgiOptions::DxgiOptions(const Config& config) {
+ // 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"));
+ this->customDeviceDesc = config.getOption<std::string>("dxgi.customDeviceDesc", "");
+
+ // Emulate a UMA device
+ this->emulateUMA = config.getOption<bool>("dxgi.emulateUMA", false);
+
+ // 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;
+
+ this->nvapiHack = config.getOption<bool>("dxgi.nvapiHack", true);
+ }
+
+} \ No newline at end of file