Skip to content

Commit

Permalink
WSI: prefetcher: fix issue w/ attempting to prefetch xcb stuff for pu…
Browse files Browse the repository at this point in the history
…re wayland surfaces
  • Loading branch information
sharkautarch committed Jun 19, 2024
1 parent b80fa9b commit a11a9e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion layer/VkLayer_FROG_gamescope_wsi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ namespace GamescopeWSILayer {
continue;
}

xcb::Prefetcher prefetcher(gamescopeSurface->connection, gamescopeSurface->window);
auto prefetcher = xcb::Prefetcher::GetPrefetcherIf(!gamescopeSurface->isWayland(), gamescopeSurface->connection, gamescopeSurface->window);
const bool canBypass = gamescopeSurface->canBypassXWayland();
if (canBypass != gamescopeSwapchain->isBypassingXWayland)
UpdateSwapchainResult(canBypass ? VK_SUBOPTIMAL_KHR : VK_ERROR_OUT_OF_DATE_KHR);
Expand Down
7 changes: 7 additions & 0 deletions layer/xcb_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ namespace xcb {

//Note: this class is currently only meant to be used within GamescopeWSILayer::VkDeviceOverrides::QueuePresentKHR:
struct Prefetcher {
static std::optional<Prefetcher> GetPrefetcherIf(bool bCond, xcb_connection_t* connection, const xcb_window_t window) {
if (bCond)
return std::optional<Prefetcher>(std::in_place_t{}, connection, window);

return std::nullopt;
}

explicit Prefetcher(xcb_connection_t* connection, const xcb_window_t window) {
g_cache = {
.window = window,
Expand Down

0 comments on commit a11a9e9

Please sign in to comment.