dep: update to windows 0.58

This commit is contained in:
chyyran 2024-08-02 00:53:13 -04:00 committed by Ronny Chan
parent 3cda5b706d
commit 3fb6e3843e
15 changed files with 137 additions and 97 deletions

143
Cargo.lock generated
View file

@ -1246,7 +1246,7 @@ dependencies = [
"presser",
"thiserror",
"winapi",
"windows",
"windows 0.52.0",
]
[[package]]
@ -1596,7 +1596,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
dependencies = [
"cfg-if",
"windows-targets 0.52.5",
"windows-targets 0.48.5",
]
[[package]]
@ -1625,7 +1625,7 @@ dependencies = [
"rayon",
"wgpu",
"wgpu-types",
"windows",
"windows 0.58.0",
]
[[package]]
@ -1649,7 +1649,7 @@ dependencies = [
"platform-dirs",
"serde",
"thiserror",
"windows",
"windows 0.58.0",
]
[[package]]
@ -1666,7 +1666,7 @@ dependencies = [
"rustc-hash 2.0.0",
"sptr",
"thiserror",
"windows",
"windows 0.58.0",
]
[[package]]
@ -1680,7 +1680,7 @@ dependencies = [
"objc2-metal",
"rustc-hash 2.0.0",
"wgpu-types",
"windows",
"windows 0.58.0",
]
[[package]]
@ -1763,7 +1763,7 @@ dependencies = [
"librashader-runtime",
"rayon",
"thiserror",
"windows",
"windows 0.58.0",
]
[[package]]
@ -1785,7 +1785,7 @@ dependencies = [
"rayon",
"thiserror",
"widestring",
"windows",
"windows 0.58.0",
]
[[package]]
@ -1803,7 +1803,8 @@ dependencies = [
"librashader-runtime",
"num-traits",
"thiserror",
"windows",
"windows 0.58.0",
"windows-core 0.58.0",
]
[[package]]
@ -2371,7 +2372,7 @@ dependencies = [
"libc",
"redox_syscall 0.5.2",
"smallvec",
"windows-targets 0.52.5",
"windows-targets 0.52.6",
]
[[package]]
@ -3800,8 +3801,18 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [
"windows-core",
"windows-targets 0.52.5",
"windows-core 0.52.0",
"windows-targets 0.52.6",
]
[[package]]
name = "windows"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
dependencies = [
"windows-core 0.58.0",
"windows-targets 0.52.6",
]
[[package]]
@ -3810,7 +3821,61 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets 0.52.5",
"windows-targets 0.52.6",
]
[[package]]
name = "windows-core"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
dependencies = [
"windows-implement",
"windows-interface",
"windows-result",
"windows-strings",
"windows-targets 0.52.6",
]
[[package]]
name = "windows-implement"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
]
[[package]]
name = "windows-interface"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.67",
]
[[package]]
name = "windows-result"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-strings"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
dependencies = [
"windows-result",
"windows-targets 0.52.6",
]
[[package]]
@ -3837,7 +3902,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.5",
"windows-targets 0.52.6",
]
[[package]]
@ -3872,18 +3937,18 @@ dependencies = [
[[package]]
name = "windows-targets"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm 0.52.5",
"windows_aarch64_msvc 0.52.5",
"windows_i686_gnu 0.52.5",
"windows_aarch64_gnullvm 0.52.6",
"windows_aarch64_msvc 0.52.6",
"windows_i686_gnu 0.52.6",
"windows_i686_gnullvm",
"windows_i686_msvc 0.52.5",
"windows_x86_64_gnu 0.52.5",
"windows_x86_64_gnullvm 0.52.5",
"windows_x86_64_msvc 0.52.5",
"windows_i686_msvc 0.52.6",
"windows_x86_64_gnu 0.52.6",
"windows_x86_64_gnullvm 0.52.6",
"windows_x86_64_msvc 0.52.6",
]
[[package]]
@ -3900,9 +3965,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
@ -3918,9 +3983,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
@ -3936,15 +4001,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
@ -3960,9 +4025,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
@ -3978,9 +4043,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
@ -3996,9 +4061,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
@ -4014,9 +4079,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winit"

View file

@ -18,7 +18,7 @@ members = [
resolver = "2"
[workspace.dependencies]
windows = "0.52.0"
windows = "0.58.0"
[workspace.metadata.release]

View file

@ -2,7 +2,7 @@
//! here because of the orphan rule.
use crate::{CacheKey, Cacheable};
use windows::core::ComInterface;
use windows::core::Interface;
impl CacheKey for windows::Win32::Graphics::Direct3D::ID3DBlob {
fn hash_bytes(&self) -> &[u8] {

View file

@ -4,7 +4,7 @@ use crate::util::d3d11_get_closest_format;
use librashader_common::{ImageFormat, Size};
use librashader_presets::Scale2D;
use librashader_runtime::scaling::{MipmapSize, ScaleFramebuffer, ViewportSize};
use windows::core::ComInterface;
use windows::core::Interface;
use windows::Win32::Graphics::Direct3D::D3D_SRV_DIMENSION_TEXTURE2D;
use windows::Win32::Graphics::Direct3D11::{
ID3D11Device, ID3D11DeviceContext, ID3D11RenderTargetView, ID3D11ShaderResourceView,

View file

@ -1,25 +1,7 @@
use crate::error::Result;
use crate::framebuffer::OwnedImage;
use librashader_common::{FilterMode, WrapMode};
use windows::Win32::Graphics::Direct3D11::{ID3D11RenderTargetView, ID3D11ShaderResourceView};
/// An image view for use as a shader resource.
///
/// Contains an `ID3D11ShaderResourceView`, and a size.
#[derive(Debug, Clone)]
pub struct D3D11InputView {
/// A handle to the shader resource view.
pub handle: ID3D11ShaderResourceView,
}
/// An image view for use as a render target.
///
/// Contains an `ID3D11RenderTargetView`, and a size.
#[derive(Debug, Clone)]
pub struct D3D11OutputView {
/// A handle to the render target view.
pub handle: ID3D11RenderTargetView,
}
use windows::Win32::Graphics::Direct3D11::{ID3D11ShaderResourceView};
#[derive(Debug, Clone)]
pub struct InputTexture {

View file

@ -2,7 +2,7 @@ use crate::error;
use crate::error::assume_d3d11_init;
use librashader_common::Size;
use std::slice;
use windows::core::{ComInterface, PCSTR};
use windows::core::{Interface, PCSTR};
use windows::Win32::Graphics::Direct3D::Fxc::{
D3DCompile, D3DCOMPILE_DEBUG, D3DCOMPILE_OPTIMIZATION_LEVEL3, D3DCOMPILE_SKIP_OPTIMIZATION,
};
@ -147,7 +147,7 @@ pub fn d3d11_compile_bound_shader<'a, T, L>(
factory: ShaderFactory<'a, L, T>,
) -> error::Result<T>
where
L: windows::core::IntoParam<ID3D11ClassLinkage>,
L: windows::core::Param<ID3D11ClassLinkage>,
{
unsafe {
// SAFETY: slice as valid for as long as vs_blob is alive.

View file

@ -144,6 +144,7 @@ where
)
};
let hwnd = hwnd?;
sample.bind_to_window(&hwnd).unwrap();
unsafe { ShowWindow(hwnd, SW_SHOW) };
@ -436,7 +437,7 @@ pub mod d3d11_hello_triangle {
drop(resources.backbuffer.take());
resources
.swapchain
.ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, 0)
.ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, DXGI_SWAP_CHAIN_FLAG(0))
.unwrap_or_else(|f| eprintln!("{f:?}"));
let (rtv, backbuffer) = create_rtv(&self.device, &resources.swapchain)?;
@ -593,7 +594,7 @@ pub mod d3d11_hello_triangle {
}
unsafe {
resources.swapchain.Present(0, 0).ok()?;
resources.swapchain.Present(0, DXGI_PRESENT::default()).ok()?;
}
resources.frame_count += 1;
Ok(())

View file

@ -30,7 +30,7 @@ use librashader_runtime::uniforms::UniformStorage;
use std::collections::VecDeque;
use std::mem::ManuallyDrop;
use std::path::Path;
use windows::core::ComInterface;
use windows::core::Interface;
use windows::Win32::Foundation::CloseHandle;
use windows::Win32::Graphics::Direct3D::Dxc::{
CLSID_DxcCompiler, CLSID_DxcLibrary, CLSID_DxcValidator, DxcCreateInstance, IDxcCompiler,

View file

@ -18,7 +18,7 @@ use librashader_runtime::quad::QuadType;
use librashader_runtime::render_target::RenderTarget;
use librashader_runtime::uniforms::{NoUniformBinder, UniformStorage};
use std::ops::Deref;
use windows::core::ComInterface;
use windows::core::Interface;
use windows::Win32::Foundation::RECT;
use windows::Win32::Graphics::Direct3D12::{
ID3D12GraphicsCommandList, ID3D12GraphicsCommandList4, D3D12_RENDER_PASS_BEGINNING_ACCESS,

View file

@ -9,7 +9,7 @@ use librashader_reflect::back::ShaderCompilerOutput;
use std::mem::ManuallyDrop;
use std::ops::Deref;
use widestring::u16cstr;
use windows::core::ComInterface;
use windows::core::Interface;
use windows::Win32::Foundation::BOOL;
use windows::Win32::Graphics::Direct3D::Dxc::{
CLSID_DxcLibrary, DxcCreateInstance, IDxcBlob, IDxcCompiler, IDxcUtils, IDxcValidator, DXC_CP,

View file

@ -4,7 +4,7 @@ use crate::error::assume_d3d12_init;
use std::mem::ManuallyDrop;
use std::u64;
use widestring::{u16cstr, U16CStr};
use windows::core::{ComInterface, PCWSTR};
use windows::core::{Interface, PCWSTR};
use windows::Win32::Graphics::Direct3D::Dxc::{
DxcValidatorFlags_InPlaceEdit, IDxcBlob, IDxcCompiler, IDxcUtils, IDxcValidator, DXC_CP,
DXC_CP_UTF8,

View file

@ -109,7 +109,8 @@ where
)
};
sample.bind_to_window(&hwnd)?;
let hwnd = hwnd?;
sample.bind_to_window(&hwnd).unwrap();
unsafe { ShowWindow(hwnd, SW_SHOW) };
loop {
@ -187,8 +188,7 @@ fn get_hardware_adapter(factory: &IDXGIFactory4) -> Result<IDXGIAdapter1> {
for i in 0.. {
let adapter = unsafe { factory.EnumAdapters1(i)? };
let mut desc = Default::default();
unsafe { adapter.GetDesc1(&mut desc)? };
let mut desc = unsafe { adapter.GetDesc1()? };
if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32) != DXGI_ADAPTER_FLAG_NONE.0 as u32 {
// Don't select the Basic Render Driver adapter. If you want a
@ -529,7 +529,7 @@ pub mod d3d12_hello_triangle {
unsafe { resources.command_queue.ExecuteCommandLists(&[command_list]) };
// Present the frame.
unsafe { resources.swap_chain.Present(1, 0) }.ok().unwrap();
unsafe { resources.swap_chain.Present(1, DXGI_PRESENT::default()) }.ok().unwrap();
wait_for_previous_frame(resources);
self.framecount += 1;

View file

@ -24,6 +24,8 @@ bytemuck = "1.12.3"
array-concat = "0.5.2"
num-traits = "0.2.18"
windows-core = "0.58.0"
[target.'cfg(windows)'.dependencies.windows]
workspace = true
features = [

View file

@ -1,6 +1,6 @@
use std::ffi::c_void;
use windows::core::imp::BOOL;
use windows::core::{IntoParam, HRESULT, PCSTR};
use windows::core::{Param, HRESULT, PCSTR};
use windows::Win32::Graphics::Direct3D::{ID3DBlob, ID3DInclude, D3D_SHADER_MACRO};
const D3DERR_INVALIDCALL: u32 = 0x8876086c;
@ -49,17 +49,17 @@ pub unsafe fn D3DXCompileShader<P1, P2, P3>(
ppconstanttable: Option<*mut Option<ID3DXConstantTable>>,
) -> ::windows::core::Result<()>
where
P1: IntoParam<ID3DInclude>,
P2: IntoParam<PCSTR>,
P3: IntoParam<PCSTR>,
P1: Param<ID3DInclude>,
P2: Param<PCSTR>,
P3: Param<PCSTR>,
{
raw::D3DXCompileShader(
psrcdata,
srcdatasize,
::core::mem::transmute(pdefines.unwrap_or(::std::ptr::null())),
pinclude.into_param().abi(),
pfunctioname.into_param().abi(),
pprofile.into_param().abi(),
pinclude.param().abi(),
pfunctioname.param().abi(),
pprofile.param().abi(),
flags,
::core::mem::transmute(ppcode),
::core::mem::transmute(pperrormsgs.unwrap_or(::std::ptr::null_mut())),
@ -68,9 +68,7 @@ where
.ok()
}
#[repr(transparent)]
#[derive(PartialEq, Eq, Debug, Clone)]
pub struct ID3DXConstantTable(windows::core::IUnknown);
windows::core::imp::define_interface!(ID3DXConstantTable, ID3DXConstantTable_Vtbl, 0xab3c758f_93e_4356_b7_62_4d_b1_8f_1b_3a1);
#[allow(dead_code)]
impl ID3DXConstantTable {
@ -79,7 +77,8 @@ impl ID3DXConstantTable {
p_function: *const c_void,
) -> windows::core::Result<ID3DXConstantTable> {
let mut result__ = ::std::mem::zeroed();
raw::D3DXGetShaderConstantTable(p_function, &mut result__).from_abi(result__)
raw::D3DXGetShaderConstantTable(p_function, &mut result__)
.and_then(|| windows::core::Type::from_abi(result__))
}
#[allow(non_snake_case)]
@ -150,12 +149,12 @@ impl ID3DXConstantTable {
pname: P,
) -> windows::core::Result<D3DXHANDLE>
where
P: IntoParam<PCSTR>,
P: Param<PCSTR>,
{
let handle = (windows::core::Interface::vtable(self).GetConstantByName)(
windows::core::Interface::as_raw(self),
hconstant.unwrap_or(D3DXHANDLE(std::ptr::null())),
pname.into_param().abi(),
pname.param().abi(),
);
if handle.0 as u32 == D3DERR_INVALIDCALL {
@ -193,11 +192,6 @@ impl ID3DXConstantTable {
}
}
impl windows::core::CanInto<windows::core::IUnknown> for ID3DXConstantTable {}
unsafe impl windows::core::Interface for ID3DXConstantTable {
type Vtable = ID3DXConstantTable_Vtbl;
}
#[repr(C)]
#[doc(hidden)]
#[allow(non_camel_case_types)]
@ -429,9 +423,4 @@ pub enum D3DXPARAMETER_TYPE {
#[repr(transparent)]
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct D3DXHANDLE(pub *const c_void);
unsafe impl windows::core::ComInterface for ID3DXConstantTable {
const IID: windows::core::GUID =
windows::core::GUID::from_u128(0xab3c758f_93e_4356_b7_62_4d_b1_8f_1b_3a1);
}
pub struct D3DXHANDLE(pub *const c_void);

View file

@ -89,6 +89,7 @@ where
)
};
let hwnd = hwnd?;
sample.bind_to_window(&hwnd).unwrap();
unsafe { ShowWindow(hwnd, SW_SHOW) };