diff options
author | Alexander Orzechowski <alex@ozal.ski> | 2022-12-01 04:41:43 -0500 |
---|---|---|
committer | Alexander Orzechowski <alex@ozal.ski> | 2022-12-01 04:41:43 -0500 |
commit | db0e962368244c3171a8f93466eda231dccf2bc7 (patch) | |
tree | 8ccc4ad097ce3ad4afa58ae5290c4bc2859caec3 /render | |
parent | f103dc74d89c88a8e1865ce47843906b0aaa8380 (diff) |
wlr_texture: Expose owning renderer
Diffstat (limited to 'render')
-rw-r--r-- | render/gles2/texture.c | 3 | ||||
-rw-r--r-- | render/pixman/renderer.c | 4 | ||||
-rw-r--r-- | render/vulkan/texture.c | 3 | ||||
-rw-r--r-- | render/wlr_renderer.c | 1 | ||||
-rw-r--r-- | render/wlr_texture.c | 5 |
5 files changed, 11 insertions, 5 deletions
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; |