[d3d11] Remove d3d11.constantBufferRangeCheck option

This commit is contained in:
Philip Rebohle 2022-07-12 02:09:39 +02:00
parent e8f48c71ab
commit f99a833f51
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
9 changed files with 6 additions and 78 deletions

View File

@ -113,15 +113,6 @@
# d3d9.tearFree = Auto
# Performs range check on dynamically indexed constant buffers in shaders.
# This may be needed to work around a certain type of game bug, but may
# also introduce incorrect behaviour.
#
# Supported values: True, False
# d3d11.constantBufferRangeCheck = False
# Assume single-use mode for command lists created on deferred contexts.
# This may need to be disabled for some applications to avoid rendering
# issues, which may come at a significant performance cost.

View File

@ -37,9 +37,6 @@ namespace dxvk {
info.usage |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
info.stages |= m_parent->GetEnabledShaderStages();
info.access |= VK_ACCESS_UNIFORM_READ_BIT;
if (m_parent->GetOptions()->constantBufferRangeCheck)
info.usage |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
}
if (pDesc->BindFlags & D3D11_BIND_SHADER_RESOURCE) {

View File

@ -35,9 +35,6 @@ namespace dxvk {
? VkDeviceSize(maxDynamicImageBufferSize) << 10
: VkDeviceSize(~0ull);
this->constantBufferRangeCheck = config.getOption<bool>("d3d11.constantBufferRangeCheck", false)
&& DxvkGpuVendor(devInfo.core.properties.vendorID) != DxvkGpuVendor::Amd;
auto cachedDynamicResources = config.getOption<std::string>("d3d11.cachedDynamicResources", std::string());
if (::GetModuleHandle("dxgitrace.dll")) {

View File

@ -24,11 +24,6 @@ namespace dxvk {
/// outputs with zero
bool enableRtOutputNanFixup;
/// Enables out-of-bounds access check for constant
/// buffers. Workaround for a few broken games that
/// access random data inside their shaders.
bool constantBufferRangeCheck;
/// Zero-initialize workgroup memory
///
/// Workargound for games that don't initialize

View File

@ -774,19 +774,15 @@ namespace dxvk {
const uint32_t bufferId = ins.dst[0].idx[0].offset;
const uint32_t elementCount = ins.dst[0].idx[1].offset;
bool asSsbo = m_moduleInfo.options.dynamicIndexedConstantBufferAsSsbo
&& ins.controls.accessType() == DxbcConstantBufferAccessType::DynamicallyIndexed;
this->emitDclConstantBufferVar(bufferId, elementCount,
str::format("cb", bufferId).c_str(), asSsbo);
str::format("cb", bufferId).c_str());
}
void DxbcCompiler::emitDclConstantBufferVar(
uint32_t regIdx,
uint32_t numConstants,
const char* name,
bool asSsbo) {
const char* name) {
// Uniform buffer data is stored as a fixed-size array
// of 4x32-bit vectors. SPIR-V requires explicit strides.
const uint32_t arrayType = m_module.defArrayTypeUnique(
@ -798,9 +794,7 @@ namespace dxvk {
// struct and decorate that struct as a block.
const uint32_t structType = m_module.defStructTypeUnique(1, &arrayType);
m_module.decorate(structType, asSsbo
? spv::DecorationBufferBlock
: spv::DecorationBlock);
m_module.decorate(structType, spv::DecorationBlock);
m_module.memberDecorateOffset(structType, 0, 0);
m_module.setDebugName (structType, str::format(name, "_t").c_str());
@ -821,20 +815,13 @@ namespace dxvk {
m_module.decorateDescriptorSet(varId, 0);
m_module.decorateBinding(varId, bindingId);
if (asSsbo)
m_module.decorate(varId, spv::DecorationNonWritable);
DxbcConstantBuffer buf;
buf.varId = varId;
buf.size = numConstants;
m_constantBuffers.at(regIdx) = buf;
// Store descriptor info for the shader interface
VkDescriptorType descriptorType = asSsbo
? VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
: VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
DxvkBindingInfo binding = { descriptorType };
DxvkBindingInfo binding = { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER };
binding.viewType = VK_IMAGE_VIEW_TYPE_MAX_ENUM;
binding.access = VK_ACCESS_UNIFORM_READ_BIT;
binding.resourceBinding = bindingId;
@ -1507,8 +1494,7 @@ namespace dxvk {
void DxbcCompiler::emitDclImmediateConstantBufferUbo(
uint32_t dwordCount,
const uint32_t* dwordArray) {
this->emitDclConstantBufferVar(Icb_BindingSlotId, dwordCount / 4, "icb",
m_moduleInfo.options.dynamicIndexedConstantBufferAsSsbo);
this->emitDclConstantBufferVar(Icb_BindingSlotId, dwordCount / 4, "icb");
m_immConstData.resize(dwordCount * sizeof(uint32_t));
std::memcpy(m_immConstData.data(), dwordArray, m_immConstData.size());
}

View File

@ -583,8 +583,7 @@ namespace dxvk {
void emitDclConstantBufferVar(
uint32_t regIdx,
uint32_t numConstants,
const char* name,
bool asSsbo);
const char* name);
void emitDclSampler(
const DxbcShaderInstruction& ins);

View File

@ -42,7 +42,6 @@ namespace dxvk {
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
forceTgsmBarriers = options.forceTgsmBarriers;
disableMsaa = options.disableMsaa;
dynamicIndexedConstantBufferAsSsbo = options.constantBufferRangeCheck;
// Disable subgroup early discard on Nvidia because it may hurt performance
if (adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0))

View File

@ -44,10 +44,6 @@ namespace dxvk {
/// Enables NaN fixup for render target outputs
bool enableRtOutputNanFixup = false;
/// Implement dynamically indexed uniform buffers
/// with storage buffers for tight bounds checking
bool dynamicIndexedConstantBufferAsSsbo = false;
/// Clear thread-group shared memory to zero
bool zeroInitWorkgroupMemory = false;

View File

@ -107,18 +107,6 @@ namespace dxvk {
{ R"(\\starwarsbattlefront(trial)?\.exe$)", {{
{ "dxgi.nvapiHack", "False" },
}} },
/* Dark Souls Remastered */
{ R"(\\DarkSoulsRemastered\.exe$)", {{
{ "d3d11.constantBufferRangeCheck", "True" },
}} },
/* Grim Dawn */
{ R"(\\Grim Dawn\.exe$)", {{
{ "d3d11.constantBufferRangeCheck", "True" },
}} },
/* NieR:Automata */
{ R"(\\NieRAutomata\.exe$)", {{
{ "d3d11.constantBufferRangeCheck", "True" },
}} },
/* NieR Replicant */
{ R"(\\NieR Replicant ver\.1\.22474487139\.exe)", {{
{ "dxgi.syncInterval", "1" },
@ -137,18 +125,6 @@ namespace dxvk {
{ R"(\\h1_[ms]p64_ship\.exe$)", {{
{ "dxgi.customVendorId", "10de" },
}} },
/* Titan Quest */
{ R"(\\TQ\.exe$)", {{
{ "d3d11.constantBufferRangeCheck", "True" },
}} },
/* Saints Row IV */
{ R"(\\SaintsRowIV\.exe$)", {{
{ "d3d11.constantBufferRangeCheck", "True" },
}} },
/* Saints Row: The Third */
{ R"(\\SaintsRowTheThird_DX11\.exe$)", {{
{ "d3d11.constantBufferRangeCheck", "True" },
}} },
/* Crysis 3 - slower if it notices AMD card *
* Apitrace mode helps massively in cpu bound *
* game parts */
@ -201,14 +177,6 @@ namespace dxvk {
{ R"(\\F1_20(1[89]|[2-9][0-9])\.exe$)", {{
{ "d3d11.forceTgsmBarriers", "True" },
}} },
/* Blue Reflection */
{ R"(\\BLUE_REFLECTION\.exe$)", {{
{ "d3d11.constantBufferRangeCheck", "True" },
}} },
/* Secret World Legends */
{ R"(\\SecretWorldLegendsDX11\.exe$)", {{
{ "d3d11.constantBufferRangeCheck", "True" },
}} },
/* Darksiders Warmastered - apparently reads *
* from write-only mapped buffers */
{ R"(\\darksiders1\.exe$)", {{