Compare commits

...

3 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen abf8b4ab70 vkd3d: Add workaround to allow identifiers to be queried from library. 2 months ago
Hans-Kristian Arntzen 0dc15ad3de vkd3d: Disallow querying identifiers from COLLECTION objects. 2 months ago
Hans-Kristian Arntzen 5243796da8 vkd3d: Log how shader identifiers are queried. 2 months ago
  1. 1
      include/vkd3d.h
  2. 2
      libs/vkd3d/device.c
  3. 33
      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 }
};

@ -251,7 +251,13 @@ static void * STDMETHODCALLTYPE d3d12_state_object_properties_GetShaderIdentifie
const WCHAR *subtype = NULL;
uint32_t index;
TRACE("iface %p, export_name %p.\n", iface, export_name);
RT_TRACE("iface %p, export_name %s.\n", iface, debugstr_w(export_name));
if (object->type == D3D12_STATE_OBJECT_TYPE_COLLECTION)
{
FIXME("Cannot query identifiers from COLLECTIONs.\n");
return NULL;
}
index = d3d12_state_object_get_export_index(object, export_name, &subtype);
@ -262,9 +268,13 @@ static void * STDMETHODCALLTYPE d3d12_state_object_properties_GetShaderIdentifie
/* Need to return the parent SBT pointer if it exists */
while (export->inherited_collection_index >= 0)
{
RT_TRACE(" chaining into collection %d.\n", export->inherited_collection_index);
object = object->collections[export->inherited_collection_index];
export = &object->exports[export->inherited_collection_export_index];
}
RT_TRACE(" identifier { %016"PRIx64", %016"PRIx64", %016"PRIx64", %016"PRIx64 " }\n",
*(const uint64_t*)(export->identifier + 0), *(const uint64_t*)(export->identifier + 8),
*(const uint64_t*)(export->identifier + 16), *(const uint64_t*)(export->identifier + 24));
return export->identifier;
}
else
@ -1351,6 +1361,13 @@ static HRESULT d3d12_state_object_get_group_handles(struct d3d12_state_object *o
if (vr)
return hresult_from_vk_result(vr);
RT_TRACE("Queried export %zu, group handle %u -> { %016"PRIx64", %016"PRIx64", %016"PRIx64", %016"PRIx64" }\n",
i, group_index,
*(const uint64_t *)(data->exports[i].identifier + 0),
*(const uint64_t *)(data->exports[i].identifier + 8),
*(const uint64_t *)(data->exports[i].identifier + 16),
*(const uint64_t *)(data->exports[i].identifier + 24));
collection_export = data->exports[i].inherited_collection_export_index;
collection_index = data->exports[i].inherited_collection_index;
@ -2126,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