From bffae036f77213c30227da196f5ceec969ee7207 Mon Sep 17 00:00:00 2001 From: Victor Brekenfeld Date: Mon, 10 Jan 2022 19:16:30 +0100 Subject: [PATCH] gles2: Expose transformation of a `Frame` --- src/backend/renderer/gles2/mod.rs | 6 ++++++ src/backend/renderer/mod.rs | 3 +++ wlcs_anvil/src/renderer.rs | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/src/backend/renderer/gles2/mod.rs b/src/backend/renderer/gles2/mod.rs index 4b3d825..2ed0649 100644 --- a/src/backend/renderer/gles2/mod.rs +++ b/src/backend/renderer/gles2/mod.rs @@ -186,6 +186,7 @@ pub struct Gles2Renderer { /// Handle to the currently rendered frame during [`Gles2Renderer::render`](Renderer::render) pub struct Gles2Frame { current_projection: Matrix3, + transform: Transform, gl: ffi::Gles2, tex_programs: [Gles2TexProgram; shaders::FRAGMENT_COUNT], solid_program: Gles2SolidProgram, @@ -1129,6 +1130,7 @@ impl Renderer for Gles2Renderer { solid_program: self.solid_program.clone(), // output transformation passed in by the user current_projection: flip180 * transform.matrix() * renderer, + transform, vbos: self.vbos, size, }; @@ -1318,6 +1320,10 @@ impl Frame for Gles2Frame { self.render_texture(texture, mat, Some(&damage), tex_verts, alpha) } + + fn transformation(&self) -> Transform { + self.transform + } } impl Gles2Frame { diff --git a/src/backend/renderer/mod.rs b/src/backend/renderer/mod.rs index c84c233..94d34a5 100644 --- a/src/backend/renderer/mod.rs +++ b/src/backend/renderer/mod.rs @@ -219,6 +219,9 @@ pub trait Frame { src_transform: Transform, alpha: f32, ) -> Result<(), Self::Error>; + + /// Output transformation that is applied to this frame + fn transformation(&self) -> Transform; } /// Abstraction of commonly used rendering operations for compositors. diff --git a/wlcs_anvil/src/renderer.rs b/wlcs_anvil/src/renderer.rs index 0ceb21d..bd75ec1 100644 --- a/wlcs_anvil/src/renderer.rs +++ b/wlcs_anvil/src/renderer.rs @@ -112,6 +112,10 @@ impl Frame for DummyFrame { ) -> Result<(), Self::Error> { Ok(()) } + + fn transformation(&self) -> Transform { + Transform::Normal + } } pub struct DummyTexture {