test: clean up imports and features
This commit is contained in:
parent
5c726efe21
commit
443fa20d22
|
@ -23,6 +23,9 @@ glfw = { workspace = true, optional = true }
|
||||||
ash = { workspace = true, optional = true }
|
ash = { workspace = true, optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
default = ["full"]
|
||||||
|
|
||||||
|
full = ["vulkan", "opengl", "wgpu", "d3d9", "d3d11", "d3d12", "metal"]
|
||||||
vulkan = ["librashader/runtime-vk", "dep:ash"]
|
vulkan = ["librashader/runtime-vk", "dep:ash"]
|
||||||
opengl = ["librashader/runtime-gl", "dep:glow", "dep:glfw"]
|
opengl = ["librashader/runtime-gl", "dep:glow", "dep:glfw"]
|
||||||
wgpu = ["librashader/runtime-wgpu", "dep:wgpu", "dep:wgpu-types"]
|
wgpu = ["librashader/runtime-wgpu", "dep:wgpu", "dep:wgpu-types"]
|
||||||
|
|
|
@ -13,7 +13,7 @@ impl RenderTest for Direct3D11 {
|
||||||
Direct3D11::new(path)
|
Direct3D11::new(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
fn render(&mut self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
||||||
let (renderbuffer, rtv) = self.create_renderbuffer(self.image_bytes.size)?;
|
let (renderbuffer, rtv) = self.create_renderbuffer(self.image_bytes.size)?;
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -3,16 +3,15 @@ use anyhow::anyhow;
|
||||||
use image::RgbaImage;
|
use image::RgbaImage;
|
||||||
use librashader::runtime::d3d9::{FilterChain, FilterChainOptions};
|
use librashader::runtime::d3d9::{FilterChain, FilterChainOptions};
|
||||||
use librashader::runtime::Viewport;
|
use librashader::runtime::Viewport;
|
||||||
use librashader_runtime::image::{Image, PixelFormat, UVDirection, ARGB8, BGRA8};
|
use librashader_runtime::image::{Image, PixelFormat, UVDirection, BGRA8};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use windows::Win32::Foundation::{HWND, TRUE};
|
use windows::Win32::Foundation::{HWND, TRUE};
|
||||||
use windows::Win32::Graphics::Direct3D9::{
|
use windows::Win32::Graphics::Direct3D9::{
|
||||||
Direct3DCreate9, IDirect3D9, IDirect3DDevice9, IDirect3DTexture9, D3DADAPTER_DEFAULT,
|
Direct3DCreate9, IDirect3D9, IDirect3DDevice9, IDirect3DTexture9, D3DADAPTER_DEFAULT,
|
||||||
D3DCREATE_HARDWARE_VERTEXPROCESSING, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, D3DFMT_R8G8B8,
|
D3DCREATE_HARDWARE_VERTEXPROCESSING, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, D3DLOCKED_RECT,
|
||||||
D3DFMT_UNKNOWN, D3DLOCKED_RECT, D3DPOOL_DEFAULT, D3DPOOL_MANAGED, D3DPOOL_SCRATCH,
|
D3DPOOL_DEFAULT, D3DPOOL_MANAGED, D3DPOOL_SYSTEMMEM, D3DPRESENT_INTERVAL_IMMEDIATE,
|
||||||
D3DPOOL_SYSTEMMEM, D3DPRESENT_INTERVAL_IMMEDIATE, D3DPRESENT_PARAMETERS, D3DRS_CLIPPING,
|
D3DPRESENT_PARAMETERS, D3DSURFACE_DESC, D3DSWAPEFFECT_DISCARD, D3DUSAGE_RENDERTARGET,
|
||||||
D3DRS_CULLMODE, D3DRS_LIGHTING, D3DRS_ZENABLE, D3DRS_ZFUNC, D3DSURFACE_DESC,
|
D3D_SDK_VERSION,
|
||||||
D3DSWAPEFFECT_DISCARD, D3DUSAGE_DYNAMIC, D3DUSAGE_RENDERTARGET, D3D_SDK_VERSION,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Direct3D9 {
|
pub struct Direct3D9 {
|
||||||
|
@ -30,7 +29,7 @@ impl RenderTest for Direct3D9 {
|
||||||
Direct3D9::new(path)
|
Direct3D9::new(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
fn render(&mut self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut filter_chain = FilterChain::load_from_path(
|
let mut filter_chain = FilterChain::load_from_path(
|
||||||
path,
|
path,
|
||||||
|
|
|
@ -29,7 +29,7 @@ impl RenderTest for OpenGl3 {
|
||||||
OpenGl3::new(path)
|
OpenGl3::new(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
fn render(&mut self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
||||||
let mut filter_chain = unsafe {
|
let mut filter_chain = unsafe {
|
||||||
FilterChain::load_from_path(
|
FilterChain::load_from_path(
|
||||||
path,
|
path,
|
||||||
|
@ -55,7 +55,7 @@ impl RenderTest for OpenGl4 {
|
||||||
OpenGl4::new(path)
|
OpenGl4::new(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
fn render(&mut self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
||||||
let mut filter_chain = unsafe {
|
let mut filter_chain = unsafe {
|
||||||
FilterChain::load_from_path(
|
FilterChain::load_from_path(
|
||||||
path,
|
path,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#[cfg(feature = "d3d11")]
|
#[cfg(all(windows, feature = "d3d11"))]
|
||||||
pub mod d3d11;
|
pub mod d3d11;
|
||||||
|
|
||||||
#[cfg(feature = "d3d12")]
|
#[cfg(all(windows, feature = "d3d12"))]
|
||||||
pub mod d3d12;
|
pub mod d3d12;
|
||||||
|
|
||||||
#[cfg(feature = "d3d9")]
|
#[cfg(all(windows, feature = "d3d9"))]
|
||||||
pub mod d3d9;
|
pub mod d3d9;
|
||||||
|
|
||||||
#[cfg(feature = "opengl")]
|
#[cfg(feature = "opengl")]
|
||||||
|
@ -16,7 +16,7 @@ pub mod vk;
|
||||||
#[cfg(feature = "wgpu")]
|
#[cfg(feature = "wgpu")]
|
||||||
pub mod wgpu;
|
pub mod wgpu;
|
||||||
|
|
||||||
#[cfg(feature = "metal")]
|
#[cfg(all(target_vendor = "apple", feature = "metal"))]
|
||||||
pub mod mtl;
|
pub mod mtl;
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
@ -66,7 +66,7 @@ mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "d3d11")]
|
#[cfg(all(windows, feature = "d3d11"))]
|
||||||
pub fn test_d3d11() -> anyhow::Result<()> {
|
pub fn test_d3d11() -> anyhow::Result<()> {
|
||||||
do_test::<crate::render::d3d11::Direct3D11>()
|
do_test::<crate::render::d3d11::Direct3D11>()
|
||||||
}
|
}
|
||||||
|
@ -96,19 +96,19 @@ mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "metal")]
|
#[cfg(all(target_vendor = "apple", feature = "metal"))]
|
||||||
pub fn test_metal() -> anyhow::Result<()> {
|
pub fn test_metal() -> anyhow::Result<()> {
|
||||||
do_test::<crate::render::mtl::Metal>()
|
do_test::<crate::render::mtl::Metal>()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "d3d9")]
|
#[cfg(all(windows, feature = "d3d9"))]
|
||||||
pub fn test_d3d9() -> anyhow::Result<()> {
|
pub fn test_d3d9() -> anyhow::Result<()> {
|
||||||
do_test::<crate::render::d3d9::Direct3D9>()
|
do_test::<crate::render::d3d9::Direct3D9>()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "d3d12")]
|
#[cfg(all(windows, feature = "d3d12"))]
|
||||||
pub fn test_d3d12() -> anyhow::Result<()> {
|
pub fn test_d3d12() -> anyhow::Result<()> {
|
||||||
do_test::<crate::render::d3d12::Direct3D12>()
|
do_test::<crate::render::d3d12::Direct3D12>()
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ impl RenderTest for Metal {
|
||||||
Metal::new(path)
|
Metal::new(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
fn render(&mut self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
||||||
let queue = self
|
let queue = self
|
||||||
.device
|
.device
|
||||||
.newCommandQueue()
|
.newCommandQueue()
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
use crate::render::vk::physical_device::QueueFamilyIndices;
|
|
||||||
use ash::prelude::VkResult;
|
|
||||||
use ash::vk;
|
use ash::vk;
|
||||||
use ash::vk::CommandBufferResetFlags;
|
|
||||||
use gpu_allocator::vulkan::Allocator;
|
use gpu_allocator::vulkan::Allocator;
|
||||||
use librashader::runtime::vk::VulkanObjects;
|
use librashader::runtime::vk::VulkanObjects;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
|
|
@ -8,7 +8,7 @@ use image::RgbaImage;
|
||||||
use librashader::runtime::vk::{FilterChain, FilterChainOptions, VulkanImage};
|
use librashader::runtime::vk::{FilterChain, FilterChainOptions, VulkanImage};
|
||||||
use librashader::runtime::Viewport;
|
use librashader::runtime::Viewport;
|
||||||
use librashader_runtime::image::{Image, UVDirection, BGRA8};
|
use librashader_runtime::image::{Image, UVDirection, BGRA8};
|
||||||
use std::io::{Cursor, Write};
|
use std::io::Write;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
mod base;
|
mod base;
|
||||||
|
@ -32,7 +32,7 @@ impl RenderTest for Vulkan {
|
||||||
Vulkan::new(path)
|
Vulkan::new(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
fn render(&mut self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut filter_chain = FilterChain::load_from_path(
|
let mut filter_chain = FilterChain::load_from_path(
|
||||||
path,
|
path,
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
use ash::vk;
|
use ash::vk;
|
||||||
use gpu_allocator::vulkan::{Allocator, AllocatorCreateDesc};
|
|
||||||
|
|
||||||
use gpu_allocator::AllocationSizes;
|
|
||||||
use parking_lot::Mutex;
|
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub unsafe fn vulkan_image_layout_transition_levels(
|
pub unsafe fn vulkan_image_layout_transition_levels(
|
||||||
|
|
|
@ -5,7 +5,7 @@ use librashader::runtime::wgpu::*;
|
||||||
use librashader::runtime::Viewport;
|
use librashader::runtime::Viewport;
|
||||||
use librashader_runtime::image::{Image, UVDirection};
|
use librashader_runtime::image::{Image, UVDirection};
|
||||||
use std::io::{Cursor, Write};
|
use std::io::{Cursor, Write};
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::DerefMut;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use wgpu::{Adapter, Device, Instance, Queue, Texture};
|
use wgpu::{Adapter, Device, Instance, Queue, Texture};
|
||||||
|
@ -56,7 +56,7 @@ impl RenderTest for Wgpu {
|
||||||
Wgpu::new(path)
|
Wgpu::new(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(&self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
fn render(&mut self, path: impl AsRef<Path>, frame_count: usize) -> anyhow::Result<RgbaImage> {
|
||||||
let mut chain = FilterChain::load_from_path(
|
let mut chain = FilterChain::load_from_path(
|
||||||
path,
|
path,
|
||||||
Arc::clone(&self.device),
|
Arc::clone(&self.device),
|
||||||
|
|
Loading…
Reference in a new issue