From 6bb271b29918fbcd48fd8b1a227ea7d3968aa59b Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sat, 27 Feb 2021 20:35:37 +0000 Subject: [PATCH] [d3d9] Cleanup options code --- src/d3d9/d3d9_options.cpp | 92 ++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/src/d3d9/d3d9_options.cpp b/src/d3d9/d3d9_options.cpp index c024906c5..c014f7c8a 100644 --- a/src/d3d9/d3d9_options.cpp +++ b/src/d3d9/d3d9_options.cpp @@ -33,57 +33,59 @@ namespace dxvk { // Fetch these as a string representing a hexadecimal number and parse it. this->customVendorId = parsePciId(config.getOption("d3d9.customVendorId")); this->customDeviceId = parsePciId(config.getOption("d3d9.customDeviceId")); - this->customDeviceDesc = config.getOption("d3d9.customDeviceDesc"); + this->customDeviceDesc = config.getOption("d3d9.customDeviceDesc"); - const int32_t vendorId = this->customDeviceId != -1 ? this->customDeviceId : (adapter != nullptr ? adapter->deviceProperties().vendorID : 0); + const int32_t vendorId = this->customDeviceId != -1 + ? this->customDeviceId + : (adapter != nullptr ? adapter->deviceProperties().vendorID : 0); - this->maxFrameLatency = config.getOption ("d3d9.maxFrameLatency", 0); - this->presentInterval = config.getOption ("d3d9.presentInterval", -1); - this->shaderModel = config.getOption ("d3d9.shaderModel", 3); - this->evictManagedOnUnlock = config.getOption ("d3d9.evictManagedOnUnlock", false); - this->dpiAware = config.getOption ("d3d9.dpiAware", true); - this->allowLockFlagReadonly = config.getOption ("d3d9.allowLockFlagReadonly", true); - this->strictConstantCopies = config.getOption ("d3d9.strictConstantCopies", false); - this->strictPow = config.getOption ("d3d9.strictPow", true); - this->lenientClear = config.getOption ("d3d9.lenientClear", false); - this->numBackBuffers = config.getOption ("d3d9.numBackBuffers", 0); - this->noExplicitFrontBuffer = config.getOption ("d3d9.noExplicitFrontBuffer", false); - this->deferSurfaceCreation = config.getOption ("d3d9.deferSurfaceCreation", false); - this->samplerAnisotropy = config.getOption ("d3d9.samplerAnisotropy", -1); - this->maxAvailableMemory = config.getOption ("d3d9.maxAvailableMemory", 4096); - this->supportDFFormats = config.getOption ("d3d9.supportDFFormats", true); - this->supportX4R4G4B4 = config.getOption ("d3d9.supportX4R4G4B4", true); - this->supportD32 = config.getOption ("d3d9.supportD32", true); - this->swvpFloatCount = config.getOption ("d3d9.swvpFloatCount", caps::MaxFloatConstantsSoftware); - this->swvpIntCount = config.getOption ("d3d9.swvpIntCount", caps::MaxOtherConstantsSoftware); - this->swvpBoolCount = config.getOption ("d3d9.swvpBoolCount", caps::MaxOtherConstantsSoftware); - this->disableA8RT = config.getOption ("d3d9.disableA8RT", false); - this->invariantPosition = config.getOption ("d3d9.invariantPosition", false); - this->memoryTrackTest = config.getOption ("d3d9.memoryTrackTest", false); - this->supportVCache = config.getOption ("d3d9.supportVCache", vendorId == 0x10de); - this->enableDialogMode = config.getOption ("d3d9.enableDialogMode", false); - this->forceSamplerTypeSpecConstants = config.getOption ("d3d9.forceSamplerTypeSpecConstants", false); - this->forceSwapchainMSAA = config.getOption ("d3d9.forceSwapchainMSAA", -1); - - this->forceAspectRatio = config.getOption("d3d9.forceAspectRatio", ""); - this->allowDoNotWait = config.getOption ("d3d9.allowDoNotWait", true); - this->allowDiscard = config.getOption ("d3d9.allowDiscard", true); - this->enumerateByDisplays = config.getOption ("d3d9.enumerateByDisplays", true); - this->longMad = config.getOption ("d3d9.longMad", false); - this->tearFree = config.getOption ("d3d9.tearFree", Tristate::Auto); - this->alphaTestWiggleRoom = config.getOption ("d3d9.alphaTestWiggleRoom", false); - - this->apitraceMode = config.getOption("d3d9.apitraceMode", false); - - this->deviceLocalConstantBuffers = config.getOption("d3d9.deviceLocalConstantBuffers", false); - this->allowImplicitDiscard = config.getOption("d3d9.allowImplicitDiscard", true); + this->maxFrameLatency = config.getOption ("d3d9.maxFrameLatency", 0); + this->presentInterval = config.getOption ("d3d9.presentInterval", -1); + this->shaderModel = config.getOption ("d3d9.shaderModel", 3); + this->evictManagedOnUnlock = config.getOption ("d3d9.evictManagedOnUnlock", false); + this->dpiAware = config.getOption ("d3d9.dpiAware", true); + this->allowLockFlagReadonly = config.getOption ("d3d9.allowLockFlagReadonly", true); + this->strictConstantCopies = config.getOption ("d3d9.strictConstantCopies", false); + this->strictPow = config.getOption ("d3d9.strictPow", true); + this->lenientClear = config.getOption ("d3d9.lenientClear", false); + this->numBackBuffers = config.getOption ("d3d9.numBackBuffers", 0); + this->noExplicitFrontBuffer = config.getOption ("d3d9.noExplicitFrontBuffer", false); + this->deferSurfaceCreation = config.getOption ("d3d9.deferSurfaceCreation", false); + this->samplerAnisotropy = config.getOption ("d3d9.samplerAnisotropy", -1); + this->maxAvailableMemory = config.getOption ("d3d9.maxAvailableMemory", 4096); + this->supportDFFormats = config.getOption ("d3d9.supportDFFormats", true); + this->supportX4R4G4B4 = config.getOption ("d3d9.supportX4R4G4B4", true); + this->supportD32 = config.getOption ("d3d9.supportD32", true); + this->swvpFloatCount = config.getOption ("d3d9.swvpFloatCount", caps::MaxFloatConstantsSoftware); + this->swvpIntCount = config.getOption ("d3d9.swvpIntCount", caps::MaxOtherConstantsSoftware); + this->swvpBoolCount = config.getOption ("d3d9.swvpBoolCount", caps::MaxOtherConstantsSoftware); + this->disableA8RT = config.getOption ("d3d9.disableA8RT", false); + this->invariantPosition = config.getOption ("d3d9.invariantPosition", false); + this->memoryTrackTest = config.getOption ("d3d9.memoryTrackTest", false); + this->supportVCache = config.getOption ("d3d9.supportVCache", vendorId == 0x10de); + this->enableDialogMode = config.getOption ("d3d9.enableDialogMode", false); + this->forceSamplerTypeSpecConstants = config.getOption ("d3d9.forceSamplerTypeSpecConstants", false); + this->forceSwapchainMSAA = config.getOption ("d3d9.forceSwapchainMSAA", -1); + this->forceAspectRatio = config.getOption ("d3d9.forceAspectRatio", ""); + this->allowDoNotWait = config.getOption ("d3d9.allowDoNotWait", true); + this->allowDiscard = config.getOption ("d3d9.allowDiscard", true); + this->enumerateByDisplays = config.getOption ("d3d9.enumerateByDisplays", true); + this->longMad = config.getOption ("d3d9.longMad", false); + this->tearFree = config.getOption ("d3d9.tearFree", Tristate::Auto); + this->alphaTestWiggleRoom = config.getOption ("d3d9.alphaTestWiggleRoom", false); + this->apitraceMode = config.getOption ("d3d9.apitraceMode", false); + this->deviceLocalConstantBuffers = config.getOption ("d3d9.deviceLocalConstantBuffers", false); + this->allowImplicitDiscard = config.getOption ("d3d9.allowImplicitDiscard", true); // If we are not Nvidia, enable general hazards. - this->generalHazards = adapter == nullptr || !adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0); + this->generalHazards = adapter != nullptr + && !adapter->matchesDriver( + DxvkGpuVendor::Nvidia, + VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, + 0, 0); applyTristate(this->generalHazards, config.getOption("d3d9.generalHazards", Tristate::Auto)); - this->d3d9FloatEmulation = true; // <-- Future Extension? - + this->d3d9FloatEmulation = true; // <-- Future Extension? applyTristate(this->d3d9FloatEmulation, config.getOption("d3d9.floatEmulation", Tristate::Auto)); }