Comments (2)
Based on the zulip conversation, and looking at the SPIRV-Cross and MoltenVK source code, I made up a quick and dirty change to fn dispatch()
and rerun the app in the Xcode debugger. I was then told by Xcode that a framebuffer-only texture should not be used as the destination of a texture copy so I also fixed that, and with these 2 changes no more validation error in Xcode. Here's the diff:
diff --git a/piet-gpu-hal/src/metal.rs b/piet-gpu-hal/src/metal.rs
index e3157d4..0c3b1a1 100644
--- a/piet-gpu-hal/src/metal.rs
+++ b/piet-gpu-hal/src/metal.rs
@@ -136,6 +136,7 @@ impl MtlInstance {
let () = msg_send![ns_view, setWantsLayer: YES];
let bounds: CGRect = msg_send![ns_view, bounds];
let () = msg_send![metal_layer, setFrame: bounds];
+ metal_layer.set_framebuffer_only(false);
if !ns_window.is_null() {
let scale_factor: CGFloat = msg_send![ns_window, backingScaleFactor];
@@ -464,6 +465,13 @@ impl crate::backend::CmdBuf<MtlDevice> for CmdBuf {
encoder.set_texture(img_ix, Some(&image.texture));
img_ix += 1;
}
+ const BUFFER_SIZE_BUFFER_INDEX: usize = 25;
+ let buffer_size_constants: [u32; 1] = [0];
+ encoder.set_bytes(
+ BUFFER_SIZE_BUFFER_INDEX as NSUInteger,
+ mem::size_of_val(&buffer_size_constants) as NSUInteger,
+ &buffer_size_constants as *const u32 as _,
+ );
let workgroup_count = metal::MTLSize {
width: workgroup_count.0 as u64,
height: workgroup_count.1 as u64,
Note that even without validation error, on a M1 Mac you still get incorrect colors, so #154 still needs to be fixed.
In regards to the diff above, I'm pretty sure set_framebuffer_only(false)
is needed (as I also needed it when investigating #154), at least with the current way the texture is handled.
Binding a buffer to 25 is also needed, but you might want to only do it in the pipelines that require it. And looking at MoltenVK it seems -[MTLComputeCommandEncoder setBytes:length:atIndex:]
might not work on some old GPUs (though these GPUs might already not be supported by piet-gpu). Also I don't fully understand what that value is needed for, so is really 0 the correct value?
from vello.
With vello now using WGPU as a backend this is not relevant anymore.
And just in case I tried running the current winit
example in the Xcode debugger and it did not trigger any assertions, so closing this.
from vello.
Related Issues (20)
- rustfmt settings (linebender-wide?) HOT 2
- Switch from `dialoguer` to `inquire` HOT 5
- Introduce a changelog HOT 1
- Appending an `Encoding` to a `Scene` HOT 5
- Simple example doesn't work on web. HOT 2
- Trouble drawing emojis HOT 8
- Improving bump estimation accuracy and performance
- API Issue for `Renderer`
- Full system hang on Apple M1 8GB HOT 13
- Rendering to a surface and transparency HOT 2
- Minor issue: example 'simple' - when compiled standalone - the render context needs to be unwrapped HOT 2
- Winit example slow on wsl HOT 4
- Lots of wgpu error messages HOT 5
- `vello_shaders` causes recompilation HOT 1
- How to figure out the correspondence of window size and image size HOT 4
- wgpu: Use `write_buffer_with` rather than `write_buffer` HOT 2
- Update ARCHITECTURE.md HOT 2
- Issue with flattening of a stroked cubic around a near-cusp
- Can we re-export `wgpu` with the feature?
- Vello anti-aliasing rendering seems not fine enough, how to improve it? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vello.