Comments (7)
Hello,
I've investigated a bit this problem and it seems the blue Tiger is due to piet-gpu copying from an RGBA8 texture (one piet-gpu created itself) to an BGRA8 one (the swapchain one the system created). It seems MTLBlitCommandEncoder
won't do the conversion for you. The copyFromTexture:toTexture:
doc explicitly says that source and destination must have the same format. It's not written in the copyFromTexture:sourceSlice:..
doc which is the one piet-gpu uses, but it seems to have the same restriction.
I was able to get the Tiger to have the correct color with any of the two following changes:
- Changing the format of the working texture piet-gpu creates to be BGRA8 instead of RGBA8.
- Replacing the texture copy by a basic compute shader that just reads from a source texture and copy that to a destination texture (note that that requires to make the MetalLayer not framebuffer only
metal_layer.set_framebuffer_only(false);
). I don't know Metal much so it was mostly based on some Apple sample code.
Changing the working texture format is just a 1-line change but some other part of the code might expect RGBA8, and using BGRA8 even though the generic code asks for RGBA8 would probably be confusing.
For the basic compute shader I can make a PR if you really want but I'm not sure it would be of much use.
from vello.
Can you give a little more detail about your macOS environment? I'm using an M1 as my daily driver and haven't seen this. I do have access to other hardware though.
Obviously it's hard to say what the problem is without digging, but I'd be suspicious of the shader translation in spirv-cross, which is the same as what it would be in MoltenVK. It should in theory be possible to compile the Vulkan version on mac, but it's very unlikely it will solve this problem.
Does forcing the session.gpu_info().workgroup_limits.max_invocations >= 1024
predicate in piet-gpu/src/lib.rs to false help? If so, I think I know what it is.
from vello.
Hello
thanks for your help
I tried something like
"if session.gpu_info().workgroup_limits.max_invocations >= 1024 && false" but did not change the result
I attach some samples on different devices
maybe is the macOS version?
from vello.
Thanks for the report, I will investigate. I am able to repro the inverted colors on my M1 :). GPU portability is hard.
from vello.
If you need more informations or
I can help you in any way just tell me
from vello.
Since #193 , we've moved over to using wgpu
. Can this still be reproduced?
from vello.
A lot has changed since this issue was filed and we're not seeing similar things now, so closing. Thanks for the report!
from vello.
Related Issues (20)
- Serde support for re-exported Peniko types HOT 1
- Rendering issue when clipping and stroking the same path HOT 5
- How: `scene.append_with_opacity(scene)` HOT 3
- IOS app crash 0.2.1 HOT 1
- Drop shadows HOT 2
- Corruption issue with clipping HOT 4
- Clips cause compute shaders to take 10 seconds and results in corruption
- Infinitesimal stroked bezier fills whole tile HOT 4
- Examples don't run on Raspberry Pi 4 HOT 12
- Vello image rendering artifacts? HOT 3
- High GPU usage and Slow Framerate on Integrated Graphics. HOT 12
- Ability to directly use a wgpu::Texture instead of a peniko::Image. HOT 2
- Zero-width stroke acts as fill HOT 4
- Better API for already GPU-resident images HOT 2
- Add an API to reserve a scene HOT 2
- Stack of scaled layers breaks at certain window size HOT 3
- Incorrect COLR Emoji Rendering
- Sparse strip path rendering HOT 1
- Add the linebender lint set
- Layers that modify transforms
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.