Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a get_info method to get GL_VENDOR, GL_RENDERER, GL_VERSION #375

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

uggla
Copy link

@uggla uggla commented May 21, 2023

My laptop is equipped with Nvidia Optimus technology, but I wasn't sure about the renderer being utilized by my macroquad applications. To address this, this pull request introduces a method to retrieve information such as GL_VENDOR, GL_RENDERER, and GL_VERSION. This method allows for the identification and confirmation of the correct GPU being utilized.

By incorporating this code into the application, it will provide the following output based on the renderer being used:

    let info = Info::get_info();

    info!("Vendor: {}", info.vendor);
    info!("Renderer: {}", info.renderer);
    info!("Version: {}", info.version);
 🦉 uggla   main  ~  workspace  rust  fztaosi   cargo run --release
   Compiling miniquad v0.3.15 (/home/uggla/workspace/rust/miniquad)
   Compiling macroquad v0.3.25 (/home/uggla/workspace/rust/macroquad)
   Compiling fztaosi v0.1.0 (/home/uggla/workspace/rust/fztaosi)
    Finished release [optimized] target(s) in 12.02s
     Running `target/release/fztaosi`
Vendor: Intel
Renderer: Mesa Intel(R) HD Graphics 630 (KBL GT2)
Version: 4.6 (Compatibility Profile) Mesa 23.0.3
 🦉 uggla   main  ~  workspace  rust  fztaosi __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia cargo run --release
    Finished release [optimized] target(s) in 0.03s
     Running `target/release/fztaosi`
Vendor: NVIDIA Corporation
Renderer: NVIDIA GeForce GTX 1050/PCIe/SSE2
Version: 4.6.0 NVIDIA 530.41.03

IohannRabeson and others added 10 commits March 19, 2023 11:11
Library shouldn't print anything when things are working correctly.
native/linux_x1: fix set_fullscreen

Changed XEvent and XPropertyChange when fullscreen var is false.
native/wasm: implement window_minimized_event

- added extern fn focus in wasm.rs
- added a call to this fn in gl.js
- added calls from XEvent 9 and 10 to the window_events
native/linux_x11: implement set_window_sze
This approach is valuable when working with native applications to
determine the renderer in use. It proves particularly beneficial when
dealing with the Nvidia Optimus renderer.
@notgull
Copy link

notgull commented May 21, 2023

How would this be implemented if we decided to add Metal support?

@not-fl3
Copy link
Owner

not-fl3 commented May 21, 2023

I do not have a really strong opinion here, but I feel that this code belongs to a crate/code snippet for a user code.

It would be hard to rebase it on 0.4.0 branch (the one with metal), but as a crate it is OK to have it GL/certain OSes only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants