Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
366 changes: 188 additions & 178 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ resolver = "2"
windows = "0.58.0"
ash = "0.38"
spirv-cross2 = { version = "0.4", default-features = false }
objc2-metal = { version = "0.2" }
objc2 = { version = "0.5.0" }
glow = { version = "0.15.0" }
glfw = { version = "0.58.0"}
objc2-metal = { version = "0.3" }
objc2 = { version = "0.6" }
glow = { version = "0.16.0" }
glfw = { version = "0.59.0" }

wgpu = { version = "24", default-features = false }
wgpu-types = { version = "24" }
wgpu = { version = "25", default-features = false }
wgpu-types = { version = "25" }

clap = { version = "=4.3.0", features = ["derive"] }
rayon = { version = "1.10.0"}
Expand Down
4 changes: 2 additions & 2 deletions librashader-capi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ workspace = true
optional = true

[target.'cfg(target_vendor="apple")'.dependencies]
objc2-metal = { version = "0.2.0" , features = [ "all" ], optional = true }
objc2 = { version = "0.5.0", features = ["apple"] , optional = true }
objc2-metal = { workspace = true, optional = true }
objc2 = { workspace = true, optional = true }

[package.metadata.docs.rs]
targets = [ "x86_64-pc-windows-msvc",
Expand Down
4 changes: 2 additions & 2 deletions librashader-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ features = [
]

[target.'cfg(target_vendor="apple")'.dependencies]
objc2-metal = { version = "0.2.0" , features = [ "all" ], optional = true }
objc2 = { version = "0.5.0", features = ["apple"], optional = true }
objc2-metal = { workspace = true, optional = true }
objc2 = { workspace = true, optional = true }
4 changes: 2 additions & 2 deletions librashader-cli/src/render/gl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl OpenGl {
image.size.height as i32,
glow::RGBA,
glow::UNSIGNED_BYTE,
PixelUnpackData::Slice(&image.bytes),
PixelUnpackData::Slice(Some(&image.bytes)),
);

context.gl.bind_texture(glow::TEXTURE_2D, None);
Expand Down Expand Up @@ -254,7 +254,7 @@ impl OpenGl {
0,
glow::RGBA,
glow::UNSIGNED_BYTE,
PixelPackData::Slice(&mut data),
PixelPackData::Slice(Some(&mut data)),
)
}
Ok(
Expand Down
2 changes: 1 addition & 1 deletion librashader-cli/src/render/mtl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl Metal {
let image: Image<BGRA8> = Image::load(image_path, UVDirection::TopLeft)?;

unsafe {
let device = Retained::from_raw(MTLCreateSystemDefaultDevice())
let device = MTLCreateSystemDefaultDevice()
.ok_or_else(|| anyhow!("Unable to create default Metal device"))?;

let texture_descriptor =
Expand Down
38 changes: 18 additions & 20 deletions librashader-cli/src/render/wgpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use std::path::Path;
use std::sync::Arc;
use wgpu::{Adapter, Device, Instance, Queue, TexelCopyBufferInfo, Texture};
use wgpu_types::{
BufferAddress, BufferDescriptor, BufferUsages, CommandEncoderDescriptor, Maintain,
TexelCopyBufferLayout, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages,
BufferAddress, BufferDescriptor, BufferUsages, CommandEncoderDescriptor, TexelCopyBufferLayout,
TextureDescriptor, TextureDimension, TextureFormat, TextureUsages,
};

use librashader::presets::ShaderPreset;
Expand Down Expand Up @@ -143,7 +143,8 @@ impl RenderTest for Wgpu {
);

let si = self.queue.submit([cmd.finish()]);
self.device.poll(Maintain::WaitForSubmissionIndex(si));
self.device
.poll(wgpu::PollType::WaitForSubmissionIndex(si))?;

let capturable = Arc::clone(&output_buf);

Expand All @@ -170,7 +171,7 @@ impl RenderTest for Wgpu {
capturable.unmap();
});

self.device.poll(Maintain::Wait);
self.device.poll(wgpu::PollType::Wait)?;

if pixels.lock().len() == 0 {
return Err(anyhow!("failed to copy pixels from buffer"));
Expand All @@ -197,22 +198,19 @@ impl Wgpu {
compatible_surface: None,
force_fallback_adapter: false,
})
.await
.ok_or(anyhow!("Couldn't request WGPU adapter"))?;
.await?;

let (device, queue) = adapter
.request_device(
&wgpu::DeviceDescriptor {
required_features: wgpu::Features::ADDRESS_MODE_CLAMP_TO_BORDER
| wgpu::Features::PIPELINE_CACHE
| wgpu::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES
| wgpu::Features::FLOAT32_FILTERABLE,
required_limits: wgpu::Limits::default(),
label: None,
memory_hints: Default::default(),
},
None,
)
.request_device(&wgpu::DeviceDescriptor {
required_features: wgpu::Features::ADDRESS_MODE_CLAMP_TO_BORDER
| wgpu::Features::PIPELINE_CACHE
| wgpu::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES
| wgpu::Features::FLOAT32_FILTERABLE,
required_limits: wgpu::Limits::default(),
label: None,
memory_hints: Default::default(),
..Default::default()
})
.await?;
let (image, texture) = Self::load_image(&device, &queue, image)?;

Expand All @@ -221,7 +219,7 @@ impl Wgpu {
_adapter: adapter,
device: Arc::new(device),
queue: Arc::new(queue),
image: image,
image,
texture: Arc::new(texture),
})
})
Expand Down Expand Up @@ -258,7 +256,7 @@ impl Wgpu {

let si = queue.submit([]);

device.poll(Maintain::WaitForSubmissionIndex(si));
device.poll(wgpu::PollType::WaitForSubmissionIndex(si))?;

Ok((image, texture))
}
Expand Down
1 change: 0 additions & 1 deletion librashader-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ features = [
[target.'cfg(target_vendor="apple")'.dependencies.objc2]
optional = true
workspace = true
features = ["apple"]


[target.'cfg(target_vendor="apple")'.dependencies.objc2-metal]
Expand Down
2 changes: 1 addition & 1 deletion librashader-reflect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ librashader-pack = { path = "../librashader-pack", version = "0.7.1" }

spirv-cross2 = { workspace = true, optional = true }

naga = { version = "24", optional = true }
naga = { version = "25", optional = true }
rspirv = { version = "0.12.0", optional = true }
spirv = { version = "0.3.0", optional = true}

Expand Down
2 changes: 1 addition & 1 deletion librashader-runtime-gl/src/gl/gl3/lut_load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl LoadLut for Gl3LutLoad {
image.size.height as i32,
glow::RGBA,
glow::UNSIGNED_BYTE,
PixelUnpackData::Slice(&image.bytes),
PixelUnpackData::Slice(Some(&image.bytes)),
);

let mipmap = levels > 1;
Expand Down
2 changes: 1 addition & 1 deletion librashader-runtime-gl/src/gl/gl46/lut_load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl LoadLut for Gl46LutLoad {
image.size.height as i32,
glow::RGBA,
glow::UNSIGNED_BYTE,
PixelUnpackData::Slice(&image.bytes),
PixelUnpackData::Slice(Some(&image.bytes)),
);

let mipmap = levels > 1;
Expand Down
14 changes: 7 additions & 7 deletions librashader-runtime-mtl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ harness = false
targets = ["x86_64-apple-darwin", "aarch64-apple-darwin", "aarch64-apple-ios"]

[target.'cfg(target_vendor="apple")'.dependencies]
objc2-foundation = { version = "0.2", features = ["NSError"] }
objc2-metal = { workspace = true, features = ["all"] }
objc2 = { workspace = true, features = ["apple"] }
objc2-foundation = { version = "0.3", features = ["NSError"] }
objc2-metal = { workspace = true }
objc2 = { workspace = true }

[features]
stable = ["librashader-reflect/stable"]

[target.'cfg(target_vendor="apple")'.dev-dependencies]
objc2-metal-kit = { version = "0.2", features = ["all"]}
objc2-foundation = { version = "0.2", features = ["all"] }
objc2-app-kit = { version = "0.2", features = ["all"] }
objc2-quartz-core = { version = "0.2", features = ["CAMetalLayer", "objc2-metal"]}
objc2-metal-kit = { version = "0.3" }
objc2-foundation = { version = "0.3" }
objc2-app-kit = { version = "0.3" }
objc2-quartz-core = { version = "0.3", features = ["CAMetalLayer", "objc2-metal"]}
#[lib]
#crate-type = ["lib", "staticlib"]
6 changes: 3 additions & 3 deletions librashader-runtime-mtl/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ impl MetalBuffer {
label: &str,
) -> error::Result<Self> {
let storage_mode = if cfg!(all(target_arch = "aarch64", target_vendor = "apple")) {
MTLResourceOptions::MTLResourceStorageModeShared
MTLResourceOptions::StorageModeShared
} else {
MTLResourceOptions::MTLResourceStorageModeManaged
MTLResourceOptions::StorageModeManaged
};

// Can't create buffer of size 0.
Expand All @@ -50,7 +50,7 @@ impl MetalBuffer {

pub fn flush(&self) {
// We don't know what was actually written to so...
if self.storage_mode == MTLResourceOptions::MTLResourceStorageModeManaged {
if self.storage_mode == MTLResourceOptions::StorageModeManaged {
self.buffer.didModifyRange(NSRange {
location: 0,
length: self.size,
Expand Down
4 changes: 2 additions & 2 deletions librashader-runtime-mtl/src/draw_quad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ impl DrawQuad {
NonNull::new_unchecked(vbo_data.as_ptr() as *mut c_void),
vbo_data.len(),
if cfg!(target_os = "ios") {
MTLResourceOptions::MTLResourceStorageModeShared
MTLResourceOptions::StorageModeShared
} else {
MTLResourceOptions::MTLResourceStorageModeManaged
MTLResourceOptions::StorageModeManaged
},
)
.ok_or(FilterChainError::BufferError)?
Expand Down
8 changes: 4 additions & 4 deletions librashader-runtime-mtl/src/filter_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use librashader_runtime::quad::QuadType;
use librashader_runtime::render_target::RenderTarget;
use librashader_runtime::scaling::ScaleFramebuffer;
use librashader_runtime::uniforms::UniformStorage;
use objc2::rc::Id;
use objc2::rc::Retained;
use objc2::runtime::ProtocolObject;
use objc2_foundation::NSString;
use objc2_metal::{
Expand Down Expand Up @@ -103,7 +103,7 @@ pub(crate) struct FilterCommon {
pub samplers: SamplerSet,
pub config: RuntimeParameters,
pub(crate) draw_quad: DrawQuad,
device: Id<ProtocolObject<dyn MTLDevice>>,
device: Retained<ProtocolObject<dyn MTLDevice>>,
}

impl FilterChainMetal {
Expand Down Expand Up @@ -174,7 +174,7 @@ impl FilterChainMetal {
}

fn init_passes(
device: &Id<ProtocolObject<dyn MTLDevice>>,
device: &Retained<ProtocolObject<dyn MTLDevice>>,
passes: Vec<ShaderPassMeta>,
semantics: &ShaderSemantics,
) -> error::Result<Box<[FilterPass]>> {
Expand Down Expand Up @@ -314,7 +314,7 @@ impl FilterChainMetal {
/// graphics queue. The command buffer must be completely executed before calling [`frame`](Self::frame).
fn load_from_pack_deferred_internal(
preset: ShaderPresetPack,
device: Id<ProtocolObject<dyn MTLDevice>>,
device: Retained<ProtocolObject<dyn MTLDevice>>,
cmd: &ProtocolObject<dyn MTLCommandBuffer>,
options: Option<&FilterChainOptionsMetal>,
) -> error::Result<FilterChainMetal> {
Expand Down
Loading