Skip to content

Fix Vulkan WSI instance extensions #2213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions framework/application/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,20 @@ GFXRECON_BEGIN_NAMESPACE(gfxrecon)
GFXRECON_BEGIN_NAMESPACE(application)

Application::Application(const std::string& name, decode::FileProcessor* file_processor) :
Application(name, std::string(), file_processor)
Application(name, file_processor, std::string(), nullptr)
{}

Application::Application(const std::string& name,
decode::FileProcessor* file_processor,
const std::string& cli_wsi_extension,
decode::FileProcessor* file_processor) :
void* platform_specific_wsi_data) :
name_(name),
file_processor_(file_processor), running_(false), paused_(false), pause_frame_(0),
cli_wsi_extension_(cli_wsi_extension), fps_info_(nullptr)
{
if (!cli_wsi_extension_.empty())
{
InitializeWsiContext(cli_wsi_extension_.c_str());
InitializeWsiContext(cli_wsi_extension_.c_str(), platform_specific_wsi_data);
}
}

Expand Down
5 changes: 4 additions & 1 deletion framework/application/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ class Application final
public:
Application(const std::string& name, decode::FileProcessor* file_processor);

Application(const std::string& name, const std::string& cli_wsi_extension, decode::FileProcessor* file_processor);
Application(const std::string& name,
decode::FileProcessor* file_processor,
const std::string& cli_wsi_extension,
void* platform_specific_wsi_data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could just initialize this here to = nullptr and remove the changes to application.cpp line 61, and the last bit of desktop_main.cpp line 156.


~Application();

Expand Down
24 changes: 20 additions & 4 deletions framework/decode/vulkan_replay_consumer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ const char kUnknownDeviceLabel[] = "<Unknown>";
const char kValidationLayerName[] = "VK_LAYER_KHRONOS_validation";

const std::unordered_set<std::string> kSurfaceExtensions = {
VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, VK_MVK_IOS_SURFACE_EXTENSION_NAME, VK_MVK_MACOS_SURFACE_EXTENSION_NAME,
VK_KHR_MIR_SURFACE_EXTENSION_NAME, VK_NN_VI_SURFACE_EXTENSION_NAME, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME,
VK_KHR_WIN32_SURFACE_EXTENSION_NAME, VK_KHR_XCB_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
VK_EXT_METAL_SURFACE_EXTENSION_NAME,
VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, VK_MVK_IOS_SURFACE_EXTENSION_NAME,
VK_MVK_MACOS_SURFACE_EXTENSION_NAME, VK_KHR_MIR_SURFACE_EXTENSION_NAME,
VK_NN_VI_SURFACE_EXTENSION_NAME, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME,
VK_KHR_WIN32_SURFACE_EXTENSION_NAME, VK_KHR_XCB_SURFACE_EXTENSION_NAME,
VK_KHR_XLIB_SURFACE_EXTENSION_NAME, VK_EXT_METAL_SURFACE_EXTENSION_NAME,
VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME,
};

// Device extensions to enable for trimming state setup, when available.
Expand Down Expand Up @@ -2693,6 +2695,20 @@ void VulkanReplayConsumerBase::ModifyCreateInstanceInfo(
}
}

// If a WSI was specified by CLI but there was none at capture time, it's possible to end up with a surface
// extension without having VK_KHR_surface. Check for that and fix that.
if (!feature_util::IsSupportedExtension(modified_extensions, VK_KHR_SURFACE_EXTENSION_NAME))
{
for (const std::string& current_extension : modified_extensions)
{
if (kSurfaceExtensions.find(current_extension) != kSurfaceExtensions.end())
{
modified_extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
break;
}
}
}

// Sanity checks depending on extension availability
std::vector<VkExtensionProperties> available_extensions;
if (feature_util::GetInstanceExtensions(instance_extension_proc, &available_extensions) == VK_SUCCESS)
Expand Down
5 changes: 2 additions & 3 deletions tools/replay/android_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ void android_main(struct android_app* app)
}
else
{
auto application =
std::make_shared<gfxrecon::application::Application>(kApplicationName, file_processor.get());
application->InitializeWsiContext(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, app);
auto application = std::make_shared<gfxrecon::application::Application>(
kApplicationName, file_processor.get(), VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, app);

gfxrecon::decode::VulkanTrackedObjectInfoTable tracked_object_info_table;
gfxrecon::decode::VulkanReplayOptions replay_options =
Expand Down
2 changes: 1 addition & 1 deletion tools/replay/desktop_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ int main(int argc, const char** argv)
// Select WSI context based on CLI
std::string wsi_extension = GetWsiExtensionName(GetWsiPlatform(arg_parser));
auto application = std::make_shared<gfxrecon::application::Application>(
kApplicationName, wsi_extension, file_processor.get());
kApplicationName, file_processor.get(), wsi_extension, nullptr);

gfxrecon::decode::VulkanTrackedObjectInfoTable tracked_object_info_table;
gfxrecon::decode::VulkanReplayOptions vulkan_replay_options =
Expand Down
Loading