Skip to content

Commit 703fc03

Browse files
committed
Rework project directory structure
This is a major simplification of the project directory structure. An example of what was confusing before was that there were multiple directories named `generic` and `egl`. Now modules are named more specifically and the directory structure is flattened. The new structure: `src/` - `angle/` <- Windows ANGLE backend - `cgl/` <- macOS CGL backend - `hardware_buffer/` <- Android / OHOS hardware buffer backends - `mesa_surfaceless/` <- Mesa-specific pbuffer surface backend - `multi/` <- multi backend - `wayland/` <- Wayland backend - `wgl/` <- Windows WGL backend - `x11/` <- X11 backend - `base` <- a directory for code that can be shared by multiple backends - `io_surface` <- IOSurface shared code (could be used by future Metal backend) - `egl` <- shared EGL types In addition, this commit removes the full file path included as a comment at the top of every source file. These paths are now incorrect and they were likely only there because the directory structure was so confusing. Signed-off-by: Martin Robinson <mrobinson@abandonedwig.info>
1 parent 73f8bcb commit 703fc03

79 files changed

Lines changed: 178 additions & 339 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

android-example/rust/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use log::Level;
1414
use std::cell::{Cell, RefCell};
1515
use std::mem;
1616
use std::thread::{self, JoinHandle};
17-
use surfman::platform::egl::tests;
17+
use surfman::hardware_buffer::tests;
1818
use surfman::{Connection, NativeContext, NativeDevice};
1919

2020
#[path = "../../../examples/threads.rs"]

build.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// surfman/surfman/build.rs
2-
//
31
//! The `surfman` build script.
42
53
use cfg_aliases::cfg_aliases;

examples/chaos_game.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// surfman/surfman/examples/chaos_game.rs
2-
//
31
//! Demonstrates how to use `surfman` to draw to a window surface via the CPU.
42
53
use euclid::default::{Point2D, Size2D};

examples/offscreen.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// surfman/surfman/examples/offscreen.rs
2-
//
31
//! This example demonstrates how to create an off-screen context and render into it using
42
//! `surfman` alone, without any other windowing libraries.
53
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// surfman/surfman/src/platform/windows/angle/connection.rs
2-
//
31
//! A connection to the window server.
42
//!
53
//! It might seem like this should wrap an `EGLDisplay`, but it doesn't. Unfortunately, in the
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
// surfman/surfman/src/platform/windows/angle/context.rs
2-
//
31
//! Wrapper for EGL contexts managed by ANGLE using Direct3D 11 as a backend on Windows.
42
53
use super::device::Device;
64
use super::surface::{Surface, Synchronization, Win32Objects};
5+
use crate::base::egl::context::{self, CurrentContextGuard};
6+
use crate::base::egl::device::EGL_FUNCTIONS;
7+
use crate::base::egl::error::ToWindowingApiError;
8+
use crate::base::egl::surface::ExternalEGLSurfaces;
79
use crate::context::{ContextID, CREATE_CONTEXT_MUTEX};
810
use crate::egl;
911
use crate::egl::types::{EGLConfig, EGLContext, EGLint};
10-
use crate::platform::generic::egl::context::{self, CurrentContextGuard};
11-
use crate::platform::generic::egl::device::EGL_FUNCTIONS;
12-
use crate::platform::generic::egl::error::ToWindowingApiError;
13-
use crate::platform::generic::egl::surface::ExternalEGLSurfaces;
1412
use crate::surface::Framebuffer;
1513
use crate::{ContextAttributes, Error, Gl, SurfaceInfo};
1614
use euclid::default::Size2D;
@@ -22,7 +20,7 @@ use std::thread;
2220
use winapi::shared::winerror::S_OK;
2321
use winapi::um::winbase::INFINITE;
2422

25-
pub use crate::platform::generic::egl::context::{ContextDescriptor, NativeContext};
23+
pub use crate::base::egl::context::{ContextDescriptor, NativeContext};
2624

2725
/// Represents an OpenGL rendering context.
2826
///
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
// surfman/surfman/src/platform/windows/angle/device.rs
2-
//
31
//! A thread-local handle to the device.
42
53
use super::connection::Connection;
4+
use crate::base::egl::device::EGL_FUNCTIONS;
5+
use crate::base::egl::ffi::EGL_DEVICE_EXT;
6+
use crate::base::egl::ffi::{EGL_D3D11_DEVICE_ANGLE, EGL_EXTENSION_FUNCTIONS};
7+
use crate::base::egl::ffi::{EGL_NO_DEVICE_EXT, EGL_PLATFORM_DEVICE_EXT};
68
use crate::egl;
79
use crate::egl::types::{EGLAttrib, EGLDeviceEXT, EGLDisplay, EGLint};
8-
use crate::platform::generic::egl::device::EGL_FUNCTIONS;
9-
use crate::platform::generic::egl::ffi::EGL_DEVICE_EXT;
10-
use crate::platform::generic::egl::ffi::{EGL_D3D11_DEVICE_ANGLE, EGL_EXTENSION_FUNCTIONS};
11-
use crate::platform::generic::egl::ffi::{EGL_NO_DEVICE_EXT, EGL_PLATFORM_DEVICE_EXT};
1210
use crate::{Error, GLApi};
1311

1412
use std::cell::{RefCell, RefMut};
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// surfman/surfman/src/platform/windows/angle/mod.rs
2-
//
31
//! Bindings to Direct3D 11 via the ANGLE OpenGL-to-Direct3D translation layer on Windows.
42
53
pub mod connection;
@@ -10,5 +8,5 @@ pub mod surface;
108
crate::implement_interfaces!();
119

1210
#[cfg(test)]
13-
#[path = "../../../tests.rs"]
11+
#[path = "../tests.rs"]
1412
mod tests;
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
// surfman/surfman/src/platform/windows/angle/surface.rs
2-
//
31
//! Surface management for Direct3D 11 on Windows using the ANGLE library as a frontend.
42
53
use super::context::{Context, ContextDescriptor};
64
use super::device::Device;
5+
use crate::base::egl::device::EGL_FUNCTIONS;
6+
use crate::base::egl::error::ToWindowingApiError;
7+
use crate::base::egl::ffi::EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE;
8+
use crate::base::egl::ffi::EGL_D3D_TEXTURE_ANGLE;
9+
use crate::base::egl::ffi::EGL_DXGI_KEYED_MUTEX_ANGLE;
10+
use crate::base::egl::ffi::EGL_EXTENSION_FUNCTIONS;
711
use crate::context::ContextID;
812
use crate::egl::types::EGLNativeWindowType;
913
use crate::egl::types::EGLSurface;
1014
use crate::egl::{self, EGLint};
1115
use crate::gl;
12-
use crate::platform::generic::egl::device::EGL_FUNCTIONS;
13-
use crate::platform::generic::egl::error::ToWindowingApiError;
14-
use crate::platform::generic::egl::ffi::EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE;
15-
use crate::platform::generic::egl::ffi::EGL_D3D_TEXTURE_ANGLE;
16-
use crate::platform::generic::egl::ffi::EGL_DXGI_KEYED_MUTEX_ANGLE;
17-
use crate::platform::generic::egl::ffi::EGL_EXTENSION_FUNCTIONS;
1816
use crate::{Error, SurfaceAccess, SurfaceID, SurfaceInfo, SurfaceType};
1917

2018
use euclid::default::Size2D;
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// surfman/surfman/src/platform/generic/egl/context.rs
2-
//
31
//! Functionality common to backends using EGL contexts.
42
53
use super::device::EGL_FUNCTIONS;

0 commit comments

Comments
 (0)