Comments (8)
It's the compiler trying to be too helpful. It would have been clearer if it just told you that UnsafeCommandBuffer
doesn't implement PrimaryCommandBufferAbstract
. In other words you can't submit it.
from vulkano.
That's definitely something we need to address. Probably as part of the task graph, but maybe earlier if possible.
from vulkano.
Yes, when the taskgraph comes around this will be fixed. Everything regarding current sync is on life support at the moment anyway, I don't see a point fixing anything to do with it.
from vulkano.
Thanks @Rua and @marc0246. I found
vulkano/vulkano/src/command_buffer/traits.rs
Line 143 in f449858
PrimaryCommandBufferAbstract
which feels like the impl for this trait, I guess the compiler would try to ''instantiate" base on it? And yes, UnsafeCommandBuffer
at least does not have resources_usage()
, so it will fail anyway. This sounds like an easy patch to work around, resources_usage()
is not used by Vulkan.On the other hand, I am still a bit unclear on
SafeDeref
, not exact sure how the original https://github.com/vulkano-rs/vulkano/pull/29/files change realizes its change description. And is UnsafeCommandBuffer
SafeDerfe
-able?from vulkano.
Close, because this is not an issue and also not directly related to "taskgraph" mentioned in the discussion.
from vulkano.
I didn't really understand the questions, so it would be nice if you could clarify. I'll answer what I made out.
The compiler understands that UnsafeCommandBuffer
doesn't implement PrimaryCommandBufferAbstract
, but it implements VulkanObject<Handle = CommandBuffer> + Send + Sync
. It understands that due to the blanket impl, any T
wich satisfies those bounds, plus SafeDeref<Target: PrimaryCommandBufferAbstract>
, will implement PrimaryCommandBufferAbstract
. It then tells you that for UnsafeCommandBuffer
to implement PrimaryCommandBufferAbstract
, it needs to implement SafeDeref
. That's true but completely useless information. To be honest I've never seen the errors arising from blanket impls help anyone rather than confuse them. UnsafeCommandBuffer
is not a reference, it doesn't even make sense to talk about dereferencing it.
Rust implements operator overloading using traits, Deref
being one of them. It overloads the *
derefercing operator, that's really it.
Pretty much all libraries that expose traits also have blanket impls for reference and other pointer types to types of those traits, otherwise you wouldn't be able to use those types if they are behind a pointer in places where an implementation of the trait is required. Most libraries implement their traits for e.g. &T
, &mut T
if applicable, Box<T>
, Rc<T>
, and Arc<T>
. It's just that vulkano chose to make the pointer type generic using SafeDeref
.
from vulkano.
@marc0246 Thanks for following up. My original question is about what's the purpose of SafeDeref
. I noticed that the commit adding SafeDeref mentions "guarantee that the device was always the same", so I was curious how SafeDeref
achieves it.
Based on your last comment and the fact SafeDeref
is a direct inherit of trait Deref
. I guess SafeDeref
isn't much different from Deref
. All my questions have been cleared now 😄
from vulkano.
You are right, SafeDeref
is just Deref
with the additional guarantee that the pointer always dereferences to the same pointee. It achieves this by being an unsafe trait.
from vulkano.
Related Issues (20)
- Allow updating descriptor sets after creation
- Support sparse binding
- `command_builder.push_constants` won't push data if `push_constant_ranges` is not aligned HOT 9
- WSL2 support HOT 1
- vulkano-win `required_extensions` function HOT 2
- Found `unimplemented!` in a part of the code HOT 1
- STATUS_ACCESS_VIOLATION on AMD GPU HOT 17
- panic in display_plane_supported_displays HOT 10
- PushConstantRange reflection is overly simplistic. HOT 2
- SIGSEGV during example compilation HOT 3
- Update to winit 0.29.x and raw-window-handle v0.6.0 for vulkano-util HOT 2
- SubbufferAllocator Question HOT 1
- Persistent Descriptor Set Usage HOT 1
- Impossible uniform struct. HOT 5
- Gaussian splats or .ply file support / examples ? HOT 2
- Expects VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, instead current layout is VK_IMAGE_LAYOUT_UNDEFINED
- [vulkano-util] Add option to choose surface by formats HOT 1
- Drag and drop is disabled on Windows but seems to work HOT 1
- Validation error and garbage image when presenting to a fullscreen surface on a different GPU's monitor HOT 2
- StandardDescriptorSetAllocator handles layouts with high VariableDescriptorCount badly 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 vulkano.