swapchain: Add wlr_swapchain_has_buffer

master
Alexander Orzechowski 1 year ago
parent d3a339a03e
commit 6e03d3015e

@ -38,6 +38,12 @@ void wlr_swapchain_destroy(struct wlr_swapchain *swapchain);
*/ */
struct wlr_buffer *wlr_swapchain_acquire(struct wlr_swapchain *swapchain, struct wlr_buffer *wlr_swapchain_acquire(struct wlr_swapchain *swapchain,
int *age); int *age);
/**
* Returns true if this buffer has been created by this swapchain, and false
* otherwise.
*/
bool wlr_swapchain_has_buffer(struct wlr_swapchain *swapchain,
struct wlr_buffer *buffer);
/** /**
* Mark the buffer as submitted for presentation. This needs to be called by * Mark the buffer as submitted for presentation. This needs to be called by
* swap chain users on frame boundaries. * swap chain users on frame boundaries.

@ -113,7 +113,7 @@ struct wlr_buffer *wlr_swapchain_acquire(struct wlr_swapchain *swapchain,
return slot_acquire(swapchain, free_slot, age); return slot_acquire(swapchain, free_slot, age);
} }
static bool swapchain_has_buffer(struct wlr_swapchain *swapchain, bool wlr_swapchain_has_buffer(struct wlr_swapchain *swapchain,
struct wlr_buffer *buffer) { struct wlr_buffer *buffer) {
for (size_t i = 0; i < WLR_SWAPCHAIN_CAP; i++) { for (size_t i = 0; i < WLR_SWAPCHAIN_CAP; i++) {
struct wlr_swapchain_slot *slot = &swapchain->slots[i]; struct wlr_swapchain_slot *slot = &swapchain->slots[i];
@ -128,7 +128,7 @@ void wlr_swapchain_set_buffer_submitted(struct wlr_swapchain *swapchain,
struct wlr_buffer *buffer) { struct wlr_buffer *buffer) {
assert(buffer != NULL); assert(buffer != NULL);
if (!swapchain_has_buffer(swapchain, buffer)) { if (!wlr_swapchain_has_buffer(swapchain, buffer)) {
return; return;
} }

Loading…
Cancel
Save