1
0
Fork 0
forked from wry/wry

render: load libEGL and libGLESv2 at runtime

This commit is contained in:
Julian Orth 2024-02-22 21:14:40 +01:00
parent aa9ca29996
commit 0c82f02b26
15 changed files with 337 additions and 259 deletions

View file

@ -97,16 +97,17 @@ fn write_egl_procs<W: Write>(f: &mut W) -> anyhow::Result<()> {
writeln!(f, "unsafe impl Send for ExtProc {{ }}")?;
writeln!(f)?;
writeln!(f, "impl ExtProc {{")?;
writeln!(f, " pub fn load() -> Self {{")?;
writeln!(f, " Self {{")?;
writeln!(f, " pub fn load() -> Option<Self> {{")?;
writeln!(f, " let egl = EGL.as_ref()?;")?;
writeln!(f, " Some(Self {{")?;
for (name, _, _) in map.iter().copied() {
writeln!(
f,
" {}: unsafe {{ eglGetProcAddress(\"{}\\0\".as_ptr() as _) }},",
" {}: unsafe {{ (egl.eglGetProcAddress)(\"{}\\0\".as_ptr() as _) }},",
name, name
)?;
}
writeln!(f, " }}")?;
writeln!(f, " }})")?;
writeln!(f, " }}")?;
for (name, ret, args) in map.iter().copied() {
let mut args_names = String::new();