aboutsummaryrefslogtreecommitdiff
path: root/src/render_helpers
diff options
context:
space:
mode:
authorChristian Meissl <meissl.christian@gmail.com>2025-04-17 13:54:17 +0200
committerIvan Molodetskikh <yalterz@gmail.com>2025-04-29 08:53:25 +0300
commitcb857e32e4295822fad39ebf5d9c650f6ead95aa (patch)
tree5fcc0ee71276dcde1ab70ec1521a8dbe0d8dab70 /src/render_helpers
parent199be26947a7aea9c8a36d05d6c49978a3880da2 (diff)
downloadniri-cb857e32e4295822fad39ebf5d9c650f6ead95aa.tar.gz
niri-cb857e32e4295822fad39ebf5d9c650f6ead95aa.tar.bz2
niri-cb857e32e4295822fad39ebf5d9c650f6ead95aa.zip
Bump Smithay and others
Presentation subsurface fix, popup unconstrain resize fix, cursor shape fix, refactors.
Diffstat (limited to 'src/render_helpers')
-rw-r--r--src/render_helpers/offscreen.rs18
-rw-r--r--src/render_helpers/surface.rs2
-rw-r--r--src/render_helpers/texture.rs16
3 files changed, 18 insertions, 18 deletions
diff --git a/src/render_helpers/offscreen.rs b/src/render_helpers/offscreen.rs
index 71959404..7798a481 100644
--- a/src/render_helpers/offscreen.rs
+++ b/src/render_helpers/offscreen.rs
@@ -13,7 +13,7 @@ use smithay::backend::renderer::utils::{
CommitCounter, DamageBag, DamageSet, DamageSnapshot, OpaqueRegions,
};
use smithay::backend::renderer::{
- Bind as _, Color32F, Frame as _, Offscreen as _, Renderer, Texture as _,
+ Bind as _, Color32F, ContextId, Frame as _, Offscreen as _, Renderer, Texture as _,
};
use smithay::utils::{Buffer, Logical, Physical, Point, Rectangle, Scale, Size, Transform};
@@ -36,8 +36,8 @@ pub struct OffscreenBuffer {
struct Inner {
/// The texture with offscreened contents.
texture: GlesTexture,
- /// Id of the renderer that the texture comes from.
- renderer_id: usize,
+ /// Id of the renderer context that the texture comes from.
+ renderer_context_id: ContextId<GlesTexture>,
/// Scale of the texture.
scale: Scale<f64>,
/// Damage tracker for drawing to the texture.
@@ -50,7 +50,7 @@ struct Inner {
pub struct OffscreenRenderElement {
id: Id,
texture: GlesTexture,
- renderer_id: usize,
+ renderer_context_id: ContextId<GlesTexture>,
scale: Scale<f64>,
damage: DamageSnapshot<i32, Buffer>,
offset: Point<f64, Logical>,
@@ -92,7 +92,7 @@ impl OffscreenBuffer {
let mut reason = "";
if let Some(Inner {
texture,
- renderer_id,
+ renderer_context_id,
..
}) = inner.as_mut()
{
@@ -109,7 +109,7 @@ impl OffscreenBuffer {
reason = "not unique";
*inner = None;
- } else if *renderer_id != renderer.id() {
+ } else if *renderer_context_id != renderer.context_id() {
reason = "renderer id changed";
*inner = None;
@@ -134,7 +134,7 @@ impl OffscreenBuffer {
inner.insert(Inner {
texture,
- renderer_id: renderer.id(),
+ renderer_context_id: renderer.context_id(),
scale,
damage,
outer_damage: DamageBag::default(),
@@ -180,7 +180,7 @@ impl OffscreenBuffer {
let elem = OffscreenRenderElement {
id: self.id.clone(),
texture: inner.texture.clone(),
- renderer_id: inner.renderer_id,
+ renderer_context_id: inner.renderer_context_id.clone(),
scale,
damage: inner.outer_damage.snapshot(),
offset,
@@ -305,7 +305,7 @@ impl RenderElement<GlesRenderer> for OffscreenRenderElement {
damage: &[Rectangle<i32, Physical>],
opaque_regions: &[Rectangle<i32, Physical>],
) -> Result<(), GlesError> {
- if frame.id() != self.renderer_id {
+ if frame.context_id() != self.renderer_context_id {
warn!("trying to render texture from different renderer");
return Ok(());
}
diff --git a/src/render_helpers/surface.rs b/src/render_helpers/surface.rs
index 96065923..d4722c17 100644
--- a/src/render_helpers/surface.rs
+++ b/src/render_helpers/surface.rs
@@ -53,7 +53,7 @@ pub fn render_snapshot_from_surface_tree(
}
let data = data.lock().unwrap();
- let Some(texture) = data.texture::<GlesRenderer>(renderer.id()) else {
+ let Some(texture) = data.texture(renderer.context_id()) else {
return;
};
diff --git a/src/render_helpers/texture.rs b/src/render_helpers/texture.rs
index 2967c361..7fcd4356 100644
--- a/src/render_helpers/texture.rs
+++ b/src/render_helpers/texture.rs
@@ -2,17 +2,17 @@ use smithay::backend::allocator::Fourcc;
use smithay::backend::renderer::element::{Element, Id, Kind, RenderElement, UnderlyingStorage};
use smithay::backend::renderer::gles::GlesTexture;
use smithay::backend::renderer::utils::{CommitCounter, OpaqueRegions};
-use smithay::backend::renderer::{Frame as _, ImportMem, Renderer, Texture};
+use smithay::backend::renderer::{ContextId, Frame as _, ImportMem, Renderer, Texture};
use smithay::utils::{Buffer, Logical, Physical, Point, Rectangle, Scale, Size, Transform};
use super::memory::MemoryBuffer;
/// Smithay's texture buffer, but with fractional scale.
#[derive(Debug, Clone)]
-pub struct TextureBuffer<T> {
+pub struct TextureBuffer<T: Texture> {
id: Id,
commit_counter: CommitCounter,
- renderer_id: usize,
+ renderer_context_id: ContextId<T>,
texture: T,
scale: Scale<f64>,
transform: Transform,
@@ -21,7 +21,7 @@ pub struct TextureBuffer<T> {
/// Render element for a [`TextureBuffer`].
#[derive(Debug, Clone)]
-pub struct TextureRenderElement<T> {
+pub struct TextureRenderElement<T: Texture> {
buffer: TextureBuffer<T>,
location: Point<f64, Logical>,
alpha: f32,
@@ -30,7 +30,7 @@ pub struct TextureRenderElement<T> {
kind: Kind,
}
-impl<T> TextureBuffer<T> {
+impl<T: Texture> TextureBuffer<T> {
pub fn from_texture<R: Renderer<TextureId = T>>(
renderer: &R,
texture: T,
@@ -41,7 +41,7 @@ impl<T> TextureBuffer<T> {
TextureBuffer {
id: Id::new(),
commit_counter: CommitCounter::default(),
- renderer_id: renderer.id(),
+ renderer_context_id: renderer.context_id(),
texture,
scale: scale.into(),
transform,
@@ -122,7 +122,7 @@ impl TextureBuffer<GlesTexture> {
}
}
-impl<T> TextureRenderElement<T> {
+impl<T: Texture> TextureRenderElement<T> {
pub fn from_texture_buffer(
buffer: TextureBuffer<T>,
location: impl Into<Point<f64, Logical>>,
@@ -226,7 +226,7 @@ where
damage: &[Rectangle<i32, Physical>],
opaque_regions: &[Rectangle<i32, Physical>],
) -> Result<(), R::Error> {
- if frame.id() != self.buffer.renderer_id {
+ if frame.context_id() != self.buffer.renderer_context_id {
warn!("trying to render texture from different renderer");
return Ok(());
}