Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,26 @@ hashes are given where a change is easiest to understand by reading the commit.
`nvram` ones, so both chips get a real MAC regardless of machine profile.
### Graphics and host OpenGL

- **Host GL on Linux.** `--features hostgl` now has an EGL backend
(`iris-hostgl/src/backend/egl.rs`): headless contexts in the compatibility
profile with no surface at all (every drawable was already a framebuffer
object), on Mesa's surfaceless platform, so no X or Wayland session is
involved. libEGL is opened at run time; building links libGL (glvnd):
`libgl-dev` on Debian/Ubuntu, `libglvnd-devel` on Fedora, `libglvnd` on
Arch. Running needs libEGL and Mesa's EGL and DRI drivers: `libegl1
libegl-mesa0 libgl1-mesa-dri` on Debian/Ubuntu (`libegl-mesa0` alone does
not bring libEGL), `mesa-libEGL mesa-dri-drivers` on Fedora, `mesa` on
Arch. glvnd and Mesa hand
out a stub for any `gl*` name, so entry points are looked up only when the
context's version or extensions provide them (`src/avail.rs`, generated
from the pinned registry by `tools/gl_avail.py`). The service's own texture
names now count down from the top, out of the way of Mesa's, which come
from the bottom whatever the program asked for. Debian 12 arm64 (Mesa
22.3, virgl, GL 4.0 compatibility): hostgl tests 31/31, gltest 167/167 n32
and o32, glcheck with the reference checksum, irisgltest, Quake 3. Fedora
44, Arch and Ubuntu 24.04 (x86_64, Mesa's software renderer, no GPU):
builds, hostgl tests 31/31. See
`rules/hostgl/linux-egl-and-mesa.md`.
- **Host GL no longer stops the machine while it draws.** A host call is
answered on the emulated CPU's thread, so while host GL replayed a
command buffer (2-5 ms for a big one) no instruction ran and no interrupt
Expand Down
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
members = ["iris-gui", "iris-hostcall"]
# iris-hostgl is built only through `--features hostgl`, never by a plain or
# `--workspace` build: it links the host's OpenGL (CGL today), which hosts
# `--workspace` build: it links the host's OpenGL (OpenGL.framework, libGL), which hosts
# such as RISC-V boards do not have.
exclude = ["iris-hostgl"]

Expand Down Expand Up @@ -253,8 +253,9 @@ hostcall = ["dep:iris-hostcall"]
# Host OpenGL for IRIX programs (iris-hostgl/): host call 3000, answered by
# replaying the replacement libGL's command stream on the host GPU. The IRIX
# side libraries are the iris-guest-tools project
# (github.com/atomchild411/iris-guest-tools). macOS only for now (CGL); on
# other hosts the service is not registered and the guest's libGL says so.
# (github.com/atomchild411/iris-guest-tools). macOS (CGL) and Linux (EGL with
# libGL); on other hosts the service is not registered and the guest's libGL
# says so.
# Off by default, and iris-hostgl is outside the workspace members, so
# nothing builds it unless this feature is asked for.
hostgl = ["hostcall", "dep:iris-hostgl"]
Expand Down
4 changes: 2 additions & 2 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Select with `cargo build --release --features <comma-separated-list>`; add
| `jitv2_smc_check` | Report writes to the executing code page; disable inline memory to observe all stores. | `jitv2` |
| `pcap` | Raw Ethernet bridge backend; needs host capture library/driver and capture permissions. | `dep:pcap` |
| `hostcall` | Private user-mode guest syscall services 3000–3009; IRIX handles other calls. | `dep:iris-hostcall` |
| `hostgl` | Guest replacement-libGL command replay; macOS CGL backend only. | `hostcall`, `dep:iris-hostgl` |
| `hostgl` | Guest replacement-libGL command replay; macOS (CGL) and Linux (EGL) backends. | `hostcall`, `dep:iris-hostgl` |

Cargo also exposes these **implicit optional-dependency features**:
`cranelift-codegen`, `cranelift-frontend`, `cranelift-jit`, `cranelift-module`, `cranelift-native`, `region`, `target-lexicon`, `wasmtime-jit-icache-coherence`. They enable library dependencies,
Expand Down Expand Up @@ -515,7 +515,7 @@ both the interpreter and jitv2.
| `jitv2_smc_check` | Report writes into the page the CPU is executing (run with `j2 inline_mem off`) |
| `jitv2_opcodefusion` | jitv2 LUI+ORI/ADDIU and branch+NOP fusion (off by default; see "JIT compilers") |
| `j2wp` | Compatibility alias for `jitv2`; whole-page compilation is the only implementation |
| `hostcall` / `hostgl` | Private host-service syscalls / host OpenGL for IRIX programs; `hostgl` has a macOS CGL backend |
| `hostcall` / `hostgl` | Private host-service syscalls / host OpenGL for IRIX programs; `hostgl` has macOS (CGL) and Linux (EGL) backends |
| `debug_cache` | Track one cache line across all operations |
| `tlbvmap` | Vestigial; the vmap TLB fast path is always on |
| `r5ksc`, `r5ksc_triton` | Refuse to build: no working R5000 secondary-cache model yet (`rules/testing/r5k-l1i-cache-bugs.md`) |
Expand Down
6 changes: 3 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ condition; update the linked guide and changelog when it lands.

## Host services, GUI, and delivery

- [ ] **Implementation — HostGL platform and extension coverage.** macOS CGL
is the only backend; Linux/Windows builds register no GL service. Either add
those backends or keep availability explicit. Inventory unavailable GL
- [ ] **Implementation — HostGL platform and extension coverage.** macOS (CGL)
and Linux (EGL) have backends; Windows builds register no GL service. Either
add that backend or keep availability explicit. Inventory unavailable GL
entry points and finish SGIS detail/sharpen/filter query result lengths,
which currently report unsupported. Complete when guest capability queries,
marshalling/readback, contexts/drawables, and representative GL apps behave
Expand Down
2 changes: 1 addition & 1 deletion iris-gui-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ emulation will be noticeably slow.
|---|---|
| `pcap` | PCAP bridged networking; the Networking tab lists host interfaces. Needs libpcap / a WinPcap-compatible SDK |
| `hostcall` | Host services for IRIX programs over private syscalls 3000-3009. No per-machine setting — the Debug tab just reports it's built in |
| `hostgl` | Host OpenGL for IRIX programs (implies `hostcall`); IRIX's replacement libGL replays its GL calls on the host GPU. macOS (CGL) only for now — builds elsewhere but registers no backend |
| `hostgl` | Host OpenGL for IRIX programs (implies `hostcall`); IRIX's replacement libGL replays its GL calls on the host GPU. macOS (CGL) and Linux (EGL; needs libGL to build, libEGL and Mesa's EGL/DRI drivers at run time; see CHANGELOG) — builds elsewhere but registers no backend |
| `premiere` | `iris/lightning` + `iris/idle-pause` for maximum in-process speed |
| `bundled` | Distributed build: hides the iris.toml import/export items. Set by the Release workflow |
| `appstore` | Mac App Store build: implies `bundled`, hides the CI tab, enables security-scoped bookmarks and folder grants |
Expand Down
6 changes: 3 additions & 3 deletions iris-gui/src/config_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1587,11 +1587,11 @@ fn show_debug(ui: &mut Ui, cfg: &mut MachineConfig) -> ConfigAction {
ui.end_row();
ui.label("Host services / Host GL");
ui.label(match (build_features::HOSTCALL, build_features::HOSTGL) {
(_, true) => "built in — IRIX OpenGL programs render on the host GPU (CGL)",
(true, false) if cfg!(target_os = "macos") =>
(_, true) => "built in — IRIX OpenGL programs render on the host GPU",
(true, false) if cfg!(any(target_os = "macos", target_os = "linux")) =>
"hostcall only — rebuild with --features hostgl for host OpenGL",
(true, false) =>
"hostcall only — host GL has no backend on this OS yet (macOS/CGL only)",
"hostcall only — host GL has no backend on this OS yet (macOS and Linux only)",
(false, _) => "not built — rebuild with --features hostgl for host OpenGL",
});
ui.end_row();
Expand Down
6 changes: 3 additions & 3 deletions iris-hostgl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "BSD-3-Clause"
iris-hostcall = { path = "../iris-hostcall" }
log = "0.4"

# The only backend so far is Apple's OpenGL.framework (CGL); elsewhere the
# crate builds and registers nothing.
[target.'cfg(target_os = "macos")'.dependencies]
# Backends: Apple's OpenGL.framework (CGL) on the Mac, EGL with libGL (glvnd)
# on Linux; elsewhere the crate builds and registers nothing.
[target.'cfg(any(target_os = "macos", target_os = "linux"))'.dependencies]
libc = "0.2"
9 changes: 5 additions & 4 deletions iris-hostgl/src/accum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,23 @@
//! state is saved around each pass and put back, so nothing it can see moves.

use std::collections::HashMap;
use std::ffi::{c_void, CString};
use std::ffi::{c_char, c_void, CString};

use crate::gl::*;

#[link(name = "OpenGL", kind = "framework")]
#[cfg_attr(target_os = "macos", link(name = "OpenGL", kind = "framework"))]
#[cfg_attr(target_os = "linux", link(name = "GL"))]
extern "C" {
fn glCreateShader(kind: u32) -> u32;
fn glShaderSource(s: u32, count: i32, strings: *const *const i8, lengths: *const i32);
fn glShaderSource(s: u32, count: i32, strings: *const *const c_char, lengths: *const i32);
fn glCompileShader(s: u32);
fn glGetShaderiv(s: u32, pname: u32, out: *mut i32);
fn glCreateProgram() -> u32;
fn glAttachShader(p: u32, s: u32);
fn glLinkProgram(p: u32);
fn glGetProgramiv(p: u32, pname: u32, out: *mut i32);
fn glUseProgram(p: u32);
fn glGetUniformLocation(p: u32, name: *const i8) -> i32;
fn glGetUniformLocation(p: u32, name: *const c_char) -> i32;
fn glUniform1i(loc: i32, v: i32);
fn glUniform4f(loc: i32, a: f32, b: f32, c: f32, d: f32);
fn glGenTextures(n: i32, ids: *mut u32);
Expand Down
Loading
Loading