include: Document other vkd3d.h structures.
I'm not sure everything I wrote here is correct, especially about vkd3d_image_resource_create_info
.
Merge request reports
Activity
+/** + * When specified as a flag of vkd3d_image_resource_create_info, it means that each time the + * resource is transitioned into the D3D12_RESOURCE_STATE_COMMON state, this is interpreted instead + * as the state specified by present_state in vkd3d_image_resource_create_info. + */ #define VKD3D_RESOURCE_PRESENT_STATE_TRANSITION 0x00000002
I think that's more of a description of the implementation than a description of the interface. In terms of the interface, VKD3D_RESOURCE_PRESENT_STATE_TRANSITION simply means that the "present_state" field is valid / not ignored.
The background is that d3d12 doesn't distinguish D3D12_RESOURCE_STATE_COMMON and D3D12_RESOURCE_STATE_PRESENT, to the point that these have the same enumeration value. Vulkan however does have a separate VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
In terms of behaviour, we end up with three distinct cases:
- VKD3D_RESOURCE_PRESENT_STATE_TRANSITION isn't set. The resource is assumed to be a regular resource, and D3D12_RESOURCE_STATE_COMMON/_PRESENT maps to VK_IMAGE_LAYOUT_GENERAL.
- VKD3D_RESOURCE_PRESENT_STATE_TRANSITION is set, and "present_state" is D3D12_RESOURCE_STATE_PRESENT/_COMMON. The resource is assumed to be a swapchain image, and D3D12_RESOURCE_STATE_COMMON/_PRESENT maps to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
- VKD3D_RESOURCE_PRESENT_STATE_TRANSITION is set, and "present_state" is some other state, like D3D12_RESOURCE_STATE_COPY_SOURCE. The resource is assumed to be a swapchain image, and D3D12_RESOURCE_STATE_COMMON/_PRESENT maps to the equivalent of "present_state". In the case of D3D12_RESOURCE_STATE_COPY_SOURCE that would be VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL.
The third case is mainly useful for use-cases where the d3d12 code is oblivious to the fact that it's running on top of vkd3d. For example, in the case of Wine, the code invoking the resource transition would be application code, outside of Wine's control.
I think that's more of a description of the implementation than a description of the interface. In terms of the interface, VKD3D_RESOURCE_PRESENT_STATE_TRANSITION simply means that the "present_state" field is valid / not ignored.
Thanks for the explanation, it makes a lot more sense now. Hopefully I put it reasonably well in the latest revision. I also took the liberty to fix a little control flow in
vk_barrier_parameters_from_d3d12_resource_state()
, since I wasn't aware thatCOMMON
andPRESENT
were the same thing, and this code gadget was quite misleading:if (present_state == PRESENT) ... else if (present_state != COMMON) ...
added 4 commits
Toggle commit listadded 1 commit
- a008bc0b - include: Document structure vkd3d_image_resource_create_info.
added 72 commits
-
a008bc0b...95489899 - 68 commits from branch
wine:master
- 5d78eeb6 - vkd3d: Simplify control flow for swapchain images.
- 2b1abc5d - include: Document structure vkd3d_device_create_info.
- 2679b10f - include: Document structure vkd3d_optional_device_extensions_info.
- 3f43d06f - include: Document structure vkd3d_image_resource_create_info.
Toggle commit list-
a008bc0b...95489899 - 68 commits from branch