mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-27 13:54:16 +01:00
[dxbc] Refactor DxbcOptions
A bit mask isn't good enough going forward, and we also don't need application-specific options for now.
This commit is contained in:
parent
ab3ba776e0
commit
bd03225c14
@ -103,8 +103,7 @@ namespace dxvk {
|
|||||||
m_dxvkDevice (pDxgiDevice->GetDXVKDevice()),
|
m_dxvkDevice (pDxgiDevice->GetDXVKDevice()),
|
||||||
m_dxvkAdapter (m_dxvkDevice->adapter()),
|
m_dxvkAdapter (m_dxvkDevice->adapter()),
|
||||||
m_d3d11Options (m_dxvkAdapter->instance()->config()),
|
m_d3d11Options (m_dxvkAdapter->instance()->config()),
|
||||||
m_dxbcOptions (getDxbcAppOptions(env::getExeName()) |
|
m_dxbcOptions (m_dxvkDevice) {
|
||||||
getDxbcDeviceOptions(m_dxvkDevice)) {
|
|
||||||
Com<IDXGIAdapter> adapter;
|
Com<IDXGIAdapter> adapter;
|
||||||
|
|
||||||
if (FAILED(pDxgiDevice->GetAdapter(&adapter))
|
if (FAILED(pDxgiDevice->GetAdapter(&adapter))
|
||||||
|
@ -852,7 +852,7 @@ namespace dxvk {
|
|||||||
const bool isUav = ins.op == DxbcOpcode::DclUavTyped;
|
const bool isUav = ins.op == DxbcOpcode::DclUavTyped;
|
||||||
|
|
||||||
if (isUav) {
|
if (isUav) {
|
||||||
if (m_moduleInfo.options.test(DxbcOption::UseStorageImageReadWithoutFormat))
|
if (m_moduleInfo.options.useStorageImageReadWithoutFormat)
|
||||||
m_module.enableCapability(spv::CapabilityStorageImageReadWithoutFormat);
|
m_module.enableCapability(spv::CapabilityStorageImageReadWithoutFormat);
|
||||||
m_module.enableCapability(spv::CapabilityStorageImageWriteWithoutFormat);
|
m_module.enableCapability(spv::CapabilityStorageImageWriteWithoutFormat);
|
||||||
}
|
}
|
||||||
@ -913,7 +913,7 @@ namespace dxvk {
|
|||||||
if (isUav) {
|
if (isUav) {
|
||||||
if ((m_analysis->uavInfos[registerId].accessAtomicOp)
|
if ((m_analysis->uavInfos[registerId].accessAtomicOp)
|
||||||
|| (m_analysis->uavInfos[registerId].accessTypedLoad
|
|| (m_analysis->uavInfos[registerId].accessTypedLoad
|
||||||
&& !m_moduleInfo.options.test(DxbcOption::UseStorageImageReadWithoutFormat)))
|
&& !m_moduleInfo.options.useStorageImageReadWithoutFormat))
|
||||||
imageFormat = getScalarImageFormat(sampledType);
|
imageFormat = getScalarImageFormat(sampledType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -952,7 +952,7 @@ namespace dxvk {
|
|||||||
// On GPUs which don't support storageImageReadWithoutFormat,
|
// On GPUs which don't support storageImageReadWithoutFormat,
|
||||||
// we have to decorate untyped UAVs as write-only
|
// we have to decorate untyped UAVs as write-only
|
||||||
if (isUav && imageFormat == spv::ImageFormatUnknown
|
if (isUav && imageFormat == spv::ImageFormatUnknown
|
||||||
&& !m_moduleInfo.options.test(DxbcOption::UseStorageImageReadWithoutFormat))
|
&& !m_moduleInfo.options.useStorageImageReadWithoutFormat)
|
||||||
m_module.decorate(varId, spv::DecorationNonReadable);
|
m_module.decorate(varId, spv::DecorationNonReadable);
|
||||||
|
|
||||||
// Declare a specialization constant which will
|
// Declare a specialization constant which will
|
||||||
@ -6147,7 +6147,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
// We may have to defer kill operations to the end of
|
// We may have to defer kill operations to the end of
|
||||||
// the shader in order to keep derivatives correct.
|
// the shader in order to keep derivatives correct.
|
||||||
if (m_analysis->usesKill && m_analysis->usesDerivatives && m_moduleInfo.options.test(DxbcOption::DeferKill)) {
|
if (m_analysis->usesKill && m_analysis->usesDerivatives && m_moduleInfo.options.deferKill) {
|
||||||
m_ps.killState = m_module.newVarInit(
|
m_ps.killState = m_module.newVarInit(
|
||||||
m_module.defPointerType(m_module.defBoolType(), spv::StorageClassPrivate),
|
m_module.defPointerType(m_module.defBoolType(), spv::StorageClassPrivate),
|
||||||
spv::StorageClassPrivate, m_module.constBool(false));
|
spv::StorageClassPrivate, m_module.constBool(false));
|
||||||
|
@ -4,30 +4,16 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
const static std::unordered_map<std::string, DxbcOptions> g_dxbcAppOptions = {{
|
DxbcOptions::DxbcOptions() {
|
||||||
|
|
||||||
}};
|
|
||||||
|
|
||||||
|
|
||||||
DxbcOptions getDxbcAppOptions(const std::string& appName) {
|
|
||||||
auto appOptions = g_dxbcAppOptions.find(appName);
|
|
||||||
|
|
||||||
return appOptions != g_dxbcAppOptions.end()
|
|
||||||
? appOptions->second
|
|
||||||
: DxbcOptions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DxbcOptions getDxbcDeviceOptions(const Rc<DxvkDevice>& device) {
|
DxbcOptions::DxbcOptions(const Rc<DxvkDevice>& device) {
|
||||||
DxbcOptions flags;
|
|
||||||
|
|
||||||
const DxvkDeviceFeatures& devFeatures = device->features();
|
const DxvkDeviceFeatures& devFeatures = device->features();
|
||||||
|
|
||||||
if (devFeatures.core.features.shaderStorageImageReadWithoutFormat)
|
useStorageImageReadWithoutFormat = devFeatures.core.features.shaderStorageImageReadWithoutFormat;
|
||||||
flags.set(DxbcOption::UseStorageImageReadWithoutFormat);
|
deferKill = true;
|
||||||
|
|
||||||
flags.set(DxbcOption::DeferKill);
|
|
||||||
return flags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -4,33 +4,18 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
enum class DxbcOption : uint64_t {
|
struct DxbcOptions {
|
||||||
|
DxbcOptions();
|
||||||
|
DxbcOptions(const Rc<DxvkDevice>& device);
|
||||||
|
|
||||||
/// Use the ShaderImageReadWithoutFormat capability.
|
/// Use the ShaderImageReadWithoutFormat capability.
|
||||||
/// Enabled by default on GPUs which support this.
|
/// Enabled by default on GPUs which support this.
|
||||||
UseStorageImageReadWithoutFormat,
|
bool useStorageImageReadWithoutFormat = false;
|
||||||
|
|
||||||
/// Defer kill operation to the end of the shader.
|
/// Defer kill operation to the end of the shader.
|
||||||
/// Fixes derivatives that are undefined due to
|
/// Fixes derivatives that are undefined due to
|
||||||
/// non-uniform control flow in fragment shaders.
|
/// non-uniform control flow in fragment shaders.
|
||||||
DeferKill,
|
bool deferKill = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
using DxbcOptions = Flags<DxbcOption>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Gets app-specific DXBC options
|
|
||||||
*
|
|
||||||
* \param [in] appName Application name
|
|
||||||
* \returns DXBC options for this application
|
|
||||||
*/
|
|
||||||
DxbcOptions getDxbcAppOptions(const std::string& appName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Gets device-specific options
|
|
||||||
*
|
|
||||||
* \param [in] device The device
|
|
||||||
* \returns Device options
|
|
||||||
*/
|
|
||||||
DxbcOptions getDxbcDeviceOptions(const Rc<DxvkDevice>& device);
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user