render: split module into gfx_apis and renderer
This commit is contained in:
parent
5e8a6eb86f
commit
d650b3375d
68 changed files with 219 additions and 222 deletions
|
|
@ -2,8 +2,8 @@ use {
|
||||||
crate::{
|
crate::{
|
||||||
async_engine::SpawnedFuture,
|
async_engine::SpawnedFuture,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
|
gfx_apis::gl::Framebuffer,
|
||||||
ifs::wl_seat::wl_pointer::{CONTINUOUS, FINGER, HORIZONTAL_SCROLL, VERTICAL_SCROLL, WHEEL},
|
ifs::wl_seat::wl_pointer::{CONTINUOUS, FINGER, HORIZONTAL_SCROLL, VERTICAL_SCROLL, WHEEL},
|
||||||
render::Framebuffer,
|
|
||||||
video::drm::{ConnectorType, DrmError, DrmVersion},
|
video::drm::{ConnectorType, DrmError, DrmVersion},
|
||||||
},
|
},
|
||||||
std::{
|
std::{
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ use {
|
||||||
},
|
},
|
||||||
backends::metal::video::{MetalDrmDeviceData, MetalRenderContext, PendingDrmDevice},
|
backends::metal::video::{MetalDrmDeviceData, MetalRenderContext, PendingDrmDevice},
|
||||||
dbus::{DbusError, SignalHandler},
|
dbus::{DbusError, SignalHandler},
|
||||||
|
gfx_apis::gl::RenderError,
|
||||||
libinput::{
|
libinput::{
|
||||||
consts::{
|
consts::{
|
||||||
AccelProfile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE,
|
AccelProfile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE,
|
||||||
|
|
@ -23,7 +24,6 @@ use {
|
||||||
LibInput, LibInputAdapter, LibInputError,
|
LibInput, LibInputAdapter, LibInputError,
|
||||||
},
|
},
|
||||||
logind::{LogindError, Session},
|
logind::{LogindError, Session},
|
||||||
render::RenderError,
|
|
||||||
state::State,
|
state::State,
|
||||||
time::now_usec,
|
time::now_usec,
|
||||||
udev::{Udev, UdevError, UdevMonitor},
|
udev::{Udev, UdevError, UdevMonitor},
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,9 @@ use {
|
||||||
backends::metal::{MetalBackend, MetalError},
|
backends::metal::{MetalBackend, MetalError},
|
||||||
edid::Descriptor,
|
edid::Descriptor,
|
||||||
format::{Format, ARGB8888, XRGB8888},
|
format::{Format, ARGB8888, XRGB8888},
|
||||||
|
gfx_apis::gl::{Framebuffer, RenderContext, Texture},
|
||||||
ifs::wp_presentation_feedback::{KIND_HW_COMPLETION, KIND_VSYNC},
|
ifs::wp_presentation_feedback::{KIND_HW_COMPLETION, KIND_VSYNC},
|
||||||
render::{Framebuffer, RenderContext, RenderResult, Texture},
|
renderer::RenderResult,
|
||||||
state::State,
|
state::State,
|
||||||
udev::UdevDevice,
|
udev::UdevDevice,
|
||||||
utils::{
|
utils::{
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@ use {
|
||||||
},
|
},
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
format::XRGB8888,
|
format::XRGB8888,
|
||||||
render::{Framebuffer, RenderContext, RenderError, RenderResult, Texture},
|
gfx_apis::gl::{Framebuffer, RenderContext, RenderError, Texture},
|
||||||
|
renderer::RenderResult,
|
||||||
state::State,
|
state::State,
|
||||||
time::now_usec,
|
time::now_usec,
|
||||||
utils::{
|
utils::{
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,12 @@ use {
|
||||||
config::ConfigProxy,
|
config::ConfigProxy,
|
||||||
dbus::Dbus,
|
dbus::Dbus,
|
||||||
forker,
|
forker,
|
||||||
|
gfx_apis::gl::{self, RenderError},
|
||||||
globals::Globals,
|
globals::Globals,
|
||||||
ifs::{wl_output::WlOutputGlobal, wl_surface::NoneSurfaceExt},
|
ifs::{wl_output::WlOutputGlobal, wl_surface::NoneSurfaceExt},
|
||||||
io_uring::{IoUring, IoUringError},
|
io_uring::{IoUring, IoUringError},
|
||||||
leaks,
|
leaks,
|
||||||
logger::Logger,
|
logger::Logger,
|
||||||
render::{self, RenderError},
|
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
sighand::{self, SighandError},
|
sighand::{self, SighandError},
|
||||||
state::{ConnectorData, IdleState, ScreenlockState, State, XWaylandState},
|
state::{ConnectorData, IdleState, ScreenlockState, State, XWaylandState},
|
||||||
|
|
@ -112,7 +112,7 @@ fn start_compositor2(
|
||||||
log::info!("pid = {}", uapi::getpid());
|
log::info!("pid = {}", uapi::getpid());
|
||||||
init_fd_limit();
|
init_fd_limit();
|
||||||
leaks::init();
|
leaks::init();
|
||||||
render::init()?;
|
gl::init()?;
|
||||||
clientmem::init()?;
|
clientmem::init()?;
|
||||||
let xkb_ctx = XkbContext::new().unwrap();
|
let xkb_ctx = XkbContext::new().unwrap();
|
||||||
let xkb_keymap = xkb_ctx.keymap_from_str(include_str!("keymap.xkb")).unwrap();
|
let xkb_keymap = xkb_ctx.keymap_from_str(include_str!("keymap.xkb")).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,9 @@ use {
|
||||||
crate::{
|
crate::{
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
format::ARGB8888,
|
format::ARGB8888,
|
||||||
|
gfx_apis::gl::{RenderContext, RenderError, Texture},
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::{RenderContext, RenderError, Renderer, Texture},
|
renderer::Renderer,
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
state::State,
|
state::State,
|
||||||
time::Time,
|
time::Time,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
|
gfx_apis::gl::sys::{GLint, GL_BGRA_EXT, GL_RGBA, GL_UNSIGNED_BYTE},
|
||||||
pipewire::pw_pod::{
|
pipewire::pw_pod::{
|
||||||
SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx, SpaVideoFormat, SPA_VIDEO_FORMAT_BGRA,
|
SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx, SpaVideoFormat, SPA_VIDEO_FORMAT_BGRA,
|
||||||
SPA_VIDEO_FORMAT_NV12, SPA_VIDEO_FORMAT_RGBA,
|
SPA_VIDEO_FORMAT_NV12, SPA_VIDEO_FORMAT_RGBA,
|
||||||
},
|
},
|
||||||
render::sys::{GLint, GL_BGRA_EXT, GL_RGBA, GL_UNSIGNED_BYTE},
|
|
||||||
utils::debug_fn::debug_fn,
|
utils::debug_fn::debug_fn,
|
||||||
},
|
},
|
||||||
ahash::AHashMap,
|
ahash::AHashMap,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use {
|
use {
|
||||||
crate::{format::Format, render::Texture, theme::Color},
|
crate::{format::Format, gfx_apis::gl::Texture, theme::Color},
|
||||||
std::rc::Rc,
|
std::rc::Rc,
|
||||||
};
|
};
|
||||||
|
|
||||||
1
src/gfx_apis.rs
Normal file
1
src/gfx_apis.rs
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
pub mod gl;
|
||||||
|
|
@ -1,8 +1,29 @@
|
||||||
|
macro_rules! egl_transparent {
|
||||||
|
($name:ident) => {
|
||||||
|
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||||
|
#[repr(transparent)]
|
||||||
|
pub struct $name(pub *mut u8);
|
||||||
|
|
||||||
|
impl $name {
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub const fn none() -> Self {
|
||||||
|
Self(std::ptr::null_mut())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn is_none(self) -> bool {
|
||||||
|
self.0.is_null()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub use renderer::*;
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
format::Format,
|
format::Format,
|
||||||
render::{
|
gfx_api::{BufferPoints, CopyTexture, FillRect, GfxApiOpt},
|
||||||
gfx_api::{BufferPoints, CopyTexture, FillRect, GfxApiOpt},
|
gfx_apis::gl::{
|
||||||
gl::texture::image_target,
|
gl::texture::image_target,
|
||||||
sys::{
|
sys::{
|
||||||
glActiveTexture, glBindTexture, glClear, glClearColor, glDisable,
|
glActiveTexture, glBindTexture, glClear, glClearColor, glDisable,
|
||||||
|
|
@ -11,15 +32,90 @@ use {
|
||||||
GL_BLEND, GL_COLOR_BUFFER_BIT, GL_FALSE, GL_FLOAT, GL_LINEAR, GL_TEXTURE0,
|
GL_BLEND, GL_COLOR_BUFFER_BIT, GL_FALSE, GL_FLOAT, GL_LINEAR, GL_TEXTURE0,
|
||||||
GL_TEXTURE_MIN_FILTER, GL_TRIANGLES, GL_TRIANGLE_STRIP,
|
GL_TEXTURE_MIN_FILTER, GL_TRIANGLES, GL_TRIANGLE_STRIP,
|
||||||
},
|
},
|
||||||
Framebuffer, RenderContext, Texture,
|
|
||||||
},
|
},
|
||||||
theme::Color,
|
theme::Color,
|
||||||
utils::{rc_eq::rc_eq, vecstorage::VecStorage},
|
utils::{rc_eq::rc_eq, vecstorage::VecStorage},
|
||||||
|
video::{drm::DrmError, gbm::GbmError},
|
||||||
},
|
},
|
||||||
isnt::std_1::vec::IsntVecExt,
|
isnt::std_1::vec::IsntVecExt,
|
||||||
std::cell::RefCell,
|
std::cell::RefCell,
|
||||||
|
thiserror::Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod egl;
|
||||||
|
mod ext;
|
||||||
|
mod gl;
|
||||||
|
mod proc;
|
||||||
|
mod renderer;
|
||||||
|
|
||||||
|
pub mod sys {
|
||||||
|
pub use super::{egl::sys::*, gl::sys::*};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn init() -> Result<(), RenderError> {
|
||||||
|
egl::init()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Error)]
|
||||||
|
pub enum RenderError {
|
||||||
|
#[error("EGL library does not support `EGL_EXT_platform_base`")]
|
||||||
|
ExtPlatformBase,
|
||||||
|
#[error("Could not compile a shader")]
|
||||||
|
ShaderCompileFailed,
|
||||||
|
#[error("Could not link a program")]
|
||||||
|
ProgramLink,
|
||||||
|
#[error("Could not bind to `EGL_OPENGL_ES_API`")]
|
||||||
|
BindFailed,
|
||||||
|
#[error("EGL library does not support the GBM platform")]
|
||||||
|
GbmExt,
|
||||||
|
#[error("Could not create a GBM device")]
|
||||||
|
Gbm(#[source] GbmError),
|
||||||
|
#[error("`eglCreateContext` failed")]
|
||||||
|
CreateContext,
|
||||||
|
#[error("`eglMakeCurrent` failed")]
|
||||||
|
MakeCurrent,
|
||||||
|
#[error("`eglCreateImageKHR` failed")]
|
||||||
|
CreateImage,
|
||||||
|
#[error("Image buffer is too small")]
|
||||||
|
SmallImageBuffer,
|
||||||
|
#[error("Binding a renderbuffer to a framebuffer failed")]
|
||||||
|
CreateFramebuffer,
|
||||||
|
#[error("`eglGetPlatformDisplayEXT` failed")]
|
||||||
|
GetDisplay,
|
||||||
|
#[error("`eglInitialize` failed")]
|
||||||
|
Initialize,
|
||||||
|
#[error("EGL display does not support `EGL_EXT_image_dma_buf_import_modifiers`")]
|
||||||
|
DmaBufImport,
|
||||||
|
#[error("GLES driver does not support `GL_OES_EGL_image`")]
|
||||||
|
OesEglImage,
|
||||||
|
#[error("EGL display does not support `EGL_KHR_image_base`")]
|
||||||
|
ImageBase,
|
||||||
|
#[error(
|
||||||
|
"EGL display does not support `EGL_KHR_no_config_context` or `EGL_MESA_configless_context`"
|
||||||
|
)]
|
||||||
|
ConfiglessContext,
|
||||||
|
#[error("EGL display does not support `EGL_KHR_surfaceless_context`")]
|
||||||
|
SurfacelessContext,
|
||||||
|
#[error("`eglQueryDmaBufFormatsEXT` failed")]
|
||||||
|
QueryDmaBufFormats,
|
||||||
|
#[error("`eglQueryDmaBufModifiersEXT` failed")]
|
||||||
|
QueryDmaBufModifiers,
|
||||||
|
#[error(transparent)]
|
||||||
|
DrmError(#[from] DrmError),
|
||||||
|
#[error("The GLES driver does not support the XRGB8888 format")]
|
||||||
|
XRGB888,
|
||||||
|
#[error("The DRM device does not have a render node")]
|
||||||
|
NoRenderNode,
|
||||||
|
#[error("The requested format is not supported")]
|
||||||
|
UnsupportedFormat,
|
||||||
|
#[error("The requested modifier is not supported")]
|
||||||
|
UnsupportedModifier,
|
||||||
|
#[error("Image is external only and cannot be rendered to")]
|
||||||
|
ExternalOnly,
|
||||||
|
#[error("OpenGL context does not support external textures")]
|
||||||
|
ExternalUnsupported,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct GfxGlState {
|
pub struct GfxGlState {
|
||||||
triangles: RefCell<Vec<f32>>,
|
triangles: RefCell<Vec<f32>>,
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use {
|
use {
|
||||||
crate::render::{
|
crate::gfx_apis::gl::{
|
||||||
egl::sys::{
|
egl::sys::{
|
||||||
eglBindAPI, EGLAttrib, EGLLabelKHR, EGLenum, EGLint, EGL_DEBUG_MSG_CRITICAL_KHR,
|
eglBindAPI, EGLAttrib, EGLLabelKHR, EGLenum, EGLint, EGL_DEBUG_MSG_CRITICAL_KHR,
|
||||||
EGL_DEBUG_MSG_ERROR_KHR, EGL_DEBUG_MSG_INFO_KHR, EGL_DEBUG_MSG_WARN_KHR, EGL_NONE,
|
EGL_DEBUG_MSG_ERROR_KHR, EGL_DEBUG_MSG_INFO_KHR, EGL_DEBUG_MSG_WARN_KHR, EGL_NONE,
|
||||||
|
|
@ -27,9 +27,9 @@ pub mod display;
|
||||||
pub mod image;
|
pub mod image;
|
||||||
pub mod sys;
|
pub mod sys;
|
||||||
|
|
||||||
pub(super) static PROCS: Lazy<ExtProc> = Lazy::new(ExtProc::load);
|
pub(crate) static PROCS: Lazy<ExtProc> = Lazy::new(ExtProc::load);
|
||||||
|
|
||||||
pub(super) static EXTS: Lazy<ClientExt> = Lazy::new(get_client_ext);
|
pub(crate) static EXTS: Lazy<ClientExt> = Lazy::new(get_client_ext);
|
||||||
|
|
||||||
pub fn init() -> Result<(), RenderError> {
|
pub fn init() -> Result<(), RenderError> {
|
||||||
if !EXTS.contains(ClientExt::EXT_PLATFORM_BASE) {
|
if !EXTS.contains(ClientExt::EXT_PLATFORM_BASE) {
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use {
|
use {
|
||||||
crate::render::{
|
crate::gfx_apis::gl::{
|
||||||
egl::{
|
egl::{
|
||||||
display::EglDisplay,
|
display::EglDisplay,
|
||||||
sys::{eglDestroyContext, eglMakeCurrent, EGLContext, EGLSurface, EGL_FALSE, EGL_TRUE},
|
sys::{eglDestroyContext, eglMakeCurrent, EGLContext, EGLSurface, EGL_FALSE, EGL_TRUE},
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
format::{formats, Format},
|
format::{formats, Format},
|
||||||
render::{
|
gfx_apis::gl::{
|
||||||
egl::{
|
egl::{
|
||||||
context::EglContext,
|
context::EglContext,
|
||||||
image::EglImage,
|
image::EglImage,
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use {
|
use {
|
||||||
crate::render::egl::{
|
crate::gfx_apis::gl::egl::{
|
||||||
display::EglDisplay,
|
display::EglDisplay,
|
||||||
sys::{EGLImageKHR, EGL_FALSE},
|
sys::{EGLImageKHR, EGL_FALSE},
|
||||||
PROCS,
|
PROCS,
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use {crate::render::sys::GLenum, uapi::c};
|
use {crate::gfx_apis::gl::sys::GLenum, uapi::c};
|
||||||
|
|
||||||
pub type EGLint = i32;
|
pub type EGLint = i32;
|
||||||
pub type EGLenum = c::c_uint;
|
pub type EGLenum = c::c_uint;
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
render::{
|
gfx_apis::gl::{
|
||||||
egl::sys::{eglQueryString, EGLDisplay, EGL_EXTENSIONS},
|
egl::sys::{eglQueryString, EGLDisplay, EGL_EXTENSIONS},
|
||||||
gl::sys::{glGetString, GL_EXTENSIONS},
|
gl::sys::{glGetString, GL_EXTENSIONS},
|
||||||
},
|
},
|
||||||
|
|
@ -82,7 +82,7 @@ bitflags::bitflags! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) unsafe fn get_display_ext(dpy: EGLDisplay) -> DisplayExt {
|
pub(crate) unsafe fn get_display_ext(dpy: EGLDisplay) -> DisplayExt {
|
||||||
let map = [
|
let map = [
|
||||||
("EGL_KHR_image_base", DisplayExt::KHR_IMAGE_BASE),
|
("EGL_KHR_image_base", DisplayExt::KHR_IMAGE_BASE),
|
||||||
(
|
(
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use {
|
use {
|
||||||
crate::render::{
|
crate::gfx_apis::gl::{
|
||||||
egl::context::EglContext,
|
egl::context::EglContext,
|
||||||
gl::{
|
gl::{
|
||||||
render_buffer::GlRenderBuffer,
|
render_buffer::GlRenderBuffer,
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use {
|
use {
|
||||||
crate::render::{
|
crate::gfx_apis::gl::{
|
||||||
egl::context::EglContext,
|
egl::context::EglContext,
|
||||||
gl::{
|
gl::{
|
||||||
shader::GlShader,
|
shader::GlShader,
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use {
|
use {
|
||||||
crate::render::{
|
crate::gfx_apis::gl::{
|
||||||
egl::{context::EglContext, image::EglImage, PROCS},
|
egl::{context::EglContext, image::EglImage, PROCS},
|
||||||
gl::{
|
gl::{
|
||||||
frame_buffer::GlFrameBuffer,
|
frame_buffer::GlFrameBuffer,
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use {
|
use {
|
||||||
crate::render::{
|
crate::gfx_apis::gl::{
|
||||||
egl::context::EglContext,
|
egl::context::EglContext,
|
||||||
gl::sys::{
|
gl::sys::{
|
||||||
glCompileShader, glCreateShader, glDeleteShader, glGetShaderiv, glShaderSource, GLenum,
|
glCompileShader, glCreateShader, glDeleteShader, glGetShaderiv, glShaderSource, GLenum,
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
format::Format,
|
format::Format,
|
||||||
render::{
|
gfx_apis::gl::{
|
||||||
egl::{context::EglContext, image::EglImage, PROCS},
|
egl::{context::EglContext, image::EglImage, PROCS},
|
||||||
ext::GlExt,
|
ext::GlExt,
|
||||||
gl::sys::{
|
gl::sys::{
|
||||||
|
|
@ -17,7 +17,7 @@ use {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct GlTexture {
|
pub struct GlTexture {
|
||||||
pub(super) ctx: Rc<EglContext>,
|
pub(crate) ctx: Rc<EglContext>,
|
||||||
pub img: Option<Rc<EglImage>>,
|
pub img: Option<Rc<EglImage>>,
|
||||||
pub tex: GLuint,
|
pub tex: GLuint,
|
||||||
pub width: i32,
|
pub width: i32,
|
||||||
6
src/gfx_apis/gl/renderer.rs
Normal file
6
src/gfx_apis/gl/renderer.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
pub use {context::*, framebuffer::*, image::*, texture::*};
|
||||||
|
|
||||||
|
mod context;
|
||||||
|
mod framebuffer;
|
||||||
|
mod image;
|
||||||
|
mod texture;
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
format::{Format, XRGB8888},
|
format::{Format, XRGB8888},
|
||||||
render::{
|
gfx_api::GfxApiOpt,
|
||||||
|
gfx_apis::gl::{
|
||||||
egl::{
|
egl::{
|
||||||
context::EglContext,
|
context::EglContext,
|
||||||
display::{EglDisplay, EglFormat},
|
display::{EglDisplay, EglFormat},
|
||||||
},
|
},
|
||||||
ext::GlExt,
|
ext::GlExt,
|
||||||
gfx_api::GfxApiOpt,
|
|
||||||
gl::{
|
gl::{
|
||||||
program::GlProgram, render_buffer::GlRenderBuffer, sys::GLint, texture::GlTexture,
|
program::GlProgram, render_buffer::GlRenderBuffer, sys::GLint, texture::GlTexture,
|
||||||
},
|
},
|
||||||
renderer::{framebuffer::Framebuffer, gfx_apis::gl::GfxGlState, image::Image},
|
renderer::{framebuffer::Framebuffer, image::Image},
|
||||||
RenderError, Texture,
|
GfxGlState, RenderError, Texture,
|
||||||
},
|
},
|
||||||
video::{
|
video::{
|
||||||
dmabuf::DmaBuf,
|
dmabuf::DmaBuf,
|
||||||
|
|
@ -30,11 +30,11 @@ use {
|
||||||
uapi::ustr,
|
uapi::ustr,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(super) struct TexProg {
|
pub(crate) struct TexProg {
|
||||||
pub(super) prog: GlProgram,
|
pub(crate) prog: GlProgram,
|
||||||
pub(super) pos: GLint,
|
pub(crate) pos: GLint,
|
||||||
pub(super) texcoord: GLint,
|
pub(crate) texcoord: GLint,
|
||||||
pub(super) tex: GLint,
|
pub(crate) tex: GLint,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TexProg {
|
impl TexProg {
|
||||||
|
|
@ -48,26 +48,26 @@ impl TexProg {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) struct TexProgs {
|
pub(crate) struct TexProgs {
|
||||||
pub alpha: TexProg,
|
pub alpha: TexProg,
|
||||||
pub solid: TexProg,
|
pub solid: TexProg,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RenderContext {
|
pub struct RenderContext {
|
||||||
pub(super) ctx: Rc<EglContext>,
|
pub(crate) ctx: Rc<EglContext>,
|
||||||
pub gbm: Rc<GbmDevice>,
|
pub gbm: Rc<GbmDevice>,
|
||||||
|
|
||||||
pub(super) render_node: Rc<CString>,
|
pub(crate) render_node: Rc<CString>,
|
||||||
|
|
||||||
pub(super) tex_internal: TexProgs,
|
pub(crate) tex_internal: TexProgs,
|
||||||
pub(super) tex_external: Option<TexProgs>,
|
pub(crate) tex_external: Option<TexProgs>,
|
||||||
|
|
||||||
pub(super) fill_prog: GlProgram,
|
pub(crate) fill_prog: GlProgram,
|
||||||
pub(super) fill_prog_pos: GLint,
|
pub(crate) fill_prog_pos: GLint,
|
||||||
pub(super) fill_prog_color: GLint,
|
pub(crate) fill_prog_color: GLint,
|
||||||
|
|
||||||
pub(super) gfx_ops: RefCell<Vec<GfxApiOpt>>,
|
pub(crate) gfx_ops: RefCell<Vec<GfxApiOpt>>,
|
||||||
pub(super) gl_state: RefCell<GfxGlState>,
|
pub(crate) gl_state: RefCell<GfxGlState>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for RenderContext {
|
impl Debug for RenderContext {
|
||||||
|
|
@ -3,8 +3,7 @@ use {
|
||||||
cursor::Cursor,
|
cursor::Cursor,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
format::{Format, ARGB8888, XRGB8888},
|
format::{Format, ARGB8888, XRGB8888},
|
||||||
rect::Rect,
|
gfx_apis::gl::{
|
||||||
render::{
|
|
||||||
gl::{
|
gl::{
|
||||||
frame_buffer::GlFrameBuffer,
|
frame_buffer::GlFrameBuffer,
|
||||||
sys::{
|
sys::{
|
||||||
|
|
@ -12,13 +11,13 @@ use {
|
||||||
GL_FRAMEBUFFER,
|
GL_FRAMEBUFFER,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
renderer::{
|
renderer::context::RenderContext,
|
||||||
context::RenderContext, gfx_apis::gl::run_ops, renderer::Renderer,
|
run_ops,
|
||||||
renderer_base::RendererBase,
|
|
||||||
},
|
|
||||||
sys::{glBlendFunc, glFlush, glReadnPixels, GL_ONE, GL_ONE_MINUS_SRC_ALPHA},
|
sys::{glBlendFunc, glFlush, glReadnPixels, GL_ONE, GL_ONE_MINUS_SRC_ALPHA},
|
||||||
RenderResult, Texture,
|
Texture,
|
||||||
},
|
},
|
||||||
|
rect::Rect,
|
||||||
|
renderer::{renderer_base::RendererBase, RenderResult, Renderer},
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
state::State,
|
state::State,
|
||||||
tree::Node,
|
tree::Node,
|
||||||
|
|
@ -31,8 +30,8 @@ use {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Framebuffer {
|
pub struct Framebuffer {
|
||||||
pub(super) ctx: Rc<RenderContext>,
|
pub(crate) ctx: Rc<RenderContext>,
|
||||||
pub(super) gl: GlFrameBuffer,
|
pub(crate) gl: GlFrameBuffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for Framebuffer {
|
impl Debug for Framebuffer {
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use {
|
use {
|
||||||
crate::render::{
|
crate::gfx_apis::gl::{
|
||||||
egl::image::EglImage,
|
egl::image::EglImage,
|
||||||
gl::{render_buffer::GlRenderBuffer, texture::GlTexture},
|
gl::{render_buffer::GlRenderBuffer, texture::GlTexture},
|
||||||
Framebuffer, RenderContext, RenderError, Texture,
|
Framebuffer, RenderContext, RenderError, Texture,
|
||||||
|
|
@ -8,8 +8,8 @@ use {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Image {
|
pub struct Image {
|
||||||
pub(super) ctx: Rc<RenderContext>,
|
pub(crate) ctx: Rc<RenderContext>,
|
||||||
pub(super) gl: Rc<EglImage>,
|
pub(crate) gl: Rc<EglImage>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Image {
|
impl Image {
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use {
|
use {
|
||||||
crate::render::{gl::texture::GlTexture, renderer::context::RenderContext},
|
crate::gfx_apis::gl::{gl::texture::GlTexture, renderer::context::RenderContext},
|
||||||
std::{
|
std::{
|
||||||
fmt::{Debug, Formatter},
|
fmt::{Debug, Formatter},
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
|
|
@ -7,8 +7,8 @@ use {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Texture {
|
pub struct Texture {
|
||||||
pub(super) ctx: Rc<RenderContext>,
|
pub(crate) ctx: Rc<RenderContext>,
|
||||||
pub(super) gl: GlTexture,
|
pub(crate) gl: GlTexture,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for Texture {
|
impl Debug for Texture {
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
client::{Client, ClientError},
|
client::{Client, ClientError},
|
||||||
|
gfx_apis::gl::RenderContext,
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::Object,
|
object::Object,
|
||||||
render::RenderContext,
|
|
||||||
utils::{
|
utils::{
|
||||||
buffd::{MsgParser, MsgParserError},
|
buffd::{MsgParser, MsgParserError},
|
||||||
errorfmt::ErrorFmt,
|
errorfmt::ErrorFmt,
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@ use {
|
||||||
crate::{
|
crate::{
|
||||||
client::{Client, ClientError},
|
client::{Client, ClientError},
|
||||||
format::XRGB8888,
|
format::XRGB8888,
|
||||||
|
gfx_apis::gl::{Framebuffer, RenderContext, RenderError, Texture},
|
||||||
ifs::jay_output::JayOutput,
|
ifs::jay_output::JayOutput,
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::Object,
|
object::Object,
|
||||||
render::{Framebuffer, RenderContext, RenderError, Texture},
|
|
||||||
tree::{OutputNode, WorkspaceNodeId},
|
tree::{OutputNode, WorkspaceNodeId},
|
||||||
utils::{
|
utils::{
|
||||||
buffd::{MsgParser, MsgParserError},
|
buffd::{MsgParser, MsgParserError},
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ use {
|
||||||
client::{Client, ClientError},
|
client::{Client, ClientError},
|
||||||
clientmem::{ClientMem, ClientMemError, ClientMemOffset},
|
clientmem::{ClientMem, ClientMemError, ClientMemOffset},
|
||||||
format::Format,
|
format::Format,
|
||||||
|
gfx_apis::gl::{Framebuffer, Image, RenderError, Texture},
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::Object,
|
object::Object,
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::{Framebuffer, Image, RenderError, Texture},
|
|
||||||
utils::{
|
utils::{
|
||||||
buffd::{MsgParser, MsgParserError},
|
buffd::{MsgParser, MsgParserError},
|
||||||
clonecell::CloneCell,
|
clonecell::CloneCell,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
client::{Client, ClientError},
|
client::{Client, ClientError},
|
||||||
|
gfx_apis::gl::RenderError,
|
||||||
globals::{Global, GlobalName},
|
globals::{Global, GlobalName},
|
||||||
ifs::wl_buffer::WlBuffer,
|
ifs::wl_buffer::WlBuffer,
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::Object,
|
object::Object,
|
||||||
render::RenderError,
|
|
||||||
utils::buffd::{MsgParser, MsgParserError},
|
utils::buffd::{MsgParser, MsgParserError},
|
||||||
video::{
|
video::{
|
||||||
dmabuf::{DmaBuf, DmaBufPlane},
|
dmabuf::{DmaBuf, DmaBufPlane},
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ use {
|
||||||
backend,
|
backend,
|
||||||
client::{Client, ClientError, ClientId},
|
client::{Client, ClientError, ClientId},
|
||||||
format::XRGB8888,
|
format::XRGB8888,
|
||||||
|
gfx_apis::gl::{Framebuffer, Texture},
|
||||||
globals::{Global, GlobalName},
|
globals::{Global, GlobalName},
|
||||||
ifs::{
|
ifs::{
|
||||||
wl_buffer::WlBufferStorage, wl_surface::WlSurface,
|
wl_buffer::WlBufferStorage, wl_surface::WlSurface,
|
||||||
|
|
@ -11,7 +12,6 @@ use {
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::Object,
|
object::Object,
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::{Framebuffer, Texture},
|
|
||||||
state::{ConnectorData, State},
|
state::{ConnectorData, State},
|
||||||
time::Time,
|
time::Time,
|
||||||
tree::OutputNode,
|
tree::OutputNode,
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ use {
|
||||||
backend::KeyState,
|
backend::KeyState,
|
||||||
client::{Client, ClientError, RequestParser},
|
client::{Client, ClientError, RequestParser},
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
|
gfx_api::{BufferPoint, BufferPoints},
|
||||||
ifs::{
|
ifs::{
|
||||||
wl_buffer::WlBuffer,
|
wl_buffer::WlBuffer,
|
||||||
wl_callback::WlCallback,
|
wl_callback::WlCallback,
|
||||||
|
|
@ -38,10 +39,7 @@ use {
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::Object,
|
object::Object,
|
||||||
rect::{Rect, Region},
|
rect::{Rect, Region},
|
||||||
render::{
|
renderer::Renderer,
|
||||||
gfx_api::{BufferPoint, BufferPoints},
|
|
||||||
Renderer,
|
|
||||||
},
|
|
||||||
tree::{
|
tree::{
|
||||||
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, NodeVisitorBase, OutputNode,
|
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, NodeVisitorBase, OutputNode,
|
||||||
ToplevelNode,
|
ToplevelNode,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use {
|
||||||
ifs::{wl_seat::WlSeatGlobal, wl_surface::WlSurface},
|
ifs::{wl_seat::WlSeatGlobal, wl_surface::WlSurface},
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::Renderer,
|
renderer::Renderer,
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
tree::{Node, NodeVisitorBase, OutputNode},
|
tree::{Node, NodeVisitorBase, OutputNode},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use {
|
||||||
wl_surface::{x_surface::XSurface, WlSurface, WlSurfaceError},
|
wl_surface::{x_surface::XSurface, WlSurface, WlSurfaceError},
|
||||||
},
|
},
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::Renderer,
|
renderer::Renderer,
|
||||||
state::State,
|
state::State,
|
||||||
tree::{
|
tree::{
|
||||||
Direction, FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, StackedNode,
|
Direction, FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, StackedNode,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use {
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::Object,
|
object::Object,
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::Renderer,
|
renderer::Renderer,
|
||||||
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, StackedNode, WorkspaceNode},
|
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, StackedNode, WorkspaceNode},
|
||||||
utils::{
|
utils::{
|
||||||
buffd::{MsgParser, MsgParserError},
|
buffd::{MsgParser, MsgParserError},
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use {
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::Object,
|
object::Object,
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::Renderer,
|
renderer::Renderer,
|
||||||
state::State,
|
state::State,
|
||||||
tree::{
|
tree::{
|
||||||
Direction, FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData,
|
Direction, FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use {
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::Object,
|
object::Object,
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::Renderer,
|
renderer::Renderer,
|
||||||
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, OutputNode},
|
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, OutputNode},
|
||||||
utils::{
|
utils::{
|
||||||
bitflags::BitflagsExt,
|
bitflags::BitflagsExt,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
client::ClientError,
|
client::ClientError,
|
||||||
|
gfx_apis::gl::RenderError,
|
||||||
ifs::{wl_buffer::WlBuffer, zwp_linux_dmabuf_v1::ZwpLinuxDmabufV1},
|
ifs::{wl_buffer::WlBuffer, zwp_linux_dmabuf_v1::ZwpLinuxDmabufV1},
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::Object,
|
object::Object,
|
||||||
render::RenderError,
|
|
||||||
utils::{
|
utils::{
|
||||||
buffd::{MsgParser, MsgParserError},
|
buffd::{MsgParser, MsgParserError},
|
||||||
errorfmt::ErrorFmt,
|
errorfmt::ErrorFmt,
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ use {
|
||||||
},
|
},
|
||||||
compositor::TestFuture,
|
compositor::TestFuture,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
|
gfx_apis::gl::{RenderContext, RenderError},
|
||||||
it::test_error::TestResult,
|
it::test_error::TestResult,
|
||||||
render::{RenderContext, RenderError},
|
|
||||||
state::State,
|
state::State,
|
||||||
time::now_usec,
|
time::now_usec,
|
||||||
utils::{
|
utils::{
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,8 @@ mod edid;
|
||||||
mod fixed;
|
mod fixed;
|
||||||
mod forker;
|
mod forker;
|
||||||
mod format;
|
mod format;
|
||||||
|
mod gfx_api;
|
||||||
|
mod gfx_apis;
|
||||||
mod globals;
|
mod globals;
|
||||||
mod ifs;
|
mod ifs;
|
||||||
mod io_uring;
|
mod io_uring;
|
||||||
|
|
@ -75,7 +77,7 @@ mod pango;
|
||||||
mod pipewire;
|
mod pipewire;
|
||||||
mod portal;
|
mod portal;
|
||||||
mod rect;
|
mod rect;
|
||||||
mod render;
|
mod renderer;
|
||||||
mod scale;
|
mod scale;
|
||||||
mod screenshoter;
|
mod screenshoter;
|
||||||
mod sighand;
|
mod sighand;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
|
gfx_apis::gl::RenderContext,
|
||||||
ifs::wl_seat::POINTER,
|
ifs::wl_seat::POINTER,
|
||||||
portal::{
|
portal::{
|
||||||
ptl_render_ctx::PortalRenderCtx, ptl_screencast::ScreencastSession,
|
ptl_render_ctx::PortalRenderCtx, ptl_screencast::ScreencastSession,
|
||||||
ptr_gui::WindowData, PortalState,
|
ptr_gui::WindowData, PortalState,
|
||||||
},
|
},
|
||||||
render::RenderContext,
|
|
||||||
utils::{
|
utils::{
|
||||||
bitflags::BitflagsExt, clonecell::CloneCell, copyhashmap::CopyHashMap,
|
bitflags::BitflagsExt, clonecell::CloneCell, copyhashmap::CopyHashMap,
|
||||||
errorfmt::ErrorFmt, oserror::OsError,
|
errorfmt::ErrorFmt, oserror::OsError,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use {crate::render::RenderContext, std::rc::Rc, uapi::c};
|
use {crate::gfx_apis::gl::RenderContext, std::rc::Rc, uapi::c};
|
||||||
|
|
||||||
pub struct PortalRenderCtx {
|
pub struct PortalRenderCtx {
|
||||||
pub dev_id: c::dev_t,
|
pub dev_id: c::dev_t,
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,10 @@ use {
|
||||||
cursor::KnownCursor,
|
cursor::KnownCursor,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
format::ARGB8888,
|
format::ARGB8888,
|
||||||
|
gfx_apis::gl::{Framebuffer, RenderContext, Texture},
|
||||||
ifs::zwlr_layer_shell_v1::OVERLAY,
|
ifs::zwlr_layer_shell_v1::OVERLAY,
|
||||||
portal::ptl_display::{PortalDisplay, PortalOutput, PortalSeat},
|
portal::ptl_display::{PortalDisplay, PortalOutput, PortalSeat},
|
||||||
render::{Framebuffer, RenderContext, RendererBase, Texture},
|
renderer::renderer_base::RendererBase,
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
text::{self, TextMeasurement},
|
text::{self, TextMeasurement},
|
||||||
theme::Color,
|
theme::Color,
|
||||||
|
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
macro_rules! egl_transparent {
|
|
||||||
($name:ident) => {
|
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
|
||||||
#[repr(transparent)]
|
|
||||||
pub struct $name(pub *mut u8);
|
|
||||||
|
|
||||||
impl $name {
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const fn none() -> Self {
|
|
||||||
Self(std::ptr::null_mut())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub fn is_none(self) -> bool {
|
|
||||||
self.0.is_null()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub use renderer::*;
|
|
||||||
use {
|
|
||||||
crate::video::{drm::DrmError, gbm::GbmError},
|
|
||||||
thiserror::Error,
|
|
||||||
};
|
|
||||||
|
|
||||||
mod egl;
|
|
||||||
mod ext;
|
|
||||||
mod gl;
|
|
||||||
mod proc;
|
|
||||||
mod renderer;
|
|
||||||
|
|
||||||
pub mod sys {
|
|
||||||
pub use super::{egl::sys::*, gl::sys::*};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn init() -> Result<(), RenderError> {
|
|
||||||
egl::init()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum RenderError {
|
|
||||||
#[error("EGL library does not support `EGL_EXT_platform_base`")]
|
|
||||||
ExtPlatformBase,
|
|
||||||
#[error("Could not compile a shader")]
|
|
||||||
ShaderCompileFailed,
|
|
||||||
#[error("Could not link a program")]
|
|
||||||
ProgramLink,
|
|
||||||
#[error("Could not bind to `EGL_OPENGL_ES_API`")]
|
|
||||||
BindFailed,
|
|
||||||
#[error("EGL library does not support the GBM platform")]
|
|
||||||
GbmExt,
|
|
||||||
#[error("Could not create a GBM device")]
|
|
||||||
Gbm(#[source] GbmError),
|
|
||||||
#[error("`eglCreateContext` failed")]
|
|
||||||
CreateContext,
|
|
||||||
#[error("`eglMakeCurrent` failed")]
|
|
||||||
MakeCurrent,
|
|
||||||
#[error("`eglCreateImageKHR` failed")]
|
|
||||||
CreateImage,
|
|
||||||
#[error("Image buffer is too small")]
|
|
||||||
SmallImageBuffer,
|
|
||||||
#[error("Binding a renderbuffer to a framebuffer failed")]
|
|
||||||
CreateFramebuffer,
|
|
||||||
#[error("`eglGetPlatformDisplayEXT` failed")]
|
|
||||||
GetDisplay,
|
|
||||||
#[error("`eglInitialize` failed")]
|
|
||||||
Initialize,
|
|
||||||
#[error("EGL display does not support `EGL_EXT_image_dma_buf_import_modifiers`")]
|
|
||||||
DmaBufImport,
|
|
||||||
#[error("GLES driver does not support `GL_OES_EGL_image`")]
|
|
||||||
OesEglImage,
|
|
||||||
#[error("EGL display does not support `EGL_KHR_image_base`")]
|
|
||||||
ImageBase,
|
|
||||||
#[error(
|
|
||||||
"EGL display does not support `EGL_KHR_no_config_context` or `EGL_MESA_configless_context`"
|
|
||||||
)]
|
|
||||||
ConfiglessContext,
|
|
||||||
#[error("EGL display does not support `EGL_KHR_surfaceless_context`")]
|
|
||||||
SurfacelessContext,
|
|
||||||
#[error("`eglQueryDmaBufFormatsEXT` failed")]
|
|
||||||
QueryDmaBufFormats,
|
|
||||||
#[error("`eglQueryDmaBufModifiersEXT` failed")]
|
|
||||||
QueryDmaBufModifiers,
|
|
||||||
#[error(transparent)]
|
|
||||||
DrmError(#[from] DrmError),
|
|
||||||
#[error("The GLES driver does not support the XRGB8888 format")]
|
|
||||||
XRGB888,
|
|
||||||
#[error("The DRM device does not have a render node")]
|
|
||||||
NoRenderNode,
|
|
||||||
#[error("The requested format is not supported")]
|
|
||||||
UnsupportedFormat,
|
|
||||||
#[error("The requested modifier is not supported")]
|
|
||||||
UnsupportedModifier,
|
|
||||||
#[error("Image is external only and cannot be rendered to")]
|
|
||||||
ExternalOnly,
|
|
||||||
#[error("OpenGL context does not support external textures")]
|
|
||||||
ExternalUnsupported,
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
pub use {context::*, framebuffer::*, image::*, renderer::*, renderer_base::*, texture::*};
|
|
||||||
|
|
||||||
mod context;
|
|
||||||
mod framebuffer;
|
|
||||||
pub mod gfx_api;
|
|
||||||
mod gfx_apis;
|
|
||||||
mod image;
|
|
||||||
mod renderer;
|
|
||||||
mod renderer_base;
|
|
||||||
mod texture;
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
pub(super) mod gl;
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
format::ARGB8888,
|
format::ARGB8888,
|
||||||
|
gfx_api::{BufferPoints, GfxApiOpt},
|
||||||
ifs::{
|
ifs::{
|
||||||
wl_buffer::WlBuffer,
|
wl_buffer::WlBuffer,
|
||||||
wl_callback::WlCallback,
|
wl_callback::WlCallback,
|
||||||
|
|
@ -10,10 +11,7 @@ use {
|
||||||
wp_presentation_feedback::WpPresentationFeedback,
|
wp_presentation_feedback::WpPresentationFeedback,
|
||||||
},
|
},
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::{
|
renderer::renderer_base::RendererBase,
|
||||||
gfx_api::GfxApiOpt,
|
|
||||||
renderer::{gfx_api::BufferPoints, renderer_base::RendererBase},
|
|
||||||
},
|
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
state::State,
|
state::State,
|
||||||
theme::Color,
|
theme::Color,
|
||||||
|
|
@ -30,6 +28,8 @@ use {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub mod renderer_base;
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct RenderResult {
|
pub struct RenderResult {
|
||||||
pub frame_requests: Vec<Rc<WlCallback>>,
|
pub frame_requests: Vec<Rc<WlCallback>>,
|
||||||
|
|
@ -44,11 +44,11 @@ impl Debug for RenderResult {
|
||||||
|
|
||||||
pub struct Renderer<'a> {
|
pub struct Renderer<'a> {
|
||||||
pub base: RendererBase<'a>,
|
pub base: RendererBase<'a>,
|
||||||
pub(super) state: &'a State,
|
pub state: &'a State,
|
||||||
pub(super) on_output: bool,
|
pub on_output: bool,
|
||||||
pub(super) result: &'a mut RenderResult,
|
pub result: &'a mut RenderResult,
|
||||||
pub(super) logical_extents: Rect,
|
pub logical_extents: Rect,
|
||||||
pub(super) physical_extents: Rect,
|
pub physical_extents: Rect,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Renderer<'_> {
|
impl Renderer<'_> {
|
||||||
|
|
@ -1,14 +1,11 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
format::Format,
|
format::Format,
|
||||||
rect::Rect,
|
gfx_api::{
|
||||||
render::{
|
AbsoluteRect, BufferPoint, BufferPoints, Clear, CopyTexture, FillRect, GfxApiOpt,
|
||||||
gfx_api::Clear,
|
|
||||||
renderer::gfx_api::{
|
|
||||||
AbsoluteRect, BufferPoint, BufferPoints, CopyTexture, FillRect, GfxApiOpt,
|
|
||||||
},
|
|
||||||
Texture,
|
|
||||||
},
|
},
|
||||||
|
gfx_apis::gl::Texture,
|
||||||
|
rect::Rect,
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
theme::Color,
|
theme::Color,
|
||||||
},
|
},
|
||||||
|
|
@ -16,10 +13,10 @@ use {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct RendererBase<'a> {
|
pub struct RendererBase<'a> {
|
||||||
pub(super) ops: &'a mut Vec<GfxApiOpt>,
|
pub ops: &'a mut Vec<GfxApiOpt>,
|
||||||
pub(super) scaled: bool,
|
pub scaled: bool,
|
||||||
pub(super) scale: Scale,
|
pub scale: Scale,
|
||||||
pub(super) scalef: f64,
|
pub scalef: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RendererBase<'_> {
|
impl RendererBase<'_> {
|
||||||
|
|
@ -143,7 +140,7 @@ impl RendererBase<'_> {
|
||||||
let (twidth, theight) = if let Some(size) = tsize {
|
let (twidth, theight) = if let Some(size) = tsize {
|
||||||
size
|
size
|
||||||
} else {
|
} else {
|
||||||
let (mut w, mut h) = (texture.gl.width, texture.gl.height);
|
let (mut w, mut h) = (texture.width(), texture.height());
|
||||||
if tscale != self.scale {
|
if tscale != self.scale {
|
||||||
let tscale = tscale.to_f64();
|
let tscale = tscale.to_f64();
|
||||||
w = (w as f64 * self.scalef / tscale).round() as _;
|
w = (w as f64 * self.scalef / tscale).round() as _;
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
format::XRGB8888,
|
format::XRGB8888,
|
||||||
render::RenderError,
|
gfx_apis::gl::RenderError,
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
state::State,
|
state::State,
|
||||||
video::{
|
video::{
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ use {
|
||||||
cursor::{Cursor, ServerCursors},
|
cursor::{Cursor, ServerCursors},
|
||||||
dbus::Dbus,
|
dbus::Dbus,
|
||||||
forker::ForkerProxy,
|
forker::ForkerProxy,
|
||||||
|
gfx_apis::gl::RenderContext,
|
||||||
globals::{Globals, GlobalsError, WaylandGlobal},
|
globals::{Globals, GlobalsError, WaylandGlobal},
|
||||||
ifs::{
|
ifs::{
|
||||||
ext_session_lock_v1::ExtSessionLockV1,
|
ext_session_lock_v1::ExtSessionLockV1,
|
||||||
|
|
@ -31,7 +32,6 @@ use {
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
logger::Logger,
|
logger::Logger,
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::RenderContext,
|
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
theme::Theme,
|
theme::Theme,
|
||||||
tree::{
|
tree::{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
format::ARGB8888,
|
format::ARGB8888,
|
||||||
|
gfx_apis::gl::{RenderContext, RenderError, Texture},
|
||||||
pango::{
|
pango::{
|
||||||
consts::{
|
consts::{
|
||||||
CAIRO_FORMAT_ARGB32, CAIRO_OPERATOR_SOURCE, PANGO_ELLIPSIZE_END, PANGO_SCALE,
|
CAIRO_FORMAT_ARGB32, CAIRO_OPERATOR_SOURCE, PANGO_ELLIPSIZE_END, PANGO_SCALE,
|
||||||
|
|
@ -9,7 +10,6 @@ use {
|
||||||
PangoLayout,
|
PangoLayout,
|
||||||
},
|
},
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::{RenderContext, RenderError, Texture},
|
|
||||||
theme::Color,
|
theme::Color,
|
||||||
},
|
},
|
||||||
std::{ops::Neg, rc::Rc},
|
std::{ops::Neg, rc::Rc},
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use {
|
||||||
wl_surface::WlSurface,
|
wl_surface::WlSurface,
|
||||||
},
|
},
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::Renderer,
|
renderer::Renderer,
|
||||||
utils::numcell::NumCell,
|
utils::numcell::NumCell,
|
||||||
xkbcommon::ModifierState,
|
xkbcommon::ModifierState,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,13 @@ use {
|
||||||
backend::KeyState,
|
backend::KeyState,
|
||||||
cursor::KnownCursor,
|
cursor::KnownCursor,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
|
gfx_apis::gl::Texture,
|
||||||
ifs::wl_seat::{
|
ifs::wl_seat::{
|
||||||
collect_kb_foci, collect_kb_foci2, wl_pointer::PendingScroll, NodeSeatState, SeatId,
|
collect_kb_foci, collect_kb_foci2, wl_pointer::PendingScroll, NodeSeatState, SeatId,
|
||||||
WlSeatGlobal, BTN_LEFT,
|
WlSeatGlobal, BTN_LEFT,
|
||||||
},
|
},
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::{Renderer, Texture},
|
renderer::Renderer,
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
state::State,
|
state::State,
|
||||||
text,
|
text,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use {
|
||||||
cursor::KnownCursor,
|
cursor::KnownCursor,
|
||||||
ifs::wl_seat::{NodeSeatState, WlSeatGlobal},
|
ifs::wl_seat::{NodeSeatState, WlSeatGlobal},
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::Renderer,
|
renderer::Renderer,
|
||||||
tree::{
|
tree::{
|
||||||
walker::NodeVisitor, FindTreeResult, FoundNode, Node, NodeId, OutputNode, StackedNode,
|
walker::NodeVisitor, FindTreeResult, FoundNode, Node, NodeId, OutputNode, StackedNode,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,10 @@ use {
|
||||||
backend::KeyState,
|
backend::KeyState,
|
||||||
cursor::KnownCursor,
|
cursor::KnownCursor,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
|
gfx_apis::gl::Texture,
|
||||||
ifs::wl_seat::{NodeSeatState, SeatId, WlSeatGlobal, BTN_LEFT},
|
ifs::wl_seat::{NodeSeatState, SeatId, WlSeatGlobal, BTN_LEFT},
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::{Renderer, Texture},
|
renderer::Renderer,
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
state::State,
|
state::State,
|
||||||
text,
|
text,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ use {
|
||||||
client::ClientId,
|
client::ClientId,
|
||||||
cursor::KnownCursor,
|
cursor::KnownCursor,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
|
gfx_apis::gl::{Framebuffer, Texture},
|
||||||
ifs::{
|
ifs::{
|
||||||
jay_output::JayOutput,
|
jay_output::JayOutput,
|
||||||
jay_screencast::JayScreencast,
|
jay_screencast::JayScreencast,
|
||||||
|
|
@ -19,7 +20,7 @@ use {
|
||||||
zwlr_layer_shell_v1::{BACKGROUND, BOTTOM, OVERLAY, TOP},
|
zwlr_layer_shell_v1::{BACKGROUND, BOTTOM, OVERLAY, TOP},
|
||||||
},
|
},
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::{Framebuffer, Renderer, Texture},
|
renderer::Renderer,
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
state::State,
|
state::State,
|
||||||
text,
|
text,
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,10 @@ use {
|
||||||
client::Client,
|
client::Client,
|
||||||
cursor::KnownCursor,
|
cursor::KnownCursor,
|
||||||
fixed::Fixed,
|
fixed::Fixed,
|
||||||
|
gfx_apis::gl::Texture,
|
||||||
ifs::wl_seat::{NodeSeatState, WlSeatGlobal},
|
ifs::wl_seat::{NodeSeatState, WlSeatGlobal},
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::{Renderer, Texture},
|
renderer::Renderer,
|
||||||
scale::Scale,
|
scale::Scale,
|
||||||
state::State,
|
state::State,
|
||||||
text,
|
text,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use {
|
||||||
wl_surface::WlSurface,
|
wl_surface::WlSurface,
|
||||||
},
|
},
|
||||||
rect::Rect,
|
rect::Rect,
|
||||||
render::Renderer,
|
renderer::Renderer,
|
||||||
tree::{
|
tree::{
|
||||||
container::ContainerNode, walker::NodeVisitor, ContainingNode, Direction,
|
container::ContainerNode, walker::NodeVisitor, ContainingNode, Direction,
|
||||||
FindTreeResult, FoundNode, Node, NodeId, NodeVisitorBase, OutputNode, StackedNode,
|
FindTreeResult, FoundNode, Node, NodeId, NodeVisitorBase, OutputNode, StackedNode,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue