Commit 4df9ef73 authored by Niklas Haas's avatar Niklas Haas

swapchain: require swapchain FBOs be blittable

So users can actually pl_tex_clear them, which is a pretty important
operation
parent 4befda55
......@@ -50,8 +50,9 @@ int pl_swapchain_latency(const struct pl_swapchain *sw);
// The struct used to hold the results of `pl_swapchain_start_frame`
struct pl_swapchain_frame {
// A texture representing the framebuffer users should use for rendering.
// It's guaranteed that `fbo->params.renderable` will be true, but no other
// guarantees are made - not even that `fbo->params.format` is a real format.
// It's guaranteed that `fbo->params.renderable` and `fbo->params.blit_dst`
// will be true, but no other guarantees are made - not even that
// `fbo->params.format` is a real format.
const struct pl_tex *fbo;
// If true, the user should assume that this framebuffer will be flipped
......
......@@ -88,14 +88,19 @@ static bool pick_surf_format(const struct pl_gpu *gpu, const struct vk_ctx *vk,
default: continue;
}
// Make sure we can wrap this format to a meaningful, renderable pl_format
// Make sure we can wrap this format to a meaningful, valid pl_format
for (int n = 0; n < gpu->num_formats; n++) {
const struct pl_fmt *rafmt = gpu->formats[n];
const struct vk_format *vkfmt = rafmt->priv;
if (vkfmt->ifmt != formats[i].format)
continue;
if (!(rafmt->caps & PL_FMT_CAP_RENDERABLE))
enum pl_fmt_caps render_caps = 0;
render_caps |= PL_FMT_CAP_RENDERABLE;
render_caps |= PL_FMT_CAP_BLITTABLE;
if ((rafmt->caps & render_caps) != render_caps)
continue;
// format valid, use it
*out_format = formats[i];
talloc_free(formats);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment