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>
Hans-Kristian Arntzen 2 months ago
parent 0dc15ad3de
commit abf8b4ab70
  1. 1
      include/vkd3d.h
  2. 2
      libs/vkd3d/device.c
  3. 14
      libs/vkd3d/raytracing_pipeline.c

@ -90,6 +90,7 @@ enum vkd3d_config_flags
VKD3D_CONFIG_FLAG_BREADCRUMBS = 0x04000000,
VKD3D_CONFIG_FLAG_PIPELINE_LIBRARY_APP_CACHE_ONLY = 0x08000000,
VKD3D_CONFIG_FLAG_SHADER_CACHE_SYNC = 0x10000000,
VKD3D_CONFIG_FLAG_ALLOW_SBT_COLLECTION = 0x20000000,
};
typedef HRESULT (*PFN_vkd3d_signal_event)(HANDLE event);

@ -509,6 +509,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 }
};

@ -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…
Cancel
Save