vkd3d: Add VKD3D_CONFIG option to disable bindless SSBO.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
Hans-Kristian Arntzen 2020-11-18 12:00:21 +01:00
parent d947c17fc2
commit 6f8ae20015
4 changed files with 21 additions and 11 deletions

View File

@ -143,7 +143,9 @@ Some of debug variables are lists of elements. Elements must be separated by
commas or semicolons.
- `VKD3D_CONFIG` - a list of options that change the behavior of vkd3d-proton.
- vk_debug - enables Vulkan debug extensions and loads validation layer.
- `vk_debug` - enables Vulkan debug extensions and loads validation layer.
- `force_bindless_texel_buffer` - Forces use of texel buffers for bindless Raw/Structured buffers.
For game workarounds only!
- `VKD3D_DEBUG` - controls the debug level for log messages produced by
vkd3d-proton. Accepts the following values: none, err, info, fixme, warn, trace.
- `VKD3D_SHADER_DEBUG` - controls the debug level for log messages produced by

View File

@ -397,7 +397,11 @@ static void vkd3d_init_debug_messenger_callback(struct vkd3d_instance *instance)
static const struct vkd3d_debug_option vkd3d_config_options[] =
{
{"vk_debug", VKD3D_CONFIG_FLAG_VULKAN_DEBUG}, /* enable Vulkan debug extensions */
/* Enable Vulkan debug extensions. */
{"vk_debug", VKD3D_CONFIG_FLAG_VULKAN_DEBUG},
/* Never use VKD3D_BINDLESS_RAW_SSBO.
* Works around buggy games which mix typed and raw buffer types. */
{"force_bindless_texel_buffer", VKD3D_CONFIG_FLAG_FORCE_BINDLESS_TEXEL_BUFFER},
};
static uint64_t vkd3d_init_config_flags(void)

View File

@ -3523,17 +3523,20 @@ static uint32_t vkd3d_bindless_state_get_bindless_flags(struct d3d12_device *dev
device_info->descriptor_indexing_features.shaderStorageBufferArrayNonUniformIndexing)
flags |= VKD3D_BINDLESS_CBV | VKD3D_BINDLESS_CBV_AS_SSBO;
/* Normally, we would be able to use SSBOs conditionally even when maxSSBOAlignment > 4, but
* applications (RE2 being one example) are of course buggy and don't match descriptor and shader usage of resources,
* so we cannot rely on alignment analysis to select the appropriate resource type. */
if (device_info->descriptor_indexing_properties.maxPerStageDescriptorUpdateAfterBindStorageBuffers >= 1000000 &&
device_info->descriptor_indexing_features.descriptorBindingStorageBufferUpdateAfterBind &&
device_info->properties2.properties.limits.minStorageBufferOffsetAlignment <= 16)
if (!(device->vkd3d_instance->config_flags & VKD3D_CONFIG_FLAG_FORCE_BINDLESS_TEXEL_BUFFER))
{
flags |= VKD3D_BINDLESS_RAW_SSBO;
/* Normally, we would be able to use SSBOs conditionally even when maxSSBOAlignment > 4, but
* applications (RE2 being one example) are of course buggy and don't match descriptor and shader usage of resources,
* so we cannot rely on alignment analysis to select the appropriate resource type. */
if (device_info->descriptor_indexing_properties.maxPerStageDescriptorUpdateAfterBindStorageBuffers >= 1000000 &&
device_info->descriptor_indexing_features.descriptorBindingStorageBufferUpdateAfterBind &&
device_info->properties2.properties.limits.minStorageBufferOffsetAlignment <= 16)
{
flags |= VKD3D_BINDLESS_RAW_SSBO;
if (device_info->properties2.properties.limits.minStorageBufferOffsetAlignment > 4)
flags |= VKD3D_SSBO_OFFSET_BUFFER;
if (device_info->properties2.properties.limits.minStorageBufferOffsetAlignment > 4)
flags |= VKD3D_SSBO_OFFSET_BUFFER;
}
}
/* Always use a typed offset buffer. Otherwise, we risk ending up with unbounded size on view maps. */

View File

@ -155,6 +155,7 @@ struct vkd3d_vulkan_info
enum vkd3d_config_flags
{
VKD3D_CONFIG_FLAG_VULKAN_DEBUG = 0x00000001,
VKD3D_CONFIG_FLAG_FORCE_BINDLESS_TEXEL_BUFFER = 0x00000002,
};
struct vkd3d_instance