-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
1,727 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
use crate::{FilterMode, ImageFormat, WrapMode}; | ||
use windows::Win32::Graphics::Direct3D9; | ||
use windows::Win32::Graphics::Dxgi::Common::DXGI_FORMAT; | ||
// | ||
impl From<ImageFormat> for Direct3D9::D3DFORMAT { | ||
fn from(format: ImageFormat) -> Self { | ||
match format { | ||
ImageFormat::Unknown => Direct3D9::D3DFMT_UNKNOWN, | ||
ImageFormat::R8Unorm => Direct3D9::D3DFMT_R8G8B8, | ||
ImageFormat::R8Uint => Direct3D9::D3DFMT_R8G8B8, | ||
ImageFormat::R8Sint => Direct3D9::D3DFMT_R8G8B8, | ||
ImageFormat::R8G8B8A8Unorm => Direct3D9::D3DFMT_A8B8G8R8, | ||
ImageFormat::R8G8B8A8Uint => Direct3D9::D3DFMT_A8B8G8R8, | ||
ImageFormat::R8G8B8A8Sint => Direct3D9::D3DFMT_A8B8G8R8, | ||
ImageFormat::R8G8B8A8Srgb => Direct3D9::D3DFMT_A8B8G8R8, | ||
ImageFormat::A2B10G10R10UnormPack32 => Direct3D9::D3DFMT_A2B10G10R10, | ||
ImageFormat::A2B10G10R10UintPack32 => Direct3D9::D3DFMT_A2B10G10R10, | ||
ImageFormat::R16Sfloat => Direct3D9::D3DFMT_R16F, | ||
ImageFormat::R16G16Uint => Direct3D9::D3DFMT_G16R16, | ||
ImageFormat::R16G16Sint => Direct3D9::D3DFMT_G16R16, | ||
ImageFormat::R16G16Sfloat => Direct3D9::D3DFMT_G16R16F, | ||
ImageFormat::R16G16B16A16Uint => Direct3D9::D3DFMT_A16B16G16R16, | ||
ImageFormat::R16G16B16A16Sint => Direct3D9::D3DFMT_A16B16G16R16, | ||
ImageFormat::R16G16B16A16Sfloat => Direct3D9::D3DFMT_A16B16G16R16F, | ||
ImageFormat::R32Sfloat => Direct3D9::D3DFMT_R32F, | ||
_ => Direct3D9::D3DFMT_UNKNOWN | ||
} | ||
} | ||
} | ||
// | ||
// impl From<Direct3D9::D3DFORMAT> for ImageFormat { | ||
// fn from(format: DXGI_FORMAT) -> Self { | ||
// match format { | ||
// dxgi::DXGI_FORMAT_UNKNOWN => ImageFormat::Unknown, | ||
// dxgi::DXGI_FORMAT_R8_UNORM => ImageFormat::R8Unorm, | ||
// dxgi::DXGI_FORMAT_R8_UINT => ImageFormat::R8Uint, | ||
// dxgi::DXGI_FORMAT_R8_SINT => ImageFormat::R8Sint, | ||
// dxgi::DXGI_FORMAT_R8G8_UNORM => ImageFormat::R8G8Unorm, | ||
// dxgi::DXGI_FORMAT_R8G8_UINT => ImageFormat::R8G8Uint, | ||
// dxgi::DXGI_FORMAT_R8G8_SINT => ImageFormat::R8G8Sint, | ||
// dxgi::DXGI_FORMAT_R8G8B8A8_UNORM => ImageFormat::R8G8B8A8Unorm, | ||
// dxgi::DXGI_FORMAT_R8G8B8A8_UINT => ImageFormat::R8G8B8A8Uint, | ||
// dxgi::DXGI_FORMAT_R8G8B8A8_SINT => ImageFormat::R8G8B8A8Sint, | ||
// dxgi::DXGI_FORMAT_R8G8B8A8_UNORM_SRGB => ImageFormat::R8G8B8A8Srgb, | ||
// dxgi::DXGI_FORMAT_R10G10B10A2_UNORM => ImageFormat::A2B10G10R10UnormPack32, | ||
// dxgi::DXGI_FORMAT_R10G10B10A2_UINT => ImageFormat::A2B10G10R10UintPack32, | ||
// dxgi::DXGI_FORMAT_R16_UINT => ImageFormat::R16Uint, | ||
// dxgi::DXGI_FORMAT_R16_SINT => ImageFormat::R16Sint, | ||
// dxgi::DXGI_FORMAT_R16_FLOAT => ImageFormat::R16Sfloat, | ||
// dxgi::DXGI_FORMAT_R16G16_UINT => ImageFormat::R16G16Uint, | ||
// dxgi::DXGI_FORMAT_R16G16_SINT => ImageFormat::R16G16Sint, | ||
// dxgi::DXGI_FORMAT_R16G16_FLOAT => ImageFormat::R16G16Sfloat, | ||
// dxgi::DXGI_FORMAT_R16G16B16A16_UINT => ImageFormat::R16G16B16A16Uint, | ||
// dxgi::DXGI_FORMAT_R16G16B16A16_SINT => ImageFormat::R16G16B16A16Sint, | ||
// dxgi::DXGI_FORMAT_R16G16B16A16_FLOAT => ImageFormat::R16G16B16A16Sfloat, | ||
// dxgi::DXGI_FORMAT_R32_UINT => ImageFormat::R32Uint, | ||
// dxgi::DXGI_FORMAT_R32_SINT => ImageFormat::R32Sint, | ||
// dxgi::DXGI_FORMAT_R32_FLOAT => ImageFormat::R32Sfloat, | ||
// dxgi::DXGI_FORMAT_R32G32_UINT => ImageFormat::R32G32Uint, | ||
// dxgi::DXGI_FORMAT_R32G32_SINT => ImageFormat::R32G32Sint, | ||
// dxgi::DXGI_FORMAT_R32G32_FLOAT => ImageFormat::R32G32Sfloat, | ||
// dxgi::DXGI_FORMAT_R32G32B32A32_UINT => ImageFormat::R32G32B32A32Uint, | ||
// dxgi::DXGI_FORMAT_R32G32B32A32_SINT => ImageFormat::R32G32B32A32Sint, | ||
// dxgi::DXGI_FORMAT_R32G32B32A32_FLOAT => ImageFormat::R32G32B32A32Sfloat, | ||
// _ => ImageFormat::Unknown, | ||
// } | ||
// } | ||
// } | ||
// | ||
|
||
impl From<WrapMode> for Direct3D9::D3DTEXTUREADDRESS { | ||
fn from(value: WrapMode) -> Self { | ||
match value { | ||
WrapMode::ClampToBorder => Direct3D9::D3DTADDRESS_BORDER, | ||
WrapMode::ClampToEdge => Direct3D9::D3DTADDRESS_CLAMP, | ||
WrapMode::Repeat => Direct3D9::D3DTADDRESS_WRAP, | ||
WrapMode::MirroredRepeat => Direct3D9::D3DTADDRESS_MIRROR, | ||
} | ||
} | ||
} | ||
|
||
impl From<FilterMode> for Direct3D9::D3DTEXTUREFILTER { | ||
fn from(value: FilterMode) -> Self { | ||
match value { | ||
FilterMode::Linear => Direct3D9::D3DFILTER_LINEAR, | ||
FilterMode::Nearest => Direct3D9::D3DFILTER_NEAREST, | ||
} | ||
} | ||
} | ||
|
||
// impl FilterMode { | ||
// /// Get the mipmap filtering mode for the given combination. | ||
// pub fn d3d9_mip(&self, mip: FilterMode) -> Direct3D9::D3DTEXTUREFILTER { | ||
// match (self, mip) { | ||
// (FilterMode::Linear, FilterMode::Linear) => Direct3D9::D3DFILTER_MIPLINEAR, | ||
// (FilterMode::Linear, FilterMode::Nearest) => Direct3D9::D3DFILTER_LINEARMIPNEAREST, | ||
// (FilterMode::Nearest, FilterMode::Linear) => Direct3D9::D3DFILTER_MIPNEAREST, | ||
// _ => Direct3D9::D3DFILTER_MIPNEAREST | ||
// } | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
[package] | ||
name = "librashader-runtime-d3d9" | ||
edition = "2021" | ||
|
||
license = "MPL-2.0 OR GPL-3.0-only" | ||
version = "0.2.4" | ||
authors = ["Ronny Chan <ronny@ronnychan.ca>"] | ||
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 = ["d3d9", "d3d11"], version = "0.2.4" } | ||
librashader-presets = { path = "../librashader-presets", version = "0.2.4" } | ||
librashader-preprocess = { path = "../librashader-preprocess", version = "0.2.4" } | ||
librashader-reflect = { path = "../librashader-reflect", version = "0.2.4" } | ||
librashader-runtime = { path = "../librashader-runtime", version = "0.2.4" } | ||
librashader-cache = { path = "../librashader-cache", version = "0.2.4", features = ["d3d"] } | ||
|
||
thiserror = "1.0.37" | ||
bytemuck = "1.12.3" | ||
rayon = "1.6.1" | ||
array-concat = "0.5.2" | ||
|
||
[target.'cfg(windows)'.dependencies.windows] | ||
workspace = true | ||
features = [ | ||
"Win32_Foundation", | ||
"Win32_Graphics_Direct3D", | ||
"Win32_Graphics_Direct3D9", | ||
"Win32_Graphics_Direct3D_Fxc", | ||
"Win32_System_Threading", | ||
"Win32_Security", | ||
] | ||
|
||
[target.'cfg(windows)'.dev-dependencies.windows] | ||
workspace = true | ||
features = [ | ||
"Win32_Foundation", | ||
"Win32_Graphics_Direct3D", | ||
"Win32_Graphics_Direct3D9", | ||
"Win32_Graphics_Direct3D_Fxc", | ||
"Win32_Graphics_Gdi", | ||
"Win32_Security", | ||
"Win32_System_LibraryLoader", | ||
"Win32_System_Threading", | ||
"Win32_UI_WindowsAndMessaging", | ||
"Win32_UI", | ||
] | ||
|
||
[dev-dependencies] | ||
gfx-maths = "0.2.8" | ||
|
||
[package.metadata.docs.rs] | ||
features = ["librashader-cache/docsrs"] |
Oops, something went wrong.