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 Oct 28, 2020
1 parent 62d69e7 commit 84f7e58
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
19 changes: 10 additions & 9 deletions integration-tests/desktop/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
mod gl33_f64_uniform;
mod scissor;
mod tess_no_data;

use colored::Colorize as _;

macro_rules! tests {
($($name:expr, $module:ident),*) => {
const TEST_NAMES: &[&str] = &[$(
$name
),*
];
// declare the modules for all tests
$(
mod $module;
)*

// list of all available integration tests
const TEST_NAMES: &[&str] = &[$( $name ),*];

// run a given test
fn run_test(name: &str) {
$(
if name == $name {
Expand All @@ -33,7 +33,8 @@ macro_rules! tests {
tests! {
"gl33-f64-uniform", gl33_f64_uniform,
"tess-no-data", tess_no_data,
"scissor-test", scissor
"scissor-test", scissor,
"360-manually-drop-framebuffer", manually_drop_framebuffer
}

fn main() {
Expand Down
27 changes: 27 additions & 0 deletions integration-tests/desktop/src/manually_drop_framebuffer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//! <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;

pub fn fixture() {
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 _ = surface.new_framebuffer::<Dim2, RGBA32F, Depth32F>([1024, 1024], 0, Sampler::default());
}

0 comments on commit 84f7e58

Please sign in to comment.