vkd3d: Add workaround to allow identifiers to be queried from library.
CP77 relies on this to work somehow ... The DXR spec seems to suggest this is allowed, but there is no direct concept for this in Vulkan. This seems to work on NVIDIA at least, but we're on very shaky ground here ... Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
d333159c86
commit
7f5dbcfc40
|
@ -89,6 +89,7 @@ extern "C" {
|
|||
#define VKD3D_CONFIG_FLAG_SHADER_CACHE_SYNC (1ull << 27)
|
||||
#define VKD3D_CONFIG_FLAG_FORCE_RAW_VA_CBV (1ull << 28)
|
||||
#define VKD3D_CONFIG_FLAG_ZERO_MEMORY_WORKAROUNDS_COMMITTED_BUFFER_UAV (1ull << 29)
|
||||
#define VKD3D_CONFIG_FLAG_ALLOW_SBT_COLLECTION (1ull << 30)
|
||||
|
||||
typedef HRESULT (*PFN_vkd3d_signal_event)(HANDLE event);
|
||||
|
||||
|
|
|
@ -518,6 +518,8 @@ static const struct vkd3d_instance_application_meta application_override[] = {
|
|||
/* Serious Sam 4 (257420).
|
||||
* Invariant workarounds cause graphical glitches when rendering foliage on NV. */
|
||||
{ VKD3D_STRING_COMPARE_EXACT, "Sam4.exe", VKD3D_CONFIG_FLAG_FORCE_NO_INVARIANT_POSITION, 0 },
|
||||
/* Cyberpunk 2077 (1091500). */
|
||||
{ VKD3D_STRING_COMPARE_EXACT, "Cyberpunk2077.exe", VKD3D_CONFIG_FLAG_ALLOW_SBT_COLLECTION, 0 },
|
||||
{ VKD3D_STRING_COMPARE_NEVER, NULL, 0, 0 }
|
||||
};
|
||||
|
||||
|
@ -664,6 +666,7 @@ static const struct vkd3d_debug_option vkd3d_config_options[] =
|
|||
{"pipeline_library_app_cache", VKD3D_CONFIG_FLAG_PIPELINE_LIBRARY_APP_CACHE_ONLY},
|
||||
{"shader_cache_sync", VKD3D_CONFIG_FLAG_SHADER_CACHE_SYNC},
|
||||
{"force_raw_va_cbv", VKD3D_CONFIG_FLAG_FORCE_RAW_VA_CBV},
|
||||
{"allow_sbt_collection", VKD3D_CONFIG_FLAG_ALLOW_SBT_COLLECTION},
|
||||
};
|
||||
|
||||
static void vkd3d_config_flags_init_once(void)
|
||||
|
|
|
@ -2143,6 +2143,20 @@ static HRESULT d3d12_state_object_init(struct d3d12_state_object *object,
|
|||
object->internal_refcount = 1;
|
||||
object->device = device;
|
||||
object->type = desc->Type;
|
||||
|
||||
if (object->type == D3D12_STATE_OBJECT_TYPE_COLLECTION &&
|
||||
(vkd3d_config_flags & VKD3D_CONFIG_FLAG_ALLOW_SBT_COLLECTION))
|
||||
{
|
||||
/* It seems to be valid to query shader identifiers from a COLLECTION which is pure insanity.
|
||||
* We can fake this behavior if we pretend we have ALLOW_STATE_OBJECT_ADDITIONS and RTPSO.
|
||||
* We will validate that the "COLLECTION" matches the consuming RTPSO.
|
||||
* If the collection does not contain an RGEN shader, we're technically out of spec here,
|
||||
* but there is nothing we can do for now without further spec improvements. */
|
||||
INFO("Promoting COLLECTION to RAYTRACING_PIPELINE as workaround.\n");
|
||||
object->type = D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE;
|
||||
object->flags |= D3D12_STATE_OBJECT_FLAG_ALLOW_STATE_OBJECT_ADDITIONS;
|
||||
}
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
|
||||
if (FAILED(hr = d3d12_state_object_parse_subobjects(object, desc, parent, &data)))
|
||||
|
|
Loading…
Reference in New Issue