diff --git a/librashader-runtime-d3d12/Cargo.toml b/librashader-runtime-d3d12/Cargo.toml new file mode 100644 index 0000000..bc9def5 --- /dev/null +++ b/librashader-runtime-d3d12/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "librashader-runtime-d3d12" +edition = "2021" + +license = "MPL-2.0 OR GPL-3.0-only" +version = "0.1.0-beta.8" +authors = ["Ronny Chan "] +repository = "https://github.com/SnowflakePowered/librashader" +readme = "../README.md" +categories = ["emulators", "compilers", "graphics"] +keywords = ["shader", "retroarch", "SPIR-V"] +description = "RetroArch shaders for all." + +[dependencies] +librashader-common = { path = "../librashader-common", features = ["d3d12"], version = "0.1.0-beta.8" } +librashader-presets = { path = "../librashader-presets", version = "0.1.0-beta.8" } +librashader-preprocess = { path = "../librashader-preprocess", version = "0.1.0-beta.8" } +librashader-reflect = { path = "../librashader-reflect", version = "0.1.0-beta.8", features = ["standalone"] } +librashader-runtime = { path = "../librashader-runtime", version = "0.1.0-beta.8" } +thiserror = "1.0.37" +spirv_cross = { package = "librashader-spirv-cross", version = "0.23" } + +rustc-hash = "1.1.0" +bytemuck = "1.12.3" +array-init = "2.1.0" +bit-set = "0.5.3" + +[target.'cfg(windows)'.dependencies.windows] +version = "0.44.0" +features = [ + "Win32_Foundation", + "Win32_Graphics_Dxgi_Common", + "Win32_Graphics_Direct3D", + "Win32_Graphics_Direct3D12", + "Win32_Graphics_Direct3D_Fxc", + "Win32_Graphics_Gdi", + "Win32_Security", + "Win32_System_LibraryLoader", + "Win32_System_Threading", + "Win32_System_WindowsProgramming", + "Win32_UI_WindowsAndMessaging", +] +[dev-dependencies] +gfx-maths = "0.2.8" diff --git a/librashader-runtime-d3d12/src/heap.rs b/librashader-runtime-d3d12/src/heap.rs index ad7cdc0..ca8f4f5 100644 --- a/librashader-runtime-d3d12/src/heap.rs +++ b/librashader-runtime-d3d12/src/heap.rs @@ -85,6 +85,8 @@ struct D3D12DescriptorHeapInner { // // 0 - Occupied // 1 - free + + // todo: actually use a bitset here. map: Box<[bool]>, } diff --git a/librashader-runtime-d3d12/src/lib.rs b/librashader-runtime-d3d12/src/lib.rs new file mode 100644 index 0000000..5950a12 --- /dev/null +++ b/librashader-runtime-d3d12/src/lib.rs @@ -0,0 +1,29 @@ +#![feature(const_trait_impl)] +#![feature(let_chains)] + +mod error; +mod filter_chain; +mod heap; +mod hello_triangle; +mod samplers; +mod texture; +mod util; +mod mipmap; + +#[cfg(test)] +mod tests { + use super::*; + use crate::hello_triangle::{DXSample, SampleCommandLine}; + + #[test] + fn triangle_d3d12() { + let sample = hello_triangle::d3d12_hello_triangle::Sample::new( + "../test/slang-shaders/border/gameboy-player/gameboy-player-crt-royale.slangp", + &SampleCommandLine { + use_warp_device: false, + }, + ) + .unwrap(); + hello_triangle::main(sample).unwrap() + } +} diff --git a/librashader-runtime-d3d12/src/mipmap.rs b/librashader-runtime-d3d12/src/mipmap.rs new file mode 100644 index 0000000..4ceffae --- /dev/null +++ b/librashader-runtime-d3d12/src/mipmap.rs @@ -0,0 +1,19 @@ +use windows::Win32::Graphics::Direct3D12::{D3D12_GPU_DESCRIPTOR_HANDLE, ID3D12Device, ID3D12PipelineState, ID3D12RootSignature}; +use librashader_common::Size; +use crate::error; + +pub struct D3D12MipmapGen { + device: ID3D12Device, + root_signature: ID3D12RootSignature, + pipeline: ID3D12PipelineState, +} + +impl D3D12MipmapGen { + pub fn new(device: &ID3D12Device) -> error::Result { + todo!() + } + + pub fn generate_mipmaps(miplevels: u16, size: Size, handle: D3D12_GPU_DESCRIPTOR_HANDLE) { + + } +} \ No newline at end of file