protonscr

CreateRootSignature from DXIL container

vkd3dclosed
HansKristian-Work/vkd3d-proton#1566 · opened 2023-05-22 by Flakebi · updated 2023-06-05 · 6 comments · github
FFlakebi 2023-05-22 github

CreateRootSignature can be used to extract a root signature that is specified in HLSL.
The root signature is compiled into dxil and can be used by handing the compiled dxil container to CreateRootSignature.

There was discussion around that here: https://github.com/microsoft/DirectXShaderCompiler/issues/2315

Trying this currently fails, my guess is this is not implemented in vkd3d as it’s probably uncommon among games.

Software information

A small, (currently) closed-source test program.
I’m running with VKD3D_DEBUG=trace VKD3D_CONFIG=vk_debug,dxr.

System information

  • GPU: AMD RX 7900 XTX
  • Driver: amdvlk 2023.Q2.1
  • Wine version: Wine Wow 8.0
  • VKD3D-Proton version: 2.9

Log files

115.855:01a4:01a8:info:vkd3d-proton:d3d12_device_determine_ray_tracing_tier: DXR support enabled.
115.855:01a4:01a8:info:vkd3d-proton:d3d12_device_supports_rtas_formats: Vulkan format 77 is not supported for RTAS VBO.
115.855:01a4:01a8:info:vkd3d-proton:vkd3d_pipeline_library_init_disk_cache: Remapping VKD3D_SHADER_CACHE to: vkd3d-proton.cache.
115.855:01a4:01a8:info:vkd3d-proton:vkd3d_pipeline_library_init_disk_cache: Attempting to load disk cache from: vkd3d-proton.cache.
115.871:01a4:01a8:warn:vkd3d-proton:vkd3d_create_timeline_semaphore: D3D12-Fence shared timeline semaphores not supported by host.
115.871:01a4:01a8:fixme:vkd3d-proton:d3d12_device_CreateFence: Shared fences not supported by Vulkan host, returning regular fence.
115.871:01a4:01a8:fixme:vkd3d-proton:d3d12_fence_init: Ignoring flags 0x1.
115.871:01a4:01b8:info:vkd3d-proton:vkd3d_pipeline_library_disk_thread_main: Performing async setup of stream archive ...
115.871:01a4:01b8:info:vkd3d-proton:vkd3d_pipeline_library_disk_cache_merge: No write cache exists. No need to merge any disk caches.
115.871:01a4:01b8:info:vkd3d-proton:vkd3d_pipeline_library_disk_cache_initial_setup: Merging pipeline libraries took 0.260 ms.
115.872:01a4:01b8:info:vkd3d-proton:vkd3d_pipeline_library_disk_cache_initial_setup: Mapping read-only cache took 0.260 ms.
115.872:01a4:01b8:info:vkd3d-proton:vkd3d_pipeline_library_disk_cache_initial_setup: Parsing stream archive took 0.116 ms.
115.872:01a4:01b8:info:vkd3d-proton:vkd3d_pipeline_library_disk_cache_initial_setup: Cannot load existing on-disk cache due to driver version mismatch.
115.872:01a4:01b8:info:vkd3d-proton:vkd3d_pipeline_library_disk_thread_main: Done performing async setup of stream archive.
115.971:01a4:01a8:warn:vkd3d-proton:vkd3d_parse_root_signature_for_version: Failed to parse root signature, vkd3d result -1.
115.971:01a4:01a8:warn:vkd3d-proton:d3d12_root_signature_create_from_blob: Failed to parse root signature, vkd3d result -1.
KK0bin 2023-05-22 github

Can you upload the problematic shaders? (the DXIL code)

FFlakebi 2023-05-22 github

Shader

// Compile with dxc -T lib_6_4 -Fo DxilRootSig.dxil

ByteAddressBuffer inbuf : register(t0);
RWByteAddressBuffer outbuf : register(u0);


[shader("raygeneration")]
void RayGen()
{
  uint offset = DispatchRaysIndex().x * 4;
  float loaded = inbuf.Load<float>(offset);
  outbuf.Store<float>(offset, loaded + 0.1);
}

// The root signature can be extracted from the dxil binary with CreateRootSignature
GlobalRootSignature root =
{
    "DescriptorTable(UAV(u0)),"  // Output
    "DescriptorTable(SRV(t0))"   // Input
};

RaytracingShaderConfig ShaderConfig =
{
    16, // max payload size
    8   // max attribute size
};

SubobjectToExportsAssociation association = {"ShaderConfig","RayGen"};

RaytracingPipelineConfig PipelineConfig =
{
    1  // Max recursion depth
};

DXIL (renamed to .txt so that GitHub accepts it): DxilRootSig.dxil

HHansKristian-Work maintainer 2023-05-22 github

Is this actually supposed to work? We support RTS0 section CreateRootSignature [RootSignature()] method, but not creating a root signature from DXIL internal state object.

FFlakebi 2023-05-22 github

Is this actually supposed to work?

I can’t say much about it other than that it works fine on every windows system I tested on (about 4) and that nobody screamed when it was mentioned as the way to go on the dxc issue linked above :)

HHansKristian-Work maintainer 2023-05-22 github

:crying_cat_face:

FFlakebi 2023-06-05 github

Thank you! It’s working as on Windows now

Launch options