summaryrefslogtreecommitdiff
path: root/sway/desktop/fx_renderer/fx_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/desktop/fx_renderer/fx_texture.c')
-rw-r--r--sway/desktop/fx_renderer/fx_texture.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sway/desktop/fx_renderer/fx_texture.c b/sway/desktop/fx_renderer/fx_texture.c
index 60aa9a26..cc5d14c8 100644
--- a/sway/desktop/fx_renderer/fx_texture.c
+++ b/sway/desktop/fx_renderer/fx_texture.c
@@ -3,7 +3,16 @@
#include "sway/desktop/fx_renderer/fx_texture.h"
-struct fx_texture fx_texture_from_wlr_texture(struct wlr_texture* texture) {
+struct fx_texture fx_texture_create() {
+ return (struct fx_texture) {
+ .id = 0,
+ .target = 0,
+ .width = -1,
+ .height = -1,
+ };
+}
+
+struct fx_texture fx_texture_from_wlr_texture(struct wlr_texture *texture) {
assert(wlr_texture_is_gles2(texture));
struct wlr_gles2_texture_attribs texture_attrs;
@@ -17,3 +26,12 @@ struct fx_texture fx_texture_from_wlr_texture(struct wlr_texture* texture) {
.height = texture->height,
};
}
+
+void fx_texture_release(struct fx_texture *texture) {
+ if (texture->id) {
+ glDeleteTextures(1, &texture->id);
+ }
+ texture->id = 0;
+ texture->width = -1;
+ texture->height = -1;
+}