Skip to content

Commit

Permalink
Merge branch 'dev/adunn/fix_quality_settings' into 'main'
Browse files Browse the repository at this point in the history
Filter graphics quality settings from Remix API

See merge request lightspeedrtx/dxvk-remix-nv!670
  • Loading branch information
AlexDunn committed Jan 18, 2024
2 parents 262bb9f + 28d5dbb commit f2a7da8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/dxvk/rtx_render/rtx_option.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ namespace dxvk {
*getValuePtr<T>(RtxOptionImpl::ValueType::DefaultValue) = v;
}

std::string getName() const {
return pImpl->getFullName();
}
const char* getDescription() const {
return pImpl->description;
}
Expand Down Expand Up @@ -306,7 +309,7 @@ namespace dxvk {
// The RTX_OPTION* macros provide a convenient way to declare a serializable option
#define RTX_OPTION_FULL(category, type, name, value, environment, flags, description) \
private: inline static RtxOption<type> m_##name = RtxOption<type>(category, #name, environment, type(value), static_cast<uint32_t>(flags), description); \
private: static RtxOption<type>& name##Object() { return m_##name; } \
public: static RtxOption<type>& name##Object() { return m_##name; } \
public : static const type& name() { return m_##name.getValue(); } \
private: static type& name##Ref() { return m_##name.getValue(); } \
public : static const char* name##Description() { return m_##name.getDescription(); }
Expand Down
29 changes: 29 additions & 0 deletions src/dxvk/rtx_render/rtx_remix_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "rtx_light_manager.h"
#include "rtx_option.h"
#include "rtx_globals.h"
#include "rtx_options.h"

#include <remix/remix_c.h>
#include "rtx_remix_pnext.h"
Expand Down Expand Up @@ -913,6 +914,26 @@ namespace {
return REMIXAPI_ERROR_CODE_SUCCESS;
}

// Below are all the graphics quality settings we want to filter out from the SetConfigVariable API.
static const std::string filteredSettings[] = {
dxvk::RtxOptions::graphicsPresetObject().getName(),
dxvk::RtxOptions::dlssPresetObject().getName(),
dxvk::RtxOptions::qualityDLSSObject().getName(),
dxvk::RtxOptions::raytraceModePresetObject().getName(),
dxvk::RtxOptions::nisPresetObject().getName(),
dxvk::RtxOptions::taauPresetObject().getName(),
dxvk::RtxOptions::pathMinBouncesObject().getName(),
dxvk::RtxOptions::pathMaxBouncesObject().getName(),
dxvk::RtxOptions::enableVolumetricLightingObject().getName(),
dxvk::RtxOptions::enableUnorderedEmissiveParticlesInIndirectRaysObject().getName(),
dxvk::RtxOptions::denoiseDirectAndIndirectLightingSeparatelyObject().getName(),
dxvk::RtxOptions::minReplacementTextureMipMapLevelObject().getName(),
dxvk::RtxOptions::enableUnorderedResolveInIndirectRaysObject().getName(),
dxvk::RtxOptions::russianRoulette1stBounceMinContinueProbabilityObject().getName(),
dxvk::RtxOptions::forceHighResolutionReplacementTexturesObject().getName(),
dxvk::RtxOptions::resolutionScaleObject().getName(),
dxvk::NeeCachePass::enableObject().getName(),
};

remixapi_ErrorCode REMIXAPI_CALL remixapi_SetConfigVariable(
const char* key,
Expand All @@ -930,6 +951,14 @@ namespace {
return REMIXAPI_ERROR_CODE_GENERAL_FAILURE;
}

// Keep users of the Remix API in automatic quality mode.
for (auto& filteredSetting : filteredSettings) {
// Skip this if we want to filter this setting
if (found->second->getFullName() == filteredSetting) {
return REMIXAPI_ERROR_CODE_SUCCESS;
}
}

dxvk::Config newSetting;
newSetting.setOption(key, std::string { value });
found->second->readOption(newSetting, dxvk::RtxOptionImpl::ValueType::Value);
Expand Down

0 comments on commit f2a7da8

Please sign in to comment.