mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-21 22:54:16 +01:00
[d3d11] Remove d3d11.constantBufferRangeCheck option
This commit is contained in:
parent
e8f48c71ab
commit
f99a833f51
@ -113,15 +113,6 @@
|
|||||||
# d3d9.tearFree = Auto
|
# 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.
|
# Assume single-use mode for command lists created on deferred contexts.
|
||||||
# This may need to be disabled for some applications to avoid rendering
|
# This may need to be disabled for some applications to avoid rendering
|
||||||
# issues, which may come at a significant performance cost.
|
# issues, which may come at a significant performance cost.
|
||||||
|
@ -37,9 +37,6 @@ namespace dxvk {
|
|||||||
info.usage |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
|
info.usage |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
|
||||||
info.stages |= m_parent->GetEnabledShaderStages();
|
info.stages |= m_parent->GetEnabledShaderStages();
|
||||||
info.access |= VK_ACCESS_UNIFORM_READ_BIT;
|
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) {
|
if (pDesc->BindFlags & D3D11_BIND_SHADER_RESOURCE) {
|
||||||
|
@ -35,9 +35,6 @@ namespace dxvk {
|
|||||||
? VkDeviceSize(maxDynamicImageBufferSize) << 10
|
? VkDeviceSize(maxDynamicImageBufferSize) << 10
|
||||||
: VkDeviceSize(~0ull);
|
: 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());
|
auto cachedDynamicResources = config.getOption<std::string>("d3d11.cachedDynamicResources", std::string());
|
||||||
|
|
||||||
if (::GetModuleHandle("dxgitrace.dll")) {
|
if (::GetModuleHandle("dxgitrace.dll")) {
|
||||||
|
@ -24,11 +24,6 @@ namespace dxvk {
|
|||||||
/// outputs with zero
|
/// outputs with zero
|
||||||
bool enableRtOutputNanFixup;
|
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
|
/// Zero-initialize workgroup memory
|
||||||
///
|
///
|
||||||
/// Workargound for games that don't initialize
|
/// Workargound for games that don't initialize
|
||||||
|
@ -774,19 +774,15 @@ namespace dxvk {
|
|||||||
const uint32_t bufferId = ins.dst[0].idx[0].offset;
|
const uint32_t bufferId = ins.dst[0].idx[0].offset;
|
||||||
const uint32_t elementCount = ins.dst[0].idx[1].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,
|
this->emitDclConstantBufferVar(bufferId, elementCount,
|
||||||
str::format("cb", bufferId).c_str(), asSsbo);
|
str::format("cb", bufferId).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxbcCompiler::emitDclConstantBufferVar(
|
void DxbcCompiler::emitDclConstantBufferVar(
|
||||||
uint32_t regIdx,
|
uint32_t regIdx,
|
||||||
uint32_t numConstants,
|
uint32_t numConstants,
|
||||||
const char* name,
|
const char* name) {
|
||||||
bool asSsbo) {
|
|
||||||
// Uniform buffer data is stored as a fixed-size array
|
// Uniform buffer data is stored as a fixed-size array
|
||||||
// of 4x32-bit vectors. SPIR-V requires explicit strides.
|
// of 4x32-bit vectors. SPIR-V requires explicit strides.
|
||||||
const uint32_t arrayType = m_module.defArrayTypeUnique(
|
const uint32_t arrayType = m_module.defArrayTypeUnique(
|
||||||
@ -798,9 +794,7 @@ namespace dxvk {
|
|||||||
// struct and decorate that struct as a block.
|
// struct and decorate that struct as a block.
|
||||||
const uint32_t structType = m_module.defStructTypeUnique(1, &arrayType);
|
const uint32_t structType = m_module.defStructTypeUnique(1, &arrayType);
|
||||||
|
|
||||||
m_module.decorate(structType, asSsbo
|
m_module.decorate(structType, spv::DecorationBlock);
|
||||||
? spv::DecorationBufferBlock
|
|
||||||
: spv::DecorationBlock);
|
|
||||||
m_module.memberDecorateOffset(structType, 0, 0);
|
m_module.memberDecorateOffset(structType, 0, 0);
|
||||||
|
|
||||||
m_module.setDebugName (structType, str::format(name, "_t").c_str());
|
m_module.setDebugName (structType, str::format(name, "_t").c_str());
|
||||||
@ -821,20 +815,13 @@ namespace dxvk {
|
|||||||
m_module.decorateDescriptorSet(varId, 0);
|
m_module.decorateDescriptorSet(varId, 0);
|
||||||
m_module.decorateBinding(varId, bindingId);
|
m_module.decorateBinding(varId, bindingId);
|
||||||
|
|
||||||
if (asSsbo)
|
|
||||||
m_module.decorate(varId, spv::DecorationNonWritable);
|
|
||||||
|
|
||||||
DxbcConstantBuffer buf;
|
DxbcConstantBuffer buf;
|
||||||
buf.varId = varId;
|
buf.varId = varId;
|
||||||
buf.size = numConstants;
|
buf.size = numConstants;
|
||||||
m_constantBuffers.at(regIdx) = buf;
|
m_constantBuffers.at(regIdx) = buf;
|
||||||
|
|
||||||
// Store descriptor info for the shader interface
|
// Store descriptor info for the shader interface
|
||||||
VkDescriptorType descriptorType = asSsbo
|
DxvkBindingInfo binding = { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER };
|
||||||
? VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
|
|
||||||
: VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
|
||||||
|
|
||||||
DxvkBindingInfo binding = { descriptorType };
|
|
||||||
binding.viewType = VK_IMAGE_VIEW_TYPE_MAX_ENUM;
|
binding.viewType = VK_IMAGE_VIEW_TYPE_MAX_ENUM;
|
||||||
binding.access = VK_ACCESS_UNIFORM_READ_BIT;
|
binding.access = VK_ACCESS_UNIFORM_READ_BIT;
|
||||||
binding.resourceBinding = bindingId;
|
binding.resourceBinding = bindingId;
|
||||||
@ -1507,8 +1494,7 @@ namespace dxvk {
|
|||||||
void DxbcCompiler::emitDclImmediateConstantBufferUbo(
|
void DxbcCompiler::emitDclImmediateConstantBufferUbo(
|
||||||
uint32_t dwordCount,
|
uint32_t dwordCount,
|
||||||
const uint32_t* dwordArray) {
|
const uint32_t* dwordArray) {
|
||||||
this->emitDclConstantBufferVar(Icb_BindingSlotId, dwordCount / 4, "icb",
|
this->emitDclConstantBufferVar(Icb_BindingSlotId, dwordCount / 4, "icb");
|
||||||
m_moduleInfo.options.dynamicIndexedConstantBufferAsSsbo);
|
|
||||||
m_immConstData.resize(dwordCount * sizeof(uint32_t));
|
m_immConstData.resize(dwordCount * sizeof(uint32_t));
|
||||||
std::memcpy(m_immConstData.data(), dwordArray, m_immConstData.size());
|
std::memcpy(m_immConstData.data(), dwordArray, m_immConstData.size());
|
||||||
}
|
}
|
||||||
|
@ -583,8 +583,7 @@ namespace dxvk {
|
|||||||
void emitDclConstantBufferVar(
|
void emitDclConstantBufferVar(
|
||||||
uint32_t regIdx,
|
uint32_t regIdx,
|
||||||
uint32_t numConstants,
|
uint32_t numConstants,
|
||||||
const char* name,
|
const char* name);
|
||||||
bool asSsbo);
|
|
||||||
|
|
||||||
void emitDclSampler(
|
void emitDclSampler(
|
||||||
const DxbcShaderInstruction& ins);
|
const DxbcShaderInstruction& ins);
|
||||||
|
@ -42,7 +42,6 @@ namespace dxvk {
|
|||||||
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
|
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
|
||||||
forceTgsmBarriers = options.forceTgsmBarriers;
|
forceTgsmBarriers = options.forceTgsmBarriers;
|
||||||
disableMsaa = options.disableMsaa;
|
disableMsaa = options.disableMsaa;
|
||||||
dynamicIndexedConstantBufferAsSsbo = options.constantBufferRangeCheck;
|
|
||||||
|
|
||||||
// Disable subgroup early discard on Nvidia because it may hurt performance
|
// Disable subgroup early discard on Nvidia because it may hurt performance
|
||||||
if (adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0))
|
if (adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0))
|
||||||
|
@ -44,10 +44,6 @@ namespace dxvk {
|
|||||||
/// Enables NaN fixup for render target outputs
|
/// Enables NaN fixup for render target outputs
|
||||||
bool enableRtOutputNanFixup = false;
|
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
|
/// Clear thread-group shared memory to zero
|
||||||
bool zeroInitWorkgroupMemory = false;
|
bool zeroInitWorkgroupMemory = false;
|
||||||
|
|
||||||
|
@ -107,18 +107,6 @@ namespace dxvk {
|
|||||||
{ R"(\\starwarsbattlefront(trial)?\.exe$)", {{
|
{ R"(\\starwarsbattlefront(trial)?\.exe$)", {{
|
||||||
{ "dxgi.nvapiHack", "False" },
|
{ "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 */
|
/* NieR Replicant */
|
||||||
{ R"(\\NieR Replicant ver\.1\.22474487139\.exe)", {{
|
{ R"(\\NieR Replicant ver\.1\.22474487139\.exe)", {{
|
||||||
{ "dxgi.syncInterval", "1" },
|
{ "dxgi.syncInterval", "1" },
|
||||||
@ -137,18 +125,6 @@ namespace dxvk {
|
|||||||
{ R"(\\h1_[ms]p64_ship\.exe$)", {{
|
{ R"(\\h1_[ms]p64_ship\.exe$)", {{
|
||||||
{ "dxgi.customVendorId", "10de" },
|
{ "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 *
|
/* Crysis 3 - slower if it notices AMD card *
|
||||||
* Apitrace mode helps massively in cpu bound *
|
* Apitrace mode helps massively in cpu bound *
|
||||||
* game parts */
|
* game parts */
|
||||||
@ -201,14 +177,6 @@ namespace dxvk {
|
|||||||
{ R"(\\F1_20(1[89]|[2-9][0-9])\.exe$)", {{
|
{ R"(\\F1_20(1[89]|[2-9][0-9])\.exe$)", {{
|
||||||
{ "d3d11.forceTgsmBarriers", "True" },
|
{ "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 *
|
/* Darksiders Warmastered - apparently reads *
|
||||||
* from write-only mapped buffers */
|
* from write-only mapped buffers */
|
||||||
{ R"(\\darksiders1\.exe$)", {{
|
{ R"(\\darksiders1\.exe$)", {{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user