diff --git a/librashader-common/Cargo.toml b/librashader-common/Cargo.toml index 291ffae..eed6ec1 100644 --- a/librashader-common/Cargo.toml +++ b/librashader-common/Cargo.toml @@ -8,7 +8,6 @@ edition = "2021" [features] default = [] opengl = ["gl"] -directx = ["windows"] [dependencies] gl = { version = "0.14.0", optional = true } diff --git a/librashader-runtime-gl/src/filter_chain.rs b/librashader-runtime-gl/src/filter_chain.rs index 6a77461..d1dde29 100644 --- a/librashader-runtime-gl/src/filter_chain.rs +++ b/librashader-runtime-gl/src/filter_chain.rs @@ -266,7 +266,7 @@ impl FilterChain { for (index, texture) in textures.iter().enumerate() { let image = Image::load(&texture.path)?; let levels = if texture.mipmap { - util::calc_miplevel(image.width, image.height) + util::calc_miplevel(image.size) } else { 1u32 }; @@ -279,8 +279,8 @@ impl FilterChain { gl::TEXTURE_2D, levels as GLsizei, gl::RGBA8, - image.width as GLsizei, - image.height as GLsizei, + image.size.width as GLsizei, + image.size.height as GLsizei, ); gl::PixelStorei(gl::UNPACK_ROW_LENGTH, 0); @@ -291,8 +291,8 @@ impl FilterChain { 0, 0, 0, - image.width as GLsizei, - image.height as GLsizei, + image.size.width as GLsizei, + image.size.height as GLsizei, gl::RGBA, gl::UNSIGNED_BYTE, image.bytes.as_ptr().cast(), @@ -347,10 +347,7 @@ impl FilterChain { image: GlImage { handle, format: gl::RGBA8, - size: Size { - width: image.width, - height: image.height, - }, + size: image.size, padded_size: Size::default(), }, filter: texture.filter_mode, diff --git a/librashader-runtime-gl/src/framebuffer.rs b/librashader-runtime-gl/src/framebuffer.rs index a097836..9b0744a 100644 --- a/librashader-runtime-gl/src/framebuffer.rs +++ b/librashader-runtime-gl/src/framebuffer.rs @@ -248,7 +248,7 @@ impl Framebuffer { size.height = 1; } - self.levels = util::calc_miplevel(size.width, size.height); + self.levels = util::calc_miplevel(size); if self.levels > self.max_levels { self.levels = self.max_levels; } @@ -288,7 +288,7 @@ impl Framebuffer { gl::GenTextures(1, &mut self.image); gl::BindTexture(1, self.image); - self.levels = util::calc_miplevel(size.width, size.height); + self.levels = util::calc_miplevel(size); if self.levels > self.max_levels { self.levels = self.max_levels; } diff --git a/librashader-runtime-gl/src/lib.rs b/librashader-runtime-gl/src/lib.rs index b9e8837..d4a7054 100644 --- a/librashader-runtime-gl/src/lib.rs +++ b/librashader-runtime-gl/src/lib.rs @@ -27,7 +27,7 @@ mod tests { fn triangle_gl() { let (glfw, window, events, shader, vao) = hello_triangle::setup(); let mut filter = - FilterChain::load_from_path("../test/slang-shaders/vhs/VHSPro.slangp") + FilterChain::load_from_path("../test/slang-shaders/crt/crt-royale.slangp") .unwrap(); hello_triangle::do_loop(glfw, window, events, shader, vao, &mut filter); } diff --git a/librashader-runtime-gl/src/util.rs b/librashader-runtime-gl/src/util.rs index 3668f0c..08df387 100644 --- a/librashader-runtime-gl/src/util.rs +++ b/librashader-runtime-gl/src/util.rs @@ -1,9 +1,9 @@ use crate::framebuffer::GlImage; use gl::types::{GLenum, GLuint}; -use librashader_common::{FilterMode, WrapMode}; +use librashader_common::{FilterMode, Size, WrapMode}; -pub fn calc_miplevel(width: u32, height: u32) -> u32 { - let mut size = std::cmp::max(width, height); +pub fn calc_miplevel(size: Size) -> u32 { + let mut size = std::cmp::max(size.width, size.height); let mut levels = 0; while size != 0 { levels += 1;