Skip to content

Commit cbce959

Browse files
committed
ability to specify debug groups for graphics commands
1 parent 0462d48 commit cbce959

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

fyrox-graphics-gl/src/server.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,4 +1530,19 @@ impl GraphicsServer for GlGraphicsServer {
15301530
fn memory_usage(&self) -> ServerMemoryUsage {
15311531
self.memory_usage.borrow().clone()
15321532
}
1533+
1534+
fn push_debug_group(&self, name: &str) {
1535+
if self.gl.supports_debug() {
1536+
unsafe {
1537+
self.gl
1538+
.push_debug_group(glow::DEBUG_SOURCE_APPLICATION, 0, name)
1539+
}
1540+
}
1541+
}
1542+
1543+
fn pop_debug_group(&self) {
1544+
if self.gl.supports_debug() {
1545+
unsafe { self.gl.pop_debug_group() }
1546+
}
1547+
}
15331548
}

fyrox-graphics/src/server.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ pub trait GraphicsServer: GraphicsServerAsAny {
210210
/// Fetches the total amount of memory used by the graphics server.
211211
fn memory_usage(&self) -> ServerMemoryUsage;
212212

213+
/// Begins a new named debug group.
214+
fn push_debug_group(&self, name: &str);
215+
216+
/// Ends the current debug group.
217+
fn pop_debug_group(&self);
218+
213219
/// A shortcut for [`Self::create_texture`], that creates a rectangular texture with the given
214220
/// size and pixel kind.
215221
fn create_2d_render_target(

0 commit comments

Comments
 (0)