From 7b0edcfc6a07ff4d64e602f2b68d93fedc8b826d Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 2 Aug 2026 16:11:30 +0200 Subject: fix(engine): improve portability by making matrices row-major --- engine/src/rendering/backend/opengl.rs | 37 +++++++++++++--------------------- engine/src/rendering/shader.rs | 5 ++--- 2 files changed, 16 insertions(+), 26 deletions(-) (limited to 'engine/src/rendering') diff --git a/engine/src/rendering/backend/opengl.rs b/engine/src/rendering/backend/opengl.rs index 1253c7b..f88fe38 100644 --- a/engine/src/rendering/backend/opengl.rs +++ b/engine/src/rendering/backend/opengl.rs @@ -76,7 +76,6 @@ use crate::ecs::query::term::Without; use crate::ecs::sole::Single; use crate::ecs::{Component, Query, Sole}; use crate::image::{ColorType as ImageColorType, Image}; -use crate::matrix::Matrix; use crate::reflection::EnumReflectionExt; use crate::rendering::backend::opengl::glutin_compat::{ DisplayBuilder, @@ -187,16 +186,14 @@ impl crate::ecs::extension::Extension for Extension } fn prepare_windows( - window_query: Query< - ( - Option<&Window>, - &mut WindowCreationAttributes, - With, - Without, - Without, - Without, - ), - >, + window_query: Query<( + Option<&Window>, + &mut WindowCreationAttributes, + With, + Without, + Without, + Without, + )>, windowing_context: Single, graphics_props: Single, mut actions: Actions, @@ -272,9 +269,12 @@ fn prepare_windows( #[tracing::instrument(skip_all)] fn init_window_graphics( - window_query: Query< - (&Window, &WindowGlConfig, With, Without), - >, + window_query: Query<( + &Window, + &WindowGlConfig, + With, + Without, + )>, windowing_context: Single, graphics_props: Single, mut graphics_ctx: Single, @@ -1485,15 +1485,6 @@ impl From> } } -impl From> - for opengl_bindings::data_types::Matrix -{ - fn from(matrix: Matrix) -> Self - { - Self { items: matrix.items } - } -} - impl From> for opengl_bindings::data_types::Dimens { fn from(dimens: Dimens) -> Self diff --git a/engine/src/rendering/shader.rs b/engine/src/rendering/shader.rs index 7d5bd51..b508670 100644 --- a/engine/src/rendering/shader.rs +++ b/engine/src/rendering/shader.rs @@ -28,12 +28,11 @@ use crate::asset::{ Submitter as AssetSubmitter, HANDLE_ASSETS_PHASE, }; -use crate::ecs::pair; use crate::builder; use crate::ecs::pair::ChildOf; use crate::ecs::phase::{Phase, POST_UPDATE as POST_UPDATE_PHASE}; use crate::ecs::sole::Single; -use crate::ecs::{declare_entity, Component, Sole}; +use crate::ecs::{declare_entity, pair, Component, Sole}; pub mod cursor; pub mod default; @@ -1018,7 +1017,7 @@ pub(super) fn prepare(collector: &mut crate::ecs::extension::Collector<'_>) let session_options = shader_slang::CompilerOptions::default() .optimization(shader_slang::OptimizationLevel::None) - .matrix_layout_column(true) + .matrix_layout_row(true) .debug_information(SlangDebugInfoLevel::Maximal) .no_mangle(true); -- cgit v1.2.3-18-g5258