SaschaWillems / vulkan.gpuinfo.org

Front-End and Back-End for the Vulkan Hardware Database
https://vulkan.gpuinfo.org
GNU Affero General Public License v3.0
23 stars 4 forks source link

linearTiling shouldn't be default Formats tab, and it's not correct for Nvidia #83

Closed alecazam closed 7 months ago

alecazam commented 7 months ago

I always click on Formats, and think nothing is supported. Can the "Optimal" tab be the first table displayed, and not "Linear". Out of all of our render targets, we have only 1 that uses linearTiling.

Also Nvidia can't mix linear and optimal tiling textures, but if VK_NV_linear_color_attachment is present, and enabled, then the 64-bit flags indicate whether a format supports linearTiling. So the Formats table could reflect this info, so I could tell if RGBA8 or BGRA8 or both are supported across cards.

https://github.com/KhronosGroup/Vulkan-Docs/issues/1779

pdaniell-nv commented 7 months ago

if VK_NV_linear_color_attachment is present, and enabled

For the purposes of querying the physical device properties, the VK_NV_linear_color_attachment device extension or feature is enabled on the device, so not needed when querying VkFormatProperties3.linearTilingFeatures has VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV set.

alecazam commented 7 months ago

Not sure I understand that comment. This extension really breaks working with the Vulkan spec. And there's no sample code of how to incorporate this into Vulkan code. Right now I'm getting Nvidia failing on RGBA8 linearTiling on older drivers, and not newer drivers. So I wanted to see which formats supported linearTiling with the extension enabled.

Our code is something like this. The feature check is basically if the extension is enabled. But looking at the extension, it says something like this flag needs to be set onto the view as well. I'm going to just have to gut all our linearTiling support because of this complexity. It's only used for screenshots/videos.


err = vkGetPhysicalDeviceImageFormatProperties(...)

bool isColorAttachment = !!( desiredFeatures & (uint32_t)VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT );
bool isComputeImage = !!( desiredFeatures & (uint32_t)VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT );
if ( isColorAttachment && !optimalTiling && !isComputeImage )
{
    if ( isNvidia )
    {
        bool isValid = isFeatures3Supported && g_renderer->IsGfxFeatureSupported( kGfxFeature_LinearRenderTargets ) && 
                     ( ( formatFeatures3.linearTilingFeatures & VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV ) != 0 );

        // This can only be used if the above is true
        if ( !isValid )
        {
            return false;
        }
        else
        {
            features |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT;
        }
    }
}
SaschaWillems commented 7 months ago

See #43

alecazam commented 5 months ago

This isn't working right. When you first jump to the formats with the link below, despite being on the "optimal" tiling tab, the format caps displayed are for linear. Only after you pick linear tab, and then pick the optimal tab are the correct caps displayed. The UI is still displaying linear for optimal at first, and that's going to throw off a lot of people.

This was an S22 I was researching, that only has BC1-BC3 support, but it shows only TRANSFER_SRC/DST, but if you click on optimal, it has sampling and other checks that are valid.

https://vulkan.gpuinfo.org/displayreport.php?id=25872#formats

SaschaWillems commented 5 months ago

Please try I again. I corrected the order, but forgot to change the tab active by default.

alecazam commented 5 months ago

That worked. Thanks!