assert renderer in init stage

This commit is contained in:
griffi-gh 2023-02-10 00:56:03 +01:00
parent 54004ee5de
commit 06e94ccb46
2 changed files with 5 additions and 11 deletions

View file

@ -57,7 +57,6 @@ use rendering::{
RenderTarget, RenderTarget,
BackgroundColor, BackgroundColor,
clear_background, clear_background,
assert_renderer,
primitives::init_primitives, primitives::init_primitives,
selection_box::render_selection_box, selection_box::render_selection_box,
world::draw_world, world::draw_world,
@ -73,7 +72,6 @@ use gui::{render_gui, init_gui, gui_testing, update_gui};
fn startup() -> Workload { fn startup() -> Workload {
( (
assert_renderer,
initial_resize_event, initial_resize_event,
load_settings, load_settings,
load_prefabs, load_prefabs,

View file

@ -1,4 +1,4 @@
use shipyard::{Unique, NonSendSync, UniqueView, UniqueViewMut}; use shipyard::{Unique, NonSendSync, UniqueView, UniqueViewMut, AllStoragesView};
use glium::{ use glium::{
Display, Surface, Display, Surface,
Version, Api, Version, Api,
@ -35,18 +35,14 @@ impl Renderer {
.with_gl_profile(GlProfile::Core); .with_gl_profile(GlProfile::Core);
let display = Display::new(wb, cb, event_loop) let display = Display::new(wb, cb, event_loop)
.expect("Failed to create a glium Display"); .expect("Failed to create a glium Display");
log::info!("renderer: {}", display.get_opengl_renderer_string()); log::info!("Renderer: {}", display.get_opengl_renderer_string());
log::info!("oepngl {}", display.get_opengl_version_string()); log::info!("OpenGL {}", display.get_opengl_version_string());
log::info!("Supports GLES {:?}", display.get_supported_glsl_version());
assert!(display.is_glsl_version_supported(&Version(Api::GlEs, 3, 0)), "GLES 3.0 is not supported");
Self { display } Self { display }
} }
} }
pub fn assert_renderer(
renderer: NonSendSync<UniqueView<Renderer>>
) {
assert!(renderer.display.is_glsl_version_supported(&Version(Api::GlEs, 3, 0)), "GLES 3.0 is not supported");
}
pub fn clear_background( pub fn clear_background(
mut target: NonSendSync<UniqueViewMut<RenderTarget>>, mut target: NonSendSync<UniqueViewMut<RenderTarget>>,
color: UniqueView<BackgroundColor>, color: UniqueView<BackgroundColor>,