From d943ba194b3cfab18354e96f7be2c1e434d6c073 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Sun, 26 Apr 2026 22:56:52 -0400 Subject: Update --- crates/renderer/src/ffi/egl.rs | 41 +++++++++++++++++++++++++++++++++++++++++ crates/renderer/src/ffi/glfw.rs | 7 +++++++ crates/renderer/src/ffi/mod.rs | 2 ++ 3 files changed, 50 insertions(+) create mode 100644 crates/renderer/src/ffi/egl.rs create mode 100644 crates/renderer/src/ffi/glfw.rs create mode 100644 crates/renderer/src/ffi/mod.rs (limited to 'crates/renderer/src/ffi') diff --git a/crates/renderer/src/ffi/egl.rs b/crates/renderer/src/ffi/egl.rs new file mode 100644 index 0000000..33a39d4 --- /dev/null +++ b/crates/renderer/src/ffi/egl.rs @@ -0,0 +1,41 @@ +// from +pub const EGL_NONE: EGLenum = 0x3038; +pub const EGL_WIDTH: EGLenum = 0x3057; +pub const EGL_HEIGHT: EGLenum = 0x3056; + +// from +pub const EGL_LINUX_DMA_BUF_EXT: EGLenum = 0x3270; +pub const EGL_LINUX_DRM_FOURCC_EXT: EGLenum = 0x3271; +pub const EGL_DMA_BUF_PLANE0_FD_EXT: EGLenum = 0x3272; +pub const EGL_DMA_BUF_PLANE0_OFFSET_EXT: EGLenum = 0x3273; +pub const EGL_DMA_BUF_PLANE0_PITCH_EXT: EGLenum = 0x3274; + +#[repr(C)] +pub struct EGLDisplayTarget(()); +pub type EGLDisplay = *mut EGLDisplayTarget; + +#[repr(C)] +pub struct EGLContextTarget(()); +pub type EGLContext = *mut EGLContextTarget; + +#[repr(C)] +pub struct EGLClientBufferTarget(()); +pub type EGLClientBuffer = *mut EGLClientBufferTarget; + +#[repr(C)] +pub struct EGLImageTarget(()); +pub type EGLImage = *mut EGLImageTarget; + +pub type EGLenum = core::ffi::c_uint; + +pub type EGLAttrib = libc::intptr_t; + +#[link(name = "EGL")] +extern "C" { + pub fn eglCreateImage(d: EGLDisplay, c: EGLContext, t: EGLenum, buf: EGLClientBuffer, attribs: *const EGLAttrib) -> EGLImage; +} + +#[link(name = "GL")] +extern "C" { + pub fn glEGLImageTargetTexture2DOES(t: u32, img: EGLImage); +} diff --git a/crates/renderer/src/ffi/glfw.rs b/crates/renderer/src/ffi/glfw.rs new file mode 100644 index 0000000..1b79089 --- /dev/null +++ b/crates/renderer/src/ffi/glfw.rs @@ -0,0 +1,7 @@ +use super::egl::*; + +#[link(name = "glfw")] +extern "C" { + pub fn glfwGetEGLDisplay() -> EGLDisplay; + pub fn glfwGetEGLContext(w: *mut glfw::ffi::GLFWwindow) -> EGLContext; +} diff --git a/crates/renderer/src/ffi/mod.rs b/crates/renderer/src/ffi/mod.rs new file mode 100644 index 0000000..a98fd71 --- /dev/null +++ b/crates/renderer/src/ffi/mod.rs @@ -0,0 +1,2 @@ +pub mod egl; +pub mod glfw; -- cgit v1.2.3