protonscr

d3d12_device_determine_tiled_resources_tier bug?

vkd3dclosed
HansKristian-Work/vkd3d-proton#1455 · opened 2023-03-07 by christophe-lunarg · updated 2023-03-09 · 4 comments · github
Cchristophe-lunarg 2023-03-07 github

Hi,

I noticed an inconsistent pattern which makes me unused about the correctness of the code:
sparse_properties->residencyAlignedMipSize is used without ! before, is this expect?

If residencyAlignedMipSize is used suposed to be supported for D3D12_TILED_RESOURCES_TIER_1 I would expect it to be in the first if block.

static D3D12_TILED_RESOURCES_TIER d3d12_device_determine_tiled_resources_tier(struct d3d12_device *device)
{
    const VkPhysicalDeviceSparseProperties *sparse_properties = &device->device_info.properties2.properties.sparseProperties;
    const VkPhysicalDeviceFeatures *features = &device->device_info.features2.features;

    if (!features->sparseBinding || !features->sparseResidencyAliased ||
            !features->sparseResidencyBuffer || !features->sparseResidencyImage2D ||
            !sparse_properties->residencyStandard2DBlockShape ||
            !device->queue_families[VKD3D_QUEUE_FAMILY_SPARSE_BINDING] ||
            !device->queue_families[VKD3D_QUEUE_FAMILY_SPARSE_BINDING]->queue_count)
        return D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED;

    if (!features->shaderResourceResidency || !features->shaderResourceMinLod ||
            sparse_properties->residencyAlignedMipSize ||
            !sparse_properties->residencyNonResidentStrict ||
            !device->device_info.vulkan_1_2_properties.filterMinmaxSingleComponentFormats)
        return D3D12_TILED_RESOURCES_TIER_1;

    if (!features->sparseResidencyImage3D ||
            !sparse_properties->residencyStandard3DBlockShape)
        return D3D12_TILED_RESOURCES_TIER_2;

    return D3D12_TILED_RESOURCES_TIER_3;
}

Thanks,
Christophe

HHansKristian-Work maintainer 2023-03-07 github

Ping @doitsujin

HHansKristian-Work maintainer 2023-03-07 github

I think sparse_properties->residencyAlignedMipSize is the correct check. If that property is true, it means:

residencyAlignedMipSize is VK_TRUE if images with mip level dimensions that are not integer multiples of the corresponding dimensions of the sparse image block may be placed in the mip tail.

So setting to false is a stricter thing for devices to support, so I think the check is correct.

Ddoitsujin maintainer 2023-03-09 github

Yes, residencyAlignedMipSize is an anti-feature since it restricts the number of tiled mip levels. Tier 2 requires it to be false.

Cchristophe-lunarg 2023-03-09 github

Ok, thanks!

Launch options