aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/render/interface.h2
-rw-r--r--include/wlr/render/wlr_texture.h2
-rw-r--r--render/gles2/texture.c3
-rw-r--r--render/pixman/renderer.c4
-rw-r--r--render/vulkan/texture.c3
-rw-r--r--render/wlr_renderer.c1
-rw-r--r--render/wlr_texture.c5
7 files changed, 14 insertions, 6 deletions
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index a8ed5825..07b26fbc 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -59,7 +59,7 @@ struct wlr_texture_impl {
void (*destroy)(struct wlr_texture *texture);
};
-void wlr_texture_init(struct wlr_texture *texture,
+void wlr_texture_init(struct wlr_texture *texture, struct wlr_renderer *rendener,
const struct wlr_texture_impl *impl, uint32_t width, uint32_t height);
#endif
diff --git a/include/wlr/render/wlr_texture.h b/include/wlr/render/wlr_texture.h
index 8d401518..87ed993f 100644
--- a/include/wlr/render/wlr_texture.h
+++ b/include/wlr/render/wlr_texture.h
@@ -21,6 +21,8 @@ struct wlr_texture_impl;
struct wlr_texture {
const struct wlr_texture_impl *impl;
uint32_t width, height;
+
+ struct wlr_renderer *renderer;
};
/**
diff --git a/render/gles2/texture.c b/render/gles2/texture.c
index 9dccc526..63360d48 100644
--- a/render/gles2/texture.c
+++ b/render/gles2/texture.c
@@ -174,7 +174,8 @@ static struct wlr_gles2_texture *gles2_texture_create(
wlr_log_errno(WLR_ERROR, "Allocation failed");
return NULL;
}
- wlr_texture_init(&texture->wlr_texture, &texture_impl, width, height);
+ wlr_texture_init(&texture->wlr_texture, &renderer->wlr_renderer,
+ &texture_impl, width, height);
texture->renderer = renderer;
wl_list_insert(&renderer->textures, &texture->link);
return texture;
diff --git a/render/pixman/renderer.c b/render/pixman/renderer.c
index b58ee1b4..490d99a8 100644
--- a/render/pixman/renderer.c
+++ b/render/pixman/renderer.c
@@ -354,8 +354,8 @@ static struct wlr_pixman_texture *pixman_texture_create(
return NULL;
}
- wlr_texture_init(&texture->wlr_texture, &texture_impl, width, height);
- texture->renderer = renderer;
+ wlr_texture_init(&texture->wlr_texture, &renderer->wlr_renderer,
+ &texture_impl, width, height);
texture->format_info = drm_get_pixel_format_info(drm_format);
if (!texture->format_info) {
diff --git a/render/vulkan/texture.c b/render/vulkan/texture.c
index d1431556..b03cec4a 100644
--- a/render/vulkan/texture.c
+++ b/render/vulkan/texture.c
@@ -252,7 +252,8 @@ static struct wlr_vk_texture *vulkan_texture_create(
wlr_log_errno(WLR_ERROR, "Allocation failed");
return NULL;
}
- wlr_texture_init(&texture->wlr_texture, &texture_impl, width, height);
+ wlr_texture_init(&texture->wlr_texture, &renderer->wlr_renderer,
+ &texture_impl, width, height);
texture->renderer = renderer;
wl_list_insert(&renderer->textures, &texture->link);
return texture;
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index f01c9345..88a48bb1 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -153,6 +153,7 @@ bool wlr_render_subtexture_with_matrix(struct wlr_renderer *r,
struct wlr_texture *texture, const struct wlr_fbox *box,
const float matrix[static 9], float alpha) {
assert(r->rendering);
+ assert(texture->renderer == r);
return r->impl->render_subtexture_with_matrix(r, texture,
box, matrix, alpha);
}
diff --git a/render/wlr_texture.c b/render/wlr_texture.c
index 8be2e811..e327bb5c 100644
--- a/render/wlr_texture.c
+++ b/render/wlr_texture.c
@@ -6,9 +6,12 @@
#include <wlr/render/wlr_texture.h>
#include "types/wlr_buffer.h"
-void wlr_texture_init(struct wlr_texture *texture,
+void wlr_texture_init(struct wlr_texture *texture, struct wlr_renderer *renderer,
const struct wlr_texture_impl *impl, uint32_t width, uint32_t height) {
+ assert(renderer);
+
memset(texture, 0, sizeof(*texture));
+ texture->renderer = renderer;
texture->impl = impl;
texture->width = width;
texture->height = height;