Keep image on vram if at all possible with wlroots based compositors

This commit is contained in:
Loki
2021-08-26 22:06:59 +02:00
parent ec184fb2ab
commit b59df48dde
8 changed files with 280 additions and 121 deletions

View File

@@ -50,6 +50,17 @@ public:
static frame_buf_t make(std::size_t count);
inline void bind(std::nullptr_t, std::nullptr_t) {
int x = 0;
for(auto fb : (*this)) {
ctx.BindFramebuffer(GL_FRAMEBUFFER, fb);
ctx.FramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + x, 0, 0);
++x;
}
return;
}
template<class It>
void bind(It it_begin, It it_end) {
using namespace std::literals;
@@ -230,6 +241,22 @@ public:
std::vector<std::uint8_t> buffer;
};
// Allow cursor and the underlying image to be kept together
class img_descriptor_t : public cursor_t {
public:
std::uint32_t format;
std::uint32_t img_width, img_height;
std::uint32_t obj_count;
std::uint32_t strides[4];
// std::uint32_t sizes[4];
std::int32_t fds[4];
std::uint32_t offsets[4];
// std::uint32_t plane_indices[4];
// Increment sequence when new rgb_t needs to be created
std::uint64_t sequence;
};
class sws_t {
public:
static std::optional<sws_t> make(int in_width, int in_height, int out_width, int out_heigth, gl::tex_t &&tex);