-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[luminance-examples] Add a fixture to demonstrate #360.
- Loading branch information
1 parent
63593b2
commit 50884cc
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
luminance-examples/src/fixtures/360-manually-drop-framebuffer.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//! <https://github.com/phaazon/luminance-rs/issues/360> | ||
//! | ||
//! When a framebuffer is created, dropped and a new one is created, the new framebuffer doesn’t | ||
//! seem to behave correctly. At the time of #360, it was detected on Windows. | ||
//! | ||
//! Because this example simply creates a framebuffer, drops it and creates another one, nothing is | ||
//! displayed and the window flashes on the screen. Run the application in a tool such as apitrace | ||
//! or renderdoc to analyze it. | ||
use luminance::context::GraphicsContext as _; | ||
use luminance::pixel::{Depth32F, RGBA32F}; | ||
use luminance::texture::{Dim2, Sampler}; | ||
use luminance_glfw::GlfwSurface; | ||
use luminance_windowing::WindowOpt; | ||
|
||
fn main() { | ||
let mut surface = | ||
GlfwSurface::new_gl33("fixture-360", WindowOpt::default()).expect("GLFW surface"); | ||
|
||
let framebuffer = | ||
surface.new_framebuffer::<Dim2, RGBA32F, Depth32F>([1024, 1024], 0, Sampler::default()); | ||
|
||
std::mem::drop(framebuffer); | ||
|
||
// #360 occurs here after the drop | ||
let framebuffer = | ||
surface.new_framebuffer::<Dim2, RGBA32F, Depth32F>([1024, 1024], 0, Sampler::default()); | ||
} |