Skip to content

Commit

Permalink
fix x11
Browse files Browse the repository at this point in the history
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
  • Loading branch information
sagudev committed Oct 17, 2024
1 parent d17f6d9 commit 0123962
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/platform/unix/x11/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//
//! OpenGL rendering contexts on X11 via EGL.

use glow::HasContext;

use super::device::Device;
use super::surface::Surface;
use crate::context::ContextID;
Expand All @@ -16,7 +18,7 @@ pub use crate::platform::generic::egl::context::{ContextDescriptor, NativeContex

thread_local! {
#[doc(hidden)]
pub static GL_FUNCTIONS: Gl = Gl::load_with(context::get_proc_address);
pub static GL_FUNCTIONS: Gl = unsafe {Gl::from_loader_function(context::get_proc_address)};
}

/// Represents an OpenGL rendering context.
Expand Down Expand Up @@ -214,7 +216,7 @@ impl Device {
GL_FUNCTIONS.with(|gl| {
unsafe {
// Flush to avoid races on Mesa/Intel and possibly other GPUs.
gl.Flush();
gl.flush();

context
.0
Expand Down
8 changes: 4 additions & 4 deletions src/platform/unix/x11/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ use super::device::Device;
use crate::egl;
use crate::egl::types::EGLint;
use crate::gl;
use crate::gl::types::{GLenum, GLuint};
use crate::platform::generic::egl::context;
use crate::platform::generic::egl::surface::{EGLBackedSurface, EGLSurfaceTexture};
use crate::{Error, SurfaceAccess, SurfaceInfo, SurfaceType};

use euclid::default::Size2D;
use glow::Texture;
use std::marker::PhantomData;
use std::os::raw::c_void;
use x11::xlib::{Window, XGetGeometry};

// FIXME(pcwalton): Is this right, or should it be `TEXTURE_EXTERNAL_OES`?
const SURFACE_GL_TEXTURE_TARGET: GLenum = gl::TEXTURE_2D;
const SURFACE_GL_TEXTURE_TARGET: u32 = gl::TEXTURE_2D;

/// Represents a hardware buffer of pixels that can be rendered to via the CPU or GPU and either
/// displayed in a native widget or bound to a texture for reading.
Expand Down Expand Up @@ -233,7 +233,7 @@ impl Device {
///
/// This will be `GL_TEXTURE_2D` or `GL_TEXTURE_RECTANGLE`, depending on platform.
#[inline]
pub fn surface_gl_texture_target(&self) -> GLenum {
pub fn surface_gl_texture_target(&self) -> u32 {
SURFACE_GL_TEXTURE_TARGET
}

Expand All @@ -251,7 +251,7 @@ impl Device {
///
/// It is only legal to read from, not write to, this texture object.
#[inline]
pub fn surface_texture_object(&self, surface_texture: &SurfaceTexture) -> GLuint {
pub fn surface_texture_object(&self, surface_texture: &SurfaceTexture) -> Option<Texture> {
surface_texture.0.texture_object
}
}
Expand Down

0 comments on commit 0123962

Please sign in to comment.