Streamline icon indicating copy to clipboard operation
Streamline copied to clipboard

support for vkAcquireNextImage2KHR

Open pprabhu78 opened this issue 4 months ago • 1 comments

We use vkAcquireNextImage2KHR, but it is not wrapped in streamline, so I patched the streamline source like below, but I am not sure whether it will work right based on the comment below. Please advise.

    // not sure this works correctly if the plugin hook is not using the deviceMask in pAcquireInfo. Streamline needs to support this.
    VkResult VKAPI_CALL vkAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR* pAcquireInfo, uint32_t* pImageIndex)
    {
        bool skip = false;
        VkResult result = VK_SUCCESS;
        {
            const auto& hooks = sl::plugin_manager::getInterface()->getBeforeHooks(sl::FunctionHookID::eVulkan_AcquireNextImageKHR);
            for (auto [hook, feature] : hooks)
            {
                result = ((sl::PFunVkAcquireNextImageKHRBefore*)hook)(device, pAcquireInfo->swapchain, pAcquireInfo->timeout, pAcquireInfo->semaphore, pAcquireInfo->fence, pImageIndex, skip);
                // report error on first fail
                if (result != VK_SUCCESS)
                {
                    return result;
                }
            }
        }

        if (!skip)
        {
            result = s_ddt.AcquireNextImage2KHR(device, pAcquireInfo, pImageIndex);
        }
        return result;
    }

pprabhu78 avatar Sep 05 '25 19:09 pprabhu78