Skip to content

Commit ebadbd9

Browse files
committed
Use actual GPU name as GPU context name
Lets you differentiate between them easier in Tracy.
1 parent eba5fdc commit ebadbd9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/backend/renderer/gles/profiler.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ impl<'a, 'b> Drop for ScopedGpuSpan<'a, 'b> {
8282
#[cfg(feature = "tracy_gpu_profiling")]
8383
mod imp {
8484
use std::cell::Cell;
85+
use std::ffi::CStr;
86+
use std::os::raw::c_char;
87+
88+
use tracing::warn;
8589

8690
use super::{ffi, GpuSpan, SpanLocation};
8791

@@ -195,14 +199,17 @@ mod imp {
195199
return Self { pool: None };
196200
}
197201

202+
let gpu_name = unsafe { CStr::from_ptr(gl.GetString(ffi::RENDERER) as *const c_char).to_str() };
203+
let gpu_name = gpu_name.unwrap_or("GlesRenderer");
204+
198205
let client = tracy_client::Client::start();
199206

200207
let mut gpu_timestamp = 0;
201208
unsafe { gl.GetInteger64v(ffi::TIMESTAMP_EXT, &mut gpu_timestamp) };
202209

203210
let context = client
204211
.new_gpu_context(
205-
Some("GlesRenderer"),
212+
Some(gpu_name),
206213
tracy_client::GpuContextType::OpenGL,
207214
gpu_timestamp,
208215
1.0,

0 commit comments

Comments
 (0)