Skip to content

Commit

Permalink
[luminance-examples] Add a fixture to demonstrate #360.
Browse files Browse the repository at this point in the history
  • Loading branch information
hadronized committed Jul 27, 2020
1 parent 63593b2 commit 50884cc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions luminance-examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ path = "src/interactive-triangle.rs"
name = "skybox"
path = "src/skybox.rs"

# Fixtures
[[bin]]
name = "fixture-360"
path = "src/fixtures/360-manually-drop-framebuffer.rs"

[dependencies]
cgmath = "0.17"
env_logger = "0.7.1"
Expand Down
28 changes: 28 additions & 0 deletions luminance-examples/src/fixtures/360-manually-drop-framebuffer.rs
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());
}

0 comments on commit 50884cc

Please sign in to comment.